@taole/deploy-helper 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +9 -0
- package/lib/project.mjs +24 -1
- package/package.json +3 -2
package/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { Client } from 'node-scp'
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import { join, basename, dirname } from "path";
|
|
6
6
|
import { simpleGit } from 'simple-git';
|
|
7
|
+
import updateNotifier from 'update-notifier';
|
|
7
8
|
import { runPipeline, checkYunxiaoToken, triggerPipeline } from './lib/pipelineApi.mjs';
|
|
8
9
|
import { setDebug, log } from './lib/util.mjs';
|
|
9
10
|
import path from 'path';
|
|
@@ -142,6 +143,14 @@ async function main() {
|
|
|
142
143
|
const packageJson = getPackageJson();
|
|
143
144
|
const version = packageJson.version;
|
|
144
145
|
|
|
146
|
+
updateNotifier({
|
|
147
|
+
pkg: packageJson,
|
|
148
|
+
updateCheckInterval: 1000 * 60 * 60 * 24,
|
|
149
|
+
}).notify({
|
|
150
|
+
defer: false,
|
|
151
|
+
message: `发现新版本 {latestVersion}(当前 {currentVersion}),建议更新:\n{updateCommand}`,
|
|
152
|
+
});
|
|
153
|
+
|
|
145
154
|
// process.argv.includes("--debug") ||
|
|
146
155
|
// 默认开启debug debug目前只是打印日志的时候额外打印时间
|
|
147
156
|
setDebug(true);
|
package/lib/project.mjs
CHANGED
|
@@ -252,6 +252,29 @@ export const cmdProjectCreate = async () => {
|
|
|
252
252
|
JSON.stringify(targetPackageJson, null, 2)
|
|
253
253
|
);
|
|
254
254
|
log(`项目package.json覆盖成功`);
|
|
255
|
+
const readmePath = path.join(projectDir, "README.md");
|
|
256
|
+
if (fs.existsSync(readmePath)) {
|
|
257
|
+
const readmeContent = fs.readFileSync(readmePath, "utf8");
|
|
258
|
+
if (!readmeContent.includes("## 访问")) {
|
|
259
|
+
const accessLines = [
|
|
260
|
+
"",
|
|
261
|
+
"## 访问",
|
|
262
|
+
`测试环境地址\thttps://act-test.tuwan.com/${name}/index.html`,
|
|
263
|
+
`线上环境地址\thttps://act.tuwan.com/${name}/index.html`,
|
|
264
|
+
`仓库地址\thttps://codeup.aliyun.com/69b3821af7b43e00d420cb32/Web-Act/${name}`,
|
|
265
|
+
];
|
|
266
|
+
if (createResult.id != null) {
|
|
267
|
+
accessLines.push(
|
|
268
|
+
`后台地址\thttps://act.tuwan.com/fe-admin/index.html#/h5/h5projects/h5projects-show?id=${createResult.id}`
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
fs.writeFileSync(
|
|
272
|
+
readmePath,
|
|
273
|
+
readmeContent.trimEnd() + "\n" + accessLines.join("\n") + "\n"
|
|
274
|
+
);
|
|
275
|
+
log(`README.md 追加访问信息成功`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
255
278
|
await git.add(".");
|
|
256
279
|
await git.commit(`-#DH-07 feat: 项目初始化`);
|
|
257
280
|
log(`请cd至项目目录: ${projectDir} 手动执行: npm install 安装依赖`);
|
|
@@ -377,7 +400,7 @@ export const cmdProjectPull = async () => {
|
|
|
377
400
|
log(`项目拉取成功, 项目目录: ${name}`);
|
|
378
401
|
git = simpleGit(projectDir);
|
|
379
402
|
const targetPackageJson = getJsonConfig(projectDir, "package.json");
|
|
380
|
-
if(targetPackageJson.name !== name){
|
|
403
|
+
if (targetPackageJson.name !== name) {
|
|
381
404
|
targetPackageJson.name = name;
|
|
382
405
|
fs.writeFileSync(
|
|
383
406
|
path.join(projectDir, "package.json"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taole/deploy-helper",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "脚本部署工具,用于将项目部署到测试环境或生产环境",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"form-data": "^4.0.5",
|
|
30
30
|
"inquirer": "^12.11.1",
|
|
31
31
|
"node-scp": "^0.0.25",
|
|
32
|
-
"simple-git": "^3.28.0"
|
|
32
|
+
"simple-git": "^3.28.0",
|
|
33
|
+
"update-notifier": "^7.3.1"
|
|
33
34
|
}
|
|
34
35
|
}
|