cmyr-template-cli 1.43.3 → 1.44.1
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/plopfile.js +38 -2
- package/package.json +1 -1
package/dist/plopfile.js
CHANGED
|
@@ -868,8 +868,13 @@ function adjustDependabotConfig(params) {
|
|
|
868
868
|
}
|
|
869
869
|
npmUpdate.ignore = needsArtTemplateIgnore ? currentIgnores : void 0;
|
|
870
870
|
}
|
|
871
|
-
const
|
|
872
|
-
if (
|
|
871
|
+
const githubActionsUpdate = next.updates?.find((update) => update["package-ecosystem"] === "github-actions");
|
|
872
|
+
if (githubActionsUpdate) {
|
|
873
|
+
githubActionsUpdate.schedule ??= { interval: "monthly", time: "04:00", timezone: "Asia/Shanghai" };
|
|
874
|
+
githubActionsUpdate.schedule.interval = "monthly";
|
|
875
|
+
githubActionsUpdate.schedule.time = "04:00";
|
|
876
|
+
githubActionsUpdate.schedule.timezone = "Asia/Shanghai";
|
|
877
|
+
} else {
|
|
873
878
|
next.updates.push({
|
|
874
879
|
"package-ecosystem": "github-actions",
|
|
875
880
|
directory: "/",
|
|
@@ -1777,6 +1782,36 @@ function getJsModuleType(fileContent) {
|
|
|
1777
1782
|
return "Unknown";
|
|
1778
1783
|
}
|
|
1779
1784
|
}
|
|
1785
|
+
async function initTypeCheck(projectPath, answers) {
|
|
1786
|
+
const loading = (0, import_ora6.default)("正在初始化 TypeCheck ……").start();
|
|
1787
|
+
try {
|
|
1788
|
+
const { template } = answers;
|
|
1789
|
+
const templateMeta = getTemplateMeta(template);
|
|
1790
|
+
const pkg = await readPackageJson(projectPath);
|
|
1791
|
+
const isTypeScript = pkg?.devDependencies?.typescript || pkg?.dependencies?.typescript;
|
|
1792
|
+
if (!isTypeScript) {
|
|
1793
|
+
loading.succeed("非 TypeScript 项目,跳过 TypeCheck 初始化");
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
let typecheckScript = "tsc --noEmit";
|
|
1797
|
+
if (templateMeta?.tags?.includes("nuxt")) {
|
|
1798
|
+
typecheckScript = "nuxt typecheck";
|
|
1799
|
+
} else if (templateMeta?.language === "vue" || templateMeta?.vueVersion && templateMeta?.vueVersion > 0) {
|
|
1800
|
+
typecheckScript = "vue-tsc --noEmit";
|
|
1801
|
+
}
|
|
1802
|
+
const newPkg = (0, import_lodash7.merge)({}, pkg, {
|
|
1803
|
+
scripts: {
|
|
1804
|
+
typecheck: typecheckScript,
|
|
1805
|
+
...pkg?.scripts
|
|
1806
|
+
}
|
|
1807
|
+
});
|
|
1808
|
+
await updatePackageJson(projectPath, newPkg);
|
|
1809
|
+
loading.succeed("TypeCheck 初始化成功!");
|
|
1810
|
+
} catch (error) {
|
|
1811
|
+
console.error(error);
|
|
1812
|
+
loading.fail("TypeCheck 初始化失败!");
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1780
1815
|
async function getNpmPackageVersion(name) {
|
|
1781
1816
|
const output = await asyncExec(`${PACKAGE_MANAGER} view ${name} version`) || "";
|
|
1782
1817
|
const semverReg = /\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?/;
|
|
@@ -2199,6 +2234,7 @@ async function init(projectPath, answers) {
|
|
|
2199
2234
|
await initTsconfig(projectPath, answers);
|
|
2200
2235
|
await initEslint(projectPath, answers);
|
|
2201
2236
|
await initStylelint(projectPath);
|
|
2237
|
+
await initTypeCheck(projectPath, answers);
|
|
2202
2238
|
if (isInitTest) {
|
|
2203
2239
|
await initTest(projectPath, answers);
|
|
2204
2240
|
}
|