@seayoo-web/scripts 1.3.10 → 1.3.12
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/dist/{git-DemoGRV7.js → git-BHXCYFmD.js} +6 -3
- package/dist/index.js +1 -1
- package/dist/node.js +11 -1
- package/package.json +1 -1
- package/types/src/utils.d.ts +4 -0
|
@@ -116,6 +116,7 @@ function fillZ(a) {
|
|
|
116
116
|
}
|
|
117
117
|
const MainBranchName = "main";
|
|
118
118
|
const DeployTagPrefix = "deploy_";
|
|
119
|
+
const BackupTagPrefix = "backup_";
|
|
119
120
|
function converToDeployTagName(deployTo) {
|
|
120
121
|
return `${DeployTagPrefix}${deployTo.toLowerCase().replace(/(?:^https?:\/\/|\/*$)/gi, "").replace(/\//g, "_")}`;
|
|
121
122
|
}
|
|
@@ -170,8 +171,9 @@ async function getLastDeployTag(deployTo) {
|
|
|
170
171
|
async function createPageDeployTag(page, deployTo, finderUser) {
|
|
171
172
|
const tagName = converToDeployTagName(deployTo);
|
|
172
173
|
const gitUser = await execCmd(`git config user.email`).catch(() => "");
|
|
174
|
+
const user = (gitUser || finderUser).replace(/@.+/g, "");
|
|
173
175
|
await execCmd(
|
|
174
|
-
[`git tag -f ${tagName} -m "${getNowTime()} deployed by ${
|
|
176
|
+
[`git tag -f ${tagName} -m "${getNowTime()} deployed by ${user}`, page ? `from ${page}` : "", '"'].filter((c) => !!c).join(" ")
|
|
175
177
|
);
|
|
176
178
|
try {
|
|
177
179
|
await execCmd(`git push origin -f ${tagName}`, true);
|
|
@@ -226,9 +228,10 @@ async function checkGitStatusBeforeDestory() {
|
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
230
|
async function createBackupTag(action, info) {
|
|
229
|
-
const tagName =
|
|
231
|
+
const tagName = `${BackupTagPrefix}${action}_${info.replace(/\//g, "-")}`;
|
|
230
232
|
const gitUser = await execCmd(`git config user.email`).catch(() => "");
|
|
231
|
-
|
|
233
|
+
const user = (gitUser || "unknown").replace(/@.+/g, "");
|
|
234
|
+
await execCmd(`git tag -f ${tagName} -m "${getNowTime()} destroyed by ${user}`);
|
|
232
235
|
try {
|
|
233
236
|
await execCmd(`git push origin -f ${tagName}`, true);
|
|
234
237
|
} catch (e) {
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import vueDevTools from "vite-plugin-vue-devtools";
|
|
|
7
7
|
import { existsSync, readFileSync } from "fs";
|
|
8
8
|
import { loadEnv } from "vite";
|
|
9
9
|
import "colors";
|
|
10
|
-
import { g as getNowTime, a as getCommitInfo, c as createPageDeployTag } from "./git-
|
|
10
|
+
import { g as getNowTime, a as getCommitInfo, c as createPageDeployTag } from "./git-BHXCYFmD.js";
|
|
11
11
|
import skipFormatting from "@vue/eslint-config-prettier/skip-formatting";
|
|
12
12
|
import { vueTsConfigs, defineConfigWithVueTs } from "@vue/eslint-config-typescript";
|
|
13
13
|
import { flatConfigs } from "eslint-plugin-import";
|
package/dist/node.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Command } from "commander";
|
|
|
5
5
|
import fs from "fs-extra";
|
|
6
6
|
import inquirer from "inquirer";
|
|
7
7
|
import ora from "ora";
|
|
8
|
-
import { b as getMonorepoRoot, d as addProjectToWorkspace, e as copyTemplate, f as getProjects, h as getTemplates, i as checkGitStatusBeforeDestory, j as createBackupTag, r as removeProjectFromWorkspace, s as submitAllDeletionChanges, k as getRepos } from "./git-
|
|
8
|
+
import { b as getMonorepoRoot, d as addProjectToWorkspace, e as copyTemplate, f as getProjects, h as getTemplates, i as checkGitStatusBeforeDestory, j as createBackupTag, r as removeProjectFromWorkspace, s as submitAllDeletionChanges, k as getRepos } from "./git-BHXCYFmD.js";
|
|
9
9
|
const commitRE = /^(?:revert: )?(?:feat|fix|docs|style|refactor|test|build|chore|debug|tweak|improve)(?:\(.+\))?: .{1,100}/;
|
|
10
10
|
function checkCommit() {
|
|
11
11
|
const msgPath = process.argv[2];
|
|
@@ -122,6 +122,14 @@ async function initSampleFiles(targetDir) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
+
async function copyGlobalFiles(targetDir) {
|
|
126
|
+
for (const filename of [".env.local"]) {
|
|
127
|
+
if (await fs.pathExists(path.join(targetDir, filename))) {
|
|
128
|
+
await fs.copy(path.join(targetDir, filename), path.join(targetDir, filename.replace(/\.sample$/, "")));
|
|
129
|
+
fs.unlink(path.join(targetDir, filename));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
125
133
|
async function startCreateJob$1(target) {
|
|
126
134
|
if (target === "project") {
|
|
127
135
|
await createProject();
|
|
@@ -159,6 +167,8 @@ async function createRepo() {
|
|
|
159
167
|
await copyTemplate(answers.template, targetDir);
|
|
160
168
|
spinner.text = "更新 package.json...";
|
|
161
169
|
await updatePackageFiles(targetDir, answers);
|
|
170
|
+
spinner.text = "复制全局文件...";
|
|
171
|
+
await copyGlobalFiles(targetDir);
|
|
162
172
|
spinner.succeed("仓库创建成功!".green);
|
|
163
173
|
console.log("\n接下来你可以:");
|
|
164
174
|
console.log(`cd ${answers.project}/${answers.repoName}`.cyan);
|
package/package.json
CHANGED
package/types/src/utils.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ export declare function getProjectName(project: string): Promise<string>;
|
|
|
31
31
|
* 复制模板到目标目录
|
|
32
32
|
*/
|
|
33
33
|
export declare function copyTemplate(templateName: string, targetDir: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* 复制全局文件
|
|
36
|
+
*/
|
|
37
|
+
export declare function copyGlobalFiles(targetDir: string): Promise<void>;
|
|
34
38
|
/**
|
|
35
39
|
* 更新 workspace.yaml
|
|
36
40
|
*/
|