technical standard
- react、redux、reducer
- antd
- less
- type-script
- webpack
guide
- npm install cli-redux-ts // pull npm scaffold
- cd node_modules // to scaffold path
- npm install -g // install npm scaffold
- my-cli // initialize scaffold
- npm install // install package
- npm start // start project
https://www.npmjs.com/package/cli-redux-ts
KEY CODE
#! node
console.log("hello cli!")
const fileManager = require("./file-manager")
const path = require("path")
fileManager.init()
let fromdir = path.join(__dirname, 'templates')
let todir = path.join(__dirname, 'src')
fileManager.mkdir('./src', function () {
fileManager.copyFolder(fromdir, todir)
})
copyFolder(from, to) {
let folder = fs.readdirSync(from)
folder.forEach((file) => {
let fromPathname = path.join(from, file)
let toPathname = path.join(to, file)
if (fs.statSync(fromPathname).isDirectory()) {
fs.mkdir(toPathname, (err) => {
if (err) throw { err, fromPathname, toPathname };
else {
this.copyFolder(fromPathname,toPathname)
console.log("mkdirCircle")
}
});
} else {
this.copyFile(fromPathname, toPathname)
}
})
},
## key word
commander
exec
fs.mkdir
本地實作了npm 執行
npm login
npm publish
npm install 拉取指令行工具
my-cli
my cli note
node編寫自己的cli:
https://www.cnblogs.com/Leo_wl/p/6901603.html
cli原了解析:
https://blog.csdn.net/weixin_33795743/article/details/91428525
echo $PATH 檢視配置的環境變量
myCli 位址: C:\Users\sesa528506\AppData\Roaming\npm
ref['http://www.ruanyifeng.com/blog/2015/05/command-line-with-node.html']