yarn install
yarn serve
yarn build
- ci 编译项目 上传代码
- 版本号自增加 版本号确认
- git对比检查
- sourceMap 保存
- 依赖更新检查
npm miniprogram-ci
微信小程序 开发辅助 /CI
如何在nodejs里调用执行系统命令
Node child_process
difference between childprocess close exit events
'exit' emits when the child exits but the stdio are not yet closed. 'close' emits when the child has exited and its stdios are closed.
nodejs在spawn中执行npm报错 [Error: spawn ENOENT]” errors
ANSI转义序列
依赖更新检查参考 check-outdated
// todo process
Life Cycle Operation Order
NPM:常用命令的生命周期脚本
调试过程中查看打印信息
npm install -D --foreground-scripts ../uniapp-weixin-ci
npm uninstall -D --foreground-scripts uniapp-weixin-ci
- npm publish
prepublish > prepare > prepublishOnly > publish > postpublish - npm pack
prepare > prepack > postpack - npm install
prepare > preinstall > install > postinstall - npm uninstall
preuninstall > uninstall > postuninstall
// https://docs.npmjs.com/cli/v7/using-npm/scripts#a-note-on-a-lack-of-npm-uninstall-scripts // npm v6 有uninstall生命周期脚本,但 npm v7 没有
-
npm version
preversion > version > postversion -
npm test
pretest > test > posttest -
npm start
prestart > start > poststart -
npm stop
prestop > stop > poststop -
npm restart
prerestart > restart > postrestart -
npm shinkwrap
preshinkwrap > shinkwrap > postshinkwrap
git-repo git-clone
github 搜索前2
@semantic-release/git
https://www.npmjs.com/package/@semantic-release/git
是个包装过git用于项目发布的命令行工具
不符合ci项目
nodegit
https://github.com/nodegit/nodegit
js-git
https://github.com/creationix/js-git
使用纯JavaScript实现Git客户端和服务器端的开源项目
使用起来太复杂了
git
https://github.com/christkv/node-git
没什么文档
参考ruby的grit rugged
nodegit/nodegit#1840 (comment)
simple-git
https://github.com/steveukx/git-js
//////
Git 合并时 --no-ff 的作用
git merge --no-ff feature
// todo
- gitlab-ci
hbuild 项目根目录的代码部分应该在 cli项目的src文件夹里
bable 不支持条件编译报错
in ./node_modules/_@dcloudio_uni-ui@1.4.4@@dcloudio/uni-ui/lib/uni-swipe-action-item/mpother.js
Module parse failed: Duplicate export 'default' (257:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| // #ifdef APP-PLUS|| MP-WEIXIN || H5
> export default { }
| // #endif
@ ./node_modules/_babel-loader@8.2.2@babel-loader
https://ext.dcloud.net.cn/plugin?id=55
注意 cli 项目默认是不编译 node_modules 下的组件的,导致条件编译等功能失效 ,导致组件异常 需要在根目录创建 vue.config.js 文件 ,增加 @dcloudio/uni-ui 包的编译即可正常
https://www.jianshu.com/p/49372ed954bd
transpileDependencies无效怎么办
要使用npm,不能使用cnpm
git relog命令查看操作历史, git checkout [hash] -b [branch] 还原reset命令删除的提交
require('./src/manifest.json')报错
需要使用json5解析
require-json5
::删除本地tag
git tag -d <tagname>
::删除远端tag
git push origin --delete <tagname>
::向远端推送本地tag
git push origin <tagname>
::向远端推送本地所有tag
git push origin --tags
使用 nodegit 安装时报错
npm ERR! code 1
npm ERR! path D:\1024\web\test\node_modules\nodegit
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@4.0.0
npm ERR! gyp info using node@16.5.0 | win32 | x64
npm ERR! (node:19808) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn E:\Python27\python2.EXE
https://github.com/nodejs/node-gyp#on-windows
nodegit/nodegit#1840 (comment)
我们将在 0.28.0 中解决这个问题。
npm安装github包的方式
直接利用用户名和仓库名进行安装
npm install easterCat/kiana-js
也可以在前面加上 github 前缀
npm install github:easterCat/kiana-js
直接通过 git 上项目的地址进行安装
npm install git+https://github.com/easterCat/kiana-js.git
或者以 ssh 的方式
npm install git+ssh://github.com/easterCat/kiana-js.git
npm install <folder>
文件第一行指定运行环境 #!/usr/bin/env node
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:\1024\web\uniapp-weixin-ci\node_modules\ora\index.js
require() of ES modules is not supported.
require() of D:\1024\web\uniapp-weixin-ci\node_modules\ora\index.js from D:\1024\web\uniapp-weixin-ci\src\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
ora 使用 ^3.4.0 版本
log-symbols 使用 ^2.2.0
/ set tag and push remoteGitError: To github.com:thetime50/uniapp-ci.git
= refs/tags/0.0.3:refs/tags/0.0.3 [up to date]
* refs/tags/0.0.4:refs/tags/0.0.4 [new tag]
! refs/tags/0.0.1:refs/tags/0.0.1 [rejected] (already exists)
! refs/tags/0.0.2:refs/tags/0.0.2 [rejected] (already exists)
Done
Pushing to github.com:thetime50/uniapp-ci.git
error: failed to push some refs to 'github.com:thetime50/uniapp-ci.git'
hint: Updates were rejected because the tag already exists in the remote.
要把 git pull 移到版本检查前面
发布前删除淘宝源
npm config delete registry
npm config delete disturl
设置淘宝源
npm config set registry http://registry.npm.taobao.org/