diff --git a/build.json b/build.json index 39b2172..b8de4ee 100644 --- a/build.json +++ b/build.json @@ -1,7 +1,28 @@ { "entry": { - "demo-general/preview": "./demo-general/src/preview.tsx", - "demo-general/index": "./demo-general/src/preview.tsx" + "demo-general/index" : "./demo-general/src/index.ts", + "demo-general/preview" : "./demo-general/src/preview.tsx", + + "demo-antd-pro-with-formily/index" : "./demo-antd-pro-with-formily/src/index.ts", + "demo-antd-pro-with-formily/preview" : "./demo-antd-pro-with-formily/src/preview.tsx", + + "demo-basic-antd/index" : "./demo-basic-antd/src/index.ts", + "demo-basic-antd/preview" : "./demo-basic-antd/src/preview.tsx", + + "demo-basic-fusion/index" : "./demo-basic-fusion/src/index.ts", + "demo-basic-fusion/preview" : "./demo-basic-fusion/src/preview.tsx", + + "demo-basic-fusion-with-single-component/index" : "./demo-basic-fusion-with-single-component/src/index.ts", + "demo-basic-fusion-with-single-component/preview" : "./demo-basic-fusion-with-single-component/src/preview.tsx", + + "demo-custom-initialization/index" : "./demo-custom-initialization/src/index.tsx", + "demo-custom-initialization/preview" : "./demo-custom-initialization/src/preview.tsx", + + "demo-next-pro/index" : "./demo-next-pro/src/index.ts", + "demo-next-pro/preview" : "./demo-next-pro/src/preview.tsx", + + "demo-node-extended-actions/index" : "./demo-node-extended-actions/src/index.ts", + "demo-node-extended-actions/preview" : "./demo-node-extended-actions/src/preview.tsx" }, "vendor": false, "devServer": { diff --git a/build.plugin.js b/build.plugin.js index 5fdc882..33b2953 100644 --- a/build.plugin.js +++ b/build.plugin.js @@ -1,4 +1,5 @@ const fs = require('fs-extra'); +const configuration = require('./build.json'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); @@ -17,31 +18,67 @@ module.exports = ({ onGetWebpackConfig }) => { fs: 'empty', }, }); + const entries = Object.keys(configuration.entry) || []; + entries.map((entry) => { + const [scenarioName, page] = entry.split('/'); + if (page === 'index') { + config + .plugin(entry) + .use(HtmlWebpackPlugin, [ + { + inject: false, + minify: false, + templateParameters: { + version, + scenarioName + }, + template: require.resolve('./public/index.ejs'), + filename: `${scenarioName}/index.html`, + }, + ]); + } + if (page === 'preview') { + config + .plugin(entry) + .use(HtmlWebpackPlugin, [ + { + inject: false, + minify: false, + templateParameters: { + scenarioName, + }, + template: require.resolve('./public/preview.html'), + filename: `${scenarioName}/preview.html`, + }, + ]); - config - .plugin('demo-general/index') - .use(HtmlWebpackPlugin, [ - { - inject: false, - minify: false, - templateParameters: { - version, - }, - template: require.resolve('./demo-general/public/index.ejs'), - filename: 'index.html', - }, - ]); - config - .plugin('demo-general/preview') - .use(HtmlWebpackPlugin, [ - { - inject: false, - templateParameters: { - }, - template: require.resolve('./demo-general/public/preview.html'), - filename: 'preview.html', - }, - ]); + } + }) + + // config + // .plugin('demo-general/index') + // .use(HtmlWebpackPlugin, [ + // { + // inject: false, + // minify: false, + // templateParameters: { + // version, + // }, + // template: require.resolve('./demo-general/public/index.ejs'), + // filename: 'demo-general/index.html', + // }, + // ]); + // config + // .plugin('demo-general/preview') + // .use(HtmlWebpackPlugin, [ + // { + // inject: false, + // templateParameters: { + // }, + // template: require.resolve('./demo-general/public/preview.html'), + // filename: 'demo-general/preview.html', + // }, + // ]); config.plugins.delete('hot'); config.devServer.hot(false); diff --git a/public/demo-antd-pro-with-formily/mock/info.json b/public/demo-antd-pro-with-formily/mock/info.json new file mode 100644 index 0000000..006209b --- /dev/null +++ b/public/demo-antd-pro-with-formily/mock/info.json @@ -0,0 +1,3 @@ +{ + "info": "Hello AliLowCode!!" +} \ No newline at end of file diff --git a/public/demo-basic-antd/mock/info.json b/public/demo-basic-antd/mock/info.json new file mode 100644 index 0000000..006209b --- /dev/null +++ b/public/demo-basic-antd/mock/info.json @@ -0,0 +1,3 @@ +{ + "info": "Hello AliLowCode!!" +} \ No newline at end of file diff --git a/public/demo-basic-fusion-with-single-component/mock/info.json b/public/demo-basic-fusion-with-single-component/mock/info.json new file mode 100644 index 0000000..006209b --- /dev/null +++ b/public/demo-basic-fusion-with-single-component/mock/info.json @@ -0,0 +1,3 @@ +{ + "info": "Hello AliLowCode!!" +} \ No newline at end of file diff --git a/public/demo-basic-fusion/mock/info.json b/public/demo-basic-fusion/mock/info.json new file mode 100644 index 0000000..006209b --- /dev/null +++ b/public/demo-basic-fusion/mock/info.json @@ -0,0 +1,3 @@ +{ + "info": "Hello AliLowCode!!" +} \ No newline at end of file diff --git a/public/demo-custom-initialization/mock/info.json b/public/demo-custom-initialization/mock/info.json new file mode 100644 index 0000000..006209b --- /dev/null +++ b/public/demo-custom-initialization/mock/info.json @@ -0,0 +1,3 @@ +{ + "info": "Hello AliLowCode!!" +} \ No newline at end of file diff --git a/public/demo-general/mock/info.json b/public/demo-general/mock/info.json new file mode 100644 index 0000000..006209b --- /dev/null +++ b/public/demo-general/mock/info.json @@ -0,0 +1,3 @@ +{ + "info": "Hello AliLowCode!!" +} \ No newline at end of file diff --git a/public/demo-next-pro/mock/info.json b/public/demo-next-pro/mock/info.json new file mode 100644 index 0000000..006209b --- /dev/null +++ b/public/demo-next-pro/mock/info.json @@ -0,0 +1,3 @@ +{ + "info": "Hello AliLowCode!!" +} \ No newline at end of file diff --git a/public/demo-node-extended-actions/mock/info.json b/public/demo-node-extended-actions/mock/info.json new file mode 100644 index 0000000..006209b --- /dev/null +++ b/public/demo-node-extended-actions/mock/info.json @@ -0,0 +1,3 @@ +{ + "info": "Hello AliLowCode!!" +} \ No newline at end of file diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000..307ffbd Binary files /dev/null and b/public/favicon.png differ diff --git a/public/index.ejs b/public/index.ejs new file mode 100644 index 0000000..51cdef0 --- /dev/null +++ b/public/index.ejs @@ -0,0 +1,48 @@ + + +
+ + + +