diff --git a/package.json b/package.json index a100165c6..0d6ecec19 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,13 @@ { "private": true, "scripts": { - "clean": "lerna clean -y", - "setup": "./scripts/reinstall.sh", - "pub": "npm run test && lerna publish --registry http://registry.npm.alibaba-inc.com", - "lint": "eslint -p tsconfig.json", - "lint:fix": "eslint --fix -p tsconfig.json", - "build": "lerna run build", + "clean": "rm -rf ./packages/*/lib ./packages/*/es ./packages/*/dist ./packages/*/build", + "setup": "./scripts/setup.sh", + "start": "./scripts/start.sh", + "build": "lerna exec -- npm run build", "test": "lerna run test", "test:snapshot": "lerna run test:snapshot", + "pub": "npm run test && lerna publish", "commit": "git-cz" }, "devDependencies": { @@ -36,15 +35,17 @@ "**/@alife/theme-lowcode-*" ] }, - "gitHooks": { - "pre-commit": "lint-staged" - }, "lint-staged": { "*.{tsx,ts}": [ - "eslint --fix", + "eslint --quiet", "git add" ] }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, "config": { "commitizen": { "path": "node_modules/cz-conventional-changelog" diff --git a/packages/demo/build.json b/packages/demo/build.json index 638a11976..623ad7a36 100644 --- a/packages/demo/build.json +++ b/packages/demo/build.json @@ -4,6 +4,9 @@ "react-simulator-renderer": "../react-simulator-renderer/src/index.js" }, "vendor": false, + "devServer": { + "hot": false + }, "publicPath": "/", "externals": { "react": "var window.React", diff --git a/packages/demo/build.plugin.js b/packages/demo/build.plugin.js index a2763e1fd..0fbf67f53 100644 --- a/packages/demo/build.plugin.js +++ b/packages/demo/build.plugin.js @@ -7,6 +7,7 @@ module.exports = ({ onGetWebpackConfig }) => { .use(TsconfigPathsPlugin, [{ configFile: "./tsconfig.json" }]); + config.plugins.delete('hot'); config.devServer.hot(false); }); }; diff --git a/packages/demo/package.json b/packages/demo/package.json index 592499865..2efe9ba32 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -3,8 +3,7 @@ "version": "0.8.0", "description": "低代码引擎 DEMO", "scripts": { - "start": "build-scripts start", - "build": "build-scripts build" + "start": "build-scripts start" }, "dependencies": { "@ali/lowcode-editor-core": "^0.8", diff --git a/packages/demo/public/assets.json b/packages/demo/public/assets.json index 7d86b9ed3..aceef84ad 100644 --- a/packages/demo/public/assets.json +++ b/packages/demo/public/assets.json @@ -1,6 +1,11 @@ { "version": "1.0.0", "packages": { + "moment": { + "package": "moment", + "urls": ["https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"], + "library": "moment" + }, "@alifd/next": { "title": "fusion组件库", "package": "@alifd/next", diff --git a/packages/demo/public/index.html b/packages/demo/public/index.html index e64754f38..c8f2cfdcb 100644 --- a/packages/demo/public/index.html +++ b/packages/demo/public/index.html @@ -15,7 +15,7 @@ -
+ diff --git a/packages/demo/src/config/components.js b/packages/demo/src/config/components.js index c933d7cd4..2d40e553c 100644 --- a/packages/demo/src/config/components.js +++ b/packages/demo/src/config/components.js @@ -1,6 +1,6 @@ import undoRedo from '@ali/lowcode-plugin-undo-redo'; -import logo from '@ali/lowcode-plugin-logo'; -import save from '@ali/lowcode-plugin-save'; +import logo from '@ali/lowcode-plugin-sample-logo'; +import SamplePreview from '@ali/lowcode-plugin-sample-preview'; import Designer from '@ali/lowcode-plugin-designer'; import SettingsPane from '@ali/lowcode-plugin-settings-pane'; import componentsPane from '@ali/lowcode-plugin-components-pane'; @@ -9,10 +9,10 @@ import { PluginFactory } from '@ali/lowcode-editor-core'; export default { logo: PluginFactory(logo), - save: PluginFactory(save), + samplePreview: PluginFactory(SamplePreview), undoRedo: PluginFactory(undoRedo), designer: PluginFactory(Designer), componentsPane: PluginFactory(componentsPane), settingsPane: PluginFactory(SettingsPane), - OutlinePane: PluginFactory(OutlinePane), + outlinePane: PluginFactory(OutlinePane), }; diff --git a/packages/demo/src/config/skeleton.js b/packages/demo/src/config/skeleton.js index 103f39cab..bb27da830 100644 --- a/packages/demo/src/config/skeleton.js +++ b/packages/demo/src/config/skeleton.js @@ -21,7 +21,7 @@ export default { width: 100 }, config: { - package: '@ali/lowcode-plugin-logo', + package: '@ali/lowcode-plugin-sample-logo', version: '1.0.0' }, pluginProps: { @@ -49,14 +49,14 @@ export default { } }, { - pluginKey: 'save', + pluginKey: 'samplePreview', type: 'Custom', props: { align: 'right', width: 64 }, config: { - package: '@ali/lowcode-plugin-save', + package: '@ali/lowcode-plugin-sample-preview', version: '1.0.0' } } @@ -120,15 +120,12 @@ export default { lifeCycles: { init: async function init(editor) { const assets = await editor.utils.get('/assets.json'); - editor.set({ - assets, - componentsMap: assets.components - }); + editor.set('assets', assets); + editor.emit('assets.loaded', assets); - editor.utils.get('/schema.json').then(res => { - editor.set('schema', res); - editor.emit('schema.reset', res); - }); + const schema = await editor.utils.get('/schema.json'); + editor.set('schema', schema); + editor.emit('schema.loaded', schema); } } }; diff --git a/packages/demo/src/preview.js b/packages/demo/src/preview.js new file mode 100644 index 000000000..e69de29bb diff --git a/packages/designer/src/designer/designer-view.tsx b/packages/designer/src/designer/designer-view.tsx index e07b06e37..0a26aef2d 100644 --- a/packages/designer/src/designer/designer-view.tsx +++ b/packages/designer/src/designer/designer-view.tsx @@ -18,7 +18,7 @@ export class DesignerView extends Component{intl('Designer not found')}
-{intl('No opened document')}
+{intl('Initializing')}