From 6df8ce82a5675702f1e9b45c66696f5af85ef3d0 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 26 Apr 2022 17:38:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(runtime):=20=E4=BF=AE=E5=A4=8Dwindow?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=B8=8Bnpm=20run=20playground=20=E5=87=BA?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98=20#29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- runtime/react/package.json | 2 ++ runtime/react/vite.config.ts | 1 + runtime/scripts/generateEntry.js | 8 +++++--- runtime/vue2/package.json | 2 ++ runtime/vue2/vite.config.ts | 1 + runtime/vue3/package.json | 2 ++ runtime/vue3/vite.config.ts | 1 + 8 files changed, 16 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 6c93e71e..5a6b08e7 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,13 @@ "scripts": { "bootstrap": "lerna bootstrap && npm run prepare", "clean:lock": "npx shx rm -rf package-lock.json **/package-lock.json **/**/package-lock.json", - "clean:top": "npx rm -rf */**/dist */dist coverage dwt*", + "clean:top": "npx shx rm -rf */**/dist */dist coverage dwt*", "clean:all": "npm run clean:top && npx shx rm -rf node_modules **/node_modules **/**/node_modules", "lint": "eslint . --ext .js,.vue,.ts,.tsx", "lint-fix": "eslint . --fix --ext .vue,.js,.ts,.tsx", "playground": "npx lerna run dev --scope tmagic-playground --scope runtime-vue3 --parallel", "build": "npx lerna run build --scope tmagic-playground --scope runtime-vue3 --scope runtime-vue2 --scope runtime-react --scope @tmagic/* --parallel", - "postbuild": "npx mkdir playground/dist/runtime && npx cp -r runtime/vue2/dist ./playground/dist/runtime/vue2 && npx cp -r runtime/vue3/dist ./playground/dist/runtime/vue3 && npx cp -r runtime/react/dist ./playground/dist/runtime/react", + "postbuild": "npx shx mkdir playground/dist/runtime && npx shx cp -r runtime/vue2/dist ./playground/dist/runtime/vue2 && npx shx cp -r runtime/vue3/dist ./playground/dist/runtime/vue3 && npx cp -r runtime/react/dist ./playground/dist/runtime/react", "docs": "cd docs && npm run doc:dev", "page": "cd page && vite", "page-vue2": "cd page-vue2 && vite", diff --git a/runtime/react/package.json b/runtime/react/package.json index 6932ac08..ac11f9af 100644 --- a/runtime/react/package.json +++ b/runtime/react/package.json @@ -9,6 +9,8 @@ "serve": "vite preview --port 8076" }, "dependencies": { + "@tmagic/schema": "^1.0.0-beta.13", + "@tmagic/stage": "^1.0.0-beta.13", "react": "^17.0.2", "react-dom": "^17.0.2" }, diff --git a/runtime/react/vite.config.ts b/runtime/react/vite.config.ts index f1eb64db..9a991e8f 100644 --- a/runtime/react/vite.config.ts +++ b/runtime/react/vite.config.ts @@ -38,6 +38,7 @@ export default defineConfig({ }, server: { + host: '0.0.0.0', port: 8090, }, diff --git a/runtime/scripts/generateEntry.js b/runtime/scripts/generateEntry.js index 5eef4204..7ea4ef65 100644 --- a/runtime/scripts/generateEntry.js +++ b/runtime/scripts/generateEntry.js @@ -196,7 +196,8 @@ const generateEntryFile = function ({ entries, entryFile, type, componentFileAff fs.writeFileSync( path.resolve(entryPath(), entryFile), - prettyPrint(parse(jsString, { parser: require('recast/parsers/typescript') }), { + // window下需要将路径中\转换成/ + prettyPrint(parse(jsString.replace(/\\/g, '/'), { parser: require('recast/parsers/typescript') }), { tabWidth: 2, trailingComma: true, quote: 'single', @@ -207,9 +208,10 @@ const generateEntryFile = function ({ entries, entryFile, type, componentFileAff const installPackage = function (package) { try { - execSync(`node -e "require.resolve('${package}')"`, { stdio: 'ignore' }); + // window下需要将路径中\转换成/ + execSync(`node -e "require.resolve('${package.replace(/\\/g, '/')}')"`, { stdio: 'ignore' }); } catch (e) { - execSync(`npm install ${package} --registry https://mirrors.tencent.com/npm/`, { + execSync(`npm install ${package}`, { stdio: 'inherit', cwd: pageRoot(), }); diff --git a/runtime/vue2/package.json b/runtime/vue2/package.json index b8b28124..632061c5 100644 --- a/runtime/vue2/package.json +++ b/runtime/vue2/package.json @@ -9,6 +9,8 @@ "serve": "vite preview --port 8077" }, "dependencies": { + "@tmagic/schema": "^1.0.0-beta.13", + "@tmagic/stage": "^1.0.0-beta.13", "@vue/composition-api": "1.0.5", "vue": "^2.6.14" }, diff --git a/runtime/vue2/vite.config.ts b/runtime/vue2/vite.config.ts index ade0e6c9..eb946b38 100644 --- a/runtime/vue2/vite.config.ts +++ b/runtime/vue2/vite.config.ts @@ -37,6 +37,7 @@ export default defineConfig({ }, server: { + host: '0.0.0.0', port: 8089, }, build: { diff --git a/runtime/vue3/package.json b/runtime/vue3/package.json index 9d9e2d3b..2ab7fa24 100644 --- a/runtime/vue3/package.json +++ b/runtime/vue3/package.json @@ -9,6 +9,8 @@ "serve": "vite preview --port 8078" }, "dependencies": { + "@tmagic/schema": "^1.0.0-beta.13", + "@tmagic/stage": "^1.0.0-beta.13", "axios": "^0.25.0", "vue": "^3.2.0" }, diff --git a/runtime/vue3/vite.config.ts b/runtime/vue3/vite.config.ts index 8627b47c..1f286372 100644 --- a/runtime/vue3/vite.config.ts +++ b/runtime/vue3/vite.config.ts @@ -37,6 +37,7 @@ export default defineConfig({ }, server: { + host: '0.0.0.0', port: 8089, }, build: {