diff --git a/designer-demo/package.json b/designer-demo/package.json index 12057fee7b..d3703904a9 100644 --- a/designer-demo/package.json +++ b/designer-demo/package.json @@ -10,7 +10,6 @@ "dependencies": { "vue": "^3.4.21", "@opentiny/tiny-engine": "workspace:^", - "@opentiny/tiny-engine-configurator": "workspace:*", "@opentiny/tiny-engine-theme-dark": "workspace:*", "@opentiny/tiny-engine-theme-light": "workspace:*", "@opentiny/vue": "~3.14.0", diff --git a/packages/design-core/package.json b/packages/design-core/package.json index 17e170f988..8ed394451c 100644 --- a/packages/design-core/package.json +++ b/packages/design-core/package.json @@ -42,6 +42,7 @@ "@babel/generator": "~7.23.2", "@babel/parser": "~7.23.2", "@babel/traverse": "~7.23.2", + "@opentiny/tiny-engine-configurator": "workspace:*", "@opentiny/tiny-engine-layout": "workspace:~", "@opentiny/tiny-engine-vite-plugin-meta-comments": "workspace:*", "@opentiny/tiny-engine-entry": "workspace:*", diff --git a/packages/engine-cli/.npmrc b/packages/engine-cli/.npmrc new file mode 100644 index 0000000000..5d81e09655 --- /dev/null +++ b/packages/engine-cli/.npmrc @@ -0,0 +1 @@ +@opentiny:registry=https://registry.npmmirror.com/ diff --git a/packages/engine-cli/README.md b/packages/engine-cli/README.md new file mode 100644 index 0000000000..39a09a3cd4 --- /dev/null +++ b/packages/engine-cli/README.md @@ -0,0 +1,28 @@ +# engine-cli + +tiny-engine cli for create new designer/plugin/... + +## dev + +```sh +npm run dev # build in watch mode +npm run build # build engine-cli +npm link # after link, you can test engine-cli commands use: engine-cli create xxx +``` + +## usage + +### create + +```sh +npx @opentiny/tiny-engine-cli@latest create my-designer +``` + +### dev + +```sh +cd my-designer && npm install # install +npm run dev # designer dev +npm run build # designer build +``` + diff --git a/packages/engine-cli/bin/cli.js b/packages/engine-cli/bin/cli.js old mode 100644 new mode 100755 index 0a70e5b0c1..30f38aa97c --- a/packages/engine-cli/bin/cli.js +++ b/packages/engine-cli/bin/cli.js @@ -1,2 +1,2 @@ #!/usr/bin/env node -import '../src/index.js' +require('../dist/index.js') diff --git a/packages/engine-cli/package.json b/packages/engine-cli/package.json index 70cbbfa834..c2de249465 100644 --- a/packages/engine-cli/package.json +++ b/packages/engine-cli/package.json @@ -1,11 +1,11 @@ { "name": "@opentiny/tiny-engine-cli", "version": "1.0.0", - "type": "module", "description": "", - "main": "index.js", + "main": "dist/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "dev": "npm run build -- --watch", + "build": "esbuild src/index.js --bundle --minify=true --outfile=dist/index.js --format=cjs --platform=node --target=node14" }, "bin": { "engine-cli": "./bin/cli.js" @@ -16,12 +16,7 @@ "devDependencies": { "chalk": "^5.3.0", "commander": "^12.0.0", - "execa": "^8.0.1", "fs-extra": "^11.2.0", - "globby": "^14.0.1", - "handlebars": "^4.7.8", - "inquirer": "^9.2.17", - "ora": "^8.0.1", - "vite": "^5.1.6" + "esbuild": "^0.18.20" } } diff --git a/packages/engine-cli/src/commands/create.js b/packages/engine-cli/src/commands/create.js index 4fe7885a74..b2b2d1d14a 100644 --- a/packages/engine-cli/src/commands/create.js +++ b/packages/engine-cli/src/commands/create.js @@ -10,18 +10,13 @@ * */ -import { fileURLToPath } from 'node:url' import { cwd } from 'node:process' import path from 'node:path' import fs from 'fs-extra' import chalk from 'chalk' -const __filename = fileURLToPath(import.meta.url) - -const __dirname = path.dirname(__filename) - export default function (name) { - const sourcePath = path.join(__dirname, '../../template/designer/') + const sourcePath = path.join(__dirname, '../template/designer/') const destPath = path.join(cwd(), name) fs.copySync(sourcePath, destPath) console.log( diff --git a/packages/engine-cli/src/index.js b/packages/engine-cli/src/index.js index 6f67424330..dcf8c381e9 100644 --- a/packages/engine-cli/src/index.js +++ b/packages/engine-cli/src/index.js @@ -9,13 +9,9 @@ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. * */ - -import { fileURLToPath } from 'node:url' import { Command } from 'commander' import create from './commands/create.js' -const __filename = fileURLToPath(import.meta.url) - const program = new Command() program diff --git a/packages/engine-cli/template/designer/env/.env.development b/packages/engine-cli/template/designer/env/.env.development index 98c505478e..e02fbee0fd 100644 --- a/packages/engine-cli/template/designer/env/.env.development +++ b/packages/engine-cli/template/designer/env/.env.development @@ -1,7 +1,7 @@ # development mode, used by the "vite" command NODE_ENV=development -VITE_CDN_DOMAIN=https://npm.onmicrosoft.cn +VITE_CDN_DOMAIN=https://unpkg.com VITE_LOCAL_IMPORT_MAPS=false VITE_LOCAL_BUNDLE_DEPS=false # request data via alpha service diff --git a/packages/engine-cli/template/designer/package.json b/packages/engine-cli/template/designer/package.json index dc8b48aaaa..18b4a34bdf 100644 --- a/packages/engine-cli/template/designer/package.json +++ b/packages/engine-cli/template/designer/package.json @@ -10,11 +10,10 @@ "dependencies": { "vue": "^3.4.21", "@opentiny/tiny-engine": "latest", - "@opentiny/tiny-engine-entry": "latest", - "@opentiny/tiny-engine-configurator": "latest", "@opentiny/tiny-engine-theme-dark": "latest", "@opentiny/tiny-engine-theme-light": "latest", "@opentiny/vue": "~3.14.0", + "@opentiny/vue-icon": "~3.14.0", "@opentiny/vue-design-smb": "~3.14.0", "@opentiny/vue-renderless": "~3.14.0", "@opentiny/vue-theme": "~3.14.0" @@ -23,7 +22,6 @@ "@vitejs/plugin-vue": "^5.0.4", "cross-env": "^7.0.3", "vite": "^5.2.7", - "@opentiny/tiny-engine-vite-config": "latest", - "@opentiny/tiny-engine-vite-plugin-meta-comments": "latest" + "@opentiny/tiny-engine-vite-config": "latest" } } diff --git a/packages/engine-cli/template/designer/preview.html b/packages/engine-cli/template/designer/preview.html index 23770ebf6d..2291301fa4 100644 --- a/packages/engine-cli/template/designer/preview.html +++ b/packages/engine-cli/template/designer/preview.html @@ -8,6 +8,6 @@
- +