Browse Source

fix(cli): local db file config

master
Hans Chan 4 years ago
parent
commit
74ff14ba71
  1. 1
      packages/cli/.gitignore
  2. 1
      packages/cli/.npmignore
  3. 26
      packages/cli/README.md
  4. 4
      packages/cli/src/cmd/editor/build.js
  5. 4
      packages/cli/src/cmd/editor/index.js
  6. 5
      packages/cli/src/cmd/editor/template/index.html

1
packages/cli/.gitignore

@ -1 +0,0 @@
src/cmd/editor/template/*.bundle.*

1
packages/cli/.npmignore

@ -1,2 +1 @@
node_modules
src/cmd/editor/template/*.bundle.*

26
packages/cli/README.md

@ -1 +1,27 @@
## iMove-cli
### Install
```bash
npm i -g @imove/cli
```
### Usage
- 初始化项目,创建 `imove.config.js`
```bash
imove -i
# OR
imove --init
```
- 启动开发服务及编辑器
```bash
imove -de
# OR
imove --dev --editor
```
浏览器打开 [http://127.0.0.1:3500/](http://127.0.0.1:3500/)

4
packages/cli/src/cmd/editor/build.js

@ -6,8 +6,9 @@ require('esbuild')
.build({
bundle: true,
entryPoints: [path.join(__dirname, 'template/app.jsx')],
outfile: path.join(__dirname, 'template/app.bundle.js'),
outfile: path.join(__dirname, 'template/dist/app.bundle.js'),
plugins: [
// fix import('antd/dist/antd.less')
{
name: 'resolve-antd-dist-less',
setup: (build) => {
@ -22,6 +23,7 @@ require('esbuild')
);
},
},
// less
lessLoader({
javascriptEnabled: true,
}),

4
packages/cli/src/cmd/editor/index.js

@ -32,12 +32,12 @@ class Editor extends Base {
}
get dbFile() {
const { dbFile } = this._dfFile || this.config || '';
const dbFile = this._dbFile || (this.config || '').dbFile;
return dbFile;
}
set dbFile(val) {
this._dfFile = val;
this._dbFile = val;
}
queryGraph(req, res) {

5
packages/cli/src/cmd/editor/template/index.html

@ -4,11 +4,10 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>iMove Editor</title>
<!-- <link rel="stylesheet" href="https://unpkg.com/antd/dist/antd.css" /> -->
<link rel="stylesheet" href="/app.bundle.css" />
<link rel="stylesheet" href="dist/app.bundle.css" />
</head>
<body>
<div id="root" style="height:100vh"></div>
<script type="module" src="/app.bundle.js"></script>
<script type="module" src="dist/app.bundle.js"></script>
</body>
</html>

Loading…
Cancel
Save