Skip to content

Commit 3ac69ef

Browse files
committed
fix: remove pull template from github and add doc for windows
1 parent 1925bac commit 3ac69ef

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

docs/guide.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,3 +767,23 @@ module.exports = {
767767
workers: 1
768768
}
769769
```
770+
771+
## 其他一些情况
772+
773+
### windows 支持
774+
775+
由于在 windows 上开发体验不是特别友好,以及一些库缺乏支持,在大部分情况下,我们优先推荐在 mac/linux 下开发 Node.js 应用。
776+
777+
经过我们的测试,在 windows 10 , nodejs 官网下载的 v10 版本的 node 下运行 midway 程序通过,但是无法确保在其他的 windows 版本上能够正常。
778+
779+
推荐使用类似 [Hyper](https://hyper.is/) 等相对友好的命令行工具来替换原生的命令行。
780+
781+
需要注意的是,由于 windows 对设置环境变量的同步,默认生成的脚手架可能需要调整,主要是环境变量的部分。
782+
783+
比如开发命令,在设置环境的时候需要使用 `set` 以及中间需要增加 `&&` 以连接命令。
784+
785+
```json
786+
{
787+
"dev": "set NODE_ENV=local && midway-bin dev --ts"
788+
}
789+
```

packages/midway-init/lib/command.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ const path = require('path');
55
const fs = require('fs');
66
const Parser = require('./parser');
77
const templateDir = path.join(__dirname, '../boilerplate/');
8+
const os = require('os');
89

910
class MidwayInitCommand extends Command {
1011

1112
constructor(options = {}) {
1213
super(Object.assign({}, options));
1314
}
1415

15-
* fetchBoilerplateMapping(pkgName) {
16-
const mapping = yield super.fetchBoilerplateMapping(pkgName);
17-
return Object.assign(require('../boilerplate/boilerplate.json'), mapping);
16+
* fetchBoilerplateMapping() {
17+
return require('../boilerplate/boilerplate.json');
1818
}
1919

2020
* downloadBoilerplate(pkgName) {
@@ -32,6 +32,15 @@ class MidwayInitCommand extends Command {
3232
getParserOptions() {
3333
return Parser.getParserOptions();
3434
}
35+
36+
printUsage() {
37+
super.printUsage();
38+
if (os.platform() === 'win32') {
39+
this.log(`Since it is windows system, please review this note.
40+
https://midwayjs.org/midway/guide.html#%E5%90%AF%E5%8A%A8%E5%8F%82%E6%95%B0%E4%BC%A0%E9%80%92
41+
`);
42+
}
43+
}
3544
}
3645

3746
module.exports = MidwayInitCommand;

0 commit comments

Comments
 (0)