update 0.9.3

This commit is contained in:
yehuozhili
2021-10-07 14:41:24 +08:00
parent 02337bae3c
commit c37d442b45
18 changed files with 494 additions and 48 deletions

View File

@@ -0,0 +1,22 @@
{
"name": "dooringx-plugin-template",
"version": "0.9.3",
"description": "> TODO: description",
"author": "yehuozhili <673632758@qq.com>",
"homepage": "https://github.com/H5-Dooring/dooringx#readme",
"license": "MIT",
"main": "index.js",
"files": [
"template"
],
"repository": {
"type": "git",
"url": "git+https://github.com/H5-Dooring/dooringx.git"
},
"scripts": {
"build": "rimraf ./dist && rollup -c"
},
"bugs": {
"url": "https://github.com/H5-Dooring/dooringx/issues"
}
}

View File

@@ -0,0 +1,59 @@
/*
* @Author: yehuozhili
* @Date: 2021-09-30 10:01:24
* @LastEditors: yehuozhili
* @LastEditTime: 2021-09-30 11:19:59
* @FilePath: \dooringx\packages\dooringx-plugin-template\.babelrc.js
*/
const envPreset = [
"@babel/preset-env",
{
modules: false,
// Allow importing core-js in entrypoint and use browserlist to select polyfills
useBuiltIns: "entry",
// Set the corejs version we are using to avoid warnings in console
corejs: 3,
// Exclude transforms that make all code slower
exclude: ["transform-typeof-symbol"],
loose: true,
targets: {
node: "current",
},
},
];
module.exports = {
presets: [
[
"@babel/preset-react",
{
development: false,
},
],
[
"@babel/preset-typescript",
{
isTSX: true,
allExtensions: true,
},
],
envPreset,
],
plugins: [
["@babel/plugin-proposal-class-properties", { loose: true }],
["@babel/plugin-syntax-dynamic-import"],
["@babel/plugin-transform-runtime"],
],
env: {
production: {
plugins: [
[
"babel-plugin-transform-react-remove-prop-types",
{
removeImport: true,
},
],
],
},
},
};

View File

@@ -0,0 +1,5 @@
{
"tabWidth": 4,
"useTabs": true,
"TrailingCooma": "es5"
}

View File

@@ -0,0 +1,11 @@
# `dooringx-plugin-template`
> TODO: description
## Usage
```
const dooringxPluginTemplate = require('dooringx-plugin-template');
// TODO: DEMONSTRATE API
```

View File

@@ -0,0 +1,79 @@
/*
* @Author: yehuozhili
* @Date: 2021-09-30 09:51:40
* @LastEditors: yehuozhili
* @LastEditTime: 2021-10-07 13:18:49
* @FilePath: \dooringx\packages\dooringx-plugin-template\template\rollup.config.js
*/
import { DEFAULT_EXTENSIONS } from "@babel/core";
import babel from "@rollup/plugin-babel";
import typescript from "rollup-plugin-typescript2";
import commonjs from "@rollup/plugin-commonjs";
import postcss from "rollup-plugin-postcss";
import resolve from "@rollup/plugin-node-resolve";
import url from "@rollup/plugin-url";
import svgr from "@svgr/rollup";
import { terser } from "rollup-plugin-terser";
import typescriptEngine from "typescript";
import external from "rollup-plugin-peer-deps-external";
const externalPkg = ["react", "react-dom"];
const externals = (id) => externalPkg.some((e) => id.indexOf(e) === 0);
export default {
input: "./src/index.tsx",
output: [
{
file: "dist/index.js",
format: "umd",
name: "DOORINGXPLUGIN",
globals: { react: "React", "react-dom": "ReactDom" },
freeze: false,
exports: "default",
},
],
onwarn: function (warning) {
// Skip certain warnings
// should intercept ... but doesn't in some rollup versions
if (warning.code === "THIS_IS_UNDEFINED") {
return;
}
// console.warn everything else
console.warn(warning.message);
},
plugins: [
postcss({
modules: true, //cssmodule
plugins: [],
minimize: true,
}),
external({
includeDependencies: true,
}),
typescript({
typescript: typescriptEngine,
include: ["*.js+(|x)", "**/*.js+(|x)"],
exclude: [
"coverage",
"config",
"dist",
"node_modules/**",
"*.test.{js+(|x), ts+(|x)}",
"**/*.test.{js+(|x), ts+(|x)}",
],
}),
commonjs({
sourceMap: true,
}),
babel({
extensions: [...DEFAULT_EXTENSIONS, ".ts", "tsx"],
babelHelpers: "runtime",
exclude: /node_modules/,
skipPreflightCheck: true,
}),
url(),
svgr(),
resolve(),
terser(),
],
external: externals,
};

View File

@@ -0,0 +1,12 @@
/*
* @Author: yehuozhili
* @Date: 2021-09-30 09:55:01
* @LastEditors: yehuozhili
* @LastEditTime: 2021-09-30 09:55:02
* @FilePath: \dooringx\packages\dooringx-plugin-template\src\global.d.ts
*/
/// <reference types="react-scripts" />
declare module "*.less" {
const classes: { readonly [key: string]: string };
export default classes;
}

View File

@@ -0,0 +1,3 @@
.hello {
background: red;
}

View File

@@ -0,0 +1,57 @@
/*
* @Author: yehuozhili
* @Date: 2021-09-30 09:54:13
* @LastEditors: yehuozhili
* @LastEditTime: 2021-09-30 09:54:24
* @FilePath: \dooringx\packages\dooringx-plugin-template\src\index.tsx
*/
import React from "react";
import styles from "./index.less";
import { ComponentItemFactory, createPannelOptions } from "dooringx-lib";
export interface FormBaseType {
receive?: string;
}
export interface FormInputType extends FormBaseType {
label: string;
}
export interface FormMap {
input: FormInputType;
}
const remoteCo = new ComponentItemFactory(
"remoteCo",
"远程组件",
{
style: [
createPannelOptions<FormMap, "input">("input", {
receive: "text",
label: "文字",
}),
],
},
{
width: 200,
height: 100,
props: {
text: "远程组件a",
},
},
(data) => {
return (
<div
className={styles.hello}
style={{
zIndex: data.zIndex,
width: data.width,
height: data.height,
}}
>
{data.props.text}
</div>
);
},
true
);
remoteCo.url =
"https://img.guguzhu.com/d/file/android/ico/2021/09/08/rytzi2w34tm.png";
export default remoteCo;

View File

@@ -0,0 +1,51 @@
{
"name": "dooringx-plugin-template",
"version": "0.0.0",
"description": "> TODO: description",
"author": "yehuozhili <673632758@qq.com>",
"homepage": "https://github.com/H5-Dooring/dooringx#readme",
"license": "MIT",
"main": "index.js",
"publishConfig": {
"registry": "http://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/H5-Dooring/dooringx.git"
},
"scripts": {
"build": "rimraf ./dist && rollup -c"
},
"bugs": {
"url": "https://github.com/H5-Dooring/dooringx/issues"
},
"devDependencies": {
"@types/react": "^17.0.18",
"@types/react-dom": "^17.0.9",
"less": "^4.1.1",
"prettier": "^2.3.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "^4.0.3",
"rimraf": "^3.0.2",
"rollup": "^2.56.2",
"tslib": "^2.3.1",
"typescript": "^4.3.5",
"@babel/core": "^7.15.0",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-typescript": "^7.15.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-url": "^6.1.0",
"@svgr/rollup": "^5.5.0",
"dooringx-lib": "^0.9.3",
"postcss": "^8.3.6",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0"
},
"dependencies": {}
}

View File

@@ -0,0 +1,50 @@
{
"compilerOptions": {
"declaration": false,
"module": "esnext",
"noImplicitAny": true,
"outDir": "./dist",
"target": "es5",
"moduleResolution": "node",
"baseUrl": "./src",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"isolatedModules": true,
"jsx": "react",
"resolveJsonModule": true,
"esModuleInterop": true,
"strict": true,
"pretty": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"downlevelIteration": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"stripInternal": true,
"emitDecoratorMetadata": false,
"experimentalDecorators": false,
"strictPropertyInitialization": true,
"importHelpers": true,
"sourceMap": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noEmit": false,
"paths": {
"*": ["*", "src/*"]
}
},
"include": ["src/**/*", "node_modules/dooringx-lib/**/*"],
"exclude": [
"coverage",
"config",
"dist",
"node_modules/**",
"**/*.test.js",
"**/*.test.ts"
]
}