zixulu 1.45.3 → 1.45.5
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/constant/index.d.ts +2 -1
- package/dist/constant/index.js +1 -0
- package/dist/constant/index.js.map +2 -2
- package/dist/utils/addPrettier.js +2 -0
- package/dist/utils/addPrettier.js.map +2 -2
- package/dist/utils/downloadBun.d.ts +1 -0
- package/dist/utils/downloadBun.js +49 -0
- package/dist/utils/downloadBun.js.map +7 -0
- package/dist/utils/downloadLatestSoftware.js +3 -1
- package/dist/utils/downloadLatestSoftware.js.map +2 -2
- package/dist/utils/getLatestRelease.d.ts +70 -0
- package/dist/utils/getLatestRelease.js +47 -0
- package/dist/utils/getLatestRelease.js.map +7 -0
- package/package.json +1 -1
- package/src/constant/index.ts +1 -0
- package/src/utils/addPrettier.ts +55 -53
- package/src/utils/downloadBun.ts +20 -0
- package/src/utils/downloadLatestSoftware.ts +2 -0
- package/src/utils/getLatestRelease.ts +82 -0
package/dist/constant/index.d.ts
CHANGED
package/dist/constant/index.js
CHANGED
|
@@ -56,6 +56,7 @@ var Software = /* @__PURE__ */ ((Software2) => {
|
|
|
56
56
|
Software2["AnyDesk"] = "AnyDesk";
|
|
57
57
|
Software2["Firefox"] = "Firefox";
|
|
58
58
|
Software2["PotPlayer"] = "PotPlayer";
|
|
59
|
+
Software2["Bun"] = "Bun";
|
|
59
60
|
return Software2;
|
|
60
61
|
})(Software || {});
|
|
61
62
|
var ProjectType = /* @__PURE__ */ ((ProjectType2) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/constant/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { HttpsProxyAgent } from \"https-proxy-agent\"\n\nexport enum PackageManager {\n npm = \"npm\",\n yarn = \"yarn\",\n pnpm = \"pnpm\",\n}\n\nexport enum Registry {\n npm = \"https://registry.npmjs.org/\",\n taobao = \"https://registry.npmmirror.com/\",\n tencent = \"https://mirrors.cloud.tencent.com/npm/\",\n}\n\nexport enum Software {\n \"VS Code\" = \"VS Code\",\n \"Chrome\" = \"Chrome\",\n \"7zip\" = \"7zip\",\n \"Git\" = \"Git\",\n \"NodeJS\" = \"NodeJS\",\n \"Geek Uninstaller\" = \"Geek Uninstaller\",\n \"DeskGo\" = \"DeskGo\",\n \"PowerToys\" = \"PowerToys\",\n \"Honeyview\" = \"Honeyview\",\n \"AnyDesk\" = \"AnyDesk\",\n \"Firefox\" = \"Firefox\",\n \"PotPlayer\" = \"PotPlayer\",\n}\n\nexport enum ProjectType {\n next = \"next\",\n remix = \"remix\",\n vite = \"vite\",\n rsbuild = \"rsbuild\",\n}\n\nexport enum CommitType {\n feature = \"feature\",\n fix = \"fix\",\n docs = \"docs\",\n wip = \"wip\",\n perfs = \"perfs\",\n rollback = \"rollback\",\n other = \"other\",\n}\n\nexport const CommitTypeMap = {\n [CommitType.feature]: \"✨feature: \",\n [CommitType.fix]: \"🐞 fix: \",\n [CommitType.docs]: \"📄 docs: \",\n [CommitType.wip]: \"🖥️ wip: \",\n [CommitType.perfs]: \"🚅 perfs: \",\n [CommitType.rollback]: \"⏪ rollback: \",\n [CommitType.other]: \"🔵 other: \",\n}\n\nexport const SpawnOptions = {\n shell: true,\n stdio: \"inherit\",\n}\n\nexport const agent = new HttpsProxyAgent(\"http://localhost:7890\")\n\nexport const addedRules = [\n \"package-lock.json\",\n \"yarn.lock\",\n \"node_modules\",\n \"dist\",\n \"build\",\n \"pnpm-lock.yaml\",\n \"yarn-error.log\",\n \"test.js\",\n \"test.mjs\",\n \"test.ts\",\n \"test\",\n]\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAEzB,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,SAAM;AACN,EAAAA,gBAAA,UAAO;AACP,EAAAA,gBAAA,UAAO;AAHC,SAAAA;AAAA,GAAA;AAML,IAAK,WAAL,kBAAKC,cAAL;AACH,EAAAA,UAAA,SAAM;AACN,EAAAA,UAAA,YAAS;AACT,EAAAA,UAAA,aAAU;AAHF,SAAAA;AAAA,GAAA;AAML,IAAK,WAAL,kBAAKC,cAAL;AACH,EAAAA,UAAA,aAAY;AACZ,EAAAA,UAAA,YAAW;AACX,EAAAA,UAAA,UAAS;AACT,EAAAA,UAAA,SAAQ;AACR,EAAAA,UAAA,YAAW;AACX,EAAAA,UAAA,sBAAqB;AACrB,EAAAA,UAAA,YAAW;AACX,EAAAA,UAAA,eAAc;AACd,EAAAA,UAAA,eAAc;AACd,EAAAA,UAAA,aAAY;AACZ,EAAAA,UAAA,aAAY;AACZ,EAAAA,UAAA,eAAc;
|
|
4
|
+
"sourcesContent": ["import { HttpsProxyAgent } from \"https-proxy-agent\"\n\nexport enum PackageManager {\n npm = \"npm\",\n yarn = \"yarn\",\n pnpm = \"pnpm\",\n}\n\nexport enum Registry {\n npm = \"https://registry.npmjs.org/\",\n taobao = \"https://registry.npmmirror.com/\",\n tencent = \"https://mirrors.cloud.tencent.com/npm/\",\n}\n\nexport enum Software {\n \"VS Code\" = \"VS Code\",\n \"Chrome\" = \"Chrome\",\n \"7zip\" = \"7zip\",\n \"Git\" = \"Git\",\n \"NodeJS\" = \"NodeJS\",\n \"Geek Uninstaller\" = \"Geek Uninstaller\",\n \"DeskGo\" = \"DeskGo\",\n \"PowerToys\" = \"PowerToys\",\n \"Honeyview\" = \"Honeyview\",\n \"AnyDesk\" = \"AnyDesk\",\n \"Firefox\" = \"Firefox\",\n \"PotPlayer\" = \"PotPlayer\",\n \"Bun\" = \"Bun\",\n}\n\nexport enum ProjectType {\n next = \"next\",\n remix = \"remix\",\n vite = \"vite\",\n rsbuild = \"rsbuild\",\n}\n\nexport enum CommitType {\n feature = \"feature\",\n fix = \"fix\",\n docs = \"docs\",\n wip = \"wip\",\n perfs = \"perfs\",\n rollback = \"rollback\",\n other = \"other\",\n}\n\nexport const CommitTypeMap = {\n [CommitType.feature]: \"✨feature: \",\n [CommitType.fix]: \"🐞 fix: \",\n [CommitType.docs]: \"📄 docs: \",\n [CommitType.wip]: \"🖥️ wip: \",\n [CommitType.perfs]: \"🚅 perfs: \",\n [CommitType.rollback]: \"⏪ rollback: \",\n [CommitType.other]: \"🔵 other: \",\n}\n\nexport const SpawnOptions = {\n shell: true,\n stdio: \"inherit\",\n}\n\nexport const agent = new HttpsProxyAgent(\"http://localhost:7890\")\n\nexport const addedRules = [\n \"package-lock.json\",\n \"yarn.lock\",\n \"node_modules\",\n \"dist\",\n \"build\",\n \"pnpm-lock.yaml\",\n \"yarn-error.log\",\n \"test.js\",\n \"test.mjs\",\n \"test.ts\",\n \"test\",\n]\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAEzB,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,SAAM;AACN,EAAAA,gBAAA,UAAO;AACP,EAAAA,gBAAA,UAAO;AAHC,SAAAA;AAAA,GAAA;AAML,IAAK,WAAL,kBAAKC,cAAL;AACH,EAAAA,UAAA,SAAM;AACN,EAAAA,UAAA,YAAS;AACT,EAAAA,UAAA,aAAU;AAHF,SAAAA;AAAA,GAAA;AAML,IAAK,WAAL,kBAAKC,cAAL;AACH,EAAAA,UAAA,aAAY;AACZ,EAAAA,UAAA,YAAW;AACX,EAAAA,UAAA,UAAS;AACT,EAAAA,UAAA,SAAQ;AACR,EAAAA,UAAA,YAAW;AACX,EAAAA,UAAA,sBAAqB;AACrB,EAAAA,UAAA,YAAW;AACX,EAAAA,UAAA,eAAc;AACd,EAAAA,UAAA,eAAc;AACd,EAAAA,UAAA,aAAY;AACZ,EAAAA,UAAA,aAAY;AACZ,EAAAA,UAAA,eAAc;AACd,EAAAA,UAAA,SAAQ;AAbA,SAAAA;AAAA,GAAA;AAgBL,IAAK,cAAL,kBAAKC,iBAAL;AACH,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,WAAQ;AACR,EAAAA,aAAA,UAAO;AACP,EAAAA,aAAA,aAAU;AAJF,SAAAA;AAAA,GAAA;AAOL,IAAK,aAAL,kBAAKC,gBAAL;AACH,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,SAAM;AACN,EAAAA,YAAA,UAAO;AACP,EAAAA,YAAA,SAAM;AACN,EAAAA,YAAA,WAAQ;AACR,EAAAA,YAAA,cAAW;AACX,EAAAA,YAAA,WAAQ;AAPA,SAAAA;AAAA,GAAA;AAUL,IAAM,gBAAgB;AAAA,EACzB,CAAC,uBAAkB,GAAG;AAAA,EACtB,CAAC,eAAc,GAAG;AAAA,EAClB,CAAC,iBAAe,GAAG;AAAA,EACnB,CAAC,eAAc,GAAG;AAAA,EAClB,CAAC,mBAAgB,GAAG;AAAA,EACpB,CAAC,yBAAmB,GAAG;AAAA,EACvB,CAAC,mBAAgB,GAAG;AACxB;AAEO,IAAM,eAAe;AAAA,EACxB,OAAO;AAAA,EACP,OAAO;AACX;AAEO,IAAM,QAAQ,IAAI,yCAAgB,uBAAuB;AAEzD,IAAM,aAAa;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;",
|
|
6
6
|
"names": ["PackageManager", "Registry", "Software", "ProjectType", "CommitType"]
|
|
7
7
|
}
|
|
@@ -39,6 +39,7 @@ var import_promises = require("fs/promises");
|
|
|
39
39
|
var import_addDependency = require("./addDependency");
|
|
40
40
|
var import_readPackageJson = require("./readPackageJson");
|
|
41
41
|
var import_writePackageJson = require("./writePackageJson");
|
|
42
|
+
var import_installDependceny = require("./installDependceny");
|
|
42
43
|
var prettierConfigText = `/**
|
|
43
44
|
* @type {import("prettier").Options}
|
|
44
45
|
*/
|
|
@@ -81,6 +82,7 @@ async function addPrettier() {
|
|
|
81
82
|
packageJson2.scripts ??= {};
|
|
82
83
|
packageJson2.scripts.format = "prettier --write .";
|
|
83
84
|
await (0, import_writePackageJson.writePackageJson)({ data: packageJson2 });
|
|
85
|
+
await (0, import_installDependceny.installDependceny)();
|
|
84
86
|
import_consola.default.success("添加 prettier 配置成功");
|
|
85
87
|
}
|
|
86
88
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/addPrettier.ts"],
|
|
4
|
-
"sourcesContent": ["import consola from \"consola\"\nimport { writeFile } from \"fs/promises\"\nimport { AddDependenciesConfig, addDependency } from \"./addDependency\"\nimport { readPackageJson } from \"./readPackageJson\"\nimport { writePackageJson } from \"./writePackageJson\"\n\nexport const prettierConfigText = `/**\n * @type {import(\"prettier\").Options}\n */\nconst config = {\n semi: false,\n tabWidth: 4,\n arrowParens: \"avoid\",\n printWidth: 160,\n plugins: [\"prettier-plugin-organize-imports\"],\n}\n\nexport default config\n`\n\nexport const prettierConfigTextWithTailwind = `/**\n * @type {import(\"prettier\").Options}\n */\nconst config = {\n semi: false,\n tabWidth: 4,\n arrowParens: \"avoid\",\n printWidth: 160,\n plugins: [\"prettier-plugin-organize-imports\", \"prettier-plugin-tailwindcss\"],\n}\n\nexport default config\n`\n\n/** 添加 prettier */\nexport async function addPrettier() {\n consola.start(\"开始添加 prettier 配置\")\n const packageJson = await readPackageJson()\n const tailwind =\n Object.keys(packageJson.dependencies ?? {}).includes(\"tailwindcss\") || Object.keys(packageJson.devDependencies ?? {}).includes(\"tailwindcss\")\n await writeFile(\"./prettier.config.mjs\", tailwind ? prettierConfigTextWithTailwind : prettierConfigText)\n const config: AddDependenciesConfig = {\n package: [\"prettier\", \"prettier-plugin-organize-imports\"],\n type: \"devDependencies\",\n }\n if (tailwind) (config.package as string[]).push(\"prettier-plugin-tailwindcss\")\n await addDependency(config)\n const packageJson2 = await readPackageJson()\n packageJson2.scripts ??= {}\n packageJson2.scripts.format = \"prettier --write .\"\n await writePackageJson({ data: packageJson2 })\n consola.success(\"添加 prettier 配置成功\")\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAA0B;AAC1B,2BAAqD;AACrD,6BAAgC;AAChC,8BAAiC;
|
|
4
|
+
"sourcesContent": ["import consola from \"consola\"\r\nimport { writeFile } from \"fs/promises\"\r\nimport { AddDependenciesConfig, addDependency } from \"./addDependency\"\r\nimport { readPackageJson } from \"./readPackageJson\"\r\nimport { writePackageJson } from \"./writePackageJson\"\r\nimport { installDependceny } from \"./installDependceny\"\r\n\r\nexport const prettierConfigText = `/**\r\n * @type {import(\"prettier\").Options}\r\n */\r\nconst config = {\r\n semi: false,\r\n tabWidth: 4,\r\n arrowParens: \"avoid\",\r\n printWidth: 160,\r\n plugins: [\"prettier-plugin-organize-imports\"],\r\n}\r\n\r\nexport default config\r\n`\r\n\r\nexport const prettierConfigTextWithTailwind = `/**\r\n * @type {import(\"prettier\").Options}\r\n */\r\nconst config = {\r\n semi: false,\r\n tabWidth: 4,\r\n arrowParens: \"avoid\",\r\n printWidth: 160,\r\n plugins: [\"prettier-plugin-organize-imports\", \"prettier-plugin-tailwindcss\"],\r\n}\r\n\r\nexport default config\r\n`\r\n\r\n/** 添加 prettier */\r\nexport async function addPrettier() {\r\n consola.start(\"开始添加 prettier 配置\")\r\n const packageJson = await readPackageJson()\r\n const tailwind =\r\n Object.keys(packageJson.dependencies ?? {}).includes(\"tailwindcss\") || Object.keys(packageJson.devDependencies ?? {}).includes(\"tailwindcss\")\r\n await writeFile(\"./prettier.config.mjs\", tailwind ? prettierConfigTextWithTailwind : prettierConfigText)\r\n const config: AddDependenciesConfig = {\r\n package: [\"prettier\", \"prettier-plugin-organize-imports\"],\r\n type: \"devDependencies\",\r\n }\r\n if (tailwind) (config.package as string[]).push(\"prettier-plugin-tailwindcss\")\r\n await addDependency(config)\r\n const packageJson2 = await readPackageJson()\r\n packageJson2.scripts ??= {}\r\n packageJson2.scripts.format = \"prettier --write .\"\r\n await writePackageJson({ data: packageJson2 })\r\n await installDependceny()\r\n consola.success(\"添加 prettier 配置成功\")\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAA0B;AAC1B,2BAAqD;AACrD,6BAAgC;AAChC,8BAAiC;AACjC,+BAAkC;AAE3B,IAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAc3B,IAAM,iCAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAe9C,eAAsB,cAAc;AAChC,iBAAAA,QAAQ,MAAM,kBAAkB;AAChC,QAAM,cAAc,UAAM,wCAAgB;AAC1C,QAAM,WACF,OAAO,KAAK,YAAY,gBAAgB,CAAC,CAAC,EAAE,SAAS,aAAa,KAAK,OAAO,KAAK,YAAY,mBAAmB,CAAC,CAAC,EAAE,SAAS,aAAa;AAChJ,YAAM,2BAAU,yBAAyB,WAAW,iCAAiC,kBAAkB;AACvG,QAAM,SAAgC;AAAA,IAClC,SAAS,CAAC,YAAY,kCAAkC;AAAA,IACxD,MAAM;AAAA,EACV;AACA,MAAI;AAAU,IAAC,OAAO,QAAqB,KAAK,6BAA6B;AAC7E,YAAM,oCAAc,MAAM;AAC1B,QAAM,eAAe,UAAM,wCAAgB;AAC3C,eAAa,YAAY,CAAC;AAC1B,eAAa,QAAQ,SAAS;AAC9B,YAAM,0CAAiB,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAM,4CAAkB;AACxB,iBAAAA,QAAQ,QAAQ,kBAAkB;AACtC;",
|
|
6
6
|
"names": ["consola"]
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function downloadBun(dir: string): Promise<void>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/utils/downloadBun.ts
|
|
20
|
+
var downloadBun_exports = {};
|
|
21
|
+
__export(downloadBun_exports, {
|
|
22
|
+
downloadBun: () => downloadBun
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(downloadBun_exports);
|
|
25
|
+
var import_promises = require("fs/promises");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
var import_soda_nodejs = require("soda-nodejs");
|
|
28
|
+
var import__ = require(".");
|
|
29
|
+
var import_getLatestRelease = require("./getLatestRelease");
|
|
30
|
+
async function downloadBun(dir) {
|
|
31
|
+
const release = await (0, import_getLatestRelease.getLatestRelease)("oven-sh", "bun");
|
|
32
|
+
const url = release.assets.find((asset) => asset.name === "bun-windows-x64.zip")?.browser_download_url;
|
|
33
|
+
if (!url)
|
|
34
|
+
throw new Error("未找到 bun-windows-x64.zip");
|
|
35
|
+
await (0, import__.download)(url, dir);
|
|
36
|
+
await (0, import_soda_nodejs.unzip)({
|
|
37
|
+
input: "bun-windows-x64.zip",
|
|
38
|
+
output: ".",
|
|
39
|
+
cwd: dir
|
|
40
|
+
});
|
|
41
|
+
await (0, import_promises.rename)((0, import_path.join)(dir, "bun-windows-x64", "bun.exe"), (0, import_path.join)(dir, "bun.exe"));
|
|
42
|
+
await (0, import_promises.rm)((0, import_path.join)(dir, "bun-windows-x64.zip"), { force: true });
|
|
43
|
+
await (0, import_promises.rm)((0, import_path.join)(dir, "bun-windows-x64"), { force: true, recursive: true });
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
downloadBun
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=downloadBun.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/downloadBun.ts"],
|
|
4
|
+
"sourcesContent": ["import { rename, rm } from \"fs/promises\"\r\nimport { join } from \"path\"\r\nimport { unzip } from \"soda-nodejs\"\r\nimport { download } from \".\"\r\nimport { getLatestRelease } from \"./getLatestRelease\"\r\n\r\nexport async function downloadBun(dir: string) {\r\n const release = await getLatestRelease(\"oven-sh\", \"bun\")\r\n const url = release.assets.find(asset => asset.name === \"bun-windows-x64.zip\")?.browser_download_url\r\n if (!url) throw new Error(\"未找到 bun-windows-x64.zip\")\r\n await download(url, dir)\r\n await unzip({\r\n input: \"bun-windows-x64.zip\",\r\n output: \".\",\r\n cwd: dir,\r\n })\r\n await rename(join(dir, \"bun-windows-x64\", \"bun.exe\"), join(dir, \"bun.exe\"))\r\n await rm(join(dir, \"bun-windows-x64.zip\"), { force: true })\r\n await rm(join(dir, \"bun-windows-x64\"), { force: true, recursive: true })\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2B;AAC3B,kBAAqB;AACrB,yBAAsB;AACtB,eAAyB;AACzB,8BAAiC;AAEjC,eAAsB,YAAY,KAAa;AAC3C,QAAM,UAAU,UAAM,0CAAiB,WAAW,KAAK;AACvD,QAAM,MAAM,QAAQ,OAAO,KAAK,WAAS,MAAM,SAAS,qBAAqB,GAAG;AAChF,MAAI,CAAC;AAAK,UAAM,IAAI,MAAM,yBAAyB;AACnD,YAAM,mBAAS,KAAK,GAAG;AACvB,YAAM,0BAAM;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,KAAK;AAAA,EACT,CAAC;AACD,YAAM,4BAAO,kBAAK,KAAK,mBAAmB,SAAS,OAAG,kBAAK,KAAK,SAAS,CAAC;AAC1E,YAAM,wBAAG,kBAAK,KAAK,qBAAqB,GAAG,EAAE,OAAO,KAAK,CAAC;AAC1D,YAAM,wBAAG,kBAAK,KAAK,iBAAiB,GAAG,EAAE,OAAO,MAAM,WAAW,KAAK,CAAC;AAC3E;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -39,6 +39,7 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
39
39
|
var import_promises = require("fs/promises");
|
|
40
40
|
var import__ = require(".");
|
|
41
41
|
var import_downloadAnydesk = require("./downloadAnydesk");
|
|
42
|
+
var import_downloadBun = require("./downloadBun");
|
|
42
43
|
var import_downloadFirefox = require("./downloadFirefox");
|
|
43
44
|
var import_downloadHoneyview = require("./downloadHoneyview");
|
|
44
45
|
var import_downloadPotPlayer = require("./downloadPotPlayer");
|
|
@@ -55,7 +56,8 @@ var SoftwareDownloadMap = {
|
|
|
55
56
|
[import_constant.Software.Honeyview]: import_downloadHoneyview.downloadHoneyview,
|
|
56
57
|
[import_constant.Software.AnyDesk]: import_downloadAnydesk.downloadAnydesk,
|
|
57
58
|
[import_constant.Software.Firefox]: import_downloadFirefox.downloadFirefox,
|
|
58
|
-
[import_constant.Software.PotPlayer]: import_downloadPotPlayer.downloadPotPlayer
|
|
59
|
+
[import_constant.Software.PotPlayer]: import_downloadPotPlayer.downloadPotPlayer,
|
|
60
|
+
[import_constant.Software.Bun]: import_downloadBun.downloadBun
|
|
59
61
|
};
|
|
60
62
|
async function downloadLatestSoftware() {
|
|
61
63
|
import_consola.default.start("开始下载软件");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/downloadLatestSoftware.ts"],
|
|
4
|
-
"sourcesContent": ["import { Software } from \"@constant/index\"\nimport consola from \"consola\"\nimport dayjs from \"dayjs\"\nimport { mkdir } from \"fs/promises\"\nimport { download7Zip, downloadChrome, downloadDeskGo, downloadGeekUninstaller, downloadGit, downloadNodeJS, downloadVscode } from \".\"\nimport { downloadAnydesk } from \"./downloadAnydesk\"\nimport { downloadFirefox } from \"./downloadFirefox\"\nimport { downloadHoneyview } from \"./downloadHoneyview\"\nimport { downloadPotPlayer } from \"./downloadPotPlayer\"\nimport { downloadPowerToys } from \"./downloadPowerToys\"\n\nexport const SoftwareDownloadMap: Record<Software, (dir: string) => Promise<void>> = {\n [Software.Chrome]: downloadChrome,\n [Software.NodeJS]: downloadNodeJS,\n [Software[\"7zip\"]]: download7Zip,\n [Software.Git]: downloadGit,\n [Software.DeskGo]: downloadDeskGo,\n [Software[\"Geek Uninstaller\"]]: downloadGeekUninstaller,\n [Software[\"VS Code\"]]: downloadVscode,\n [Software.PowerToys]: downloadPowerToys,\n [Software.Honeyview]: downloadHoneyview,\n [Software.AnyDesk]: downloadAnydesk,\n [Software.Firefox]: downloadFirefox,\n [Software.PotPlayer]: downloadPotPlayer,\n}\n\nexport async function downloadLatestSoftware() {\n consola.start(\"开始下载软件\")\n const { default: inquirer } = await import(\"inquirer\")\n const dir = `softwares-${dayjs().format(\"YYYYMMDDHHmmss\")}`\n const { softwares } = await inquirer.prompt({\n type: \"checkbox\",\n name: \"softwares\",\n message: \"请选择要下载的软件\",\n choices: Object.values(Software),\n default: Object.values(Software),\n })\n if (softwares.length === 0) return\n await mkdir(dir, { recursive: true })\n for (const software of softwares) {\n consola.start(`正在下载 ${software}`)\n await SoftwareDownloadMap[software as Software](dir)\n }\n consola.success(\"软件下载完成\")\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,qBAAoB;AACpB,mBAAkB;AAClB,sBAAsB;AACtB,eAAmI;AACnI,6BAAgC;AAChC,6BAAgC;AAChC,+BAAkC;AAClC,+BAAkC;AAClC,+BAAkC;AAE3B,IAAM,sBAAwE;AAAA,EACjF,CAAC,yBAAS,MAAM,GAAG;AAAA,EACnB,CAAC,yBAAS,MAAM,GAAG;AAAA,EACnB,CAAC,yBAAS,MAAM,CAAC,GAAG;AAAA,EACpB,CAAC,yBAAS,GAAG,GAAG;AAAA,EAChB,CAAC,yBAAS,MAAM,GAAG;AAAA,EACnB,CAAC,yBAAS,kBAAkB,CAAC,GAAG;AAAA,EAChC,CAAC,yBAAS,SAAS,CAAC,GAAG;AAAA,EACvB,CAAC,yBAAS,SAAS,GAAG;AAAA,EACtB,CAAC,yBAAS,SAAS,GAAG;AAAA,EACtB,CAAC,yBAAS,OAAO,GAAG;AAAA,EACpB,CAAC,yBAAS,OAAO,GAAG;AAAA,EACpB,CAAC,yBAAS,SAAS,GAAG;
|
|
4
|
+
"sourcesContent": ["import { Software } from \"@constant/index\"\nimport consola from \"consola\"\nimport dayjs from \"dayjs\"\nimport { mkdir } from \"fs/promises\"\nimport { download7Zip, downloadChrome, downloadDeskGo, downloadGeekUninstaller, downloadGit, downloadNodeJS, downloadVscode } from \".\"\nimport { downloadAnydesk } from \"./downloadAnydesk\"\nimport { downloadBun } from \"./downloadBun\"\nimport { downloadFirefox } from \"./downloadFirefox\"\nimport { downloadHoneyview } from \"./downloadHoneyview\"\nimport { downloadPotPlayer } from \"./downloadPotPlayer\"\nimport { downloadPowerToys } from \"./downloadPowerToys\"\n\nexport const SoftwareDownloadMap: Record<Software, (dir: string) => Promise<void>> = {\n [Software.Chrome]: downloadChrome,\n [Software.NodeJS]: downloadNodeJS,\n [Software[\"7zip\"]]: download7Zip,\n [Software.Git]: downloadGit,\n [Software.DeskGo]: downloadDeskGo,\n [Software[\"Geek Uninstaller\"]]: downloadGeekUninstaller,\n [Software[\"VS Code\"]]: downloadVscode,\n [Software.PowerToys]: downloadPowerToys,\n [Software.Honeyview]: downloadHoneyview,\n [Software.AnyDesk]: downloadAnydesk,\n [Software.Firefox]: downloadFirefox,\n [Software.PotPlayer]: downloadPotPlayer,\n [Software.Bun]: downloadBun,\n}\n\nexport async function downloadLatestSoftware() {\n consola.start(\"开始下载软件\")\n const { default: inquirer } = await import(\"inquirer\")\n const dir = `softwares-${dayjs().format(\"YYYYMMDDHHmmss\")}`\n const { softwares } = await inquirer.prompt({\n type: \"checkbox\",\n name: \"softwares\",\n message: \"请选择要下载的软件\",\n choices: Object.values(Software),\n default: Object.values(Software),\n })\n if (softwares.length === 0) return\n await mkdir(dir, { recursive: true })\n for (const software of softwares) {\n consola.start(`正在下载 ${software}`)\n await SoftwareDownloadMap[software as Software](dir)\n }\n consola.success(\"软件下载完成\")\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,qBAAoB;AACpB,mBAAkB;AAClB,sBAAsB;AACtB,eAAmI;AACnI,6BAAgC;AAChC,yBAA4B;AAC5B,6BAAgC;AAChC,+BAAkC;AAClC,+BAAkC;AAClC,+BAAkC;AAE3B,IAAM,sBAAwE;AAAA,EACjF,CAAC,yBAAS,MAAM,GAAG;AAAA,EACnB,CAAC,yBAAS,MAAM,GAAG;AAAA,EACnB,CAAC,yBAAS,MAAM,CAAC,GAAG;AAAA,EACpB,CAAC,yBAAS,GAAG,GAAG;AAAA,EAChB,CAAC,yBAAS,MAAM,GAAG;AAAA,EACnB,CAAC,yBAAS,kBAAkB,CAAC,GAAG;AAAA,EAChC,CAAC,yBAAS,SAAS,CAAC,GAAG;AAAA,EACvB,CAAC,yBAAS,SAAS,GAAG;AAAA,EACtB,CAAC,yBAAS,SAAS,GAAG;AAAA,EACtB,CAAC,yBAAS,OAAO,GAAG;AAAA,EACpB,CAAC,yBAAS,OAAO,GAAG;AAAA,EACpB,CAAC,yBAAS,SAAS,GAAG;AAAA,EACtB,CAAC,yBAAS,GAAG,GAAG;AACpB;AAEA,eAAsB,yBAAyB;AAC3C,iBAAAA,QAAQ,MAAM,QAAQ;AACtB,QAAM,EAAE,SAAS,SAAS,IAAI,MAAM,OAAO,UAAU;AACrD,QAAM,MAAM,iBAAa,aAAAC,SAAM,EAAE,OAAO,gBAAgB;AACxD,QAAM,EAAE,UAAU,IAAI,MAAM,SAAS,OAAO;AAAA,IACxC,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS,OAAO,OAAO,wBAAQ;AAAA,IAC/B,SAAS,OAAO,OAAO,wBAAQ;AAAA,EACnC,CAAC;AACD,MAAI,UAAU,WAAW;AAAG;AAC5B,YAAM,uBAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AACpC,aAAW,YAAY,WAAW;AAC9B,mBAAAD,QAAQ,MAAM,QAAQ,UAAU;AAChC,UAAM,oBAAoB,QAAoB,EAAE,GAAG;AAAA,EACvD;AACA,iBAAAA,QAAQ,QAAQ,QAAQ;AAC5B;",
|
|
6
6
|
"names": ["consola", "dayjs"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface Release {
|
|
2
|
+
url: string;
|
|
3
|
+
assets_url: string;
|
|
4
|
+
upload_url: string;
|
|
5
|
+
html_url: string;
|
|
6
|
+
id: number;
|
|
7
|
+
author: Author;
|
|
8
|
+
node_id: string;
|
|
9
|
+
tag_name: string;
|
|
10
|
+
target_commitish: string;
|
|
11
|
+
name: string;
|
|
12
|
+
draft: boolean;
|
|
13
|
+
prerelease: boolean;
|
|
14
|
+
created_at: string;
|
|
15
|
+
published_at: string;
|
|
16
|
+
assets: Asset[];
|
|
17
|
+
tarball_url: string;
|
|
18
|
+
zipball_url: string;
|
|
19
|
+
body: string;
|
|
20
|
+
discussion_url: string;
|
|
21
|
+
reactions: Reactions;
|
|
22
|
+
}
|
|
23
|
+
export interface Reactions {
|
|
24
|
+
url: string;
|
|
25
|
+
total_count: number;
|
|
26
|
+
"+1": number;
|
|
27
|
+
"-1": number;
|
|
28
|
+
laugh: number;
|
|
29
|
+
hooray: number;
|
|
30
|
+
confused: number;
|
|
31
|
+
heart: number;
|
|
32
|
+
rocket: number;
|
|
33
|
+
eyes: number;
|
|
34
|
+
}
|
|
35
|
+
export interface Asset {
|
|
36
|
+
url: string;
|
|
37
|
+
id: number;
|
|
38
|
+
node_id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
label?: string;
|
|
41
|
+
uploader: Author;
|
|
42
|
+
content_type: string;
|
|
43
|
+
state: string;
|
|
44
|
+
size: number;
|
|
45
|
+
download_count: number;
|
|
46
|
+
created_at: string;
|
|
47
|
+
updated_at: string;
|
|
48
|
+
browser_download_url: string;
|
|
49
|
+
}
|
|
50
|
+
export interface Author {
|
|
51
|
+
login: string;
|
|
52
|
+
id: number;
|
|
53
|
+
node_id: string;
|
|
54
|
+
avatar_url: string;
|
|
55
|
+
gravatar_id: string;
|
|
56
|
+
url: string;
|
|
57
|
+
html_url: string;
|
|
58
|
+
followers_url: string;
|
|
59
|
+
following_url: string;
|
|
60
|
+
gists_url: string;
|
|
61
|
+
starred_url: string;
|
|
62
|
+
subscriptions_url: string;
|
|
63
|
+
organizations_url: string;
|
|
64
|
+
repos_url: string;
|
|
65
|
+
events_url: string;
|
|
66
|
+
received_events_url: string;
|
|
67
|
+
type: string;
|
|
68
|
+
site_admin: boolean;
|
|
69
|
+
}
|
|
70
|
+
export declare function getLatestRelease(owner: string, repo: string): Promise<Release>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/utils/getLatestRelease.ts
|
|
30
|
+
var getLatestRelease_exports = {};
|
|
31
|
+
__export(getLatestRelease_exports, {
|
|
32
|
+
getLatestRelease: () => getLatestRelease
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(getLatestRelease_exports);
|
|
35
|
+
var import_constant = require("../constant");
|
|
36
|
+
var import_node_fetch = __toESM(require("node-fetch"));
|
|
37
|
+
async function getLatestRelease(owner, repo) {
|
|
38
|
+
const url = `https://api.github.com/repos/${owner}/${repo}/releases/latest`;
|
|
39
|
+
const response = await (0, import_node_fetch.default)(url, { agent: import_constant.agent });
|
|
40
|
+
const data = await response.json();
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
getLatestRelease
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=getLatestRelease.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/getLatestRelease.ts"],
|
|
4
|
+
"sourcesContent": ["import { agent } from \"@src/constant\"\r\nimport fetch from \"node-fetch\"\r\n\r\nexport interface Release {\r\n url: string\r\n assets_url: string\r\n upload_url: string\r\n html_url: string\r\n id: number\r\n author: Author\r\n node_id: string\r\n tag_name: string\r\n target_commitish: string\r\n name: string\r\n draft: boolean\r\n prerelease: boolean\r\n created_at: string\r\n published_at: string\r\n assets: Asset[]\r\n tarball_url: string\r\n zipball_url: string\r\n body: string\r\n discussion_url: string\r\n reactions: Reactions\r\n}\r\n\r\nexport interface Reactions {\r\n url: string\r\n total_count: number\r\n \"+1\": number\r\n \"-1\": number\r\n laugh: number\r\n hooray: number\r\n confused: number\r\n heart: number\r\n rocket: number\r\n eyes: number\r\n}\r\n\r\nexport interface Asset {\r\n url: string\r\n id: number\r\n node_id: string\r\n name: string\r\n label?: string\r\n uploader: Author\r\n content_type: string\r\n state: string\r\n size: number\r\n download_count: number\r\n created_at: string\r\n updated_at: string\r\n browser_download_url: string\r\n}\r\n\r\nexport interface Author {\r\n login: string\r\n id: number\r\n node_id: string\r\n avatar_url: string\r\n gravatar_id: string\r\n url: string\r\n html_url: string\r\n followers_url: string\r\n following_url: string\r\n gists_url: string\r\n starred_url: string\r\n subscriptions_url: string\r\n organizations_url: string\r\n repos_url: string\r\n events_url: string\r\n received_events_url: string\r\n type: string\r\n site_admin: boolean\r\n}\r\n\r\nexport async function getLatestRelease(owner: string, repo: string): Promise<Release> {\r\n const url = `https://api.github.com/repos/${owner}/${repo}/releases/latest`\r\n const response = await fetch(url, { agent })\r\n const data = await response.json()\r\n return data as Release\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAsB;AACtB,wBAAkB;AA2ElB,eAAsB,iBAAiB,OAAe,MAAgC;AAClF,QAAM,MAAM,gCAAgC,SAAS;AACrD,QAAM,WAAW,UAAM,kBAAAA,SAAM,KAAK,EAAE,6BAAM,CAAC;AAC3C,QAAM,OAAO,MAAM,SAAS,KAAK;AACjC,SAAO;AACX;",
|
|
6
|
+
"names": ["fetch"]
|
|
7
|
+
}
|
package/package.json
CHANGED
package/src/constant/index.ts
CHANGED
package/src/utils/addPrettier.ts
CHANGED
|
@@ -1,53 +1,55 @@
|
|
|
1
|
-
import consola from "consola"
|
|
2
|
-
import { writeFile } from "fs/promises"
|
|
3
|
-
import { AddDependenciesConfig, addDependency } from "./addDependency"
|
|
4
|
-
import { readPackageJson } from "./readPackageJson"
|
|
5
|
-
import { writePackageJson } from "./writePackageJson"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
packageJson2
|
|
50
|
-
packageJson2.scripts
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
import consola from "consola"
|
|
2
|
+
import { writeFile } from "fs/promises"
|
|
3
|
+
import { AddDependenciesConfig, addDependency } from "./addDependency"
|
|
4
|
+
import { readPackageJson } from "./readPackageJson"
|
|
5
|
+
import { writePackageJson } from "./writePackageJson"
|
|
6
|
+
import { installDependceny } from "./installDependceny"
|
|
7
|
+
|
|
8
|
+
export const prettierConfigText = `/**
|
|
9
|
+
* @type {import("prettier").Options}
|
|
10
|
+
*/
|
|
11
|
+
const config = {
|
|
12
|
+
semi: false,
|
|
13
|
+
tabWidth: 4,
|
|
14
|
+
arrowParens: "avoid",
|
|
15
|
+
printWidth: 160,
|
|
16
|
+
plugins: ["prettier-plugin-organize-imports"],
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default config
|
|
20
|
+
`
|
|
21
|
+
|
|
22
|
+
export const prettierConfigTextWithTailwind = `/**
|
|
23
|
+
* @type {import("prettier").Options}
|
|
24
|
+
*/
|
|
25
|
+
const config = {
|
|
26
|
+
semi: false,
|
|
27
|
+
tabWidth: 4,
|
|
28
|
+
arrowParens: "avoid",
|
|
29
|
+
printWidth: 160,
|
|
30
|
+
plugins: ["prettier-plugin-organize-imports", "prettier-plugin-tailwindcss"],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default config
|
|
34
|
+
`
|
|
35
|
+
|
|
36
|
+
/** 添加 prettier */
|
|
37
|
+
export async function addPrettier() {
|
|
38
|
+
consola.start("开始添加 prettier 配置")
|
|
39
|
+
const packageJson = await readPackageJson()
|
|
40
|
+
const tailwind =
|
|
41
|
+
Object.keys(packageJson.dependencies ?? {}).includes("tailwindcss") || Object.keys(packageJson.devDependencies ?? {}).includes("tailwindcss")
|
|
42
|
+
await writeFile("./prettier.config.mjs", tailwind ? prettierConfigTextWithTailwind : prettierConfigText)
|
|
43
|
+
const config: AddDependenciesConfig = {
|
|
44
|
+
package: ["prettier", "prettier-plugin-organize-imports"],
|
|
45
|
+
type: "devDependencies",
|
|
46
|
+
}
|
|
47
|
+
if (tailwind) (config.package as string[]).push("prettier-plugin-tailwindcss")
|
|
48
|
+
await addDependency(config)
|
|
49
|
+
const packageJson2 = await readPackageJson()
|
|
50
|
+
packageJson2.scripts ??= {}
|
|
51
|
+
packageJson2.scripts.format = "prettier --write ."
|
|
52
|
+
await writePackageJson({ data: packageJson2 })
|
|
53
|
+
await installDependceny()
|
|
54
|
+
consola.success("添加 prettier 配置成功")
|
|
55
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { rename, rm } from "fs/promises"
|
|
2
|
+
import { join } from "path"
|
|
3
|
+
import { unzip } from "soda-nodejs"
|
|
4
|
+
import { download } from "."
|
|
5
|
+
import { getLatestRelease } from "./getLatestRelease"
|
|
6
|
+
|
|
7
|
+
export async function downloadBun(dir: string) {
|
|
8
|
+
const release = await getLatestRelease("oven-sh", "bun")
|
|
9
|
+
const url = release.assets.find(asset => asset.name === "bun-windows-x64.zip")?.browser_download_url
|
|
10
|
+
if (!url) throw new Error("未找到 bun-windows-x64.zip")
|
|
11
|
+
await download(url, dir)
|
|
12
|
+
await unzip({
|
|
13
|
+
input: "bun-windows-x64.zip",
|
|
14
|
+
output: ".",
|
|
15
|
+
cwd: dir,
|
|
16
|
+
})
|
|
17
|
+
await rename(join(dir, "bun-windows-x64", "bun.exe"), join(dir, "bun.exe"))
|
|
18
|
+
await rm(join(dir, "bun-windows-x64.zip"), { force: true })
|
|
19
|
+
await rm(join(dir, "bun-windows-x64"), { force: true, recursive: true })
|
|
20
|
+
}
|
|
@@ -4,6 +4,7 @@ import dayjs from "dayjs"
|
|
|
4
4
|
import { mkdir } from "fs/promises"
|
|
5
5
|
import { download7Zip, downloadChrome, downloadDeskGo, downloadGeekUninstaller, downloadGit, downloadNodeJS, downloadVscode } from "."
|
|
6
6
|
import { downloadAnydesk } from "./downloadAnydesk"
|
|
7
|
+
import { downloadBun } from "./downloadBun"
|
|
7
8
|
import { downloadFirefox } from "./downloadFirefox"
|
|
8
9
|
import { downloadHoneyview } from "./downloadHoneyview"
|
|
9
10
|
import { downloadPotPlayer } from "./downloadPotPlayer"
|
|
@@ -22,6 +23,7 @@ export const SoftwareDownloadMap: Record<Software, (dir: string) => Promise<void
|
|
|
22
23
|
[Software.AnyDesk]: downloadAnydesk,
|
|
23
24
|
[Software.Firefox]: downloadFirefox,
|
|
24
25
|
[Software.PotPlayer]: downloadPotPlayer,
|
|
26
|
+
[Software.Bun]: downloadBun,
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export async function downloadLatestSoftware() {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { agent } from "@src/constant"
|
|
2
|
+
import fetch from "node-fetch"
|
|
3
|
+
|
|
4
|
+
export interface Release {
|
|
5
|
+
url: string
|
|
6
|
+
assets_url: string
|
|
7
|
+
upload_url: string
|
|
8
|
+
html_url: string
|
|
9
|
+
id: number
|
|
10
|
+
author: Author
|
|
11
|
+
node_id: string
|
|
12
|
+
tag_name: string
|
|
13
|
+
target_commitish: string
|
|
14
|
+
name: string
|
|
15
|
+
draft: boolean
|
|
16
|
+
prerelease: boolean
|
|
17
|
+
created_at: string
|
|
18
|
+
published_at: string
|
|
19
|
+
assets: Asset[]
|
|
20
|
+
tarball_url: string
|
|
21
|
+
zipball_url: string
|
|
22
|
+
body: string
|
|
23
|
+
discussion_url: string
|
|
24
|
+
reactions: Reactions
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Reactions {
|
|
28
|
+
url: string
|
|
29
|
+
total_count: number
|
|
30
|
+
"+1": number
|
|
31
|
+
"-1": number
|
|
32
|
+
laugh: number
|
|
33
|
+
hooray: number
|
|
34
|
+
confused: number
|
|
35
|
+
heart: number
|
|
36
|
+
rocket: number
|
|
37
|
+
eyes: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface Asset {
|
|
41
|
+
url: string
|
|
42
|
+
id: number
|
|
43
|
+
node_id: string
|
|
44
|
+
name: string
|
|
45
|
+
label?: string
|
|
46
|
+
uploader: Author
|
|
47
|
+
content_type: string
|
|
48
|
+
state: string
|
|
49
|
+
size: number
|
|
50
|
+
download_count: number
|
|
51
|
+
created_at: string
|
|
52
|
+
updated_at: string
|
|
53
|
+
browser_download_url: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface Author {
|
|
57
|
+
login: string
|
|
58
|
+
id: number
|
|
59
|
+
node_id: string
|
|
60
|
+
avatar_url: string
|
|
61
|
+
gravatar_id: string
|
|
62
|
+
url: string
|
|
63
|
+
html_url: string
|
|
64
|
+
followers_url: string
|
|
65
|
+
following_url: string
|
|
66
|
+
gists_url: string
|
|
67
|
+
starred_url: string
|
|
68
|
+
subscriptions_url: string
|
|
69
|
+
organizations_url: string
|
|
70
|
+
repos_url: string
|
|
71
|
+
events_url: string
|
|
72
|
+
received_events_url: string
|
|
73
|
+
type: string
|
|
74
|
+
site_admin: boolean
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function getLatestRelease(owner: string, repo: string): Promise<Release> {
|
|
78
|
+
const url = `https://api.github.com/repos/${owner}/${repo}/releases/latest`
|
|
79
|
+
const response = await fetch(url, { agent })
|
|
80
|
+
const data = await response.json()
|
|
81
|
+
return data as Release
|
|
82
|
+
}
|