From c97055d903699f0b88d68f742a3ecc5427512c3b Mon Sep 17 00:00:00 2001 From: Hans Chan Date: Fri, 23 Jul 2021 16:28:33 +0800 Subject: [PATCH] fix: npm postinstall script --- example/package.json | 2 +- package.json | 2 +- packages/cli/package.json | 1 + packages/cli/src/cmd/editor/build.js | 8 +------- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/example/package.json b/example/package.json index b4c3738..93666dd 100644 --- a/example/package.json +++ b/example/package.json @@ -2,7 +2,7 @@ "name": "example", "scripts": { "start": "umi dev", - "build": "umi build", + "build": "", "postinstall": "umi generate tmp" }, "dependencies": { diff --git a/package.json b/package.json index 99b684b..acb4868 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "doc": "dumi dev", "start": "concurrently \"lerna run watch --parallel\" \"cross-env APP_ROOT=example umi dev\"", "example": "concurrently \"lerna run watch --parallel\" \"cross-env APP_ROOT=example umi dev\" \"imove -d\"", - "postinstall": "npm link packages/cli && lerna init && lerna bootstrap", + "postinstall": "lerna init && lerna exec npm i && lerna exec npm run build && npm link packages/cli && lerna bootstrap", "prepare": "husky install" }, "jest": { diff --git a/packages/cli/package.json b/packages/cli/package.json index 7a5723e..29112fb 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -11,6 +11,7 @@ "compile" ], "scripts": { + "build": "", "build:editor": "node src/cmd/editor/build.js", "postinstall": "npm run build:editor" }, diff --git a/packages/cli/src/cmd/editor/build.js b/packages/cli/src/cmd/editor/build.js index 95d97e3..90a084b 100644 --- a/packages/cli/src/cmd/editor/build.js +++ b/packages/cli/src/cmd/editor/build.js @@ -2,15 +2,8 @@ /* eslint-disable @typescript-eslint/no-var-requires */ const path = require('path'); -const fs = require('fs-extra'); const { lessLoader } = require('esbuild-plugin-less'); -// build @imove/core first, if in imove repo -const CORE_DIR = path.join(__dirname, '../../../../core'); -if (fs.pathExistsSync(CORE_DIR)) { - require('child_process').execSync(`cd ${CORE_DIR} && rollup -c`); -} - // build js and css for editor const OUT_FILE = path.join(__dirname, 'template/dist/app.bundle.js'); require('esbuild') @@ -19,6 +12,7 @@ require('esbuild') entryPoints: [path.join(__dirname, 'template/app.jsx')], outfile: OUT_FILE, plugins: [ + // fix multi-react with lerna { name: 'resolve-multi-react', setup: (build) => {