Browse Source

Merge pull request #118 from csbun/feature/cli-with-editor

fix: npm postinstall script
master
Yang Pei 4 years ago
committed by GitHub
parent
commit
c6a24739db
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      example/package.json
  2. 2
      package.json
  3. 1
      packages/cli/package.json
  4. 8
      packages/cli/src/cmd/editor/build.js

2
example/package.json

@ -2,7 +2,7 @@
"name": "example",
"scripts": {
"start": "umi dev",
"build": "umi build",
"build": "",
"postinstall": "umi generate tmp"
},
"dependencies": {

2
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": {

1
packages/cli/package.json

@ -11,6 +11,7 @@
"compile"
],
"scripts": {
"build": "",
"build:editor": "node src/cmd/editor/build.js",
"postinstall": "npm run build:editor"
},

8
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) => {

Loading…
Cancel
Save