@xylabs/ts-scripts-yarn3 7.0.2 → 7.1.0
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/actions/build.mjs +39 -87
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-docs.mjs +8 -22
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs +5 -11
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs +16 -29
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs +32 -63
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile.mjs +50 -76
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs +23 -38
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.mjs +28 -57
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs +16 -31
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/checkPackage.mjs +48 -71
- package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +5 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +9 -5
- package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +5 -5
- package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +0 -4
- package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +1 -1
- package/dist/actions/deplint/checkPackage/index.mjs +48 -71
- package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
- package/dist/actions/deplint/deplint.mjs +61 -86
- package/dist/actions/deplint/deplint.mjs.map +1 -1
- package/dist/actions/deplint/findFiles.mjs +4 -20
- package/dist/actions/deplint/findFiles.mjs.map +1 -1
- package/dist/actions/deplint/findFilesByGlob.mjs +1 -8
- package/dist/actions/deplint/findFilesByGlob.mjs.map +1 -1
- package/dist/actions/deplint/getBasePackageName.mjs +0 -4
- package/dist/actions/deplint/getBasePackageName.mjs.map +1 -1
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +0 -4
- package/dist/actions/deplint/getDependenciesFromPackageJson.mjs.map +1 -1
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs +12 -24
- package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
- package/dist/actions/deplint/getImportsFromFile.mjs +9 -16
- package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
- package/dist/actions/deplint/index.mjs +61 -86
- package/dist/actions/deplint/index.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs +26 -57
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs +26 -57
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs +26 -57
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs +26 -57
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs +26 -37
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs +36 -54
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs +25 -65
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs +28 -44
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/gitlint-fix.mjs +5 -14
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.mjs +4 -7
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/index.mjs +705 -1251
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/knip.mjs +16 -31
- package/dist/actions/knip.mjs.map +1 -1
- package/dist/actions/license.mjs +37 -51
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint.mjs +33 -48
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs +28 -44
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +6 -16
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +6 -16
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs +12 -29
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +19 -34
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs +165 -195
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +20 -23
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/deepMerge.mjs +0 -5
- package/dist/actions/package/compile/deepMerge.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +2 -5
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs +165 -195
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +15 -25
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +25 -17
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +19 -36
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +160 -185
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +12 -21
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/cycle.mjs +5 -14
- package/dist/actions/package/cycle.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs +11 -12
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs +236 -308
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/lint.mjs +16 -39
- package/dist/actions/package/lint.mjs.map +1 -1
- package/dist/actions/package/publint.mjs +13 -14
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs +179 -223
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs +37 -71
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs +17 -29
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs +50 -67
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs +25 -43
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs +40 -63
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs +17 -35
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs +16 -32
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs +27 -46
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs +16 -30
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs +16 -27
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs +18 -33
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs +19 -53
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs +16 -31
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs +12 -23
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/build-only.mjs +165 -194
- package/dist/bin/package/build-only.mjs.map +1 -1
- package/dist/bin/package/build.mjs +166 -197
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs +6 -15
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs +6 -15
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +12 -28
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs +165 -194
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs +160 -184
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +165 -194
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +13 -23
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +13 -23
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/cycle.mjs +5 -13
- package/dist/bin/package/cycle.mjs.map +1 -1
- package/dist/bin/package/fix.mjs +16 -38
- package/dist/bin/package/fix.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs +11 -11
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/lint.mjs +16 -38
- package/dist/bin/package/lint.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +13 -13
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +179 -222
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/relint.mjs +16 -38
- package/dist/bin/package/relint.mjs.map +1 -1
- package/dist/bin/xy.mjs +932 -1266
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.mjs +1191 -1612
- package/dist/index.mjs.map +1 -1
- package/dist/lib/checkResult.mjs +2 -5
- package/dist/lib/checkResult.mjs.map +1 -1
- package/dist/lib/createBuildConfig.mjs +9 -24
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/defaultBuildConfig.mjs +2 -6
- package/dist/lib/defaultBuildConfig.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs +3 -9
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +12 -23
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +22 -33
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +22 -33
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +1 -3
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/constants.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs +12 -13
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs +14 -15
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs +3 -8
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs +27 -43
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs +99 -157
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/jsonFormatters.mjs +2 -5
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/loadConfig.mjs +3 -11
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +2 -5
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/processEx.mjs +6 -9
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.mjs +13 -19
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs +22 -22
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs +19 -31
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/runXyWithWarning.mjs +2 -5
- package/dist/lib/runXyWithWarning.mjs.map +1 -1
- package/dist/lib/safeExit.mjs +10 -13
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/string/empty.mjs +2 -5
- package/dist/lib/string/empty.mjs.map +1 -1
- package/dist/lib/string/index.mjs +3 -9
- package/dist/lib/string/index.mjs.map +1 -1
- package/dist/lib/string/union.mjs +1 -7
- package/dist/lib/string/union.mjs.map +1 -1
- package/dist/lib/withErrnoException.mjs +4 -7
- package/dist/lib/withErrnoException.mjs.map +1 -1
- package/dist/lib/withError.mjs +2 -5
- package/dist/lib/withError.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs +11 -30
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +4 -15
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs +5 -16
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs +5 -16
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +3 -14
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/lib/yarn/yarnInitCwd.mjs +2 -5
- package/dist/lib/yarn/yarnInitCwd.mjs.map +1 -1
- package/dist/loadPackageConfig.mjs +3 -8
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/index.mjs +932 -1267
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs +3 -9
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs +932 -1267
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +228 -320
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs +251 -336
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs +99 -161
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +145 -193
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs +302 -403
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/dist/xy/xyParseOptions.mjs +2 -5
- package/dist/xy/xyParseOptions.mjs.map +1 -1
- package/package.json +8 -9
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/actions/build.ts
|
|
5
2
|
import chalk9 from "chalk";
|
|
6
3
|
|
|
7
4
|
// src/lib/checkResult.ts
|
|
8
5
|
import chalk from "chalk";
|
|
9
|
-
var checkResult =
|
|
6
|
+
var checkResult = (name, result, level = "error", exitOnFail = false) => {
|
|
10
7
|
if (result) {
|
|
11
8
|
const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
|
|
12
9
|
const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
|
|
@@ -15,7 +12,7 @@ var checkResult = /* @__PURE__ */ __name((name, result, level = "error", exitOnF
|
|
|
15
12
|
process.exit(result);
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
}
|
|
15
|
+
};
|
|
19
16
|
|
|
20
17
|
// src/lib/createBuildConfig.ts
|
|
21
18
|
import { readFileSync } from "fs";
|
|
@@ -24,9 +21,7 @@ import { readFileSync } from "fs";
|
|
|
24
21
|
var defaultBuildConfig = {
|
|
25
22
|
compilerOptions: {
|
|
26
23
|
rootDir: "src",
|
|
27
|
-
rootDirs: [
|
|
28
|
-
"package.json"
|
|
29
|
-
]
|
|
24
|
+
rootDirs: ["package.json"]
|
|
30
25
|
},
|
|
31
26
|
exclude: [
|
|
32
27
|
"**/build",
|
|
@@ -39,24 +34,20 @@ var defaultBuildConfig = {
|
|
|
39
34
|
"**/spec/*",
|
|
40
35
|
"**/stories/*"
|
|
41
36
|
],
|
|
42
|
-
include: [
|
|
43
|
-
"src"
|
|
44
|
-
]
|
|
37
|
+
include: ["src"]
|
|
45
38
|
};
|
|
46
39
|
|
|
47
40
|
// src/lib/createBuildConfig.ts
|
|
48
|
-
var getGeneralTypescriptConfig =
|
|
41
|
+
var getGeneralTypescriptConfig = (location) => {
|
|
49
42
|
let generalConfig;
|
|
50
43
|
try {
|
|
51
|
-
generalConfig = readFileSync(`${location}/tsconfig.json`, {
|
|
52
|
-
encoding: "utf8"
|
|
53
|
-
});
|
|
44
|
+
generalConfig = readFileSync(`${location}/tsconfig.json`, { encoding: "utf8" });
|
|
54
45
|
} catch {
|
|
55
46
|
return false;
|
|
56
47
|
}
|
|
57
48
|
return JSON.parse(generalConfig);
|
|
58
|
-
}
|
|
59
|
-
var createBuildConfig =
|
|
49
|
+
};
|
|
50
|
+
var createBuildConfig = (location, module, target, outDirSuffix) => {
|
|
60
51
|
const generalConfigObject = getGeneralTypescriptConfig(location);
|
|
61
52
|
if (generalConfigObject === false) {
|
|
62
53
|
return void 0;
|
|
@@ -70,29 +61,20 @@ var createBuildConfig = /* @__PURE__ */ __name((location, module, target, outDir
|
|
|
70
61
|
outDir: `./${generalConfigObject.compilerOptions?.outDir ?? "dist"}/${outDirSuffix}`,
|
|
71
62
|
target
|
|
72
63
|
},
|
|
73
|
-
exclude: [
|
|
74
|
-
|
|
75
|
-
...defaultBuildConfig.exclude
|
|
76
|
-
],
|
|
77
|
-
include: [
|
|
78
|
-
...generalConfigObject.include ?? [],
|
|
79
|
-
...defaultBuildConfig.include
|
|
80
|
-
]
|
|
64
|
+
exclude: [...generalConfigObject.exclude ?? [], ...defaultBuildConfig.exclude],
|
|
65
|
+
include: [...generalConfigObject.include ?? [], ...defaultBuildConfig.include]
|
|
81
66
|
};
|
|
82
|
-
}
|
|
67
|
+
};
|
|
83
68
|
|
|
84
69
|
// src/lib/deleteGlob.ts
|
|
85
70
|
import fs from "fs";
|
|
86
71
|
import { glob } from "glob";
|
|
87
|
-
var deleteGlob =
|
|
72
|
+
var deleteGlob = (globPath) => {
|
|
88
73
|
const files = glob.sync(globPath);
|
|
89
74
|
for (const file of files) {
|
|
90
|
-
fs.rmSync(file, {
|
|
91
|
-
recursive: true,
|
|
92
|
-
force: true
|
|
93
|
-
});
|
|
75
|
+
fs.rmSync(file, { recursive: true, force: true });
|
|
94
76
|
}
|
|
95
|
-
}
|
|
77
|
+
};
|
|
96
78
|
|
|
97
79
|
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
98
80
|
import { execSync } from "child_process";
|
|
@@ -101,17 +83,17 @@ import { execSync } from "child_process";
|
|
|
101
83
|
import chalk2 from "chalk";
|
|
102
84
|
|
|
103
85
|
// src/lib/withError.ts
|
|
104
|
-
var withError =
|
|
86
|
+
var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
|
|
105
87
|
return predicate(ex) ? closure(ex) : void 0;
|
|
106
|
-
}
|
|
88
|
+
};
|
|
107
89
|
|
|
108
90
|
// src/lib/withErrnoException.ts
|
|
109
|
-
var withErrnoException =
|
|
91
|
+
var withErrnoException = (ex, closure) => {
|
|
110
92
|
return withError(ex, closure, (ex2) => ex2.errno !== void 0);
|
|
111
|
-
}
|
|
93
|
+
};
|
|
112
94
|
|
|
113
95
|
// src/lib/processEx.ts
|
|
114
|
-
var processEx =
|
|
96
|
+
var processEx = (ex) => {
|
|
115
97
|
const error = typeof ex === "string" ? new Error(ex) : ex;
|
|
116
98
|
const exitCode = withErrnoException(error, (error2) => {
|
|
117
99
|
if (error2.code === "ENOENT") {
|
|
@@ -128,10 +110,10 @@ var processEx = /* @__PURE__ */ __name((ex) => {
|
|
|
128
110
|
return -1;
|
|
129
111
|
})();
|
|
130
112
|
process.exit(process.exitCode ?? exitCode);
|
|
131
|
-
}
|
|
113
|
+
};
|
|
132
114
|
|
|
133
115
|
// src/lib/safeExit.ts
|
|
134
|
-
var safeExit =
|
|
116
|
+
var safeExit = (func, exitOnFail = true) => {
|
|
135
117
|
try {
|
|
136
118
|
const result = func();
|
|
137
119
|
if (result && exitOnFail) {
|
|
@@ -141,8 +123,8 @@ var safeExit = /* @__PURE__ */ __name((func, exitOnFail = true) => {
|
|
|
141
123
|
} catch (ex) {
|
|
142
124
|
return processEx(ex);
|
|
143
125
|
}
|
|
144
|
-
}
|
|
145
|
-
var safeExitAsync =
|
|
126
|
+
};
|
|
127
|
+
var safeExitAsync = async (func, exitOnFail = true) => {
|
|
146
128
|
try {
|
|
147
129
|
const result = await func();
|
|
148
130
|
if (result && exitOnFail) {
|
|
@@ -152,22 +134,22 @@ var safeExitAsync = /* @__PURE__ */ __name(async (func, exitOnFail = true) => {
|
|
|
152
134
|
} catch (ex) {
|
|
153
135
|
return processEx(ex);
|
|
154
136
|
}
|
|
155
|
-
}
|
|
137
|
+
};
|
|
156
138
|
|
|
157
139
|
// src/lib/dependencies/DuplicateDetector.ts
|
|
158
140
|
import { EOL } from "os";
|
|
159
141
|
import chalk3 from "chalk";
|
|
160
142
|
|
|
161
143
|
// src/lib/jsonFormatters.ts
|
|
162
|
-
var multiLineToJSONArray =
|
|
144
|
+
var multiLineToJSONArray = (output) => {
|
|
163
145
|
const withCommas = output.replaceAll("\r\n", "").replaceAll("\n", ",");
|
|
164
146
|
const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1));
|
|
165
147
|
const collection = `[${cleanCollection}]`;
|
|
166
148
|
return JSON.parse(collection);
|
|
167
|
-
}
|
|
149
|
+
};
|
|
168
150
|
|
|
169
151
|
// src/lib/dependencies/DuplicateDetector.ts
|
|
170
|
-
var trimVirtualMeta =
|
|
152
|
+
var trimVirtualMeta = (value) => {
|
|
171
153
|
const virtualParts = value.split("virtual:");
|
|
172
154
|
if (virtualParts.length > 1) {
|
|
173
155
|
const hashParts = virtualParts[1].split("#");
|
|
@@ -175,8 +157,8 @@ var trimVirtualMeta = /* @__PURE__ */ __name((value) => {
|
|
|
175
157
|
} else {
|
|
176
158
|
return value;
|
|
177
159
|
}
|
|
178
|
-
}
|
|
179
|
-
var trimObjectDependencyVirtualMeta =
|
|
160
|
+
};
|
|
161
|
+
var trimObjectDependencyVirtualMeta = (obj) => {
|
|
180
162
|
const resultObj = {};
|
|
181
163
|
for (const [key, value] of Object.entries(obj)) {
|
|
182
164
|
resultObj[trimVirtualMeta(key)] = {
|
|
@@ -185,19 +167,13 @@ var trimObjectDependencyVirtualMeta = /* @__PURE__ */ __name((obj) => {
|
|
|
185
167
|
};
|
|
186
168
|
}
|
|
187
169
|
return resultObj;
|
|
188
|
-
}
|
|
189
|
-
var trimDependencyVirtualMeta =
|
|
170
|
+
};
|
|
171
|
+
var trimDependencyVirtualMeta = (dependencies) => {
|
|
190
172
|
return dependencies.map((dependency) => {
|
|
191
|
-
return {
|
|
192
|
-
children: trimObjectDependencyVirtualMeta(dependency.children),
|
|
193
|
-
value: trimVirtualMeta(dependency.value)
|
|
194
|
-
};
|
|
173
|
+
return { children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value) };
|
|
195
174
|
});
|
|
196
|
-
}
|
|
175
|
+
};
|
|
197
176
|
var DuplicateDetector = class {
|
|
198
|
-
static {
|
|
199
|
-
__name(this, "DuplicateDetector");
|
|
200
|
-
}
|
|
201
177
|
dependency;
|
|
202
178
|
dependencyEntries;
|
|
203
179
|
constructor(output, dependency) {
|
|
@@ -227,21 +203,19 @@ var DuplicateDetector = class {
|
|
|
227
203
|
acc.duplicateVersions.push(acc.currentVersion);
|
|
228
204
|
}
|
|
229
205
|
acc.duplicateVersions.push(version);
|
|
230
|
-
acc.duplicateVersions = [
|
|
231
|
-
...new Set(acc.duplicateVersions)
|
|
232
|
-
];
|
|
206
|
+
acc.duplicateVersions = [...new Set(acc.duplicateVersions)];
|
|
233
207
|
}
|
|
234
208
|
return acc;
|
|
235
209
|
}
|
|
236
|
-
resultsFactory =
|
|
210
|
+
resultsFactory = (dependency) => ({
|
|
237
211
|
currentVersion: void 0,
|
|
238
212
|
dependency,
|
|
239
213
|
duplicateVersions: []
|
|
240
|
-
})
|
|
214
|
+
});
|
|
241
215
|
};
|
|
242
216
|
|
|
243
217
|
// src/lib/dependencies/detectDuplicateDependencies.ts
|
|
244
|
-
var detectDuplicateDependencies =
|
|
218
|
+
var detectDuplicateDependencies = (depsFromPackageJSON, DefaultDependencies2) => {
|
|
245
219
|
let exitCode = 0;
|
|
246
220
|
const dependencies = depsFromPackageJSON?.length ? depsFromPackageJSON : DefaultDependencies2;
|
|
247
221
|
return safeExit(() => {
|
|
@@ -272,57 +246,51 @@ var detectDuplicateDependencies = /* @__PURE__ */ __name((depsFromPackageJSON, D
|
|
|
272
246
|
return exitCode;
|
|
273
247
|
}
|
|
274
248
|
});
|
|
275
|
-
}
|
|
249
|
+
};
|
|
276
250
|
|
|
277
251
|
// src/lib/file/constants.ts
|
|
278
252
|
var WINDOWS_NEWLINE_REGEX = /\r\n/g;
|
|
279
253
|
var CROSS_PLATFORM_NEWLINE = "\n";
|
|
280
254
|
|
|
281
255
|
// src/lib/file/fileLines.ts
|
|
282
|
-
import {
|
|
256
|
+
import {
|
|
257
|
+
existsSync,
|
|
258
|
+
readFileSync as readFileSync2,
|
|
259
|
+
writeFileSync
|
|
260
|
+
} from "fs";
|
|
283
261
|
|
|
284
262
|
// src/lib/string/empty.ts
|
|
285
|
-
var empty =
|
|
286
|
-
var notEmpty =
|
|
263
|
+
var empty = (value) => value?.trim().length === 0;
|
|
264
|
+
var notEmpty = (value) => !empty(value);
|
|
287
265
|
|
|
288
266
|
// src/lib/string/union.ts
|
|
289
|
-
var union =
|
|
290
|
-
...new Set(a),
|
|
291
|
-
...new Set(b)
|
|
292
|
-
]), "union");
|
|
267
|
+
var union = (a, b) => /* @__PURE__ */ new Set([...new Set(a), ...new Set(b)]);
|
|
293
268
|
|
|
294
269
|
// src/lib/file/ReadFileSyncOptions.ts
|
|
295
|
-
var defaultReadFileSyncOptions = {
|
|
296
|
-
encoding: "utf8"
|
|
297
|
-
};
|
|
270
|
+
var defaultReadFileSyncOptions = { encoding: "utf8" };
|
|
298
271
|
|
|
299
272
|
// src/lib/file/fileLines.ts
|
|
300
|
-
var readLines =
|
|
301
|
-
var readNonEmptyLines =
|
|
302
|
-
var writeLines =
|
|
273
|
+
var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync2(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [];
|
|
274
|
+
var readNonEmptyLines = (uri, options = defaultReadFileSyncOptions) => readLines(uri, options).filter(notEmpty);
|
|
275
|
+
var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
|
|
303
276
|
const existing = existsSync(uri) ? readFileSync2(uri, options) : void 0;
|
|
304
277
|
const desired = lines.join(CROSS_PLATFORM_NEWLINE);
|
|
305
278
|
if (existing !== desired) writeFileSync(uri, desired, options);
|
|
306
|
-
}
|
|
279
|
+
};
|
|
307
280
|
|
|
308
281
|
// src/lib/file/tryReadFileSync.ts
|
|
309
282
|
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "fs";
|
|
310
|
-
var tryReadFileSync =
|
|
283
|
+
var tryReadFileSync = (uri, options = defaultReadFileSyncOptions) => {
|
|
311
284
|
return existsSync2(uri) ? readFileSync3(uri, options) : void 0;
|
|
312
|
-
}
|
|
285
|
+
};
|
|
313
286
|
|
|
314
287
|
// src/lib/generateIgnoreFiles.ts
|
|
315
288
|
import chalk4 from "chalk";
|
|
316
289
|
|
|
317
290
|
// src/lib/yarn/isYarnVersionOrGreater.ts
|
|
318
291
|
import { spawnSync } from "child_process";
|
|
319
|
-
var isYarnVersionOrGreater =
|
|
320
|
-
const result = spawnSync("yarn", [
|
|
321
|
-
"-v"
|
|
322
|
-
], {
|
|
323
|
-
encoding: "utf8",
|
|
324
|
-
shell: true
|
|
325
|
-
});
|
|
292
|
+
var isYarnVersionOrGreater = (major, minor, patch) => {
|
|
293
|
+
const result = spawnSync("yarn", ["-v"], { encoding: "utf8", shell: true });
|
|
326
294
|
const version = result.stdout.toString().replaceAll("\n", "");
|
|
327
295
|
const versionNumbers = version.split(".").map((ver) => Number.parseInt(ver));
|
|
328
296
|
const majorDelta = versionNumbers[0] - major;
|
|
@@ -331,58 +299,43 @@ var isYarnVersionOrGreater = /* @__PURE__ */ __name((major, minor, patch) => {
|
|
|
331
299
|
const majorOk = majorDelta >= 0;
|
|
332
300
|
const minorOk = majorDelta > 0 || minorDelta >= 0;
|
|
333
301
|
const patchOk = majorDelta > 0 || minorDelta > 0 || patchDelta >= 0;
|
|
334
|
-
return [
|
|
335
|
-
|
|
336
|
-
version
|
|
337
|
-
];
|
|
338
|
-
}, "isYarnVersionOrGreater");
|
|
302
|
+
return [majorOk && minorOk && patchOk, version];
|
|
303
|
+
};
|
|
339
304
|
|
|
340
305
|
// src/lib/yarn/workspace/yarnWorkspaces.ts
|
|
341
306
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
342
|
-
var yarnWorkspaces =
|
|
343
|
-
const result = spawnSync2("yarn", [
|
|
344
|
-
"workspaces",
|
|
345
|
-
"list",
|
|
346
|
-
"--json",
|
|
347
|
-
"--recursive"
|
|
348
|
-
], {
|
|
349
|
-
encoding: "utf8",
|
|
350
|
-
shell: true
|
|
351
|
-
});
|
|
307
|
+
var yarnWorkspaces = () => {
|
|
308
|
+
const result = spawnSync2("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
|
|
352
309
|
if (result.error) {
|
|
353
310
|
throw result.error;
|
|
354
311
|
}
|
|
355
312
|
return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
|
|
356
313
|
return JSON.parse(item);
|
|
357
314
|
});
|
|
358
|
-
}
|
|
315
|
+
};
|
|
359
316
|
|
|
360
317
|
// src/lib/yarn/workspace/yarnWorkspace.ts
|
|
361
|
-
var yarnWorkspace =
|
|
318
|
+
var yarnWorkspace = (pkg) => {
|
|
362
319
|
const workspace = yarnWorkspaces().find(({ name }) => name === pkg);
|
|
363
320
|
if (!workspace) throw new Error(`Workspace ${pkg} not found`);
|
|
364
321
|
return workspace;
|
|
365
|
-
}
|
|
322
|
+
};
|
|
366
323
|
|
|
367
324
|
// src/lib/yarn/yarnInitCwd.ts
|
|
368
|
-
var INIT_CWD =
|
|
325
|
+
var INIT_CWD = () => {
|
|
369
326
|
if (!process.env.INIT_CWD) console.error("Missing INIT_CWD");
|
|
370
327
|
return process.env.INIT_CWD;
|
|
371
|
-
}
|
|
328
|
+
};
|
|
372
329
|
|
|
373
330
|
// src/lib/generateIgnoreFiles.ts
|
|
374
|
-
var localeCompare =
|
|
375
|
-
var mergeEntries =
|
|
376
|
-
|
|
377
|
-
].sort(localeCompare), "mergeEntries");
|
|
378
|
-
var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
331
|
+
var localeCompare = (a, b) => a.localeCompare(b);
|
|
332
|
+
var mergeEntries = (a, b) => [...union(a, b)].sort(localeCompare);
|
|
333
|
+
var generateIgnoreFiles = (filename3, pkg) => {
|
|
379
334
|
console.log(chalk4.green(`Generate ${filename3} Files`));
|
|
380
335
|
const cwd5 = INIT_CWD() ?? ".";
|
|
381
|
-
const workspaces = pkg ? [
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
const readEntries = /* @__PURE__ */ __name((location) => readNonEmptyLines(`${location}/${filename3}`), "readEntries");
|
|
385
|
-
const writeEntries = /* @__PURE__ */ __name((location, entries) => writeLines(`${location}/${filename3}`, entries), "writeEntries");
|
|
336
|
+
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
|
|
337
|
+
const readEntries = (location) => readNonEmptyLines(`${location}/${filename3}`);
|
|
338
|
+
const writeEntries = (location, entries) => writeLines(`${location}/${filename3}`, entries);
|
|
386
339
|
const results = workspaces.map(({ location, name }) => {
|
|
387
340
|
try {
|
|
388
341
|
writeEntries(location, mergeEntries(readEntries(cwd5), readEntries(location)));
|
|
@@ -395,7 +348,7 @@ var generateIgnoreFiles = /* @__PURE__ */ __name((filename3, pkg) => {
|
|
|
395
348
|
});
|
|
396
349
|
const succeeded = results.every((result) => result === 0);
|
|
397
350
|
return succeeded ? 0 : 1;
|
|
398
|
-
}
|
|
351
|
+
};
|
|
399
352
|
|
|
400
353
|
// src/lib/loadConfig.ts
|
|
401
354
|
import chalk5 from "chalk";
|
|
@@ -403,14 +356,9 @@ import { cosmiconfig } from "cosmiconfig";
|
|
|
403
356
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
404
357
|
import deepmerge from "deepmerge";
|
|
405
358
|
var config;
|
|
406
|
-
var loadConfig =
|
|
359
|
+
var loadConfig = async (params) => {
|
|
407
360
|
if (config === void 0) {
|
|
408
|
-
const cosmicConfigResult = await cosmiconfig("xy", {
|
|
409
|
-
cache: true,
|
|
410
|
-
loaders: {
|
|
411
|
-
".ts": TypeScriptLoader()
|
|
412
|
-
}
|
|
413
|
-
}).search();
|
|
361
|
+
const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
|
|
414
362
|
config = cosmicConfigResult?.config;
|
|
415
363
|
const configFilePath = cosmicConfigResult?.filepath;
|
|
416
364
|
if (configFilePath !== void 0) {
|
|
@@ -421,21 +369,21 @@ var loadConfig = /* @__PURE__ */ __name(async (params) => {
|
|
|
421
369
|
}
|
|
422
370
|
}
|
|
423
371
|
return deepmerge(config, params ?? {});
|
|
424
|
-
}
|
|
372
|
+
};
|
|
425
373
|
|
|
426
374
|
// src/lib/parsedPackageJSON.ts
|
|
427
375
|
import { readFileSync as readFileSync4 } from "fs";
|
|
428
|
-
var parsedPackageJSON =
|
|
376
|
+
var parsedPackageJSON = (path11) => {
|
|
429
377
|
const pathToPackageJSON = path11 ?? process.env.npm_package_json ?? "";
|
|
430
378
|
const packageJSON = readFileSync4(pathToPackageJSON).toString();
|
|
431
379
|
return JSON.parse(packageJSON);
|
|
432
|
-
}
|
|
380
|
+
};
|
|
433
381
|
|
|
434
382
|
// src/lib/runSteps.ts
|
|
435
383
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
436
384
|
import { existsSync as existsSync3 } from "fs";
|
|
437
385
|
import chalk6 from "chalk";
|
|
438
|
-
var runSteps =
|
|
386
|
+
var runSteps = (name, steps, exitOnFail = true, messages) => {
|
|
439
387
|
return safeExit(() => {
|
|
440
388
|
const pkgName = process.env.npm_package_name;
|
|
441
389
|
console.log(chalk6.green(`${name} [${pkgName}]`));
|
|
@@ -451,10 +399,7 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
451
399
|
const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
|
|
452
400
|
...config2,
|
|
453
401
|
encoding: "utf8",
|
|
454
|
-
env: {
|
|
455
|
-
FORCE_COLOR: "3",
|
|
456
|
-
...process.env
|
|
457
|
-
},
|
|
402
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
458
403
|
shell: true,
|
|
459
404
|
stdio: "inherit"
|
|
460
405
|
}).status ?? 0;
|
|
@@ -463,13 +408,13 @@ var runSteps = /* @__PURE__ */ __name((name, steps, exitOnFail = true, messages)
|
|
|
463
408
|
}
|
|
464
409
|
return totalStatus;
|
|
465
410
|
}, !!exitOnFail);
|
|
466
|
-
}
|
|
411
|
+
};
|
|
467
412
|
|
|
468
413
|
// src/lib/runStepsAsync.ts
|
|
469
414
|
import { spawn } from "child_process";
|
|
470
415
|
import { existsSync as existsSync4 } from "fs";
|
|
471
416
|
import chalk7 from "chalk";
|
|
472
|
-
var runStepAsync =
|
|
417
|
+
var runStepAsync = (name, step, exitOnFail = true, message) => {
|
|
473
418
|
return new Promise((resolve) => {
|
|
474
419
|
const [command, args, config2] = step;
|
|
475
420
|
if (message) {
|
|
@@ -481,15 +426,18 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
|
|
|
481
426
|
}
|
|
482
427
|
spawn(command, Array.isArray(args) ? args : args.split(" "), {
|
|
483
428
|
...config2,
|
|
484
|
-
env: {
|
|
485
|
-
FORCE_COLOR: "3",
|
|
486
|
-
...process.env
|
|
487
|
-
},
|
|
429
|
+
env: { FORCE_COLOR: "3", ...process.env },
|
|
488
430
|
shell: true,
|
|
489
431
|
stdio: "inherit"
|
|
490
432
|
}).on("close", (code) => {
|
|
491
433
|
if (code) {
|
|
492
|
-
console.error(
|
|
434
|
+
console.error(
|
|
435
|
+
chalk7.red(
|
|
436
|
+
`Command Exited With Non-Zero Result [${chalk7.gray(code)}] | ${chalk7.yellow(command)} ${chalk7.white(
|
|
437
|
+
Array.isArray(args) ? args.join(" ") : args
|
|
438
|
+
)}`
|
|
439
|
+
)
|
|
440
|
+
);
|
|
493
441
|
checkResult(name, code, "error", exitOnFail);
|
|
494
442
|
resolve(code);
|
|
495
443
|
} else {
|
|
@@ -497,8 +445,8 @@ var runStepAsync = /* @__PURE__ */ __name((name, step, exitOnFail = true, messag
|
|
|
497
445
|
}
|
|
498
446
|
});
|
|
499
447
|
});
|
|
500
|
-
}
|
|
501
|
-
var runStepsAsync =
|
|
448
|
+
};
|
|
449
|
+
var runStepsAsync = async (name, steps, exitOnFail = true, messages) => {
|
|
502
450
|
return await safeExitAsync(async () => {
|
|
503
451
|
const pkgName = process.env.npm_package_name;
|
|
504
452
|
console.log(chalk7.green(`${name} [${pkgName}]`));
|
|
@@ -508,163 +456,85 @@ var runStepsAsync = /* @__PURE__ */ __name(async (name, steps, exitOnFail = true
|
|
|
508
456
|
}
|
|
509
457
|
return result;
|
|
510
458
|
});
|
|
511
|
-
}
|
|
459
|
+
};
|
|
512
460
|
|
|
513
461
|
// src/lib/runXy.ts
|
|
514
|
-
var runXy =
|
|
515
|
-
return runSteps(
|
|
516
|
-
[
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
command,
|
|
521
|
-
...process.argv.filter((value, index) => index > 1 ? value : void 0)
|
|
522
|
-
]
|
|
523
|
-
]
|
|
524
|
-
]);
|
|
525
|
-
}, "runXy");
|
|
462
|
+
var runXy = (command) => {
|
|
463
|
+
return runSteps(
|
|
464
|
+
`XY [${command}]`,
|
|
465
|
+
[["yarn", ["xy", command, ...process.argv.filter((value, index) => index > 1 ? value : void 0)]]]
|
|
466
|
+
);
|
|
467
|
+
};
|
|
526
468
|
|
|
527
469
|
// src/lib/runXyWithWarning.ts
|
|
528
470
|
import chalk8 from "chalk";
|
|
529
|
-
var runXyWithWarning =
|
|
471
|
+
var runXyWithWarning = (command) => {
|
|
530
472
|
const commandString = `yarn ${command}`;
|
|
531
473
|
const commandXyString = `yarn xy ${command}`;
|
|
532
474
|
console.warn(chalk8.yellow(`WARNING: [${chalk8.white(commandString)}] is deprecated for XY Labs Scripts.`));
|
|
533
475
|
console.warn(chalk8.gray(`Did you mean [${chalk8.magenta(commandXyString)}]?`));
|
|
534
476
|
return 1;
|
|
535
|
-
}
|
|
477
|
+
};
|
|
536
478
|
|
|
537
479
|
// src/actions/build.ts
|
|
538
|
-
var build =
|
|
480
|
+
var build = async ({
|
|
481
|
+
incremental,
|
|
482
|
+
jobs,
|
|
483
|
+
target,
|
|
484
|
+
verbose,
|
|
485
|
+
pkg
|
|
486
|
+
}) => {
|
|
539
487
|
const start = Date.now();
|
|
540
|
-
const pkgOptions = pkg === void 0 ? [] : [
|
|
541
|
-
|
|
542
|
-
];
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
] : [];
|
|
546
|
-
const verboseOptions = verbose ? [
|
|
547
|
-
"-v"
|
|
548
|
-
] : [];
|
|
549
|
-
const targetOptions = target === void 0 ? [] : [
|
|
550
|
-
"-t",
|
|
551
|
-
target
|
|
552
|
-
];
|
|
553
|
-
const jobsOptions = jobs === void 0 ? [] : [
|
|
554
|
-
"-j",
|
|
555
|
-
`${jobs}`
|
|
556
|
-
];
|
|
488
|
+
const pkgOptions = pkg === void 0 ? [] : [pkg];
|
|
489
|
+
const incrementalOptions = incremental ? ["-i"] : [];
|
|
490
|
+
const verboseOptions = verbose ? ["-v"] : [];
|
|
491
|
+
const targetOptions = target === void 0 ? [] : ["-t", target];
|
|
492
|
+
const jobsOptions = jobs === void 0 ? [] : ["-j", `${jobs}`];
|
|
557
493
|
if (jobs !== void 0) {
|
|
558
494
|
console.log(chalk9.blue(`Jobs set to [${jobs}]`));
|
|
559
495
|
}
|
|
560
496
|
const result = await runStepsAsync(`Build${incremental ? "-Incremental" : ""} [${pkg ?? "All"}]`, [
|
|
561
|
-
[
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
"compile",
|
|
566
|
-
...pkgOptions,
|
|
567
|
-
...targetOptions,
|
|
568
|
-
...verboseOptions,
|
|
569
|
-
...jobsOptions,
|
|
570
|
-
...incrementalOptions,
|
|
571
|
-
"--types",
|
|
572
|
-
"tsup"
|
|
573
|
-
]
|
|
574
|
-
],
|
|
575
|
-
[
|
|
576
|
-
"yarn",
|
|
577
|
-
[
|
|
578
|
-
"xy",
|
|
579
|
-
"publint",
|
|
580
|
-
...pkgOptions,
|
|
581
|
-
...verboseOptions,
|
|
582
|
-
...jobsOptions,
|
|
583
|
-
...incrementalOptions
|
|
584
|
-
]
|
|
585
|
-
],
|
|
586
|
-
[
|
|
587
|
-
"yarn",
|
|
588
|
-
[
|
|
589
|
-
"xy",
|
|
590
|
-
"deplint",
|
|
591
|
-
...pkgOptions,
|
|
592
|
-
...verboseOptions,
|
|
593
|
-
...jobsOptions,
|
|
594
|
-
...incrementalOptions
|
|
595
|
-
]
|
|
596
|
-
],
|
|
597
|
-
[
|
|
598
|
-
"yarn",
|
|
599
|
-
[
|
|
600
|
-
"xy",
|
|
601
|
-
"lint",
|
|
602
|
-
...pkgOptions,
|
|
603
|
-
...verboseOptions,
|
|
604
|
-
...incrementalOptions
|
|
605
|
-
]
|
|
606
|
-
]
|
|
497
|
+
["yarn", ["xy", "compile", ...pkgOptions, ...targetOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions, "--types", "tsup"]],
|
|
498
|
+
["yarn", ["xy", "publint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
499
|
+
["yarn", ["xy", "deplint", ...pkgOptions, ...verboseOptions, ...jobsOptions, ...incrementalOptions]],
|
|
500
|
+
["yarn", ["xy", "lint", ...pkgOptions, ...verboseOptions, ...incrementalOptions]]
|
|
607
501
|
]);
|
|
608
502
|
console.log(`${chalk9.gray("Built in")} [${chalk9.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk9.gray("seconds")}`);
|
|
609
503
|
return result;
|
|
610
|
-
}
|
|
504
|
+
};
|
|
611
505
|
|
|
612
506
|
// src/actions/clean.ts
|
|
613
|
-
var clean =
|
|
614
|
-
return pkg ? await cleanPackage({
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
[
|
|
624
|
-
"yarn",
|
|
625
|
-
[
|
|
626
|
-
"workspace",
|
|
627
|
-
pkg,
|
|
628
|
-
"run",
|
|
629
|
-
"package-clean"
|
|
630
|
-
]
|
|
631
|
-
]
|
|
632
|
-
]);
|
|
633
|
-
}, "cleanPackage");
|
|
634
|
-
var cleanAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
635
|
-
const verboseOptions = verbose ? [
|
|
636
|
-
"--verbose"
|
|
637
|
-
] : [
|
|
638
|
-
"--no-verbose"
|
|
639
|
-
];
|
|
640
|
-
return runStepsAsync("Clean", [
|
|
641
|
-
[
|
|
642
|
-
"yarn",
|
|
643
|
-
[
|
|
644
|
-
"workspaces foreach",
|
|
645
|
-
"-pA",
|
|
646
|
-
"--jobs 64",
|
|
647
|
-
...verboseOptions,
|
|
648
|
-
"run",
|
|
649
|
-
"package-clean"
|
|
650
|
-
]
|
|
651
|
-
]
|
|
652
|
-
]);
|
|
653
|
-
}, "cleanAll");
|
|
507
|
+
var clean = async ({ verbose, pkg }) => {
|
|
508
|
+
return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
|
|
509
|
+
};
|
|
510
|
+
var cleanPackage = ({ pkg }) => {
|
|
511
|
+
return runStepsAsync(`Clean [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-clean"]]]);
|
|
512
|
+
};
|
|
513
|
+
var cleanAll = ({ verbose }) => {
|
|
514
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
515
|
+
return runStepsAsync("Clean", [["yarn", ["workspaces foreach", "-pA", "--jobs 64", ...verboseOptions, "run", "package-clean"]]]);
|
|
516
|
+
};
|
|
654
517
|
|
|
655
518
|
// src/actions/clean-docs.ts
|
|
656
519
|
import path from "path";
|
|
657
520
|
import chalk10 from "chalk";
|
|
658
|
-
var cleanDocs =
|
|
521
|
+
var cleanDocs = () => {
|
|
659
522
|
const pkgName = process.env.npm_package_name;
|
|
660
523
|
console.log(chalk10.green(`Cleaning Docs [${pkgName}]`));
|
|
661
524
|
for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
|
|
662
525
|
return 0;
|
|
663
|
-
}
|
|
526
|
+
};
|
|
664
527
|
|
|
665
528
|
// src/actions/compile.ts
|
|
666
529
|
import chalk11 from "chalk";
|
|
667
|
-
var compile =
|
|
530
|
+
var compile = ({
|
|
531
|
+
verbose,
|
|
532
|
+
target,
|
|
533
|
+
pkg,
|
|
534
|
+
incremental,
|
|
535
|
+
publint: publint2,
|
|
536
|
+
jobs
|
|
537
|
+
}) => {
|
|
668
538
|
return pkg ? compilePackage({
|
|
669
539
|
pkg,
|
|
670
540
|
publint: publint2,
|
|
@@ -677,91 +547,58 @@ var compile = /* @__PURE__ */ __name(({ verbose, target, pkg, incremental, publi
|
|
|
677
547
|
verbose,
|
|
678
548
|
jobs
|
|
679
549
|
});
|
|
680
|
-
}
|
|
681
|
-
var compilePackage =
|
|
682
|
-
const targetOptions = target ? [
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
...targetOptions
|
|
695
|
-
]
|
|
696
|
-
]
|
|
697
|
-
]);
|
|
698
|
-
}, "compilePackage");
|
|
699
|
-
var compileAll = /* @__PURE__ */ __name(({ jobs, verbose, target, incremental }) => {
|
|
550
|
+
};
|
|
551
|
+
var compilePackage = ({ target, pkg }) => {
|
|
552
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
553
|
+
return runSteps(
|
|
554
|
+
`Compile [${pkg}]`,
|
|
555
|
+
[["yarn", ["workspace", pkg, "run", "package-compile", ...targetOptions]]]
|
|
556
|
+
);
|
|
557
|
+
};
|
|
558
|
+
var compileAll = ({
|
|
559
|
+
jobs,
|
|
560
|
+
verbose,
|
|
561
|
+
target,
|
|
562
|
+
incremental
|
|
563
|
+
}) => {
|
|
700
564
|
const start = Date.now();
|
|
701
|
-
const verboseOptions = verbose ? [
|
|
702
|
-
|
|
703
|
-
] : [
|
|
704
|
-
|
|
705
|
-
];
|
|
706
|
-
const targetOptions = target ? [
|
|
707
|
-
"-t",
|
|
708
|
-
target
|
|
709
|
-
] : [];
|
|
710
|
-
const incrementalOptions = incremental ? [
|
|
711
|
-
"--since",
|
|
712
|
-
"-Apt",
|
|
713
|
-
"--topological-dev"
|
|
714
|
-
] : [
|
|
715
|
-
"--parallel",
|
|
716
|
-
"-Apt",
|
|
717
|
-
"--topological-dev"
|
|
718
|
-
];
|
|
719
|
-
const jobsOptions = jobs ? [
|
|
720
|
-
"-j",
|
|
721
|
-
`${jobs}`
|
|
722
|
-
] : [];
|
|
565
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
566
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
567
|
+
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
568
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
723
569
|
if (jobs) {
|
|
724
570
|
console.log(chalk11.blue(`Jobs set to [${jobs}]`));
|
|
725
571
|
}
|
|
726
572
|
const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
|
|
727
|
-
[
|
|
728
|
-
"
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
...targetOptions
|
|
738
|
-
]
|
|
739
|
-
]
|
|
573
|
+
["yarn", [
|
|
574
|
+
"workspaces",
|
|
575
|
+
"foreach",
|
|
576
|
+
...incrementalOptions,
|
|
577
|
+
...jobsOptions,
|
|
578
|
+
...verboseOptions,
|
|
579
|
+
"run",
|
|
580
|
+
"package-compile",
|
|
581
|
+
...targetOptions
|
|
582
|
+
]]
|
|
740
583
|
]);
|
|
741
584
|
console.log(`${chalk11.gray("Compiled in")} [${chalk11.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk11.gray("seconds")}`);
|
|
742
585
|
return result;
|
|
743
|
-
}
|
|
586
|
+
};
|
|
744
587
|
|
|
745
588
|
// src/actions/copy-assets.ts
|
|
746
589
|
import path2 from "path/posix";
|
|
747
590
|
import chalk12 from "chalk";
|
|
748
591
|
import cpy from "cpy";
|
|
749
|
-
var copyPackageTargetAssets =
|
|
592
|
+
var copyPackageTargetAssets = async (target, name, location) => {
|
|
750
593
|
try {
|
|
751
|
-
const values = await cpy(
|
|
752
|
-
"**/*.jpg",
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
"**/*.gif",
|
|
760
|
-
"**/*.css"
|
|
761
|
-
], `../dist/${target}`, {
|
|
762
|
-
cwd: path2.join(process.cwd(), location, "src"),
|
|
763
|
-
flat: false
|
|
764
|
-
});
|
|
594
|
+
const values = await cpy(
|
|
595
|
+
["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
|
|
596
|
+
`../dist/${target}`,
|
|
597
|
+
{
|
|
598
|
+
cwd: path2.join(process.cwd(), location, "src"),
|
|
599
|
+
flat: false
|
|
600
|
+
}
|
|
601
|
+
);
|
|
765
602
|
for (const value of values) {
|
|
766
603
|
console.log(`${value.split("/").pop()} => ./dist/${target}`);
|
|
767
604
|
}
|
|
@@ -770,8 +607,8 @@ var copyPackageTargetAssets = /* @__PURE__ */ __name(async (target, name, locati
|
|
|
770
607
|
console.log(`Copy Failed: ${name}: ${reason}`);
|
|
771
608
|
return 1;
|
|
772
609
|
}
|
|
773
|
-
}
|
|
774
|
-
var copyTargetAssets =
|
|
610
|
+
};
|
|
611
|
+
var copyTargetAssets = async (target, pkg) => {
|
|
775
612
|
const workspaces = yarnWorkspaces();
|
|
776
613
|
console.log(chalk12.green(`Copying Assets [${target.toUpperCase()}]`));
|
|
777
614
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
@@ -780,15 +617,17 @@ var copyTargetAssets = /* @__PURE__ */ __name(async (target, pkg) => {
|
|
|
780
617
|
if (workspaceList.length === 0) {
|
|
781
618
|
console.error(`Package not found [${pkg}]`);
|
|
782
619
|
} else {
|
|
783
|
-
const results = await Promise.all(
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
620
|
+
const results = await Promise.all(
|
|
621
|
+
workspaceList.map(async (workspace) => {
|
|
622
|
+
const { location, name } = workspace;
|
|
623
|
+
return await copyPackageTargetAssets(target, name, location);
|
|
624
|
+
})
|
|
625
|
+
);
|
|
787
626
|
return results.reduce((prev, result) => prev || result, 0);
|
|
788
627
|
}
|
|
789
628
|
return 0;
|
|
790
|
-
}
|
|
791
|
-
var copyAssets =
|
|
629
|
+
};
|
|
630
|
+
var copyAssets = async ({ target, pkg }) => {
|
|
792
631
|
switch (target) {
|
|
793
632
|
case "esm": {
|
|
794
633
|
return await copyTargetAssets("esm", pkg);
|
|
@@ -800,38 +639,21 @@ var copyAssets = /* @__PURE__ */ __name(async ({ target, pkg }) => {
|
|
|
800
639
|
return await copyTargetAssets("esm", pkg) || await copyTargetAssets("cjs", pkg);
|
|
801
640
|
}
|
|
802
641
|
}
|
|
803
|
-
}
|
|
642
|
+
};
|
|
804
643
|
|
|
805
644
|
// src/actions/cycle.ts
|
|
806
645
|
import { cruise } from "dependency-cruiser";
|
|
807
|
-
var cycle =
|
|
808
|
-
return pkg ? cyclePackage({
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
] : [
|
|
819
|
-
"--no-verbose"
|
|
820
|
-
];
|
|
821
|
-
return runSteps(`Cycle [${pkg}]`, [
|
|
822
|
-
[
|
|
823
|
-
"yarn",
|
|
824
|
-
[
|
|
825
|
-
"workspace",
|
|
826
|
-
pkg,
|
|
827
|
-
"run",
|
|
828
|
-
"package-cycle",
|
|
829
|
-
...verboseOptions
|
|
830
|
-
]
|
|
831
|
-
]
|
|
832
|
-
]);
|
|
833
|
-
}, "cyclePackage");
|
|
834
|
-
var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
646
|
+
var cycle = async ({ verbose, pkg } = {}) => {
|
|
647
|
+
return pkg ? cyclePackage({ pkg, verbose }) : await cycleAll({ verbose });
|
|
648
|
+
};
|
|
649
|
+
var cyclePackage = ({ pkg, verbose }) => {
|
|
650
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
651
|
+
return runSteps(
|
|
652
|
+
`Cycle [${pkg}]`,
|
|
653
|
+
[["yarn", ["workspace", pkg, "run", "package-cycle", ...verboseOptions]]]
|
|
654
|
+
);
|
|
655
|
+
};
|
|
656
|
+
var cycleAll = async ({ verbose = false }) => {
|
|
835
657
|
const pkgName = process.env.npm_package_name;
|
|
836
658
|
const cruiseOptions = {
|
|
837
659
|
ruleSet: {
|
|
@@ -841,26 +663,20 @@ var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
841
663
|
severity: "error",
|
|
842
664
|
comment: "This dependency creates a circular reference",
|
|
843
665
|
from: {},
|
|
844
|
-
to: {
|
|
845
|
-
circular: true
|
|
846
|
-
}
|
|
666
|
+
to: { circular: true }
|
|
847
667
|
}
|
|
848
668
|
]
|
|
849
669
|
},
|
|
850
670
|
exclude: "node_modules|packages/.*/packages",
|
|
851
671
|
validate: true,
|
|
852
|
-
doNotFollow: {
|
|
853
|
-
path: "node_modules|packages/.*/packages"
|
|
854
|
-
},
|
|
672
|
+
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
855
673
|
tsPreCompilationDeps: false,
|
|
856
674
|
combinedDependencies: true,
|
|
857
675
|
outputType: verbose ? "text" : "err"
|
|
858
676
|
};
|
|
859
677
|
const target = "**/src";
|
|
860
678
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
861
|
-
const result = await cruise([
|
|
862
|
-
target
|
|
863
|
-
], cruiseOptions);
|
|
679
|
+
const result = await cruise([target], cruiseOptions);
|
|
864
680
|
if (result.output) {
|
|
865
681
|
console.log(result.output);
|
|
866
682
|
}
|
|
@@ -870,21 +686,12 @@ var cycleAll = /* @__PURE__ */ __name(async ({ verbose = false }) => {
|
|
|
870
686
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
871
687
|
}
|
|
872
688
|
return result.exitCode;
|
|
873
|
-
}
|
|
689
|
+
};
|
|
874
690
|
|
|
875
691
|
// src/actions/dead.ts
|
|
876
|
-
var dead =
|
|
877
|
-
return runSteps("Dead", [
|
|
878
|
-
|
|
879
|
-
"yarn",
|
|
880
|
-
[
|
|
881
|
-
"ts-prune",
|
|
882
|
-
"-p",
|
|
883
|
-
"tsconfig.json"
|
|
884
|
-
]
|
|
885
|
-
]
|
|
886
|
-
]);
|
|
887
|
-
}, "dead");
|
|
692
|
+
var dead = () => {
|
|
693
|
+
return runSteps("Dead", [["yarn", ["ts-prune", "-p", "tsconfig.json"]]]);
|
|
694
|
+
};
|
|
888
695
|
|
|
889
696
|
// src/actions/deplint/deplint.ts
|
|
890
697
|
import chalk17 from "chalk";
|
|
@@ -892,30 +699,17 @@ import chalk17 from "chalk";
|
|
|
892
699
|
// src/actions/deplint/findFilesByGlob.ts
|
|
893
700
|
import { globSync } from "glob";
|
|
894
701
|
function findFilesByGlob(cwd5, pattern) {
|
|
895
|
-
return globSync(pattern, {
|
|
896
|
-
cwd: cwd5,
|
|
897
|
-
absolute: true
|
|
898
|
-
});
|
|
702
|
+
return globSync(pattern, { cwd: cwd5, absolute: true });
|
|
899
703
|
}
|
|
900
|
-
__name(findFilesByGlob, "findFilesByGlob");
|
|
901
704
|
|
|
902
705
|
// src/actions/deplint/findFiles.ts
|
|
903
706
|
function findFiles(path11) {
|
|
904
|
-
const allSourceInclude = [
|
|
905
|
-
|
|
906
|
-
];
|
|
907
|
-
const allDistInclude = [
|
|
908
|
-
"./dist/**/*.d.ts",
|
|
909
|
-
"./dist/**/*.{mjs,js,cjs}"
|
|
910
|
-
];
|
|
707
|
+
const allSourceInclude = ["./src/**/*.{ts,tsx}"];
|
|
708
|
+
const allDistInclude = ["./dist/**/*.d.ts", "./dist/**/*.{mjs,js,cjs}"];
|
|
911
709
|
const srcFiles = allSourceInclude.flatMap((pattern) => findFilesByGlob(path11, pattern));
|
|
912
710
|
const distFiles = allDistInclude.flatMap((pattern) => findFilesByGlob(path11, pattern));
|
|
913
|
-
return {
|
|
914
|
-
srcFiles,
|
|
915
|
-
distFiles
|
|
916
|
-
};
|
|
711
|
+
return { srcFiles, distFiles };
|
|
917
712
|
}
|
|
918
|
-
__name(findFiles, "findFiles");
|
|
919
713
|
|
|
920
714
|
// src/actions/deplint/getDependenciesFromPackageJson.ts
|
|
921
715
|
import fs2 from "fs";
|
|
@@ -933,7 +727,6 @@ function getDependenciesFromPackageJson(packageJsonPath) {
|
|
|
933
727
|
peerDependencies
|
|
934
728
|
};
|
|
935
729
|
}
|
|
936
|
-
__name(getDependenciesFromPackageJson, "getDependenciesFromPackageJson");
|
|
937
730
|
|
|
938
731
|
// src/actions/deplint/getImportsFromFile.ts
|
|
939
732
|
import fs3 from "fs";
|
|
@@ -949,13 +742,18 @@ function getBasePackageName(importName) {
|
|
|
949
742
|
}
|
|
950
743
|
return importNameScrubbed.split("/")[0];
|
|
951
744
|
}
|
|
952
|
-
__name(getBasePackageName, "getBasePackageName");
|
|
953
745
|
|
|
954
746
|
// src/actions/deplint/getImportsFromFile.ts
|
|
955
747
|
function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
956
748
|
const sourceCode = fs3.readFileSync(filePath, "utf8");
|
|
957
749
|
const isMjsFile = filePath.endsWith(".mjs");
|
|
958
|
-
const sourceFile = ts.createSourceFile(
|
|
750
|
+
const sourceFile = ts.createSourceFile(
|
|
751
|
+
path4.basename(filePath),
|
|
752
|
+
sourceCode,
|
|
753
|
+
ts.ScriptTarget.Latest,
|
|
754
|
+
true,
|
|
755
|
+
isMjsFile ? ts.ScriptKind.JS : void 0
|
|
756
|
+
);
|
|
959
757
|
const imports = [];
|
|
960
758
|
const typeImports = [];
|
|
961
759
|
const isDeclarationFile = filePath.endsWith(".d.ts");
|
|
@@ -980,13 +778,8 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
980
778
|
}
|
|
981
779
|
ts.forEachChild(node, visit);
|
|
982
780
|
}
|
|
983
|
-
__name(visit, "visit");
|
|
984
781
|
visit(sourceFile);
|
|
985
|
-
const importsStartsWithExcludes = [
|
|
986
|
-
".",
|
|
987
|
-
"#",
|
|
988
|
-
"node:"
|
|
989
|
-
];
|
|
782
|
+
const importsStartsWithExcludes = [".", "#", "node:"];
|
|
990
783
|
const cleanedImports = imports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
|
|
991
784
|
const cleanedTypeImports = typeImports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
|
|
992
785
|
for (const imp of cleanedImports) {
|
|
@@ -997,22 +790,14 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
|
|
|
997
790
|
typeImportPaths[imp] = typeImportPaths[imp] ?? [];
|
|
998
791
|
typeImportPaths[imp].push(filePath);
|
|
999
792
|
}
|
|
1000
|
-
return [
|
|
1001
|
-
cleanedImports,
|
|
1002
|
-
cleanedTypeImports
|
|
1003
|
-
];
|
|
793
|
+
return [cleanedImports, cleanedTypeImports];
|
|
1004
794
|
}
|
|
1005
|
-
__name(getImportsFromFile, "getImportsFromFile");
|
|
1006
795
|
|
|
1007
796
|
// src/actions/deplint/getExternalImportsFromFiles.ts
|
|
1008
|
-
var internalImportPrefixes = [
|
|
1009
|
-
|
|
1010
|
-
"#",
|
|
1011
|
-
"node:"
|
|
1012
|
-
];
|
|
1013
|
-
var removeInternalImports = /* @__PURE__ */ __name((imports) => {
|
|
797
|
+
var internalImportPrefixes = [".", "#", "node:"];
|
|
798
|
+
var removeInternalImports = (imports) => {
|
|
1014
799
|
return imports.filter((imp) => !internalImportPrefixes.some((prefix) => imp.startsWith(prefix)));
|
|
1015
|
-
}
|
|
800
|
+
};
|
|
1016
801
|
function getExternalImportsFromFiles({ srcFiles, distFiles }) {
|
|
1017
802
|
const srcImportPaths = {};
|
|
1018
803
|
const distImportPaths = {};
|
|
@@ -1038,12 +823,15 @@ function getExternalImportsFromFiles({ srcFiles, distFiles }) {
|
|
|
1038
823
|
externalDistTypeImports
|
|
1039
824
|
};
|
|
1040
825
|
}
|
|
1041
|
-
__name(getExternalImportsFromFiles, "getExternalImportsFromFiles");
|
|
1042
826
|
|
|
1043
827
|
// src/actions/deplint/checkPackage/getUnlistedDependencies.ts
|
|
1044
828
|
import { builtinModules } from "module";
|
|
1045
829
|
import chalk13 from "chalk";
|
|
1046
|
-
function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, {
|
|
830
|
+
function getUnlistedDependencies({ name, location }, { dependencies, peerDependencies }, {
|
|
831
|
+
externalDistImports,
|
|
832
|
+
externalDistTypeImports,
|
|
833
|
+
distImportPaths
|
|
834
|
+
}) {
|
|
1047
835
|
let unlistedDependencies = 0;
|
|
1048
836
|
for (const imp of externalDistImports) {
|
|
1049
837
|
if (!dependencies.includes(imp) && imp !== name && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !builtinModules.includes(imp) && !builtinModules.includes(`@types/${imp}`)) {
|
|
@@ -1066,12 +854,19 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
|
|
|
1066
854
|
}
|
|
1067
855
|
return unlistedDependencies;
|
|
1068
856
|
}
|
|
1069
|
-
__name(getUnlistedDependencies, "getUnlistedDependencies");
|
|
1070
857
|
|
|
1071
858
|
// src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
|
|
1072
859
|
import { builtinModules as builtinModules2 } from "module";
|
|
1073
860
|
import chalk14 from "chalk";
|
|
1074
|
-
function getUnlistedDevDependencies({ name, location }, {
|
|
861
|
+
function getUnlistedDevDependencies({ name, location }, {
|
|
862
|
+
devDependencies,
|
|
863
|
+
dependencies,
|
|
864
|
+
peerDependencies
|
|
865
|
+
}, {
|
|
866
|
+
srcImportPaths,
|
|
867
|
+
externalSrcImports,
|
|
868
|
+
distImports
|
|
869
|
+
}) {
|
|
1075
870
|
let unlistedDevDependencies = 0;
|
|
1076
871
|
for (const imp of externalSrcImports) {
|
|
1077
872
|
if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
|
|
@@ -1087,11 +882,14 @@ function getUnlistedDevDependencies({ name, location }, { devDependencies, depen
|
|
|
1087
882
|
}
|
|
1088
883
|
return unlistedDevDependencies;
|
|
1089
884
|
}
|
|
1090
|
-
__name(getUnlistedDevDependencies, "getUnlistedDevDependencies");
|
|
1091
885
|
|
|
1092
886
|
// src/actions/deplint/checkPackage/getUnusedDependencies.ts
|
|
1093
887
|
import chalk15 from "chalk";
|
|
1094
|
-
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
888
|
+
function getUnusedDependencies({ name, location }, { dependencies }, {
|
|
889
|
+
externalDistImports,
|
|
890
|
+
externalDistTypeImports,
|
|
891
|
+
externalSrcImports
|
|
892
|
+
}) {
|
|
1095
893
|
let unusedDependencies = 0;
|
|
1096
894
|
for (const dep of dependencies) {
|
|
1097
895
|
if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
|
|
@@ -1110,7 +908,6 @@ function getUnusedDependencies({ name, location }, { dependencies }, { externalD
|
|
|
1110
908
|
}
|
|
1111
909
|
return unusedDependencies;
|
|
1112
910
|
}
|
|
1113
|
-
__name(getUnusedDependencies, "getUnusedDependencies");
|
|
1114
911
|
|
|
1115
912
|
// src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
|
|
1116
913
|
import chalk16 from "chalk";
|
|
@@ -1133,10 +930,16 @@ function getUnusedPeerDependencies({ name, location }, { peerDependencies, depen
|
|
|
1133
930
|
}
|
|
1134
931
|
return unusedDependencies;
|
|
1135
932
|
}
|
|
1136
|
-
__name(getUnusedPeerDependencies, "getUnusedPeerDependencies");
|
|
1137
933
|
|
|
1138
934
|
// src/actions/deplint/checkPackage/checkPackage.ts
|
|
1139
|
-
function checkPackage({
|
|
935
|
+
function checkPackage({
|
|
936
|
+
name,
|
|
937
|
+
location,
|
|
938
|
+
deps = false,
|
|
939
|
+
devDeps = false,
|
|
940
|
+
peerDeps = false,
|
|
941
|
+
verbose = false
|
|
942
|
+
}) {
|
|
1140
943
|
const { srcFiles, distFiles } = findFiles(location);
|
|
1141
944
|
if (verbose) {
|
|
1142
945
|
console.info(`Checking package: ${name} at ${location}`);
|
|
@@ -1151,34 +954,24 @@ function checkPackage({ name, location, deps = false, devDeps = false, peerDeps
|
|
|
1151
954
|
const checkDeps = deps || !(deps || devDeps || peerDeps);
|
|
1152
955
|
const checkDevDeps = devDeps || !(deps || devDeps || peerDeps);
|
|
1153
956
|
const checkPeerDeps = peerDeps;
|
|
1154
|
-
const sourceParams = getExternalImportsFromFiles({
|
|
1155
|
-
srcFiles,
|
|
1156
|
-
distFiles
|
|
1157
|
-
});
|
|
957
|
+
const sourceParams = getExternalImportsFromFiles({ srcFiles, distFiles });
|
|
1158
958
|
const packageParams = getDependenciesFromPackageJson(`${location}/package.json`);
|
|
1159
|
-
const unlistedDependencies = checkDeps ? getUnlistedDependencies({
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
}, packageParams, sourceParams) : 0;
|
|
1163
|
-
const unusedDependencies = checkDeps ? getUnusedDependencies({
|
|
1164
|
-
name,
|
|
1165
|
-
location
|
|
1166
|
-
}, packageParams, sourceParams) : 0;
|
|
1167
|
-
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({
|
|
1168
|
-
name,
|
|
1169
|
-
location
|
|
1170
|
-
}, packageParams, sourceParams) : 0;
|
|
1171
|
-
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({
|
|
1172
|
-
name,
|
|
1173
|
-
location
|
|
1174
|
-
}, packageParams, sourceParams) : 0;
|
|
959
|
+
const unlistedDependencies = checkDeps ? getUnlistedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
960
|
+
const unusedDependencies = checkDeps ? getUnusedDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
961
|
+
const unlistedDevDependencies = checkDevDeps ? getUnlistedDevDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
962
|
+
const unusedPeerDependencies = checkPeerDeps ? getUnusedPeerDependencies({ name, location }, packageParams, sourceParams) : 0;
|
|
1175
963
|
const totalErrors = unlistedDependencies + unlistedDevDependencies + unusedDependencies + unusedPeerDependencies;
|
|
1176
964
|
return totalErrors;
|
|
1177
965
|
}
|
|
1178
|
-
__name(checkPackage, "checkPackage");
|
|
1179
966
|
|
|
1180
967
|
// src/actions/deplint/deplint.ts
|
|
1181
|
-
var deplint =
|
|
968
|
+
var deplint = ({
|
|
969
|
+
pkg,
|
|
970
|
+
deps,
|
|
971
|
+
devDeps,
|
|
972
|
+
peerDeps,
|
|
973
|
+
verbose
|
|
974
|
+
}) => {
|
|
1182
975
|
let totalErrors = 0;
|
|
1183
976
|
if (pkg === void 0) {
|
|
1184
977
|
const workspaces = yarnWorkspaces();
|
|
@@ -1210,297 +1003,183 @@ var deplint = /* @__PURE__ */ __name(({ pkg, deps, devDeps, peerDeps, verbose })
|
|
|
1210
1003
|
console.info(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
|
|
1211
1004
|
}
|
|
1212
1005
|
return 0;
|
|
1213
|
-
}
|
|
1006
|
+
};
|
|
1214
1007
|
|
|
1215
1008
|
// src/actions/deploy.ts
|
|
1216
1009
|
import { readFileSync as readFileSync5 } from "fs";
|
|
1217
|
-
var privatePackageExcludeList =
|
|
1010
|
+
var privatePackageExcludeList = () => {
|
|
1218
1011
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1219
1012
|
workspace,
|
|
1220
|
-
JSON.parse(readFileSync5(`${workspace.location}/package.json`, {
|
|
1221
|
-
encoding: "utf8"
|
|
1222
|
-
}))
|
|
1013
|
+
JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1223
1014
|
]);
|
|
1224
1015
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1225
1016
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1226
1017
|
return excludeList;
|
|
1227
|
-
}
|
|
1228
|
-
var deploy =
|
|
1018
|
+
};
|
|
1019
|
+
var deploy = () => {
|
|
1229
1020
|
const excludeList = privatePackageExcludeList();
|
|
1230
1021
|
if (excludeList.length > 0) {
|
|
1231
1022
|
console.log("Excluding private packages from deployment:", excludeList);
|
|
1232
1023
|
}
|
|
1233
1024
|
return runSteps("Deploy [Patch]", [
|
|
1234
|
-
[
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
],
|
|
1238
|
-
[
|
|
1239
|
-
"yarn",
|
|
1240
|
-
"xy clean"
|
|
1241
|
-
],
|
|
1242
|
-
[
|
|
1243
|
-
"yarn",
|
|
1244
|
-
"xy build"
|
|
1245
|
-
],
|
|
1246
|
-
[
|
|
1247
|
-
"yarn",
|
|
1248
|
-
"version apply --all"
|
|
1249
|
-
],
|
|
1250
|
-
[
|
|
1251
|
-
"yarn",
|
|
1252
|
-
`workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`
|
|
1253
|
-
]
|
|
1025
|
+
["yarn", "workspaces foreach --all version patch --deferred"],
|
|
1026
|
+
["yarn", "xy clean"],
|
|
1027
|
+
["yarn", "xy build"],
|
|
1028
|
+
["yarn", "version apply --all"],
|
|
1029
|
+
["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
|
|
1254
1030
|
]);
|
|
1255
|
-
}
|
|
1031
|
+
};
|
|
1256
1032
|
|
|
1257
1033
|
// src/actions/deploy-major.ts
|
|
1258
1034
|
import { readFileSync as readFileSync6 } from "fs";
|
|
1259
|
-
var privatePackageExcludeList2 =
|
|
1035
|
+
var privatePackageExcludeList2 = () => {
|
|
1260
1036
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1261
1037
|
workspace,
|
|
1262
|
-
JSON.parse(readFileSync6(`${workspace.location}/package.json`, {
|
|
1263
|
-
encoding: "utf8"
|
|
1264
|
-
}))
|
|
1038
|
+
JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1265
1039
|
]);
|
|
1266
1040
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1267
1041
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1268
1042
|
return excludeList;
|
|
1269
|
-
}
|
|
1270
|
-
var deployMajor =
|
|
1043
|
+
};
|
|
1044
|
+
var deployMajor = () => {
|
|
1271
1045
|
const excludeList = privatePackageExcludeList2();
|
|
1272
1046
|
if (excludeList.length > 0) {
|
|
1273
1047
|
console.log("Excluding private packages from deployment:", excludeList);
|
|
1274
1048
|
}
|
|
1275
1049
|
return runSteps("Deploy [Major]", [
|
|
1276
|
-
[
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
],
|
|
1280
|
-
[
|
|
1281
|
-
"yarn",
|
|
1282
|
-
"xy clean"
|
|
1283
|
-
],
|
|
1284
|
-
[
|
|
1285
|
-
"yarn",
|
|
1286
|
-
"xy build"
|
|
1287
|
-
],
|
|
1288
|
-
[
|
|
1289
|
-
"yarn",
|
|
1290
|
-
"version apply --all"
|
|
1291
|
-
],
|
|
1292
|
-
[
|
|
1293
|
-
"yarn",
|
|
1294
|
-
`workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`
|
|
1295
|
-
]
|
|
1050
|
+
["yarn", "workspaces foreach --all version major --deferred"],
|
|
1051
|
+
["yarn", "xy clean"],
|
|
1052
|
+
["yarn", "xy build"],
|
|
1053
|
+
["yarn", "version apply --all"],
|
|
1054
|
+
["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
|
|
1296
1055
|
]);
|
|
1297
|
-
}
|
|
1056
|
+
};
|
|
1298
1057
|
|
|
1299
1058
|
// src/actions/deploy-minor.ts
|
|
1300
1059
|
import { readFileSync as readFileSync7 } from "fs";
|
|
1301
|
-
var privatePackageExcludeList3 =
|
|
1060
|
+
var privatePackageExcludeList3 = () => {
|
|
1302
1061
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1303
1062
|
workspace,
|
|
1304
|
-
JSON.parse(readFileSync7(`${workspace.location}/package.json`, {
|
|
1305
|
-
encoding: "utf8"
|
|
1306
|
-
}))
|
|
1063
|
+
JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1307
1064
|
]);
|
|
1308
1065
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1309
1066
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1310
1067
|
return excludeList;
|
|
1311
|
-
}
|
|
1312
|
-
var deployMinor =
|
|
1068
|
+
};
|
|
1069
|
+
var deployMinor = () => {
|
|
1313
1070
|
const excludeList = privatePackageExcludeList3();
|
|
1314
1071
|
if (excludeList.length > 0) {
|
|
1315
1072
|
console.log("Excluding private packages from deployment:", excludeList);
|
|
1316
1073
|
}
|
|
1317
1074
|
return runSteps("Deploy [Minor]", [
|
|
1318
|
-
[
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
],
|
|
1322
|
-
[
|
|
1323
|
-
"yarn",
|
|
1324
|
-
"xy clean"
|
|
1325
|
-
],
|
|
1326
|
-
[
|
|
1327
|
-
"yarn",
|
|
1328
|
-
"xy build"
|
|
1329
|
-
],
|
|
1330
|
-
[
|
|
1331
|
-
"yarn",
|
|
1332
|
-
"version apply --all"
|
|
1333
|
-
],
|
|
1334
|
-
[
|
|
1335
|
-
"yarn",
|
|
1336
|
-
`workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`
|
|
1337
|
-
]
|
|
1075
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
1076
|
+
["yarn", "xy clean"],
|
|
1077
|
+
["yarn", "xy build"],
|
|
1078
|
+
["yarn", "version apply --all"],
|
|
1079
|
+
["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish`]
|
|
1338
1080
|
]);
|
|
1339
|
-
}
|
|
1081
|
+
};
|
|
1340
1082
|
|
|
1341
1083
|
// src/actions/deploy-next.ts
|
|
1342
1084
|
import { readFileSync as readFileSync8 } from "fs";
|
|
1343
|
-
var privatePackageExcludeList4 =
|
|
1085
|
+
var privatePackageExcludeList4 = () => {
|
|
1344
1086
|
const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
|
|
1345
1087
|
workspace,
|
|
1346
|
-
JSON.parse(readFileSync8(`${workspace.location}/package.json`, {
|
|
1347
|
-
encoding: "utf8"
|
|
1348
|
-
}))
|
|
1088
|
+
JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
|
|
1349
1089
|
]);
|
|
1350
1090
|
const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
|
|
1351
1091
|
const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
|
|
1352
1092
|
return excludeList;
|
|
1353
|
-
}
|
|
1354
|
-
var deployNext =
|
|
1093
|
+
};
|
|
1094
|
+
var deployNext = () => {
|
|
1355
1095
|
const excludeList = privatePackageExcludeList4();
|
|
1356
1096
|
if (excludeList.length > 0) {
|
|
1357
1097
|
console.log("Excluding private packages from deployment:", excludeList);
|
|
1358
1098
|
}
|
|
1359
1099
|
return runSteps("Deploy [Next]", [
|
|
1360
|
-
[
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
],
|
|
1364
|
-
[
|
|
1365
|
-
"yarn",
|
|
1366
|
-
"xy clean"
|
|
1367
|
-
],
|
|
1368
|
-
[
|
|
1369
|
-
"yarn",
|
|
1370
|
-
"xy build"
|
|
1371
|
-
],
|
|
1372
|
-
[
|
|
1373
|
-
"yarn",
|
|
1374
|
-
"version apply --all --prerelease"
|
|
1375
|
-
],
|
|
1376
|
-
[
|
|
1377
|
-
"yarn",
|
|
1378
|
-
`workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish --tag next`
|
|
1379
|
-
]
|
|
1100
|
+
["yarn", "workspaces foreach --all version minor --deferred"],
|
|
1101
|
+
["yarn", "xy clean"],
|
|
1102
|
+
["yarn", "xy build"],
|
|
1103
|
+
["yarn", "version apply --all --prerelease"],
|
|
1104
|
+
["yarn", `workspaces foreach --all ${excludeList.join(" ")} --parallel npm publish --tag next`]
|
|
1380
1105
|
]);
|
|
1381
|
-
}
|
|
1106
|
+
};
|
|
1382
1107
|
|
|
1383
1108
|
// src/actions/dupdeps.ts
|
|
1384
1109
|
import chalk18 from "chalk";
|
|
1385
|
-
var dupdeps =
|
|
1110
|
+
var dupdeps = () => {
|
|
1386
1111
|
console.log(chalk18.green("Checking all Dependencies for Duplicates"));
|
|
1387
1112
|
const allDependencies = parsedPackageJSON()?.dependencies;
|
|
1388
1113
|
const dependencies = Object.entries(allDependencies).map(([k]) => k);
|
|
1389
1114
|
return detectDuplicateDependencies(dependencies);
|
|
1390
|
-
}
|
|
1115
|
+
};
|
|
1391
1116
|
|
|
1392
1117
|
// src/actions/lint.ts
|
|
1393
1118
|
import chalk19 from "chalk";
|
|
1394
|
-
var lintPackage =
|
|
1119
|
+
var lintPackage = ({ pkg, fix: fix2 }) => {
|
|
1395
1120
|
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
|
|
1396
1121
|
const start = Date.now();
|
|
1397
1122
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
|
|
1398
|
-
[
|
|
1399
|
-
"
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
fix2 ? "package-fix" : "package-lint"
|
|
1405
|
-
]
|
|
1406
|
-
]
|
|
1123
|
+
["yarn", [
|
|
1124
|
+
"workspace",
|
|
1125
|
+
pkg,
|
|
1126
|
+
"run",
|
|
1127
|
+
fix2 ? "package-fix" : "package-lint"
|
|
1128
|
+
]]
|
|
1407
1129
|
]);
|
|
1408
1130
|
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
1409
1131
|
return result;
|
|
1410
|
-
}
|
|
1411
|
-
var lint =
|
|
1132
|
+
};
|
|
1133
|
+
var lint = ({
|
|
1134
|
+
pkg,
|
|
1135
|
+
verbose,
|
|
1136
|
+
incremental,
|
|
1137
|
+
fix: fix2
|
|
1138
|
+
} = {}) => {
|
|
1412
1139
|
return pkg === void 0 ? lintAllPackages({
|
|
1413
1140
|
verbose,
|
|
1414
1141
|
incremental,
|
|
1415
1142
|
fix: fix2
|
|
1416
|
-
}) : lintPackage({
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
});
|
|
1420
|
-
}, "lint");
|
|
1421
|
-
var lintAllPackages = /* @__PURE__ */ __name(({ fix: fix2 = false } = {}) => {
|
|
1143
|
+
}) : lintPackage({ pkg, fix: fix2 });
|
|
1144
|
+
};
|
|
1145
|
+
var lintAllPackages = ({ fix: fix2 = false } = {}) => {
|
|
1422
1146
|
console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
|
|
1423
1147
|
const start = Date.now();
|
|
1424
|
-
const fixOptions = fix2 ? [
|
|
1425
|
-
"--fix"
|
|
1426
|
-
] : [];
|
|
1148
|
+
const fixOptions = fix2 ? ["--fix"] : [];
|
|
1427
1149
|
const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
|
|
1428
|
-
[
|
|
1429
|
-
"yarn",
|
|
1430
|
-
[
|
|
1431
|
-
"eslint",
|
|
1432
|
-
...fixOptions
|
|
1433
|
-
]
|
|
1434
|
-
]
|
|
1150
|
+
["yarn", ["eslint", ...fixOptions]]
|
|
1435
1151
|
]);
|
|
1436
1152
|
console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
|
|
1437
1153
|
return result;
|
|
1438
|
-
}
|
|
1154
|
+
};
|
|
1439
1155
|
|
|
1440
1156
|
// src/actions/fix.ts
|
|
1441
|
-
var fix =
|
|
1442
|
-
return lint({
|
|
1443
|
-
|
|
1444
|
-
fix: true
|
|
1445
|
-
});
|
|
1446
|
-
}, "fix");
|
|
1157
|
+
var fix = (params) => {
|
|
1158
|
+
return lint({ ...params, fix: true });
|
|
1159
|
+
};
|
|
1447
1160
|
|
|
1448
1161
|
// src/actions/gen-docs.ts
|
|
1449
|
-
var genDocs =
|
|
1450
|
-
return pkg ? genDocsPackage({
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
var
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
"workspace",
|
|
1462
|
-
pkg,
|
|
1463
|
-
"run",
|
|
1464
|
-
"package-gen-docs"
|
|
1465
|
-
]
|
|
1466
|
-
]
|
|
1467
|
-
];
|
|
1468
|
-
return runSteps(`GenDocs [${pkg}]`, [
|
|
1469
|
-
...steps
|
|
1470
|
-
]);
|
|
1471
|
-
}, "genDocsPackage");
|
|
1472
|
-
var genDocsAll = /* @__PURE__ */ __name(({ incremental }) => {
|
|
1473
|
-
const incrementalOptions = incremental ? [
|
|
1474
|
-
"--since",
|
|
1475
|
-
"-pA"
|
|
1476
|
-
] : [
|
|
1477
|
-
"-pA"
|
|
1478
|
-
];
|
|
1479
|
-
const steps = [
|
|
1480
|
-
[
|
|
1481
|
-
"yarn",
|
|
1482
|
-
[
|
|
1483
|
-
"workspaces",
|
|
1484
|
-
"foreach",
|
|
1485
|
-
...incrementalOptions,
|
|
1486
|
-
"run",
|
|
1487
|
-
"package-gen-docs"
|
|
1488
|
-
]
|
|
1489
|
-
]
|
|
1490
|
-
];
|
|
1491
|
-
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [
|
|
1492
|
-
...steps
|
|
1493
|
-
]);
|
|
1494
|
-
}, "genDocsAll");
|
|
1162
|
+
var genDocs = ({ pkg, incremental }) => {
|
|
1163
|
+
return pkg ? genDocsPackage({ pkg }) : genDocsAll({ incremental });
|
|
1164
|
+
};
|
|
1165
|
+
var genDocsPackage = ({ pkg }) => {
|
|
1166
|
+
const steps = [["yarn", ["workspace", pkg, "run", "package-gen-docs"]]];
|
|
1167
|
+
return runSteps(`GenDocs [${pkg}]`, [...steps]);
|
|
1168
|
+
};
|
|
1169
|
+
var genDocsAll = ({ incremental }) => {
|
|
1170
|
+
const incrementalOptions = incremental ? ["--since", "-pA"] : ["-pA"];
|
|
1171
|
+
const steps = [["yarn", ["workspaces", "foreach", ...incrementalOptions, "run", "package-gen-docs"]]];
|
|
1172
|
+
return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [...steps]);
|
|
1173
|
+
};
|
|
1495
1174
|
|
|
1496
1175
|
// src/actions/gitignore-gen.ts
|
|
1497
1176
|
var filename = ".gitignore";
|
|
1498
|
-
var gitignoreGen =
|
|
1177
|
+
var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
|
|
1499
1178
|
|
|
1500
1179
|
// src/actions/gitlint.ts
|
|
1501
1180
|
import chalk20 from "chalk";
|
|
1502
1181
|
import ParseGitConfig from "parse-git-config";
|
|
1503
|
-
var gitlint =
|
|
1182
|
+
var gitlint = () => {
|
|
1504
1183
|
console.log(`
|
|
1505
1184
|
Gitlint Start [${process.cwd()}]
|
|
1506
1185
|
`);
|
|
@@ -1508,10 +1187,10 @@ Gitlint Start [${process.cwd()}]
|
|
|
1508
1187
|
let warnings = 0;
|
|
1509
1188
|
const errors = 0;
|
|
1510
1189
|
const gitConfig = ParseGitConfig.sync();
|
|
1511
|
-
const warn =
|
|
1190
|
+
const warn = (message) => {
|
|
1512
1191
|
console.warn(chalk20.yellow(`Warning: ${message}`));
|
|
1513
1192
|
warnings++;
|
|
1514
|
-
}
|
|
1193
|
+
};
|
|
1515
1194
|
if (gitConfig.core.ignorecase) {
|
|
1516
1195
|
warn("Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]");
|
|
1517
1196
|
} else {
|
|
@@ -1540,56 +1219,41 @@ Gitlint Start [${process.cwd()}]
|
|
|
1540
1219
|
console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
|
|
1541
1220
|
`);
|
|
1542
1221
|
return warnings + errors === 0 ? 1 : 0;
|
|
1543
|
-
}
|
|
1222
|
+
};
|
|
1544
1223
|
|
|
1545
1224
|
// src/actions/gitlint-fix.ts
|
|
1546
1225
|
import { execSync as execSync2 } from "child_process";
|
|
1547
1226
|
import chalk21 from "chalk";
|
|
1548
1227
|
import ParseGitConfig2 from "parse-git-config";
|
|
1549
|
-
var gitlintFix =
|
|
1228
|
+
var gitlintFix = () => {
|
|
1550
1229
|
console.log(`
|
|
1551
1230
|
Gitlint Fix Start [${process.cwd()}]
|
|
1552
1231
|
`);
|
|
1553
1232
|
const gitConfig = ParseGitConfig2.sync();
|
|
1554
1233
|
if (gitConfig.core.ignorecase) {
|
|
1555
|
-
execSync2("git config core.ignorecase false", {
|
|
1556
|
-
stdio: "inherit"
|
|
1557
|
-
});
|
|
1234
|
+
execSync2("git config core.ignorecase false", { stdio: "inherit" });
|
|
1558
1235
|
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
|
|
1559
1236
|
}
|
|
1560
1237
|
if (gitConfig.core.autocrlf !== false) {
|
|
1561
|
-
execSync2("git config core.autocrlf false", {
|
|
1562
|
-
stdio: "inherit"
|
|
1563
|
-
});
|
|
1238
|
+
execSync2("git config core.autocrlf false", { stdio: "inherit" });
|
|
1564
1239
|
console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
|
|
1565
1240
|
}
|
|
1566
1241
|
if (gitConfig.core.eol !== "lf") {
|
|
1567
|
-
execSync2("git config core.eol lf", {
|
|
1568
|
-
stdio: "inherit"
|
|
1569
|
-
});
|
|
1242
|
+
execSync2("git config core.eol lf", { stdio: "inherit" });
|
|
1570
1243
|
console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
|
|
1571
1244
|
}
|
|
1572
1245
|
return 1;
|
|
1573
|
-
}
|
|
1246
|
+
};
|
|
1574
1247
|
|
|
1575
1248
|
// src/actions/knip.ts
|
|
1576
|
-
var knip =
|
|
1577
|
-
return runSteps("Knip", [
|
|
1578
|
-
|
|
1579
|
-
"yarn",
|
|
1580
|
-
[
|
|
1581
|
-
"knip",
|
|
1582
|
-
"--dependencies",
|
|
1583
|
-
"--no-exit-code"
|
|
1584
|
-
]
|
|
1585
|
-
]
|
|
1586
|
-
]);
|
|
1587
|
-
}, "knip");
|
|
1249
|
+
var knip = () => {
|
|
1250
|
+
return runSteps("Knip", [["yarn", ["knip", "--dependencies", "--no-exit-code"]]]);
|
|
1251
|
+
};
|
|
1588
1252
|
|
|
1589
1253
|
// src/actions/license.ts
|
|
1590
1254
|
import chalk22 from "chalk";
|
|
1591
1255
|
import { init } from "license-checker";
|
|
1592
|
-
var license =
|
|
1256
|
+
var license = async (pkg) => {
|
|
1593
1257
|
const workspaces = yarnWorkspaces();
|
|
1594
1258
|
const workspaceList = workspaces.filter(({ name }) => {
|
|
1595
1259
|
return pkg === void 0 || name === pkg;
|
|
@@ -1613,96 +1277,82 @@ var license = /* @__PURE__ */ __name(async (pkg) => {
|
|
|
1613
1277
|
"Python-2.0"
|
|
1614
1278
|
]);
|
|
1615
1279
|
console.log(chalk22.green("License Checker"));
|
|
1616
|
-
return (await Promise.all(
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
production: true,
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
if (
|
|
1641
|
-
|
|
1280
|
+
return (await Promise.all(
|
|
1281
|
+
workspaceList.map(({ location, name }) => {
|
|
1282
|
+
return new Promise((resolve) => {
|
|
1283
|
+
init({ production: true, start: location }, (error, packages) => {
|
|
1284
|
+
if (error) {
|
|
1285
|
+
console.error(chalk22.red(`License Checker [${name}] Error`));
|
|
1286
|
+
console.error(chalk22.gray(error));
|
|
1287
|
+
console.log("\n");
|
|
1288
|
+
resolve(1);
|
|
1289
|
+
} else {
|
|
1290
|
+
console.log(chalk22.green(`License Checker [${name}]`));
|
|
1291
|
+
let count = 0;
|
|
1292
|
+
for (const [name2, info] of Object.entries(packages)) {
|
|
1293
|
+
const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
|
|
1294
|
+
for (let license2 of licenses) {
|
|
1295
|
+
if (license2) {
|
|
1296
|
+
const processedLicense = license2[0] === "(" && license2.at(-1) === ")" ? license2.slice(1, -2) : license2;
|
|
1297
|
+
const orLicenses = processedLicense.split(" OR ");
|
|
1298
|
+
let orLicenseFound = false;
|
|
1299
|
+
for (const orLicense of orLicenses) {
|
|
1300
|
+
if (exclude.has(orLicense)) {
|
|
1301
|
+
orLicenseFound = true;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
if (!orLicenseFound) {
|
|
1305
|
+
count++;
|
|
1306
|
+
console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1642
1307
|
}
|
|
1643
|
-
}
|
|
1644
|
-
if (!orLicenseFound) {
|
|
1645
|
-
count++;
|
|
1646
|
-
console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
|
|
1647
1308
|
}
|
|
1648
1309
|
}
|
|
1649
1310
|
}
|
|
1311
|
+
console.log("\n");
|
|
1312
|
+
resolve(count);
|
|
1650
1313
|
}
|
|
1651
|
-
|
|
1652
|
-
resolve(count);
|
|
1653
|
-
}
|
|
1314
|
+
});
|
|
1654
1315
|
});
|
|
1655
|
-
})
|
|
1656
|
-
|
|
1657
|
-
}
|
|
1316
|
+
})
|
|
1317
|
+
)).reduce((prev, value) => prev || value, 0);
|
|
1318
|
+
};
|
|
1658
1319
|
|
|
1659
1320
|
// src/actions/npmignore-gen.ts
|
|
1660
1321
|
var filename2 = ".npmignore";
|
|
1661
|
-
var npmignoreGen =
|
|
1322
|
+
var npmignoreGen = (pkg) => generateIgnoreFiles(filename2, pkg);
|
|
1662
1323
|
|
|
1663
1324
|
// src/actions/package/clean-outputs.ts
|
|
1664
1325
|
import path5 from "path";
|
|
1665
1326
|
import chalk23 from "chalk";
|
|
1666
|
-
var packageCleanOutputs =
|
|
1327
|
+
var packageCleanOutputs = () => {
|
|
1667
1328
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1668
1329
|
const pkgName = process.env.npm_package_name;
|
|
1669
|
-
const folders = [
|
|
1670
|
-
path5.join(pkg, "dist"),
|
|
1671
|
-
path5.join(pkg, "build"),
|
|
1672
|
-
path5.join(pkg, "docs")
|
|
1673
|
-
];
|
|
1330
|
+
const folders = [path5.join(pkg, "dist"), path5.join(pkg, "build"), path5.join(pkg, "docs")];
|
|
1674
1331
|
console.log(chalk23.green(`Cleaning Outputs [${pkgName}]`));
|
|
1675
1332
|
for (let folder of folders) {
|
|
1676
1333
|
deleteGlob(folder);
|
|
1677
1334
|
}
|
|
1678
1335
|
return 0;
|
|
1679
|
-
}
|
|
1336
|
+
};
|
|
1680
1337
|
|
|
1681
1338
|
// src/actions/package/clean-typescript.ts
|
|
1682
1339
|
import path6 from "path";
|
|
1683
1340
|
import chalk24 from "chalk";
|
|
1684
|
-
var packageCleanTypescript =
|
|
1341
|
+
var packageCleanTypescript = () => {
|
|
1685
1342
|
const pkg = process.env.INIT_CWD ?? ".";
|
|
1686
1343
|
const pkgName = process.env.npm_package_name;
|
|
1687
1344
|
console.log(chalk24.green(`Cleaning Typescript [${pkgName}]`));
|
|
1688
|
-
const files = [
|
|
1689
|
-
path6.join(pkg, "*.tsbuildinfo"),
|
|
1690
|
-
path6.join(pkg, ".tsconfig.*"),
|
|
1691
|
-
path6.join(pkg, ".eslintcache")
|
|
1692
|
-
];
|
|
1345
|
+
const files = [path6.join(pkg, "*.tsbuildinfo"), path6.join(pkg, ".tsconfig.*"), path6.join(pkg, ".eslintcache")];
|
|
1693
1346
|
for (let file of files) {
|
|
1694
1347
|
deleteGlob(file);
|
|
1695
1348
|
}
|
|
1696
1349
|
return 0;
|
|
1697
|
-
}
|
|
1350
|
+
};
|
|
1698
1351
|
|
|
1699
1352
|
// src/actions/package/clean.ts
|
|
1700
|
-
var packageClean =
|
|
1701
|
-
return (await Promise.all([
|
|
1702
|
-
|
|
1703
|
-
packageCleanTypescript()
|
|
1704
|
-
])).reduce((prev, value) => prev + value, 0);
|
|
1705
|
-
}, "packageClean");
|
|
1353
|
+
var packageClean = async () => {
|
|
1354
|
+
return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0);
|
|
1355
|
+
};
|
|
1706
1356
|
|
|
1707
1357
|
// src/actions/package/compile/compile.ts
|
|
1708
1358
|
import chalk29 from "chalk";
|
|
@@ -1714,38 +1364,28 @@ import { build as build2, defineConfig } from "tsup";
|
|
|
1714
1364
|
// src/actions/package/compile/inputs.ts
|
|
1715
1365
|
import chalk25 from "chalk";
|
|
1716
1366
|
import { glob as glob2 } from "glob";
|
|
1717
|
-
var getAllInputs =
|
|
1718
|
-
return [
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
if (verbose) {
|
|
1733
|
-
console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1734
|
-
}
|
|
1735
|
-
return result;
|
|
1736
|
-
})
|
|
1737
|
-
];
|
|
1738
|
-
}, "getAllInputs");
|
|
1367
|
+
var getAllInputs = (srcDir, verbose = false) => {
|
|
1368
|
+
return [...glob2.sync(`${srcDir}/**/*.ts`, { posix: true }).map((file) => {
|
|
1369
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1370
|
+
if (verbose) {
|
|
1371
|
+
console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1372
|
+
}
|
|
1373
|
+
return result;
|
|
1374
|
+
}), ...glob2.sync(`${srcDir}/**/*.tsx`, { posix: true }).map((file) => {
|
|
1375
|
+
const result = file.slice(Math.max(0, srcDir.length + 1));
|
|
1376
|
+
if (verbose) {
|
|
1377
|
+
console.log(chalk25.gray(`getAllInputs: ${JSON.stringify(result, null, 2)}`));
|
|
1378
|
+
}
|
|
1379
|
+
return result;
|
|
1380
|
+
})];
|
|
1381
|
+
};
|
|
1739
1382
|
|
|
1740
1383
|
// src/actions/package/compile/buildEntries.ts
|
|
1741
|
-
var buildEntries =
|
|
1384
|
+
var buildEntries = (srcDir, entryMode = "single", options, excludeSpecAndStories = true, verbose = false) => {
|
|
1742
1385
|
let entries = [];
|
|
1743
1386
|
switch (entryMode) {
|
|
1744
1387
|
case "platform": {
|
|
1745
|
-
entries = [
|
|
1746
|
-
"index-node.ts",
|
|
1747
|
-
"index-browser.ts"
|
|
1748
|
-
];
|
|
1388
|
+
entries = ["index-node.ts", "index-browser.ts"];
|
|
1749
1389
|
break;
|
|
1750
1390
|
}
|
|
1751
1391
|
case "all": {
|
|
@@ -1757,9 +1397,7 @@ var buildEntries = /* @__PURE__ */ __name((srcDir, entryMode = "single", options
|
|
|
1757
1397
|
break;
|
|
1758
1398
|
}
|
|
1759
1399
|
default: {
|
|
1760
|
-
entries = [
|
|
1761
|
-
"index.ts"
|
|
1762
|
-
];
|
|
1400
|
+
entries = ["index.ts"];
|
|
1763
1401
|
break;
|
|
1764
1402
|
}
|
|
1765
1403
|
}
|
|
@@ -1768,7 +1406,7 @@ var buildEntries = /* @__PURE__ */ __name((srcDir, entryMode = "single", options
|
|
|
1768
1406
|
}
|
|
1769
1407
|
if (verbose) console.log(`buildEntries [${entryMode}] ${entries.length}`);
|
|
1770
1408
|
return entries;
|
|
1771
|
-
}
|
|
1409
|
+
};
|
|
1772
1410
|
|
|
1773
1411
|
// src/actions/package/compile/deepMerge.ts
|
|
1774
1412
|
function deepMerge(target, source) {
|
|
@@ -1785,7 +1423,6 @@ function deepMerge(target, source) {
|
|
|
1785
1423
|
}
|
|
1786
1424
|
return target;
|
|
1787
1425
|
}
|
|
1788
|
-
__name(deepMerge, "deepMerge");
|
|
1789
1426
|
function deepMergeObjects(objects) {
|
|
1790
1427
|
const result = {};
|
|
1791
1428
|
for (const obj of objects) {
|
|
@@ -1793,30 +1430,39 @@ function deepMergeObjects(objects) {
|
|
|
1793
1430
|
}
|
|
1794
1431
|
return result;
|
|
1795
1432
|
}
|
|
1796
|
-
__name(deepMergeObjects, "deepMergeObjects");
|
|
1797
1433
|
|
|
1798
1434
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1799
1435
|
import { cwd as cwd2 } from "process";
|
|
1800
1436
|
import chalk26 from "chalk";
|
|
1801
1437
|
import { createProgramFromConfig } from "tsc-prog";
|
|
1802
|
-
import ts2, {
|
|
1438
|
+
import ts2, {
|
|
1439
|
+
DiagnosticCategory,
|
|
1440
|
+
formatDiagnosticsWithColorAndContext,
|
|
1441
|
+
getPreEmitDiagnostics,
|
|
1442
|
+
sys
|
|
1443
|
+
} from "typescript";
|
|
1803
1444
|
|
|
1804
1445
|
// src/actions/package/compile/getCompilerOptions.ts
|
|
1805
1446
|
import { cwd } from "process";
|
|
1806
1447
|
import deepmerge2 from "deepmerge";
|
|
1807
1448
|
import { getTsconfig } from "get-tsconfig";
|
|
1808
|
-
var getCompilerOptions =
|
|
1449
|
+
var getCompilerOptions = (options = {}, fileName = "tsconfig.json") => {
|
|
1809
1450
|
const resolvedTsConfigCompilerOptions = getTsconfig(cwd(), fileName)?.config?.compilerOptions ?? {};
|
|
1810
1451
|
return deepmerge2(resolvedTsConfigCompilerOptions, options);
|
|
1811
|
-
}
|
|
1452
|
+
};
|
|
1812
1453
|
|
|
1813
1454
|
// src/actions/package/compile/packageCompileTsc.ts
|
|
1814
|
-
var packageCompileTsc =
|
|
1455
|
+
var packageCompileTsc = (platform, entries, srcDir = "src", outDir = "dist", compilerOptionsParam, verbose = false) => {
|
|
1815
1456
|
const pkg = process.env.INIT_CWD ?? cwd2();
|
|
1816
1457
|
if (verbose) {
|
|
1817
1458
|
console.log(chalk26.cyan(`Validating code START: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1818
1459
|
}
|
|
1819
|
-
const configFilePath = ts2.findConfigFile(
|
|
1460
|
+
const configFilePath = ts2.findConfigFile(
|
|
1461
|
+
"./",
|
|
1462
|
+
// search path
|
|
1463
|
+
ts2.sys.fileExists,
|
|
1464
|
+
"tsconfig.json"
|
|
1465
|
+
);
|
|
1820
1466
|
if (configFilePath === void 0) {
|
|
1821
1467
|
throw new Error("Could not find tsconfig.json");
|
|
1822
1468
|
}
|
|
@@ -1845,17 +1491,18 @@ var packageCompileTsc = /* @__PURE__ */ __name((platform, entries, srcDir = "src
|
|
|
1845
1491
|
basePath: pkg ?? cwd2(),
|
|
1846
1492
|
compilerOptions,
|
|
1847
1493
|
files: entries.map((entry) => `${srcDir}/${entry}`),
|
|
1848
|
-
include: [
|
|
1849
|
-
`${srcDir}/**/*.*`
|
|
1850
|
-
]
|
|
1494
|
+
include: [`${srcDir}/**/*.*`]
|
|
1851
1495
|
});
|
|
1852
1496
|
const diagnostics = getPreEmitDiagnostics(program);
|
|
1853
1497
|
if (diagnostics.length > 0) {
|
|
1854
|
-
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1498
|
+
const formattedDiagnostics = formatDiagnosticsWithColorAndContext(
|
|
1499
|
+
diagnostics,
|
|
1500
|
+
{
|
|
1501
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
1502
|
+
getCurrentDirectory: () => srcDir,
|
|
1503
|
+
getNewLine: () => sys.newLine
|
|
1504
|
+
}
|
|
1505
|
+
);
|
|
1859
1506
|
console.error(formattedDiagnostics);
|
|
1860
1507
|
}
|
|
1861
1508
|
program.emit();
|
|
@@ -1867,7 +1514,7 @@ var packageCompileTsc = /* @__PURE__ */ __name((platform, entries, srcDir = "src
|
|
|
1867
1514
|
console.log(chalk26.cyan(`Validating code FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1868
1515
|
}
|
|
1869
1516
|
}
|
|
1870
|
-
}
|
|
1517
|
+
};
|
|
1871
1518
|
|
|
1872
1519
|
// src/actions/package/compile/packageCompileTscTypes.ts
|
|
1873
1520
|
import path7 from "path";
|
|
@@ -1876,31 +1523,23 @@ import chalk27 from "chalk";
|
|
|
1876
1523
|
import { rollup } from "rollup";
|
|
1877
1524
|
import dts from "rollup-plugin-dts";
|
|
1878
1525
|
import nodeExternals from "rollup-plugin-node-externals";
|
|
1879
|
-
var ignoredWarningCodes = /* @__PURE__ */ new Set([
|
|
1880
|
-
"EMPTY_BUNDLE",
|
|
1881
|
-
"UNRESOLVED_IMPORT"
|
|
1882
|
-
]);
|
|
1526
|
+
var ignoredWarningCodes = /* @__PURE__ */ new Set(["EMPTY_BUNDLE", "UNRESOLVED_IMPORT"]);
|
|
1883
1527
|
async function bundleDts(inputPath, outputPath, platform, options, verbose = false) {
|
|
1884
1528
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1885
1529
|
const tsconfigPath = path7.resolve(pkg, "tsconfig.json");
|
|
1886
|
-
const nodePlugIns = platform === "node" ? [
|
|
1887
|
-
nodeExternals()
|
|
1888
|
-
] : [];
|
|
1530
|
+
const nodePlugIns = platform === "node" ? [nodeExternals()] : [];
|
|
1889
1531
|
try {
|
|
1890
1532
|
const bundle = await rollup({
|
|
1891
1533
|
input: inputPath,
|
|
1892
|
-
plugins: [
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
}),
|
|
1902
|
-
...nodePlugIns
|
|
1903
|
-
],
|
|
1534
|
+
plugins: [dts({
|
|
1535
|
+
...options,
|
|
1536
|
+
tsconfig: tsconfigPath,
|
|
1537
|
+
compilerOptions: {
|
|
1538
|
+
emitDeclarationOnly: true,
|
|
1539
|
+
noEmit: false,
|
|
1540
|
+
declarationMap: true
|
|
1541
|
+
}
|
|
1542
|
+
}), ...nodePlugIns],
|
|
1904
1543
|
onwarn(warning, warn) {
|
|
1905
1544
|
if (ignoredWarningCodes.has(warning.code ?? "")) {
|
|
1906
1545
|
return;
|
|
@@ -1923,22 +1562,18 @@ async function bundleDts(inputPath, outputPath, platform, options, verbose = fal
|
|
|
1923
1562
|
console.log(`Bundled declarations written to ${outputPath}`);
|
|
1924
1563
|
}
|
|
1925
1564
|
}
|
|
1926
|
-
|
|
1927
|
-
var packageCompileTscTypes = /* @__PURE__ */ __name(async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1565
|
+
var packageCompileTscTypes = async (entries, outDir, platform, srcDir = "build", verbose = false) => {
|
|
1928
1566
|
if (verbose) {
|
|
1929
1567
|
console.log(chalk27.cyan(`Compiling Types START [${platform}]: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1930
1568
|
console.log(`Entries: ${entries.join(", ")}`);
|
|
1931
1569
|
}
|
|
1932
1570
|
const pkg = process.env.INIT_CWD ?? cwd3();
|
|
1933
1571
|
const srcRoot = `${pkg}/${srcDir}/${platform}`;
|
|
1934
|
-
const entryNameToTypeName =
|
|
1572
|
+
const entryNameToTypeName = (entry) => {
|
|
1935
1573
|
const splitEntryName = entry.split(".");
|
|
1936
1574
|
const newEntryExtension = "d." + splitEntryName.at(-1);
|
|
1937
|
-
return [
|
|
1938
|
-
|
|
1939
|
-
newEntryExtension
|
|
1940
|
-
].join(".");
|
|
1941
|
-
}, "entryNameToTypeName");
|
|
1575
|
+
return [...splitEntryName.slice(0, -1), newEntryExtension].join(".");
|
|
1576
|
+
};
|
|
1942
1577
|
const compilerOptions = getCompilerOptions({
|
|
1943
1578
|
removeComments: false,
|
|
1944
1579
|
skipDefaultLibCheck: true,
|
|
@@ -1950,18 +1585,16 @@ var packageCompileTscTypes = /* @__PURE__ */ __name(async (entries, outDir, plat
|
|
|
1950
1585
|
const entryNames = entries.map((entry) => entry.split(`${srcDir}/`).at(-1) ?? entry);
|
|
1951
1586
|
await Promise.all(entryNames.map(async (entryName) => {
|
|
1952
1587
|
const entryTypeName = entryNameToTypeName(entryName);
|
|
1953
|
-
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, {
|
|
1954
|
-
compilerOptions
|
|
1955
|
-
}, verbose);
|
|
1588
|
+
await bundleDts(`${srcRoot}/${entryTypeName}`, `${outDir}/${entryTypeName}`, platform, { compilerOptions }, verbose);
|
|
1956
1589
|
}));
|
|
1957
1590
|
if (verbose) {
|
|
1958
1591
|
console.log(chalk27.cyan(`Compiling Types FINISH: ${entries.length} files to ${outDir} from ${srcDir}`));
|
|
1959
1592
|
}
|
|
1960
1593
|
return 0;
|
|
1961
|
-
}
|
|
1594
|
+
};
|
|
1962
1595
|
|
|
1963
1596
|
// src/actions/package/compile/packageCompileTsup.ts
|
|
1964
|
-
var compileFolder =
|
|
1597
|
+
var compileFolder = async (srcDir, entries, buildDir, options, bundleTypes = false, verbose) => {
|
|
1965
1598
|
const outDir = options?.outDir ?? "dist";
|
|
1966
1599
|
if (verbose) {
|
|
1967
1600
|
console.log(`compileFolder [${srcDir}, ${options?.outDir}]`);
|
|
@@ -1978,35 +1611,27 @@ var compileFolder = /* @__PURE__ */ __name(async (srcDir, entries, buildDir, opt
|
|
|
1978
1611
|
console.error(chalk28.red(`Compile:Validation had ${validationResult} errors`));
|
|
1979
1612
|
return validationResult;
|
|
1980
1613
|
}
|
|
1981
|
-
const optionsParams = tsupOptions([
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
...options,
|
|
1996
|
-
entry: entries.map((entry) => `${srcDir}/${entry}`)
|
|
1997
|
-
}
|
|
1998
|
-
]);
|
|
1614
|
+
const optionsParams = tsupOptions([{
|
|
1615
|
+
bundle: true,
|
|
1616
|
+
cjsInterop: true,
|
|
1617
|
+
clean: false,
|
|
1618
|
+
dts: false,
|
|
1619
|
+
format: ["esm"],
|
|
1620
|
+
outDir,
|
|
1621
|
+
silent: true,
|
|
1622
|
+
sourcemap: true,
|
|
1623
|
+
splitting: false,
|
|
1624
|
+
tsconfig: "tsconfig.json",
|
|
1625
|
+
...options,
|
|
1626
|
+
entry: entries.map((entry) => `${srcDir}/${entry}`)
|
|
1627
|
+
}]);
|
|
1999
1628
|
const optionsResult = defineConfig(optionsParams);
|
|
2000
|
-
const optionsList = (await Promise.all(
|
|
2001
|
-
optionsResult
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
return Array.isArray(result) ? result : [
|
|
2007
|
-
result
|
|
2008
|
-
];
|
|
2009
|
-
}))).flat();
|
|
1629
|
+
const optionsList = (await Promise.all(
|
|
1630
|
+
(Array.isArray(optionsResult) ? optionsResult : [optionsResult]).flatMap(async (options2) => {
|
|
1631
|
+
const result = typeof options2 === "function" ? await options2({}) : [options2];
|
|
1632
|
+
return Array.isArray(result) ? result : [result];
|
|
1633
|
+
})
|
|
1634
|
+
)).flat();
|
|
2010
1635
|
if (verbose) {
|
|
2011
1636
|
console.log(chalk28.cyan(`TSUP:build:start [${srcDir}]`));
|
|
2012
1637
|
console.log(chalk28.gray(`TSUP:build:options [${JSON.stringify(optionsList, null, 2)}]`));
|
|
@@ -2019,8 +1644,8 @@ var compileFolder = /* @__PURE__ */ __name(async (srcDir, entries, buildDir, opt
|
|
|
2019
1644
|
await packageCompileTscTypes(entries, outDir, options?.platform ?? "neutral", buildDir, verbose);
|
|
2020
1645
|
}
|
|
2021
1646
|
return 0;
|
|
2022
|
-
}
|
|
2023
|
-
var tsupOptions =
|
|
1647
|
+
};
|
|
1648
|
+
var tsupOptions = (options = []) => {
|
|
2024
1649
|
const standardLoaders = {
|
|
2025
1650
|
".gif": "copy",
|
|
2026
1651
|
".html": "copy",
|
|
@@ -2032,25 +1657,16 @@ var tsupOptions = /* @__PURE__ */ __name((options = []) => {
|
|
|
2032
1657
|
};
|
|
2033
1658
|
const standardOptions = {
|
|
2034
1659
|
bundle: true,
|
|
2035
|
-
format: [
|
|
2036
|
-
"esm"
|
|
2037
|
-
],
|
|
1660
|
+
format: ["esm"],
|
|
2038
1661
|
loader: standardLoaders,
|
|
2039
|
-
outExtension:
|
|
2040
|
-
js: ".mjs"
|
|
2041
|
-
} : {
|
|
2042
|
-
js: ".cjs"
|
|
2043
|
-
}, "outExtension"),
|
|
1662
|
+
outExtension: ({ format }) => format === "esm" ? { js: ".mjs" } : { js: ".cjs" },
|
|
2044
1663
|
skipNodeModulesBundle: true,
|
|
2045
1664
|
sourcemap: true,
|
|
2046
1665
|
target: "esnext"
|
|
2047
1666
|
};
|
|
2048
|
-
return deepMergeObjects([
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
]);
|
|
2052
|
-
}, "tsupOptions");
|
|
2053
|
-
var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
1667
|
+
return deepMergeObjects([standardOptions, ...options]);
|
|
1668
|
+
};
|
|
1669
|
+
var packageCompileTsup = async (config2) => {
|
|
2054
1670
|
const compile2 = config2?.compile;
|
|
2055
1671
|
const verbose = config2?.verbose ?? false;
|
|
2056
1672
|
const outDirAsBuildDir = compile2?.outDirAsBuildDir ?? true;
|
|
@@ -2058,94 +1674,100 @@ var packageCompileTsup = /* @__PURE__ */ __name(async (config2) => {
|
|
|
2058
1674
|
if (verbose) {
|
|
2059
1675
|
console.log("Compiling with TSUP");
|
|
2060
1676
|
}
|
|
2061
|
-
const compileForNode = compile2?.node ?? {
|
|
2062
|
-
|
|
2063
|
-
};
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
compile2?.
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
1677
|
+
const compileForNode = compile2?.node ?? { src: {} };
|
|
1678
|
+
const compileForBrowser = compile2?.browser ?? { src: {} };
|
|
1679
|
+
const compileForNeutral = compile2?.neutral ?? { src: {} };
|
|
1680
|
+
return (await Promise.all(
|
|
1681
|
+
Object.entries(compileForNode).map(async ([srcDir, options]) => {
|
|
1682
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
1683
|
+
const inEsBuildOptions = typeof compile2?.node?.esbuildOptions === "object" ? compile2?.node?.esbuildOptions : {};
|
|
1684
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
1685
|
+
const platform = "node";
|
|
1686
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
1687
|
+
const outDir = rootOutDir + "/" + platform;
|
|
1688
|
+
return typeof srcDir === "string" ? await compileFolder(
|
|
1689
|
+
srcDir,
|
|
1690
|
+
entry,
|
|
1691
|
+
outDirAsBuildDir ? rootOutDir : "build",
|
|
1692
|
+
tsupOptions([
|
|
1693
|
+
inEsBuildOptions,
|
|
1694
|
+
compile2?.tsup?.options ?? {},
|
|
1695
|
+
typeof options === "object" ? options : {},
|
|
1696
|
+
{ platform: "node", outDir }
|
|
1697
|
+
]),
|
|
1698
|
+
bundleTypes,
|
|
1699
|
+
verbose
|
|
1700
|
+
) : 0;
|
|
1701
|
+
})
|
|
1702
|
+
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
1703
|
+
Object.entries(compileForBrowser).map(async ([srcDir, options]) => {
|
|
1704
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
1705
|
+
const inEsBuildOptions = typeof compile2?.browser?.esbuildOptions === "object" ? compile2?.browser?.esbuildOptions : {};
|
|
1706
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
1707
|
+
const platform = "browser";
|
|
1708
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
1709
|
+
const outDir = rootOutDir + "/" + platform;
|
|
1710
|
+
return typeof srcDir === "string" ? await compileFolder(
|
|
1711
|
+
srcDir,
|
|
1712
|
+
entry,
|
|
1713
|
+
outDirAsBuildDir ? rootOutDir : "build",
|
|
1714
|
+
tsupOptions([
|
|
1715
|
+
inEsBuildOptions,
|
|
1716
|
+
compile2?.tsup?.options ?? {},
|
|
1717
|
+
typeof options === "object" ? options : {},
|
|
1718
|
+
{ platform: "browser", outDir }
|
|
1719
|
+
]),
|
|
1720
|
+
bundleTypes,
|
|
1721
|
+
verbose
|
|
1722
|
+
) : 0;
|
|
1723
|
+
})
|
|
1724
|
+
)).reduce((prev, value) => prev + value, 0) + (await Promise.all(
|
|
1725
|
+
Object.entries(compileForNeutral).map(async ([srcDir, options]) => {
|
|
1726
|
+
const optionsObject = typeof options === "object" ? options : {};
|
|
1727
|
+
const inEsBuildOptions = typeof compile2?.neutral?.esbuildOptions === "object" ? compile2?.neutral?.esbuildOptions : {};
|
|
1728
|
+
const entry = buildEntries(srcDir, compile2?.entryMode, options, true, verbose);
|
|
1729
|
+
const platform = "neutral";
|
|
1730
|
+
const rootOutDir = optionsObject.outDir ?? "dist";
|
|
1731
|
+
const outDir = rootOutDir + "/" + platform;
|
|
1732
|
+
return typeof srcDir === "string" ? await compileFolder(
|
|
1733
|
+
srcDir,
|
|
1734
|
+
entry,
|
|
1735
|
+
outDirAsBuildDir ? rootOutDir : "build",
|
|
1736
|
+
tsupOptions([
|
|
1737
|
+
inEsBuildOptions,
|
|
1738
|
+
compile2?.tsup?.options ?? {},
|
|
1739
|
+
typeof options === "object" ? options : {},
|
|
1740
|
+
{ platform: "neutral", outDir }
|
|
1741
|
+
]),
|
|
1742
|
+
bundleTypes,
|
|
1743
|
+
verbose
|
|
1744
|
+
) : 0;
|
|
1745
|
+
})
|
|
1746
|
+
)).reduce((prev, value) => prev + value, 0) + 0;
|
|
1747
|
+
};
|
|
2120
1748
|
|
|
2121
1749
|
// src/actions/package/compile/compile.ts
|
|
2122
|
-
var packageCompile =
|
|
1750
|
+
var packageCompile = async (inConfig = {}) => {
|
|
2123
1751
|
const pkg = process.env.INIT_CWD;
|
|
2124
1752
|
console.log(chalk29.green(`Compiling ${pkg}`));
|
|
2125
1753
|
const config2 = await loadConfig(inConfig);
|
|
2126
1754
|
return await packageCompileTsup(config2);
|
|
2127
|
-
}
|
|
1755
|
+
};
|
|
2128
1756
|
|
|
2129
1757
|
// src/actions/package/copy-assets.ts
|
|
2130
1758
|
import path8 from "path/posix";
|
|
2131
1759
|
import chalk30 from "chalk";
|
|
2132
1760
|
import cpy2 from "cpy";
|
|
2133
|
-
var copyTargetAssets2 =
|
|
1761
|
+
var copyTargetAssets2 = async (target, name, location) => {
|
|
2134
1762
|
try {
|
|
2135
|
-
const values = await cpy2(
|
|
2136
|
-
"**/*.jpg",
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
"**/*.gif",
|
|
2144
|
-
"**/*.css"
|
|
2145
|
-
], `../dist/${target}`, {
|
|
2146
|
-
cwd: path8.join(location, "src"),
|
|
2147
|
-
flat: false
|
|
2148
|
-
});
|
|
1763
|
+
const values = await cpy2(
|
|
1764
|
+
["**/*.jpg", "**/*.png", "**/*.gif", "**/*.svg", "**/*.webp", "**/*.sass", "**/*.scss", "**/*.gif", "**/*.css"],
|
|
1765
|
+
`../dist/${target}`,
|
|
1766
|
+
{
|
|
1767
|
+
cwd: path8.join(location, "src"),
|
|
1768
|
+
flat: false
|
|
1769
|
+
}
|
|
1770
|
+
);
|
|
2149
1771
|
if (values.length > 0) {
|
|
2150
1772
|
console.log(chalk30.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`));
|
|
2151
1773
|
}
|
|
@@ -2158,8 +1780,8 @@ var copyTargetAssets2 = /* @__PURE__ */ __name(async (target, name, location) =>
|
|
|
2158
1780
|
console.log(`Copy Assets Failed: ${name}: ${error.message}`);
|
|
2159
1781
|
return 1;
|
|
2160
1782
|
}
|
|
2161
|
-
}
|
|
2162
|
-
var packageCopyAssets =
|
|
1783
|
+
};
|
|
1784
|
+
var packageCopyAssets = async ({ target }) => {
|
|
2163
1785
|
const pkg = process.env.INIT_CWD ?? "./";
|
|
2164
1786
|
const pkgName = process.env.npm_package_name ?? "Unknown";
|
|
2165
1787
|
switch (target) {
|
|
@@ -2173,11 +1795,11 @@ var packageCopyAssets = /* @__PURE__ */ __name(async ({ target }) => {
|
|
|
2173
1795
|
return await copyTargetAssets2("esm", pkgName, pkg) || await copyTargetAssets2("cjs", pkgName, pkg);
|
|
2174
1796
|
}
|
|
2175
1797
|
}
|
|
2176
|
-
}
|
|
1798
|
+
};
|
|
2177
1799
|
|
|
2178
1800
|
// src/actions/package/cycle.ts
|
|
2179
1801
|
import { cruise as cruise2 } from "dependency-cruiser";
|
|
2180
|
-
var packageCycle =
|
|
1802
|
+
var packageCycle = async () => {
|
|
2181
1803
|
const pkg = process.env.INIT_CWD;
|
|
2182
1804
|
const pkgName = process.env.npm_package_name;
|
|
2183
1805
|
const cruiseOptions = {
|
|
@@ -2188,26 +1810,20 @@ var packageCycle = /* @__PURE__ */ __name(async () => {
|
|
|
2188
1810
|
severity: "error",
|
|
2189
1811
|
comment: "This dependency creates a circular reference",
|
|
2190
1812
|
from: {},
|
|
2191
|
-
to: {
|
|
2192
|
-
circular: true
|
|
2193
|
-
}
|
|
1813
|
+
to: { circular: true }
|
|
2194
1814
|
}
|
|
2195
1815
|
]
|
|
2196
1816
|
},
|
|
2197
1817
|
exclude: "node_modules|packages/.*/packages",
|
|
2198
1818
|
validate: true,
|
|
2199
|
-
doNotFollow: {
|
|
2200
|
-
path: "node_modules|packages/.*/packages"
|
|
2201
|
-
},
|
|
1819
|
+
doNotFollow: { path: "node_modules|packages/.*/packages" },
|
|
2202
1820
|
tsPreCompilationDeps: false,
|
|
2203
1821
|
combinedDependencies: true,
|
|
2204
1822
|
outputType: "err"
|
|
2205
1823
|
};
|
|
2206
1824
|
const target = `${pkg}/src`;
|
|
2207
1825
|
console.log(`Checking for circular dependencies in ${target}...`);
|
|
2208
|
-
const result = await cruise2([
|
|
2209
|
-
target
|
|
2210
|
-
], cruiseOptions);
|
|
1826
|
+
const result = await cruise2([target], cruiseOptions);
|
|
2211
1827
|
console.log(result.output);
|
|
2212
1828
|
if (result.exitCode === 0) {
|
|
2213
1829
|
console.log(`${pkgName} \u2705 No dependency violations`);
|
|
@@ -2215,13 +1831,18 @@ var packageCycle = /* @__PURE__ */ __name(async () => {
|
|
|
2215
1831
|
console.error(`${pkgName} \u274C Dependency violations found`);
|
|
2216
1832
|
}
|
|
2217
1833
|
return result.exitCode;
|
|
2218
|
-
}
|
|
1834
|
+
};
|
|
2219
1835
|
|
|
2220
1836
|
// src/actions/package/gen-docs.ts
|
|
2221
1837
|
import { existsSync as existsSync5 } from "fs";
|
|
2222
1838
|
import path9 from "path";
|
|
2223
1839
|
import chalk31 from "chalk";
|
|
2224
|
-
import {
|
|
1840
|
+
import {
|
|
1841
|
+
Application,
|
|
1842
|
+
ArgumentsReader,
|
|
1843
|
+
TSConfigReader,
|
|
1844
|
+
TypeDocReader
|
|
1845
|
+
} from "typedoc";
|
|
2225
1846
|
var ExitCodes = {
|
|
2226
1847
|
CompileError: 3,
|
|
2227
1848
|
ExceptionThrown: 6,
|
|
@@ -2231,17 +1852,14 @@ var ExitCodes = {
|
|
|
2231
1852
|
OutputError: 5,
|
|
2232
1853
|
ValidationError: 4
|
|
2233
1854
|
};
|
|
2234
|
-
var packageGenDocs =
|
|
1855
|
+
var packageGenDocs = async () => {
|
|
2235
1856
|
const pkg = process.env.INIT_CWD;
|
|
2236
1857
|
if (pkg !== void 0 && !existsSync5(path9.join(pkg, "typedoc.json"))) {
|
|
2237
1858
|
return;
|
|
2238
1859
|
}
|
|
2239
1860
|
const app = await Application.bootstrap({
|
|
2240
1861
|
entryPointStrategy: "merge",
|
|
2241
|
-
entryPoints: [
|
|
2242
|
-
`${pkg}/src/**/*.ts`,
|
|
2243
|
-
`${pkg}/packages/*/dist/docs.json`
|
|
2244
|
-
],
|
|
1862
|
+
entryPoints: [`${pkg}/src/**/*.ts`, `${pkg}/packages/*/dist/docs.json`],
|
|
2245
1863
|
excludeExternals: true,
|
|
2246
1864
|
json: `${pkg}/dist/docs.json`,
|
|
2247
1865
|
logLevel: "Error",
|
|
@@ -2252,8 +1870,8 @@ var packageGenDocs = /* @__PURE__ */ __name(async () => {
|
|
|
2252
1870
|
app.options.addReader(new TSConfigReader());
|
|
2253
1871
|
app.options.addReader(new ArgumentsReader(300));
|
|
2254
1872
|
return await runTypeDoc(app);
|
|
2255
|
-
}
|
|
2256
|
-
var runTypeDoc =
|
|
1873
|
+
};
|
|
1874
|
+
var runTypeDoc = async (app) => {
|
|
2257
1875
|
const pkgName = process.env.npm_package_name;
|
|
2258
1876
|
if (app.options.getValue("version")) {
|
|
2259
1877
|
console.log(app.toString());
|
|
@@ -2324,7 +1942,7 @@ var runTypeDoc = /* @__PURE__ */ __name(async (app) => {
|
|
|
2324
1942
|
}
|
|
2325
1943
|
console.log(chalk31.green(`${pkgName} - Ok`));
|
|
2326
1944
|
return ExitCodes.Ok;
|
|
2327
|
-
}
|
|
1945
|
+
};
|
|
2328
1946
|
|
|
2329
1947
|
// src/actions/package/lint.ts
|
|
2330
1948
|
import { readdirSync } from "fs";
|
|
@@ -2335,27 +1953,24 @@ import chalk32 from "chalk";
|
|
|
2335
1953
|
import { ESLint } from "eslint";
|
|
2336
1954
|
import { findUp } from "find-up";
|
|
2337
1955
|
import picomatch from "picomatch";
|
|
2338
|
-
var dumpMessages =
|
|
2339
|
-
const colors = [
|
|
2340
|
-
|
|
2341
|
-
"yellow",
|
|
2342
|
-
"red"
|
|
2343
|
-
];
|
|
2344
|
-
const severity = [
|
|
2345
|
-
"none",
|
|
2346
|
-
"warning",
|
|
2347
|
-
"error"
|
|
2348
|
-
];
|
|
1956
|
+
var dumpMessages = (lintResults) => {
|
|
1957
|
+
const colors = ["white", "yellow", "red"];
|
|
1958
|
+
const severity = ["none", "warning", "error"];
|
|
2349
1959
|
for (const lintResult of lintResults) {
|
|
2350
1960
|
if (lintResult.messages.length > 0) {
|
|
2351
1961
|
console.log(chalk32.gray(`
|
|
2352
1962
|
${lintResult.filePath}`));
|
|
2353
1963
|
for (const message of lintResult.messages) {
|
|
2354
|
-
console.log(
|
|
1964
|
+
console.log(
|
|
1965
|
+
chalk32.gray(` ${message.line}:${message.column}`),
|
|
1966
|
+
chalk32[colors[message.severity]](` ${severity[message.severity]}`),
|
|
1967
|
+
chalk32.white(` ${message.message}`),
|
|
1968
|
+
chalk32.gray(` ${message.ruleId}`)
|
|
1969
|
+
);
|
|
2355
1970
|
}
|
|
2356
1971
|
}
|
|
2357
1972
|
}
|
|
2358
|
-
}
|
|
1973
|
+
};
|
|
2359
1974
|
async function getRootESLintConfig() {
|
|
2360
1975
|
const configPath = await findUp("eslint.config.mjs");
|
|
2361
1976
|
if (configPath === void 0) {
|
|
@@ -2363,43 +1978,26 @@ async function getRootESLintConfig() {
|
|
|
2363
1978
|
}
|
|
2364
1979
|
return pathToFileURL(configPath);
|
|
2365
1980
|
}
|
|
2366
|
-
__name(getRootESLintConfig, "getRootESLintConfig");
|
|
2367
1981
|
function getFiles(dir, ignoreFolders) {
|
|
2368
1982
|
const currentDirectory = cwd4();
|
|
2369
1983
|
const subDirectory = dir.split(currentDirectory)[1];
|
|
2370
1984
|
if (ignoreFolders.includes(subDirectory)) return [];
|
|
2371
|
-
return readdirSync(dir, {
|
|
2372
|
-
withFileTypes: true
|
|
2373
|
-
}).flatMap((dirent) => {
|
|
1985
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((dirent) => {
|
|
2374
1986
|
const res = path10.resolve(dir, dirent.name);
|
|
2375
1987
|
const relativePath = subDirectory === void 0 ? dirent.name : `${subDirectory}/${dirent.name}`;
|
|
2376
1988
|
const ignoreMatchers = ignoreFolders.map((pattern) => picomatch(pattern));
|
|
2377
1989
|
if (ignoreMatchers.some((isMatch) => isMatch(relativePath))) return [];
|
|
2378
|
-
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [
|
|
2379
|
-
res
|
|
2380
|
-
];
|
|
1990
|
+
return dirent.isDirectory() ? getFiles(res, ignoreFolders) : [res];
|
|
2381
1991
|
});
|
|
2382
1992
|
}
|
|
2383
|
-
|
|
2384
|
-
var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, cache = true) => {
|
|
1993
|
+
var packageLint = async (fix2 = false, verbose = false, cache = true) => {
|
|
2385
1994
|
const pkg = process.env.INIT_CWD;
|
|
2386
1995
|
const configPath = await getRootESLintConfig();
|
|
2387
1996
|
const { default: eslintConfig } = await import(configPath.href);
|
|
2388
1997
|
const start = Date.now();
|
|
2389
|
-
const ignoreFolders = [
|
|
2390
|
-
"node_modules",
|
|
2391
|
-
"dist",
|
|
2392
|
-
"packages",
|
|
2393
|
-
".git",
|
|
2394
|
-
"build",
|
|
2395
|
-
".yarn",
|
|
2396
|
-
".vscode",
|
|
2397
|
-
".github"
|
|
2398
|
-
];
|
|
1998
|
+
const ignoreFolders = ["node_modules", "dist", "packages", ".git", "build", ".yarn", ".vscode", ".github"];
|
|
2399
1999
|
const engine = new ESLint({
|
|
2400
|
-
baseConfig: [
|
|
2401
|
-
...eslintConfig
|
|
2402
|
-
],
|
|
2000
|
+
baseConfig: [...eslintConfig],
|
|
2403
2001
|
fix: fix2,
|
|
2404
2002
|
warnIgnored: false,
|
|
2405
2003
|
cache
|
|
@@ -2418,33 +2016,35 @@ var packageLint = /* @__PURE__ */ __name(async (fix2 = false, verbose = false, c
|
|
|
2418
2016
|
const lintTimeColor = lintTime < 1e3 ? "green" : lintTime < 3e3 ? "yellow" : "red";
|
|
2419
2017
|
console.log(chalk32.white(`Linted ${chalk32[filesCountColor](files.length)} files in ${chalk32[lintTimeColor](lintTime)}ms`));
|
|
2420
2018
|
return lintResults.reduce((prev, lintResult) => prev + lintResult.errorCount, 0);
|
|
2421
|
-
}
|
|
2019
|
+
};
|
|
2422
2020
|
|
|
2423
2021
|
// src/actions/package/publint.ts
|
|
2424
2022
|
import { promises as fs4 } from "fs";
|
|
2425
2023
|
import chalk33 from "chalk";
|
|
2426
2024
|
import sortPackageJson from "sort-package-json";
|
|
2427
|
-
var customPubLint =
|
|
2025
|
+
var customPubLint = (pkg) => {
|
|
2428
2026
|
let errorCount = 0;
|
|
2429
2027
|
let warningCount = 0;
|
|
2430
2028
|
if (pkg.files === void 0) {
|
|
2431
|
-
console.
|
|
2029
|
+
console.warn(chalk33.yellow('Publint [custom]: "files" field is missing'));
|
|
2432
2030
|
warningCount++;
|
|
2433
2031
|
}
|
|
2434
2032
|
if (pkg.main !== void 0) {
|
|
2435
|
-
console.
|
|
2033
|
+
console.warn(chalk33.yellow('Publint [custom]: "main" field is deprecated, use "exports" instead'));
|
|
2436
2034
|
warningCount++;
|
|
2437
2035
|
}
|
|
2438
2036
|
if (pkg.sideEffects !== false) {
|
|
2439
|
-
console.
|
|
2037
|
+
console.warn(chalk33.yellow('Publint [custom]: "sideEffects" field should be set to false'));
|
|
2038
|
+
warningCount++;
|
|
2039
|
+
}
|
|
2040
|
+
if (pkg.resolutions !== void 0) {
|
|
2041
|
+
console.warn(chalk33.yellow('Publint [custom]: "resolutions" in use'));
|
|
2042
|
+
console.warn(chalk33.gray(JSON.stringify(pkg.resolutions, null, 2)));
|
|
2440
2043
|
warningCount++;
|
|
2441
2044
|
}
|
|
2442
|
-
return [
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
];
|
|
2446
|
-
}, "customPubLint");
|
|
2447
|
-
var packagePublint = /* @__PURE__ */ __name(async ({ strict = true, verbose = false } = {}) => {
|
|
2045
|
+
return [errorCount, warningCount];
|
|
2046
|
+
};
|
|
2047
|
+
var packagePublint = async ({ strict = true, verbose = false } = {}) => {
|
|
2448
2048
|
const pkgDir = process.env.INIT_CWD;
|
|
2449
2049
|
const sortedPkg = sortPackageJson(await fs4.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
2450
2050
|
await fs4.writeFile(`${pkgDir}/package.json`, sortedPkg);
|
|
@@ -2479,73 +2079,41 @@ var packagePublint = /* @__PURE__ */ __name(async ({ strict = true, verbose = fa
|
|
|
2479
2079
|
console.log(chalk33.gray(`Publint [Finish]: ${pkgDir} [${messages.length + errorCount + warningCount} messages]`));
|
|
2480
2080
|
}
|
|
2481
2081
|
return messages.filter((message) => message.type === "error").length + errorCount;
|
|
2482
|
-
}
|
|
2082
|
+
};
|
|
2483
2083
|
|
|
2484
2084
|
// src/actions/package/recompile.ts
|
|
2485
|
-
var packageRecompile =
|
|
2085
|
+
var packageRecompile = async () => {
|
|
2486
2086
|
return await packageClean() || await packageCompile();
|
|
2487
|
-
}
|
|
2087
|
+
};
|
|
2488
2088
|
|
|
2489
2089
|
// src/actions/publint.ts
|
|
2490
|
-
var publint =
|
|
2491
|
-
return pkg === void 0 ? publintAll({
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
[
|
|
2501
|
-
"yarn",
|
|
2502
|
-
[
|
|
2503
|
-
"workspace",
|
|
2504
|
-
pkg,
|
|
2505
|
-
"run",
|
|
2506
|
-
"package-publint"
|
|
2507
|
-
]
|
|
2508
|
-
]
|
|
2509
|
-
]);
|
|
2510
|
-
}, "publintPackage");
|
|
2511
|
-
var publintAll = /* @__PURE__ */ __name(({ verbose }) => {
|
|
2512
|
-
const verboseOptions = verbose ? [
|
|
2513
|
-
"--verbose"
|
|
2514
|
-
] : [
|
|
2515
|
-
"--no-verbose"
|
|
2516
|
-
];
|
|
2517
|
-
return runSteps("Publint", [
|
|
2518
|
-
[
|
|
2519
|
-
"yarn",
|
|
2520
|
-
[
|
|
2521
|
-
"workspaces",
|
|
2522
|
-
"foreach",
|
|
2523
|
-
"-pA",
|
|
2524
|
-
...verboseOptions,
|
|
2525
|
-
"run",
|
|
2526
|
-
"package-publint"
|
|
2527
|
-
]
|
|
2528
|
-
]
|
|
2529
|
-
]);
|
|
2530
|
-
}, "publintAll");
|
|
2090
|
+
var publint = async ({ verbose, pkg }) => {
|
|
2091
|
+
return pkg === void 0 ? publintAll({ verbose }) : await publintPackage({ pkg, verbose });
|
|
2092
|
+
};
|
|
2093
|
+
var publintPackage = ({ pkg }) => {
|
|
2094
|
+
return runStepsAsync(`Publint [${pkg}]`, [["yarn", ["workspace", pkg, "run", "package-publint"]]]);
|
|
2095
|
+
};
|
|
2096
|
+
var publintAll = ({ verbose }) => {
|
|
2097
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2098
|
+
return runSteps("Publint", [["yarn", ["workspaces", "foreach", "-pA", ...verboseOptions, "run", "package-publint"]]]);
|
|
2099
|
+
};
|
|
2531
2100
|
|
|
2532
2101
|
// src/actions/rebuild.ts
|
|
2533
|
-
var rebuild =
|
|
2102
|
+
var rebuild = ({ target }) => {
|
|
2534
2103
|
return runSteps("Rebuild", [
|
|
2535
|
-
[
|
|
2536
|
-
|
|
2537
|
-
"xy clean"
|
|
2538
|
-
],
|
|
2539
|
-
[
|
|
2540
|
-
"yarn",
|
|
2541
|
-
target ? `xy build -t ${target}` : "xy build"
|
|
2542
|
-
]
|
|
2104
|
+
["yarn", "xy clean"],
|
|
2105
|
+
["yarn", target ? `xy build -t ${target}` : "xy build"]
|
|
2543
2106
|
]);
|
|
2544
|
-
}
|
|
2107
|
+
};
|
|
2545
2108
|
|
|
2546
2109
|
// src/actions/recompile.ts
|
|
2547
2110
|
import chalk34 from "chalk";
|
|
2548
|
-
var recompile =
|
|
2111
|
+
var recompile = async ({
|
|
2112
|
+
verbose,
|
|
2113
|
+
target,
|
|
2114
|
+
pkg,
|
|
2115
|
+
incremental
|
|
2116
|
+
}) => {
|
|
2549
2117
|
return pkg ? await recompilePackage({
|
|
2550
2118
|
pkg,
|
|
2551
2119
|
target,
|
|
@@ -2555,49 +2123,25 @@ var recompile = /* @__PURE__ */ __name(async ({ verbose, target, pkg, incrementa
|
|
|
2555
2123
|
target,
|
|
2556
2124
|
verbose
|
|
2557
2125
|
});
|
|
2558
|
-
}
|
|
2559
|
-
var recompilePackage =
|
|
2560
|
-
const targetOptions = target ? [
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
...targetOptions
|
|
2573
|
-
]
|
|
2574
|
-
]
|
|
2575
|
-
]);
|
|
2576
|
-
}, "recompilePackage");
|
|
2577
|
-
var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, incremental }) => {
|
|
2126
|
+
};
|
|
2127
|
+
var recompilePackage = ({ target, pkg }) => {
|
|
2128
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
2129
|
+
return runStepsAsync(
|
|
2130
|
+
`Recompile [${pkg}]`,
|
|
2131
|
+
[["yarn", ["workspace", pkg, "run", "package-recompile", ...targetOptions]]]
|
|
2132
|
+
);
|
|
2133
|
+
};
|
|
2134
|
+
var recompileAll = async ({
|
|
2135
|
+
jobs,
|
|
2136
|
+
verbose,
|
|
2137
|
+
target,
|
|
2138
|
+
incremental
|
|
2139
|
+
}) => {
|
|
2578
2140
|
const start = Date.now();
|
|
2579
|
-
const verboseOptions = verbose ? [
|
|
2580
|
-
|
|
2581
|
-
] : [
|
|
2582
|
-
|
|
2583
|
-
];
|
|
2584
|
-
const targetOptions = target ? [
|
|
2585
|
-
"-t",
|
|
2586
|
-
target
|
|
2587
|
-
] : [];
|
|
2588
|
-
const incrementalOptions = incremental ? [
|
|
2589
|
-
"--since",
|
|
2590
|
-
"-Apt",
|
|
2591
|
-
"--topological-dev"
|
|
2592
|
-
] : [
|
|
2593
|
-
"--parallel",
|
|
2594
|
-
"-Apt",
|
|
2595
|
-
"--topological-dev"
|
|
2596
|
-
];
|
|
2597
|
-
const jobsOptions = jobs ? [
|
|
2598
|
-
"-j",
|
|
2599
|
-
`${jobs}`
|
|
2600
|
-
] : [];
|
|
2141
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2142
|
+
const targetOptions = target ? ["-t", target] : [];
|
|
2143
|
+
const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
|
|
2144
|
+
const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
|
|
2601
2145
|
if (jobs) {
|
|
2602
2146
|
console.log(chalk34.blue(`Jobs set to [${jobs}]`));
|
|
2603
2147
|
}
|
|
@@ -2629,13 +2173,19 @@ var recompileAll = /* @__PURE__ */ __name(async ({ jobs, verbose, target, increm
|
|
|
2629
2173
|
]
|
|
2630
2174
|
]
|
|
2631
2175
|
]);
|
|
2632
|
-
console.log(
|
|
2176
|
+
console.log(
|
|
2177
|
+
`${chalk34.gray("Recompiled in")} [${chalk34.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk34.gray("seconds")}`
|
|
2178
|
+
);
|
|
2633
2179
|
return result;
|
|
2634
|
-
}
|
|
2180
|
+
};
|
|
2635
2181
|
|
|
2636
2182
|
// src/actions/reinstall.ts
|
|
2637
|
-
import {
|
|
2638
|
-
|
|
2183
|
+
import {
|
|
2184
|
+
closeSync,
|
|
2185
|
+
openSync,
|
|
2186
|
+
rmSync
|
|
2187
|
+
} from "fs";
|
|
2188
|
+
var reinstall = () => {
|
|
2639
2189
|
console.log("Reinstall [Clear Lock File]");
|
|
2640
2190
|
closeSync(openSync("./yarn.lock", "w"));
|
|
2641
2191
|
console.log("Reinstall [Clear Node Modules]");
|
|
@@ -2643,10 +2193,7 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2643
2193
|
const result = workspaces.map(({ location, name }) => {
|
|
2644
2194
|
const dist = `${location}/node_modules`;
|
|
2645
2195
|
try {
|
|
2646
|
-
rmSync(dist, {
|
|
2647
|
-
force: true,
|
|
2648
|
-
recursive: true
|
|
2649
|
-
});
|
|
2196
|
+
rmSync(dist, { force: true, recursive: true });
|
|
2650
2197
|
return 0;
|
|
2651
2198
|
} catch (ex) {
|
|
2652
2199
|
const error = ex;
|
|
@@ -2654,573 +2201,605 @@ var reinstall = /* @__PURE__ */ __name(() => {
|
|
|
2654
2201
|
return 1;
|
|
2655
2202
|
}
|
|
2656
2203
|
}).reduce((prev, result2) => prev || result2, 0);
|
|
2657
|
-
return result || runSteps("Reinstall", [
|
|
2658
|
-
|
|
2659
|
-
"yarn",
|
|
2660
|
-
"install --network-timeout 10000"
|
|
2661
|
-
]
|
|
2662
|
-
]);
|
|
2663
|
-
}, "reinstall");
|
|
2204
|
+
return result || runSteps("Reinstall", [["yarn", "install --network-timeout 10000"]]);
|
|
2205
|
+
};
|
|
2664
2206
|
|
|
2665
2207
|
// src/actions/relint.ts
|
|
2666
2208
|
import chalk35 from "chalk";
|
|
2667
|
-
var relintPackage =
|
|
2209
|
+
var relintPackage = ({ pkg }) => {
|
|
2668
2210
|
console.log(chalk35.gray(`${"Relint"} [All-Packages]`));
|
|
2669
2211
|
const start = Date.now();
|
|
2670
2212
|
const result = runSteps("Relint [All-Packages]", [
|
|
2671
|
-
[
|
|
2672
|
-
"
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
"package-relint"
|
|
2678
|
-
]
|
|
2679
|
-
]
|
|
2213
|
+
["yarn", [
|
|
2214
|
+
"workspace",
|
|
2215
|
+
pkg,
|
|
2216
|
+
"run",
|
|
2217
|
+
"package-relint"
|
|
2218
|
+
]]
|
|
2680
2219
|
]);
|
|
2681
2220
|
console.log(chalk35.gray(`${"Relinted in"} [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
|
|
2682
2221
|
return result;
|
|
2683
|
-
}
|
|
2684
|
-
var relint =
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
var relintAllPackages = /* @__PURE__ */ __name(({ verbose = false, incremental } = {}) => {
|
|
2222
|
+
};
|
|
2223
|
+
var relint = ({
|
|
2224
|
+
pkg,
|
|
2225
|
+
verbose,
|
|
2226
|
+
incremental
|
|
2227
|
+
} = {}) => {
|
|
2228
|
+
return pkg ? relintPackage({ pkg }) : relintAllPackages({ verbose, incremental });
|
|
2229
|
+
};
|
|
2230
|
+
var relintAllPackages = ({ verbose = false, incremental } = {}) => {
|
|
2693
2231
|
console.log(chalk35.gray(`${"Relint"} [All-Packages]`));
|
|
2694
2232
|
const start = Date.now();
|
|
2695
|
-
const verboseOptions = verbose ? [
|
|
2696
|
-
|
|
2697
|
-
] : [
|
|
2698
|
-
"--no-verbose"
|
|
2699
|
-
];
|
|
2700
|
-
const incrementalOptions = incremental ? [
|
|
2701
|
-
"--since",
|
|
2702
|
-
"-Ap"
|
|
2703
|
-
] : [
|
|
2704
|
-
"--parallel",
|
|
2705
|
-
"-Ap"
|
|
2706
|
-
];
|
|
2233
|
+
const verboseOptions = verbose ? ["--verbose"] : ["--no-verbose"];
|
|
2234
|
+
const incrementalOptions = incremental ? ["--since", "-Ap"] : ["--parallel", "-Ap"];
|
|
2707
2235
|
const result = runSteps(`${"Relint"} [All-Packages]`, [
|
|
2708
|
-
[
|
|
2709
|
-
"
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
"package-relint"
|
|
2717
|
-
]
|
|
2718
|
-
]
|
|
2236
|
+
["yarn", [
|
|
2237
|
+
"workspaces",
|
|
2238
|
+
"foreach",
|
|
2239
|
+
...verboseOptions,
|
|
2240
|
+
...incrementalOptions,
|
|
2241
|
+
"run",
|
|
2242
|
+
"package-relint"
|
|
2243
|
+
]]
|
|
2719
2244
|
]);
|
|
2720
2245
|
console.log(chalk35.gray(`Relinted in [${chalk35.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk35.gray("seconds")}`));
|
|
2721
2246
|
return result;
|
|
2722
|
-
}
|
|
2247
|
+
};
|
|
2723
2248
|
|
|
2724
2249
|
// src/actions/retest.ts
|
|
2725
|
-
var retest =
|
|
2250
|
+
var retest = () => {
|
|
2726
2251
|
return runSteps("Test", [
|
|
2727
|
-
[
|
|
2728
|
-
|
|
2729
|
-
[
|
|
2730
|
-
"jest",
|
|
2731
|
-
"--clearCache"
|
|
2732
|
-
]
|
|
2733
|
-
],
|
|
2734
|
-
[
|
|
2735
|
-
"yarn",
|
|
2736
|
-
[
|
|
2737
|
-
"jest",
|
|
2738
|
-
"."
|
|
2739
|
-
]
|
|
2740
|
-
]
|
|
2252
|
+
["yarn", ["jest", "--clearCache"]],
|
|
2253
|
+
["yarn", ["jest", "."]]
|
|
2741
2254
|
]);
|
|
2742
|
-
}
|
|
2255
|
+
};
|
|
2743
2256
|
|
|
2744
2257
|
// src/actions/sonar.ts
|
|
2745
|
-
var sonar =
|
|
2746
|
-
return runSteps("Sonar", [
|
|
2747
|
-
|
|
2748
|
-
"yarn",
|
|
2749
|
-
[
|
|
2750
|
-
"eslint",
|
|
2751
|
-
"-c",
|
|
2752
|
-
"sonar.eslintrc",
|
|
2753
|
-
"."
|
|
2754
|
-
]
|
|
2755
|
-
]
|
|
2756
|
-
]);
|
|
2757
|
-
}, "sonar");
|
|
2258
|
+
var sonar = () => {
|
|
2259
|
+
return runSteps("Sonar", [["yarn", ["eslint", "-c", "sonar.eslintrc", "."]]]);
|
|
2260
|
+
};
|
|
2758
2261
|
|
|
2759
2262
|
// src/actions/statics.ts
|
|
2760
2263
|
import chalk36 from "chalk";
|
|
2761
|
-
var DefaultDependencies = [
|
|
2762
|
-
|
|
2763
|
-
"@xylabs/pixel",
|
|
2764
|
-
"react",
|
|
2765
|
-
"graphql",
|
|
2766
|
-
"react-router",
|
|
2767
|
-
"@mui/material",
|
|
2768
|
-
"@mui/system"
|
|
2769
|
-
];
|
|
2770
|
-
var statics = /* @__PURE__ */ __name(() => {
|
|
2264
|
+
var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
|
|
2265
|
+
var statics = () => {
|
|
2771
2266
|
console.log(chalk36.green("Check Required Static Dependencies"));
|
|
2772
2267
|
const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
|
|
2773
2268
|
return detectDuplicateDependencies(statics2, DefaultDependencies);
|
|
2774
|
-
}
|
|
2269
|
+
};
|
|
2775
2270
|
|
|
2776
2271
|
// src/actions/test.ts
|
|
2777
|
-
var test =
|
|
2778
|
-
return runSteps("Test", [
|
|
2779
|
-
|
|
2780
|
-
"yarn",
|
|
2781
|
-
[
|
|
2782
|
-
"vitest",
|
|
2783
|
-
"."
|
|
2784
|
-
]
|
|
2785
|
-
]
|
|
2786
|
-
]);
|
|
2787
|
-
}, "test");
|
|
2272
|
+
var test = () => {
|
|
2273
|
+
return runSteps("Test", [["yarn", ["vitest", "."]]]);
|
|
2274
|
+
};
|
|
2788
2275
|
|
|
2789
2276
|
// src/actions/up.ts
|
|
2790
|
-
var up =
|
|
2791
|
-
return runSteps("Up", [
|
|
2792
|
-
|
|
2793
|
-
"yarn",
|
|
2794
|
-
"outdated"
|
|
2795
|
-
]
|
|
2796
|
-
]);
|
|
2797
|
-
}, "up");
|
|
2277
|
+
var up = () => {
|
|
2278
|
+
return runSteps("Up", [["yarn", "outdated"]]);
|
|
2279
|
+
};
|
|
2798
2280
|
|
|
2799
2281
|
// src/actions/updo.ts
|
|
2800
|
-
var updo =
|
|
2282
|
+
var updo = () => {
|
|
2801
2283
|
return runSteps("Updo", [
|
|
2802
|
-
[
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
],
|
|
2806
|
-
[
|
|
2807
|
-
"yarn",
|
|
2808
|
-
"upgrade-interactive"
|
|
2809
|
-
],
|
|
2810
|
-
[
|
|
2811
|
-
"yarn",
|
|
2812
|
-
"dedupe"
|
|
2813
|
-
]
|
|
2284
|
+
["yarn", "install"],
|
|
2285
|
+
["yarn", "upgrade-interactive"],
|
|
2286
|
+
["yarn", "dedupe"]
|
|
2814
2287
|
]);
|
|
2815
|
-
}
|
|
2288
|
+
};
|
|
2816
2289
|
|
|
2817
2290
|
// src/actions/upplug.ts
|
|
2818
|
-
var updateYarnPlugins =
|
|
2291
|
+
var updateYarnPlugins = () => {
|
|
2819
2292
|
return runSteps("Update Yarn Plugins", [
|
|
2820
|
-
[
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
"import",
|
|
2825
|
-
"https://mskelton.dev/yarn-outdated/v3"
|
|
2826
|
-
]
|
|
2827
|
-
],
|
|
2828
|
-
[
|
|
2829
|
-
"yarn",
|
|
2830
|
-
[
|
|
2831
|
-
"plugin",
|
|
2832
|
-
"import",
|
|
2833
|
-
"version"
|
|
2834
|
-
]
|
|
2835
|
-
],
|
|
2836
|
-
[
|
|
2837
|
-
"yarn",
|
|
2838
|
-
[
|
|
2839
|
-
"plugin",
|
|
2840
|
-
"import",
|
|
2841
|
-
"interactive-tools"
|
|
2842
|
-
]
|
|
2843
|
-
],
|
|
2844
|
-
[
|
|
2845
|
-
"yarn",
|
|
2846
|
-
[
|
|
2847
|
-
"plugin",
|
|
2848
|
-
"import",
|
|
2849
|
-
"workspace-tools"
|
|
2850
|
-
]
|
|
2851
|
-
]
|
|
2293
|
+
["yarn", ["plugin", "import", "https://mskelton.dev/yarn-outdated/v3"]],
|
|
2294
|
+
["yarn", ["plugin", "import", "version"]],
|
|
2295
|
+
["yarn", ["plugin", "import", "interactive-tools"]],
|
|
2296
|
+
["yarn", ["plugin", "import", "workspace-tools"]]
|
|
2852
2297
|
]);
|
|
2853
|
-
}
|
|
2298
|
+
};
|
|
2854
2299
|
|
|
2855
2300
|
// src/actions/upyarn.ts
|
|
2856
|
-
var updateYarnVersion =
|
|
2857
|
-
return runSteps("Update Yarn Version", [
|
|
2858
|
-
|
|
2859
|
-
"yarn",
|
|
2860
|
-
[
|
|
2861
|
-
"set",
|
|
2862
|
-
"version",
|
|
2863
|
-
"latest"
|
|
2864
|
-
]
|
|
2865
|
-
]
|
|
2866
|
-
]);
|
|
2867
|
-
}, "updateYarnVersion");
|
|
2301
|
+
var updateYarnVersion = () => {
|
|
2302
|
+
return runSteps("Update Yarn Version", [["yarn", ["set", "version", "latest"]]]);
|
|
2303
|
+
};
|
|
2868
2304
|
|
|
2869
2305
|
// src/actions/yarn3only.ts
|
|
2870
|
-
var yarn3Only =
|
|
2306
|
+
var yarn3Only = () => {
|
|
2871
2307
|
const [valid, version] = isYarnVersionOrGreater(3);
|
|
2872
2308
|
if (!valid) {
|
|
2873
2309
|
processEx(`Invalid Yarn version [${version}]`);
|
|
2874
2310
|
}
|
|
2875
2311
|
return 0;
|
|
2876
|
-
}
|
|
2312
|
+
};
|
|
2877
2313
|
|
|
2878
2314
|
// src/loadPackageConfig.ts
|
|
2879
2315
|
import { readFile } from "fs/promises";
|
|
2880
|
-
var loadPackageConfig =
|
|
2316
|
+
var loadPackageConfig = async () => {
|
|
2881
2317
|
const pkg = process.env.INIT_CWD;
|
|
2882
|
-
const pkgConfig = await readFile(`${pkg}/package.json`, {
|
|
2883
|
-
encoding: "utf8"
|
|
2884
|
-
});
|
|
2318
|
+
const pkgConfig = await readFile(`${pkg}/package.json`, { encoding: "utf8" });
|
|
2885
2319
|
return JSON.parse(pkgConfig);
|
|
2886
|
-
}
|
|
2320
|
+
};
|
|
2887
2321
|
|
|
2888
2322
|
// src/xy/xy.ts
|
|
2889
2323
|
import chalk38 from "chalk";
|
|
2890
2324
|
|
|
2891
2325
|
// src/xy/xyBuildCommands.ts
|
|
2892
|
-
var xyBuildCommands =
|
|
2893
|
-
return args.command(
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
}
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
}
|
|
2972
|
-
|
|
2973
|
-
|
|
2326
|
+
var xyBuildCommands = (args) => {
|
|
2327
|
+
return args.command(
|
|
2328
|
+
"build [package]",
|
|
2329
|
+
"Build - Compile & Lint",
|
|
2330
|
+
(yargs2) => {
|
|
2331
|
+
return yargs2.positional("package", { describe: "Specific package to build" });
|
|
2332
|
+
},
|
|
2333
|
+
async (argv) => {
|
|
2334
|
+
if (argv.verbose) {
|
|
2335
|
+
console.log(`Building: ${argv.package ?? "all"}`);
|
|
2336
|
+
}
|
|
2337
|
+
process.exitCode = await build({
|
|
2338
|
+
incremental: !!argv.incremental,
|
|
2339
|
+
jobs: argv.jobs,
|
|
2340
|
+
pkg: argv.package,
|
|
2341
|
+
target: argv.target,
|
|
2342
|
+
verbose: !!argv.verbose
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
).command(
|
|
2346
|
+
"compile [package]",
|
|
2347
|
+
"Compile with Typescript & Copy Images",
|
|
2348
|
+
(yargs2) => {
|
|
2349
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2350
|
+
},
|
|
2351
|
+
(argv) => {
|
|
2352
|
+
if (argv.verbose) {
|
|
2353
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2354
|
+
}
|
|
2355
|
+
process.exitCode = compile({
|
|
2356
|
+
incremental: !!argv.incremental,
|
|
2357
|
+
jobs: argv.jobs,
|
|
2358
|
+
pkg: argv.package,
|
|
2359
|
+
target: argv.target,
|
|
2360
|
+
verbose: !!argv.verbose
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
).command(
|
|
2364
|
+
"compile-only [package]",
|
|
2365
|
+
"Compile with Typescript & Copy Images (No Publint)",
|
|
2366
|
+
(yargs2) => {
|
|
2367
|
+
return yargs2.positional("package", { describe: "Specific package to compile" });
|
|
2368
|
+
},
|
|
2369
|
+
(argv) => {
|
|
2370
|
+
if (argv.verbose) {
|
|
2371
|
+
console.log(`Compiling: ${argv.package ?? "all"}`);
|
|
2372
|
+
}
|
|
2373
|
+
process.exitCode = compile({
|
|
2374
|
+
incremental: !!argv.incremental,
|
|
2375
|
+
jobs: argv.jobs,
|
|
2376
|
+
pkg: argv.package,
|
|
2377
|
+
publint: false,
|
|
2378
|
+
target: argv.target,
|
|
2379
|
+
verbose: !!argv.verbose
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
).command(
|
|
2383
|
+
"recompile [package]",
|
|
2384
|
+
"Re-compile with Typescript & Copy Images",
|
|
2385
|
+
(yargs2) => {
|
|
2386
|
+
return yargs2.positional("package", { describe: "Specific package to re-compile" });
|
|
2387
|
+
},
|
|
2388
|
+
async (argv) => {
|
|
2389
|
+
if (argv.verbose) {
|
|
2390
|
+
console.log(`Re-compiling: ${argv.package ?? "all"}`);
|
|
2391
|
+
}
|
|
2392
|
+
process.exitCode = await recompile({
|
|
2393
|
+
incremental: !!argv.incremental,
|
|
2394
|
+
jobs: argv.jobs,
|
|
2395
|
+
pkg: argv.package,
|
|
2396
|
+
target: argv.target,
|
|
2397
|
+
verbose: !!argv.verbose
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2400
|
+
).command(
|
|
2401
|
+
"rebuild [package]",
|
|
2402
|
+
"Rebuild - Clean, Compile & Lint",
|
|
2403
|
+
(yargs2) => {
|
|
2404
|
+
return yargs2.positional("package", { describe: "Specific package to rebuild" });
|
|
2405
|
+
},
|
|
2406
|
+
(argv) => {
|
|
2407
|
+
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? "all"}`);
|
|
2408
|
+
process.exitCode = rebuild({ target: argv.target });
|
|
2409
|
+
}
|
|
2410
|
+
).command(
|
|
2411
|
+
"copy-assets [package]",
|
|
2412
|
+
"Copy Assets - Copy the assets from src to dist",
|
|
2413
|
+
(yargs2) => {
|
|
2414
|
+
return yargs2.positional("package", { describe: "Specific package to copy assets" });
|
|
2415
|
+
},
|
|
2416
|
+
async (argv) => {
|
|
2417
|
+
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? "all"}`);
|
|
2418
|
+
process.exitCode = await copyAssets({ target: argv.target });
|
|
2419
|
+
}
|
|
2420
|
+
);
|
|
2421
|
+
};
|
|
2974
2422
|
|
|
2975
2423
|
// src/xy/param.ts
|
|
2976
|
-
var packagePositionalParam =
|
|
2977
|
-
return yargs2.positional("package", {
|
|
2978
|
-
|
|
2979
|
-
type: "string"
|
|
2980
|
-
});
|
|
2981
|
-
}, "packagePositionalParam");
|
|
2424
|
+
var packagePositionalParam = (yargs2) => {
|
|
2425
|
+
return yargs2.positional("package", { describe: "Specific package to target", type: "string" });
|
|
2426
|
+
};
|
|
2982
2427
|
|
|
2983
2428
|
// src/xy/xyCommonCommands.ts
|
|
2984
|
-
var xyCommonCommands =
|
|
2985
|
-
return args.command(
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
2429
|
+
var xyCommonCommands = (args) => {
|
|
2430
|
+
return args.command(
|
|
2431
|
+
"license [package]",
|
|
2432
|
+
"License - Check licenses of dependencies",
|
|
2433
|
+
(yargs2) => {
|
|
2434
|
+
return packagePositionalParam(yargs2);
|
|
2435
|
+
},
|
|
2436
|
+
async (argv) => {
|
|
2437
|
+
if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
|
|
2438
|
+
process.exitCode = await license();
|
|
2439
|
+
}
|
|
2440
|
+
).command(
|
|
2441
|
+
"dead [package]",
|
|
2442
|
+
"Dead - Check for dead code",
|
|
2443
|
+
(yargs2) => {
|
|
2444
|
+
return packagePositionalParam(yargs2);
|
|
2445
|
+
},
|
|
2446
|
+
(argv) => {
|
|
2447
|
+
if (argv.verbose) console.log("Dead");
|
|
2448
|
+
process.exitCode = dead();
|
|
2449
|
+
}
|
|
2450
|
+
).command(
|
|
2451
|
+
"gen-docs [package]",
|
|
2452
|
+
"GenDocs - Generate TypeDocs",
|
|
2453
|
+
(yargs2) => {
|
|
2454
|
+
return packagePositionalParam(yargs2);
|
|
2455
|
+
},
|
|
2456
|
+
(argv) => {
|
|
2457
|
+
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
|
|
2458
|
+
process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
|
|
2459
|
+
}
|
|
2460
|
+
).command(
|
|
2461
|
+
"clean-docs",
|
|
2462
|
+
"CleanDocs - Clean TypeDocs",
|
|
2463
|
+
(yargs2) => yargs2,
|
|
2464
|
+
(argv) => {
|
|
2465
|
+
if (argv.verbose) console.log("Cleaning TypeDocs: all");
|
|
2466
|
+
process.exitCode = cleanDocs();
|
|
2467
|
+
}
|
|
2468
|
+
).command(
|
|
2469
|
+
"gitlint [package]",
|
|
2470
|
+
"Gitlint - Lint your git config",
|
|
2471
|
+
(yargs2) => {
|
|
2472
|
+
return yargs2;
|
|
2473
|
+
},
|
|
2474
|
+
(argv) => {
|
|
2475
|
+
if (argv.verbose) console.log("Gitlint");
|
|
2476
|
+
process.exitCode = argv.fix ? gitlintFix() : gitlint();
|
|
2477
|
+
}
|
|
2478
|
+
).command(
|
|
2479
|
+
"gitignore-gen",
|
|
2480
|
+
"GitIgnore Gen - Generate .gitignore files",
|
|
2481
|
+
(yargs2) => {
|
|
2482
|
+
return yargs2;
|
|
2483
|
+
},
|
|
2484
|
+
(argv) => {
|
|
2485
|
+
if (argv.verbose) console.log("GitIgnore Gen");
|
|
2486
|
+
process.exitCode = gitignoreGen();
|
|
2487
|
+
}
|
|
2488
|
+
).command(
|
|
2489
|
+
"npmignore-gen",
|
|
2490
|
+
"NpmIgnore Gen - Generate .npmignore files",
|
|
2491
|
+
(yargs2) => {
|
|
2492
|
+
return yargs2;
|
|
2493
|
+
},
|
|
2494
|
+
(argv) => {
|
|
2495
|
+
if (argv.verbose) console.log("NpmIgnore Gen");
|
|
2496
|
+
process.exitCode = npmignoreGen();
|
|
2497
|
+
}
|
|
2498
|
+
).command(
|
|
2499
|
+
"retest",
|
|
2500
|
+
"Re-Test - Run Jest Tests with cleaned cache",
|
|
2501
|
+
(yargs2) => {
|
|
2502
|
+
return yargs2;
|
|
2503
|
+
},
|
|
2504
|
+
(argv) => {
|
|
2505
|
+
if (argv.verbose) console.log("Re-Testing");
|
|
2506
|
+
process.exitCode = retest();
|
|
2507
|
+
}
|
|
2508
|
+
).command(
|
|
2509
|
+
"test",
|
|
2510
|
+
"Test - Run Jest Tests",
|
|
2511
|
+
(yargs2) => {
|
|
2512
|
+
return yargs2;
|
|
2513
|
+
},
|
|
2514
|
+
(argv) => {
|
|
2515
|
+
if (argv.verbose) console.log("Testing");
|
|
2516
|
+
process.exitCode = test();
|
|
2517
|
+
}
|
|
2518
|
+
).command(
|
|
2519
|
+
"upplug",
|
|
2520
|
+
"UpPlug - Update Yarn Plugins",
|
|
2521
|
+
(yargs2) => {
|
|
2522
|
+
return yargs2;
|
|
2523
|
+
},
|
|
2524
|
+
(argv) => {
|
|
2525
|
+
if (argv.verbose) console.log("UpPlug");
|
|
2526
|
+
process.exitCode = updateYarnPlugins();
|
|
2527
|
+
}
|
|
2528
|
+
).command(
|
|
2529
|
+
"upyarn",
|
|
2530
|
+
"UpYarn - Update Yarn Version",
|
|
2531
|
+
(yargs2) => {
|
|
2532
|
+
return yargs2;
|
|
2533
|
+
},
|
|
2534
|
+
(argv) => {
|
|
2535
|
+
if (argv.verbose) console.log("UpYarn");
|
|
2536
|
+
process.exitCode = updateYarnVersion();
|
|
2537
|
+
}
|
|
2538
|
+
).command(
|
|
2539
|
+
"yarn3only",
|
|
2540
|
+
"Yarn3Only - Check if using Yarn v3",
|
|
2541
|
+
(yargs2) => {
|
|
2542
|
+
return yargs2;
|
|
2543
|
+
},
|
|
2544
|
+
(argv) => {
|
|
2545
|
+
if (argv.verbose) console.log("Yarn 3 Check");
|
|
2546
|
+
process.exitCode = yarn3Only();
|
|
2547
|
+
}
|
|
2548
|
+
);
|
|
2549
|
+
};
|
|
3048
2550
|
|
|
3049
2551
|
// src/xy/xyDeployCommands.ts
|
|
3050
|
-
var xyDeployCommands =
|
|
3051
|
-
return args.command(
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
2552
|
+
var xyDeployCommands = (args) => {
|
|
2553
|
+
return args.command(
|
|
2554
|
+
"deploy",
|
|
2555
|
+
"Deploy - Deploy patch",
|
|
2556
|
+
(yargs2) => {
|
|
2557
|
+
return yargs2;
|
|
2558
|
+
},
|
|
2559
|
+
(argv) => {
|
|
2560
|
+
if (argv.verbose) console.log("Deploy patch");
|
|
2561
|
+
process.exitCode = deploy();
|
|
2562
|
+
}
|
|
2563
|
+
).command(
|
|
2564
|
+
"deploy-minor",
|
|
2565
|
+
"Deploy - Deploy minor",
|
|
2566
|
+
(yargs2) => {
|
|
2567
|
+
return yargs2;
|
|
2568
|
+
},
|
|
2569
|
+
(argv) => {
|
|
2570
|
+
if (argv.verbose) console.log("Deploy minor");
|
|
2571
|
+
process.exitCode = deployMinor();
|
|
2572
|
+
}
|
|
2573
|
+
).command(
|
|
2574
|
+
"deploy-major",
|
|
2575
|
+
"Deploy - Deploy major",
|
|
2576
|
+
(yargs2) => {
|
|
2577
|
+
return yargs2;
|
|
2578
|
+
},
|
|
2579
|
+
(argv) => {
|
|
2580
|
+
if (argv.verbose) console.log("Deploy major");
|
|
2581
|
+
process.exitCode = deployMajor();
|
|
2582
|
+
}
|
|
2583
|
+
).command(
|
|
2584
|
+
"deploy-next",
|
|
2585
|
+
"Deploy - Deploy next",
|
|
2586
|
+
(yargs2) => {
|
|
2587
|
+
return yargs2;
|
|
2588
|
+
},
|
|
2589
|
+
(argv) => {
|
|
2590
|
+
if (argv.verbose) console.log("Deploy next");
|
|
2591
|
+
process.exitCode = deployNext();
|
|
2592
|
+
}
|
|
2593
|
+
);
|
|
2594
|
+
};
|
|
3073
2595
|
|
|
3074
2596
|
// src/xy/xyInstallCommands.ts
|
|
3075
|
-
var xyInstallCommands =
|
|
3076
|
-
return args.command(
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
2597
|
+
var xyInstallCommands = (args) => {
|
|
2598
|
+
return args.command(
|
|
2599
|
+
"clean [package]",
|
|
2600
|
+
"Clean",
|
|
2601
|
+
(yargs2) => {
|
|
2602
|
+
return yargs2.positional("package", { describe: "Specific package to clean" });
|
|
2603
|
+
},
|
|
2604
|
+
async (argv) => {
|
|
2605
|
+
if (argv.verbose) {
|
|
2606
|
+
console.log(`Cleaning: ${argv.package ?? "all"}`);
|
|
2607
|
+
}
|
|
2608
|
+
process.exitCode = await clean({
|
|
2609
|
+
pkg: argv.package,
|
|
2610
|
+
verbose: !!argv.verbose
|
|
2611
|
+
});
|
|
3083
2612
|
}
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
2613
|
+
).command(
|
|
2614
|
+
"reinstall",
|
|
2615
|
+
"Reinstall - Clean & Install",
|
|
2616
|
+
(yargs2) => {
|
|
2617
|
+
return yargs2;
|
|
2618
|
+
},
|
|
2619
|
+
(argv) => {
|
|
2620
|
+
if (argv.verbose) console.log("Reinstalling");
|
|
2621
|
+
process.exitCode = reinstall();
|
|
2622
|
+
}
|
|
2623
|
+
).command(
|
|
2624
|
+
"up",
|
|
2625
|
+
"Up - Update dependencies",
|
|
2626
|
+
(yargs2) => {
|
|
2627
|
+
return yargs2;
|
|
2628
|
+
},
|
|
2629
|
+
(argv) => {
|
|
2630
|
+
if (argv.verbose) console.log("Up");
|
|
2631
|
+
process.exitCode = up();
|
|
2632
|
+
}
|
|
2633
|
+
).command(
|
|
2634
|
+
"updo",
|
|
2635
|
+
"Updo - Update dependencies [Interactive]",
|
|
2636
|
+
(yargs2) => {
|
|
2637
|
+
return yargs2;
|
|
2638
|
+
},
|
|
2639
|
+
(argv) => {
|
|
2640
|
+
if (argv.verbose) console.log("Updo");
|
|
2641
|
+
process.exitCode = updo();
|
|
2642
|
+
}
|
|
2643
|
+
).command(
|
|
2644
|
+
"statics",
|
|
2645
|
+
"Statics - Confirming Static Packages",
|
|
2646
|
+
(yargs2) => {
|
|
2647
|
+
return yargs2;
|
|
2648
|
+
},
|
|
2649
|
+
(argv) => {
|
|
2650
|
+
if (argv.verbose) console.log("Statics");
|
|
2651
|
+
process.exitCode = statics();
|
|
2652
|
+
}
|
|
2653
|
+
).command(
|
|
2654
|
+
"dupdeps",
|
|
2655
|
+
"Dupdeps - Duplicate Dependencies in package.json",
|
|
2656
|
+
(yargs2) => {
|
|
2657
|
+
return yargs2;
|
|
2658
|
+
},
|
|
2659
|
+
(argv) => {
|
|
2660
|
+
if (argv.verbose) console.log("Dupdeps");
|
|
2661
|
+
process.exitCode = dupdeps();
|
|
2662
|
+
}
|
|
2663
|
+
);
|
|
2664
|
+
};
|
|
3115
2665
|
|
|
3116
2666
|
// src/xy/xyLintCommands.ts
|
|
3117
2667
|
import chalk37 from "chalk";
|
|
3118
|
-
var xyLintCommands =
|
|
3119
|
-
return args.command(
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
}
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
2668
|
+
var xyLintCommands = (args) => {
|
|
2669
|
+
return args.command(
|
|
2670
|
+
"cycle [package]",
|
|
2671
|
+
"Cycle - Check for dependency cycles",
|
|
2672
|
+
(yargs2) => {
|
|
2673
|
+
return packagePositionalParam(yargs2);
|
|
2674
|
+
},
|
|
2675
|
+
async (argv) => {
|
|
2676
|
+
const start = Date.now();
|
|
2677
|
+
if (argv.verbose) console.log("Cycle");
|
|
2678
|
+
process.exitCode = await cycle({ pkg: argv.package });
|
|
2679
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
2680
|
+
}
|
|
2681
|
+
).command(
|
|
2682
|
+
"lint [package]",
|
|
2683
|
+
"Lint - Run Eslint",
|
|
2684
|
+
(yargs2) => {
|
|
2685
|
+
return packagePositionalParam(yargs2).option("fix", {
|
|
2686
|
+
alias: "f",
|
|
2687
|
+
default: false,
|
|
2688
|
+
description: "Fix fixable issues",
|
|
2689
|
+
type: "boolean"
|
|
2690
|
+
}).option("cache", {
|
|
2691
|
+
alias: "c",
|
|
2692
|
+
default: false,
|
|
2693
|
+
description: "Use caching for performance",
|
|
2694
|
+
type: "boolean"
|
|
2695
|
+
});
|
|
2696
|
+
},
|
|
2697
|
+
(argv) => {
|
|
2698
|
+
if (argv.verbose) console.log("Lint");
|
|
2699
|
+
const start = Date.now();
|
|
2700
|
+
process.exitCode = argv.fix ? fix({ pkg: argv.package, cache: argv.cache }) : lint({ pkg: argv.package, cache: argv.cache });
|
|
2701
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
2702
|
+
}
|
|
2703
|
+
).command(
|
|
2704
|
+
"deplint [package]",
|
|
2705
|
+
"Deplint - Run Deplint",
|
|
2706
|
+
(yargs2) => {
|
|
2707
|
+
return packagePositionalParam(yargs2).option("deps", {
|
|
2708
|
+
alias: "d",
|
|
2709
|
+
default: false,
|
|
2710
|
+
description: "Check dependencies",
|
|
2711
|
+
type: "boolean"
|
|
2712
|
+
}).option("devDeps", {
|
|
2713
|
+
alias: "v",
|
|
2714
|
+
default: false,
|
|
2715
|
+
description: "Check devDependencies",
|
|
2716
|
+
type: "boolean"
|
|
2717
|
+
}).option("peerDeps", {
|
|
2718
|
+
alias: "p",
|
|
2719
|
+
default: false,
|
|
2720
|
+
description: "Check peerDependencies",
|
|
2721
|
+
type: "boolean"
|
|
2722
|
+
});
|
|
2723
|
+
},
|
|
2724
|
+
(argv) => {
|
|
2725
|
+
if (argv.verbose) console.log("Deplint");
|
|
2726
|
+
const start = Date.now();
|
|
2727
|
+
process.exitCode = deplint({
|
|
2728
|
+
pkg: argv.package,
|
|
2729
|
+
deps: !!argv.deps,
|
|
2730
|
+
devDeps: !!argv.devDeps,
|
|
2731
|
+
peerDeps: !!argv.peerDeps,
|
|
2732
|
+
verbose: !!argv.verbose
|
|
2733
|
+
});
|
|
2734
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
2735
|
+
}
|
|
2736
|
+
).command(
|
|
2737
|
+
"fix [package]",
|
|
2738
|
+
"Fix - Run Eslint w/fix",
|
|
2739
|
+
(yargs2) => {
|
|
2740
|
+
return packagePositionalParam(yargs2);
|
|
2741
|
+
},
|
|
2742
|
+
(argv) => {
|
|
2743
|
+
const start = Date.now();
|
|
2744
|
+
if (argv.verbose) console.log("Fix");
|
|
2745
|
+
process.exitCode = fix();
|
|
2746
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
2747
|
+
}
|
|
2748
|
+
).command(
|
|
2749
|
+
"relint [package]",
|
|
2750
|
+
"Relint - Clean & Lint",
|
|
2751
|
+
(yargs2) => {
|
|
2752
|
+
return packagePositionalParam(yargs2);
|
|
2753
|
+
},
|
|
2754
|
+
(argv) => {
|
|
2755
|
+
if (argv.verbose) console.log("Relinting");
|
|
2756
|
+
const start = Date.now();
|
|
2757
|
+
process.exitCode = relint();
|
|
2758
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
2759
|
+
}
|
|
2760
|
+
).command(
|
|
2761
|
+
"publint [package]",
|
|
2762
|
+
"Publint - Run Publint",
|
|
2763
|
+
(yargs2) => {
|
|
2764
|
+
return packagePositionalParam(yargs2);
|
|
2765
|
+
},
|
|
2766
|
+
async (argv) => {
|
|
2767
|
+
if (argv.verbose) console.log("Publint");
|
|
2768
|
+
const start = Date.now();
|
|
2769
|
+
process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
|
|
2770
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
2771
|
+
}
|
|
2772
|
+
).command(
|
|
2773
|
+
"knip",
|
|
2774
|
+
"Knip - Run Knip",
|
|
2775
|
+
(yargs2) => {
|
|
2776
|
+
return packagePositionalParam(yargs2);
|
|
2777
|
+
},
|
|
2778
|
+
(argv) => {
|
|
2779
|
+
if (argv.verbose) console.log("Knip");
|
|
2780
|
+
const start = Date.now();
|
|
2781
|
+
process.exitCode = knip();
|
|
2782
|
+
console.log(chalk37.blue(`Knip finished in ${Date.now() - start}ms`));
|
|
2783
|
+
}
|
|
2784
|
+
).command(
|
|
2785
|
+
"sonar",
|
|
2786
|
+
"Sonar - Run Sonar Check",
|
|
2787
|
+
(yargs2) => {
|
|
2788
|
+
return packagePositionalParam(yargs2);
|
|
2789
|
+
},
|
|
2790
|
+
(argv) => {
|
|
2791
|
+
const start = Date.now();
|
|
2792
|
+
if (argv.verbose) console.log("Sonar Check");
|
|
2793
|
+
process.exitCode = sonar();
|
|
2794
|
+
console.log(chalk37.blue(`Finished in ${Date.now() - start}ms`));
|
|
2795
|
+
}
|
|
2796
|
+
);
|
|
2797
|
+
};
|
|
3219
2798
|
|
|
3220
2799
|
// src/xy/xyParseOptions.ts
|
|
3221
2800
|
import yargs from "yargs";
|
|
3222
2801
|
import { hideBin } from "yargs/helpers";
|
|
3223
|
-
var xyParseOptions =
|
|
2802
|
+
var xyParseOptions = () => {
|
|
3224
2803
|
return yargs(hideBin(process.argv)).scriptName("yarn xy").option("jobs", {
|
|
3225
2804
|
alias: "j",
|
|
3226
2805
|
default: void 0,
|
|
@@ -3242,16 +2821,16 @@ var xyParseOptions = /* @__PURE__ */ __name(() => {
|
|
|
3242
2821
|
description: "Profile action",
|
|
3243
2822
|
type: "boolean"
|
|
3244
2823
|
});
|
|
3245
|
-
}
|
|
2824
|
+
};
|
|
3246
2825
|
|
|
3247
2826
|
// src/xy/xy.ts
|
|
3248
|
-
var xy =
|
|
2827
|
+
var xy = async () => {
|
|
3249
2828
|
const options = xyParseOptions();
|
|
3250
2829
|
return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
|
|
3251
2830
|
console.error(chalk38.yellow(`Command not found [${chalk38.magenta(process.argv[2])}]`));
|
|
3252
2831
|
console.log(chalk38.gray("Try 'yarn xy --help' for list of commands"));
|
|
3253
2832
|
}).version().help().argv;
|
|
3254
|
-
}
|
|
2833
|
+
};
|
|
3255
2834
|
export {
|
|
3256
2835
|
CROSS_PLATFORM_NEWLINE,
|
|
3257
2836
|
DuplicateDetector,
|