@xylabs/ts-scripts-yarn3 3.15.4 → 3.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/build.cjs.map +1 -1
- package/dist/actions/build.mjs.map +1 -1
- package/dist/actions/clean-jest.cjs.map +1 -1
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.cjs.map +1 -1
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile.cjs.map +1 -1
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.cjs +1 -1
- package/dist/actions/copy-assets.cjs.map +1 -1
- package/dist/actions/copy-assets.mjs +1 -1
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.cjs.map +1 -1
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.cjs.map +1 -1
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deploy-major.cjs.map +1 -1
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.cjs.map +1 -1
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.cjs.map +1 -1
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.cjs.map +1 -1
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/deps.cjs.map +1 -1
- package/dist/actions/deps.mjs.map +1 -1
- package/dist/actions/dupdeps.cjs +0 -3
- package/dist/actions/dupdeps.cjs.map +1 -1
- package/dist/actions/dupdeps.mjs +0 -3
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.cjs.map +1 -1
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.cjs.map +1 -1
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.cjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/index.cjs +2 -5
- package/dist/actions/index.cjs.map +1 -1
- package/dist/actions/index.mjs +2 -5
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/license.cjs.map +1 -1
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint-clean.cjs.map +1 -1
- package/dist/actions/lint-clean.mjs.map +1 -1
- package/dist/actions/lint-profile.cjs.map +1 -1
- package/dist/actions/lint-profile.mjs.map +1 -1
- package/dist/actions/lint.cjs.map +1 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.cjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.cjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.cjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.cjs.map +1 -1
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/XyConfig.cjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.cjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.cjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.cjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/index.cjs.map +1 -1
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.cjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.cjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.cjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.cjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.cjs +1 -1
- package/dist/actions/package/copy-assets.cjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs +1 -1
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/deps.cjs.map +1 -1
- package/dist/actions/package/deps.mjs.map +1 -1
- package/dist/actions/package/index.cjs +1 -1
- package/dist/actions/package/index.cjs.map +1 -1
- package/dist/actions/package/index.mjs +1 -1
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/publint.cjs.map +1 -1
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.cjs.map +1 -1
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.cjs.map +1 -1
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.cjs.map +1 -1
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.cjs.map +1 -1
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.cjs.map +1 -1
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.cjs.map +1 -1
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.cjs.map +1 -1
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.cjs.map +1 -1
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.cjs +0 -3
- package/dist/actions/statics.cjs.map +1 -1
- package/dist/actions/statics.mjs +0 -3
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.cjs.map +1 -1
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.cjs.map +1 -1
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.cjs.map +1 -1
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.cjs.map +1 -1
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.cjs.map +1 -1
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.cjs.map +1 -1
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.cjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.cjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.cjs.map +1 -1
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.cjs.map +1 -1
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.cjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.cjs.map +1 -1
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.cjs +1 -1
- package/dist/bin/package/copy-assets-cjs.cjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.cjs +1 -1
- package/dist/bin/package/copy-assets-esm.cjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs +1 -1
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/deps.cjs.map +1 -1
- package/dist/bin/package/deps.mjs.map +1 -1
- package/dist/bin/package/publint.cjs.map +1 -1
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.cjs.map +1 -1
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy-ts.cjs +1 -4
- package/dist/bin/xy-ts.cjs.map +1 -1
- package/dist/bin/xy-ts.mjs +1 -4
- package/dist/bin/xy-ts.mjs.map +1 -1
- package/dist/bin/xy.cjs +1 -4
- package/dist/bin/xy.cjs.map +1 -1
- package/dist/bin/xy.mjs +1 -4
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.cjs +2 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -5
- package/dist/index.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.cjs +0 -3
- package/dist/lib/dependencies/detectDuplicateDependencies.cjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +0 -3
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.cjs +0 -3
- package/dist/lib/dependencies/index.cjs.map +1 -1
- package/dist/lib/dependencies/index.mjs +0 -3
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.cjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.cjs +0 -3
- package/dist/lib/index.cjs.map +1 -1
- package/dist/lib/index.mjs +0 -3
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/processEx.cjs.map +1 -1
- package/dist/lib/processEx.mjs.map +1 -1
- package/dist/lib/runSteps.cjs.map +1 -1
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.cjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.cjs.map +1 -1
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/safeExit.cjs.map +1 -1
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/yarn/index.cjs.map +1 -1
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.cjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/xy/index.cjs +1 -4
- package/dist/xy/index.cjs.map +1 -1
- package/dist/xy/index.mjs +1 -4
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/xy.cjs +1 -4
- package/dist/xy/xy.cjs.map +1 -1
- package/dist/xy/xy.mjs +1 -4
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.cjs +1 -1
- package/dist/xy/xyBuildCommands.cjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs +1 -1
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.cjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.cjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.cjs +0 -3
- package/dist/xy/xyInstallCommands.cjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs +0 -3
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.cjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +14 -14
- package/src/actions/build.ts +1 -1
- package/src/actions/copy-assets.ts +2 -2
- package/src/actions/cycle.ts +1 -1
- package/src/actions/deps.ts +2 -1
- package/src/actions/license.ts +2 -2
- package/src/actions/lint.ts +1 -1
- package/src/actions/package/clean-outputs.ts +1 -1
- package/src/actions/package/clean-typescript.ts +1 -1
- package/src/actions/package/compile/XyConfig.ts +2 -0
- package/src/actions/package/compile/buildEntries.ts +1 -1
- package/src/actions/package/compile/copyTypeFiles.ts +4 -4
- package/src/actions/package/compile/inputs.ts +4 -4
- package/src/actions/package/compile/packageCompileTsc.ts +1 -1
- package/src/actions/package/compile/packageCompileTscTypes.ts +1 -1
- package/src/actions/package/compile/packageCompileTsup.ts +38 -38
- package/src/actions/package/copy-assets.ts +1 -1
- package/src/actions/package/deps.ts +5 -5
- package/src/actions/package/publint.ts +4 -4
- package/src/bin/package/compile-only.ts +1 -1
- package/src/bin/package/compile-tsup.ts +1 -1
- package/src/bin/package/copy-assets-cjs.ts +1 -1
- package/src/bin/package/copy-assets-esm.ts +1 -1
- package/src/bin/package/deps.ts +1 -1
- package/src/bin/package/publint.ts +1 -1
- package/src/bin/package/recompile.ts +1 -1
- package/src/lib/dependencies/detectDuplicateDependencies.ts +0 -3
- package/src/lib/generateIgnoreFiles.ts +1 -1
- package/src/lib/processEx.ts +7 -7
- package/src/lib/runSteps.ts +4 -4
- package/src/lib/yarn/isYarnVersionOrGreater.ts +1 -1
- package/src/xy/xy.ts +1 -1
- package/src/xy/xyCommonCommands.ts +1 -1
- package/src/xy/xyLintCommands.ts +6 -4
package/src/actions/lint.ts
CHANGED
|
@@ -33,7 +33,7 @@ const dumpMessages = (lintResults: ESLint.LintResult[]) => {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export const lintPackage = async ({ pkg }: LintParams) => {
|
|
36
|
-
const workspace = yarnWorkspaces().find(
|
|
36
|
+
const workspace = yarnWorkspaces().find(workspace => workspace.name === pkg)
|
|
37
37
|
if (!workspace) {
|
|
38
38
|
console.error(chalk.red(`Unable to locate package [${chalk.magenta(pkg)}]`))
|
|
39
39
|
process.exit(1)
|
|
@@ -9,7 +9,7 @@ export const packageCleanOutputs = async () => {
|
|
|
9
9
|
const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]
|
|
10
10
|
console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))
|
|
11
11
|
|
|
12
|
-
await Promise.all(folders.map(
|
|
12
|
+
await Promise.all(folders.map(folder => rimraf(folder)))
|
|
13
13
|
|
|
14
14
|
return 0
|
|
15
15
|
}
|
|
@@ -9,7 +9,7 @@ export const packageCleanTypescript = async () => {
|
|
|
9
9
|
console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))
|
|
10
10
|
const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]
|
|
11
11
|
|
|
12
|
-
await Promise.all(files.map(
|
|
12
|
+
await Promise.all(files.map(file => rimraf(file)))
|
|
13
13
|
|
|
14
14
|
return 0
|
|
15
15
|
}
|
|
@@ -21,11 +21,13 @@ export interface PathConfig {
|
|
|
21
21
|
/**
|
|
22
22
|
* Configuration for Dynamic Share.
|
|
23
23
|
*/
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
24
25
|
export interface DynamicShareConfig extends PathConfig {}
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Configuration for Live Share.
|
|
28
29
|
*/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
29
31
|
export interface LiveShareConfig extends PathConfig {}
|
|
30
32
|
|
|
31
33
|
export interface CompileConfig {
|
|
@@ -9,7 +9,7 @@ export const buildEntries = (folder: string, entryMode?: EntryMode, verbose = fa
|
|
|
9
9
|
}
|
|
10
10
|
case 'all': {
|
|
11
11
|
if (verbose) console.log('buildEntries [all]')
|
|
12
|
-
return getAllInputs2(folder).filter(
|
|
12
|
+
return getAllInputs2(folder).filter(entry => !entry.includes('.spec.') && !entry.includes('.story.'))
|
|
13
13
|
}
|
|
14
14
|
default: {
|
|
15
15
|
if (verbose) console.log('buildEntries [single]')
|
|
@@ -7,18 +7,18 @@ const copyFileMutex = new Mutex()
|
|
|
7
7
|
|
|
8
8
|
const getDistTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {
|
|
9
9
|
const outDir = compilerOptions.outDir ?? 'dist'
|
|
10
|
-
return (await readdir(outDir, { recursive: true })).filter(
|
|
10
|
+
return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts')).map(file => `${outDir}/${file}`)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const getDistTypeMapFiles = async (compilerOptions: TsConfigCompilerOptions) => {
|
|
14
14
|
const outDir = compilerOptions.outDir ?? 'dist'
|
|
15
|
-
return (await readdir(outDir, { recursive: true })).filter(
|
|
15
|
+
return (await readdir(outDir, { recursive: true })).filter(file => file.endsWith('d.ts.map')).map(file => `${outDir}/${file}`)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const copyTypeFiles = async (compilerOptions: TsConfigCompilerOptions) => {
|
|
19
|
-
//using a mutex since sometimes two compiles are running at once and cause a lock on windows
|
|
19
|
+
// using a mutex since sometimes two compiles are running at once and cause a lock on windows
|
|
20
20
|
await copyFileMutex.runExclusive(async () => {
|
|
21
|
-
//hybrid packages want two copies of the types
|
|
21
|
+
// hybrid packages want two copies of the types
|
|
22
22
|
const distTypeFiles = await getDistTypeFiles(compilerOptions)
|
|
23
23
|
await Promise.all(
|
|
24
24
|
distTypeFiles.map(async (file) => {
|
|
@@ -5,9 +5,9 @@ import { glob } from 'glob'
|
|
|
5
5
|
export const getInputs = async (subDir?: string) => {
|
|
6
6
|
return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))
|
|
7
7
|
.filter(
|
|
8
|
-
|
|
8
|
+
file => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.includes('.spec.') && !file.includes('.stories.'),
|
|
9
9
|
)
|
|
10
|
-
.map(
|
|
10
|
+
.map(file => (subDir ? `${subDir}/${file}` : file))
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const getInputDirs = async (depth: number = 0) => {
|
|
@@ -17,7 +17,7 @@ export const getInputDirs = async (depth: number = 0) => {
|
|
|
17
17
|
return [
|
|
18
18
|
'.',
|
|
19
19
|
...(await readdir('src', { recursive: true, withFileTypes: true }))
|
|
20
|
-
.filter(
|
|
20
|
+
.filter(file => file.isDirectory())
|
|
21
21
|
.map((file) => {
|
|
22
22
|
const pathParts = file.path?.split('/') ?? []
|
|
23
23
|
pathParts.shift()
|
|
@@ -33,7 +33,7 @@ export const getInputDirs = async (depth: number = 0) => {
|
|
|
33
33
|
|
|
34
34
|
export const getAllInputs = async (depth = 100) => {
|
|
35
35
|
const dirs = await getInputDirs(depth)
|
|
36
|
-
return (await Promise.all(dirs.map(async
|
|
36
|
+
return (await Promise.all(dirs.map(async dir => await getInputs(dir)))).flat()
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const getAllInputs2 = (folder: string) => {
|
|
@@ -23,7 +23,7 @@ export const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig,
|
|
|
23
23
|
const verbose = config?.verbose ?? false
|
|
24
24
|
|
|
25
25
|
const formatHost: FormatDiagnosticsHost = {
|
|
26
|
-
getCanonicalFileName:
|
|
26
|
+
getCanonicalFileName: fileName => fileName,
|
|
27
27
|
getCurrentDirectory: () => pkg,
|
|
28
28
|
getNewLine: () => '\n',
|
|
29
29
|
}
|
|
@@ -34,7 +34,7 @@ export const packageCompileTscTypes = async (
|
|
|
34
34
|
...compilerOptionsParam,
|
|
35
35
|
} as TsConfigCompilerOptions
|
|
36
36
|
|
|
37
|
-
//calling all here since the types do not get rolled up
|
|
37
|
+
// calling all here since the types do not get rolled up
|
|
38
38
|
const files = buildEntries(folder, 'all')
|
|
39
39
|
|
|
40
40
|
const result = createProgramFromConfig({
|
|
@@ -35,7 +35,7 @@ const compileFolder = async (folder: string, entryMode: EntryMode = 'single', op
|
|
|
35
35
|
)
|
|
36
36
|
).flat()
|
|
37
37
|
|
|
38
|
-
await Promise.all(optionsList.map(
|
|
38
|
+
await Promise.all(optionsList.map(options => build(options)))
|
|
39
39
|
await packageCompileTscTypes(folder, { verbose }, { outDir })
|
|
40
40
|
|
|
41
41
|
return 0
|
|
@@ -55,46 +55,46 @@ export const packageCompileTsup = async (config?: XyTsupConfig) => {
|
|
|
55
55
|
const compileForNeutral = compile?.neutral ?? { src: {} }
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
|
-
(await packageCompileTsc(true, { publint: false, verbose }))
|
|
59
|
-
(
|
|
58
|
+
(await packageCompileTsc(true, { publint: false, verbose }))
|
|
59
|
+
|| (
|
|
60
60
|
await Promise.all(
|
|
61
61
|
Object.entries(compileForNode).map(async ([folder, options]) => {
|
|
62
62
|
const inEsBuildOptions = typeof compile?.node?.esbuildOptions === 'object' ? compile?.node?.esbuildOptions : {}
|
|
63
|
-
return folder
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
63
|
+
return folder
|
|
64
|
+
? await compileFolder(
|
|
65
|
+
folder,
|
|
66
|
+
compile?.entryMode,
|
|
67
|
+
{
|
|
68
|
+
bundle: true,
|
|
69
|
+
format: ['cjs', 'esm'],
|
|
70
|
+
loader: merge(
|
|
71
|
+
{},
|
|
72
|
+
{ '.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy' },
|
|
73
|
+
inEsBuildOptions?.loader,
|
|
74
|
+
),
|
|
75
|
+
// minify: true,
|
|
76
|
+
outDir: 'dist/node',
|
|
77
|
+
outExtension: ({ format }) => (format === 'esm' ? { js: '.mjs' } : { js: '.cjs' }),
|
|
78
|
+
platform: 'node',
|
|
79
|
+
skipNodeModulesBundle: true,
|
|
80
|
+
sourcemap: true,
|
|
81
|
+
target: 'node16',
|
|
82
|
+
// terserOptions: { format: { comments: false } },
|
|
83
|
+
...compile?.tsup?.options,
|
|
84
|
+
...(typeof options === 'object' ? options : {}),
|
|
85
|
+
},
|
|
86
|
+
verbose,
|
|
87
|
+
)
|
|
88
88
|
: 0
|
|
89
89
|
}),
|
|
90
90
|
)
|
|
91
|
-
).reduce((prev, value) => prev + value, 0)
|
|
92
|
-
(
|
|
91
|
+
).reduce((prev, value) => prev + value, 0)
|
|
92
|
+
|| (
|
|
93
93
|
await Promise.all(
|
|
94
94
|
Object.entries(compileForBrowser).map(async ([folder, options]) => {
|
|
95
95
|
const inEsBuildOptions = typeof compile?.browser?.esbuildOptions === 'object' ? compile?.browser?.esbuildOptions : {}
|
|
96
|
-
return folder
|
|
97
|
-
|
|
96
|
+
return folder
|
|
97
|
+
? (
|
|
98
98
|
await Promise.all([
|
|
99
99
|
compileFolder(
|
|
100
100
|
folder,
|
|
@@ -149,13 +149,13 @@ export const packageCompileTsup = async (config?: XyTsupConfig) => {
|
|
|
149
149
|
: 0
|
|
150
150
|
}),
|
|
151
151
|
)
|
|
152
|
-
).reduce((prev, value) => prev + value, 0)
|
|
153
|
-
(
|
|
152
|
+
).reduce((prev, value) => prev + value, 0)
|
|
153
|
+
|| (
|
|
154
154
|
await Promise.all(
|
|
155
155
|
Object.entries(compileForNeutral).map(async ([folder, options]) => {
|
|
156
156
|
const inEsBuildOptions = typeof compile?.neutral?.esbuildOptions === 'object' ? compile?.neutral?.esbuildOptions : {}
|
|
157
|
-
return folder
|
|
158
|
-
|
|
157
|
+
return folder
|
|
158
|
+
? (
|
|
159
159
|
await Promise.all([
|
|
160
160
|
compileFolder(
|
|
161
161
|
folder,
|
|
@@ -210,7 +210,7 @@ export const packageCompileTsup = async (config?: XyTsupConfig) => {
|
|
|
210
210
|
: 0
|
|
211
211
|
}),
|
|
212
212
|
)
|
|
213
|
-
).reduce((prev, value) => prev + value, 0)
|
|
214
|
-
(publint ? await packagePublint() : 0)
|
|
213
|
+
).reduce((prev, value) => prev + value, 0)
|
|
214
|
+
|| (publint ? await packagePublint() : 0)
|
|
215
215
|
)
|
|
216
216
|
}
|
|
@@ -69,8 +69,8 @@ export const packageDeps = async () => {
|
|
|
69
69
|
|
|
70
70
|
const packageContent = existsSync(`${pkg}/package.json`) ? JSON.parse(readFileSync(`${pkg}/package.json`, { encoding: 'utf8' })) : undefined
|
|
71
71
|
|
|
72
|
-
const rawIgnore
|
|
73
|
-
existsSync(`${pkg}/.depcheckrc`) ? readFileSync(`${pkg}/.depcheckrc`, { encoding: 'utf8' }).replace('ignores:', '"ignores":') : undefined
|
|
72
|
+
const rawIgnore
|
|
73
|
+
= existsSync(`${pkg}/.depcheckrc`) ? readFileSync(`${pkg}/.depcheckrc`, { encoding: 'utf8' }).replace('ignores:', '"ignores":') : undefined
|
|
74
74
|
let ignoreMatches: string[] = []
|
|
75
75
|
try {
|
|
76
76
|
ignoreMatches = rawIgnore ? (JSON.parse(`{${rawIgnore}}`).ignores as string[]) : []
|
|
@@ -86,10 +86,10 @@ export const packageDeps = async () => {
|
|
|
86
86
|
const declaredDevDeps = Object.keys(packageContent.devDependencies ?? {})
|
|
87
87
|
|
|
88
88
|
const missingDeps = Object.keys(usedDeps).filter(
|
|
89
|
-
|
|
89
|
+
key => !declaredDeps.includes(key) && !declaredPeerDeps.includes(key) && !key.startsWith('@types/'),
|
|
90
90
|
)
|
|
91
91
|
|
|
92
|
-
const missingDevDeps = Object.keys(usedDevDeps).filter(
|
|
92
|
+
const missingDevDeps = Object.keys(usedDevDeps).filter(key => !declaredDevDeps.includes(key) && !declaredDeps.includes(key))
|
|
93
93
|
|
|
94
94
|
const missingDepsObject: Record<string, string[]> = {}
|
|
95
95
|
for (const key of missingDeps) {
|
|
@@ -136,6 +136,6 @@ export const packageDeps = async () => {
|
|
|
136
136
|
|
|
137
137
|
checkResult(`Deps [${pkgName}]`, errorCount, 'warn', false)
|
|
138
138
|
|
|
139
|
-
//returning 0 here since we never want deps to be fatal
|
|
139
|
+
// returning 0 here since we never want deps to be fatal
|
|
140
140
|
return 0
|
|
141
141
|
}
|
|
@@ -27,7 +27,7 @@ export const packagePublint = async (params?: PackagePublintParams) => {
|
|
|
27
27
|
|
|
28
28
|
const validMessage = (_message: Message): boolean => {
|
|
29
29
|
return true
|
|
30
|
-
/*try {
|
|
30
|
+
/* try {
|
|
31
31
|
const value = getValueFromPath(pkg, message.path)
|
|
32
32
|
switch (message.code) {
|
|
33
33
|
case 'FILE_INVALID_FORMAT':
|
|
@@ -42,10 +42,10 @@ export const packagePublint = async (params?: PackagePublintParams) => {
|
|
|
42
42
|
console.error(chalk.red(`validMessage Excepted: ${error.message}`))
|
|
43
43
|
console.error(chalk.gray(JSON.stringify(error.stack)))
|
|
44
44
|
return true
|
|
45
|
-
}*/
|
|
45
|
+
} */
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
//we filter out invalid file formats for the esm folder since it is intentionally done
|
|
48
|
+
// we filter out invalid file formats for the esm folder since it is intentionally done
|
|
49
49
|
const validMessages = messages.filter(validMessage)
|
|
50
50
|
for (const message of validMessages) {
|
|
51
51
|
switch (message.type) {
|
|
@@ -68,5 +68,5 @@ export const packagePublint = async (params?: PackagePublintParams) => {
|
|
|
68
68
|
console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
return validMessages.filter(
|
|
71
|
+
return validMessages.filter(message => message.type === 'error').length
|
|
72
72
|
}
|
|
@@ -5,7 +5,7 @@ import chalk from 'chalk'
|
|
|
5
5
|
import { packageCompile } from '../../actions/index.ts'
|
|
6
6
|
|
|
7
7
|
packageCompile({ verbose: true, publint: false })
|
|
8
|
-
.then(
|
|
8
|
+
.then(value => (process.exitCode = value))
|
|
9
9
|
.catch((reason) => {
|
|
10
10
|
console.error(chalk.red(reason))
|
|
11
11
|
process.exitCode = 1
|
|
@@ -5,7 +5,7 @@ import chalk from 'chalk'
|
|
|
5
5
|
import { packageCompileTsup } from '../../actions/index.ts'
|
|
6
6
|
|
|
7
7
|
packageCompileTsup({ verbose: true })
|
|
8
|
-
.then(
|
|
8
|
+
.then(value => (process.exitCode = value))
|
|
9
9
|
.catch((reason) => {
|
|
10
10
|
console.error(chalk.red(reason))
|
|
11
11
|
process.exitCode = 1
|
|
@@ -5,7 +5,7 @@ import chalk from 'chalk'
|
|
|
5
5
|
import { packageCopyAssets } from '../../actions/index.ts'
|
|
6
6
|
|
|
7
7
|
packageCopyAssets({ target: 'cjs' })
|
|
8
|
-
.then(
|
|
8
|
+
.then(value => (process.exitCode = value))
|
|
9
9
|
.catch((reason) => {
|
|
10
10
|
console.error(chalk.red(reason))
|
|
11
11
|
process.exitCode = 1
|
|
@@ -5,7 +5,7 @@ import chalk from 'chalk'
|
|
|
5
5
|
import { packageCopyAssets } from '../../actions/index.ts'
|
|
6
6
|
|
|
7
7
|
packageCopyAssets({ target: 'esm' })
|
|
8
|
-
.then(
|
|
8
|
+
.then(value => (process.exitCode = value))
|
|
9
9
|
.catch((reason) => {
|
|
10
10
|
console.error(chalk.red(reason))
|
|
11
11
|
process.exitCode = 1
|
package/src/bin/package/deps.ts
CHANGED
|
@@ -5,7 +5,7 @@ import chalk from 'chalk'
|
|
|
5
5
|
import { packageDeps } from '../../actions/index.ts'
|
|
6
6
|
|
|
7
7
|
packageDeps()
|
|
8
|
-
.then(
|
|
8
|
+
.then(value => (process.exitCode = value))
|
|
9
9
|
.catch((ex: Error) => {
|
|
10
10
|
console.error(`Deps Failed: ${chalk.red(ex)}`)
|
|
11
11
|
process.exitCode = 0
|
|
@@ -5,7 +5,7 @@ import chalk from 'chalk'
|
|
|
5
5
|
import { packagePublint } from '../../actions/index.ts'
|
|
6
6
|
|
|
7
7
|
packagePublint()
|
|
8
|
-
.then(
|
|
8
|
+
.then(value => (process.exitCode = value))
|
|
9
9
|
.catch((ex: Error) => {
|
|
10
10
|
console.error(`Publint Failed: ${chalk.red(ex)}`)
|
|
11
11
|
console.error(chalk.gray(ex.stack))
|
|
@@ -5,7 +5,7 @@ import chalk from 'chalk'
|
|
|
5
5
|
import { packageRecompile } from '../../actions/index.ts'
|
|
6
6
|
|
|
7
7
|
packageRecompile()
|
|
8
|
-
.then(
|
|
8
|
+
.then(value => (process.exitCode = value))
|
|
9
9
|
.catch((reason) => {
|
|
10
10
|
console.error(chalk.red(reason))
|
|
11
11
|
process.exitCode = 1
|
|
@@ -19,20 +19,17 @@ export const detectDuplicateDependencies = (depsFromPackageJSON?: string[], Defa
|
|
|
19
19
|
} catch (e) {
|
|
20
20
|
console.error(`Error running yarn why: ${e}`)
|
|
21
21
|
exitCode = 1
|
|
22
|
-
exitCode
|
|
23
22
|
continue
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
if (output) {
|
|
27
26
|
exitCode = new DuplicateDetector(output, dependency).detect()
|
|
28
|
-
exitCode
|
|
29
27
|
} else {
|
|
30
28
|
console.log(`${dependency} - N/A`)
|
|
31
29
|
if (depsFromPackageJSON) {
|
|
32
30
|
exitCode = 1
|
|
33
31
|
console.log(`🚨 Library ${dependency} was requested in package.json but not found`)
|
|
34
32
|
}
|
|
35
|
-
exitCode
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
return exitCode
|
package/src/lib/processEx.ts
CHANGED
|
@@ -5,23 +5,23 @@ import { withError } from './withError.ts'
|
|
|
5
5
|
|
|
6
6
|
export const processEx = (ex: unknown) => {
|
|
7
7
|
const error = typeof ex === 'string' ? new Error(ex) : ex
|
|
8
|
-
const exitCode
|
|
9
|
-
withErrnoException(error, (error) => {
|
|
8
|
+
const exitCode
|
|
9
|
+
= withErrnoException(error, (error) => {
|
|
10
10
|
if (error.code === 'ENOENT') {
|
|
11
11
|
console.error(chalk.red(`'${error.path}' not found.`))
|
|
12
12
|
} else {
|
|
13
13
|
console.error(chalk.red(`Errno: ${error.code}`))
|
|
14
14
|
}
|
|
15
15
|
return error.errno ?? -1
|
|
16
|
-
})
|
|
17
|
-
withError(error, (error) => {
|
|
16
|
+
})
|
|
17
|
+
?? withError(error, (error) => {
|
|
18
18
|
console.error(chalk.red(`${error.name}: ${error.message}`))
|
|
19
19
|
return -1
|
|
20
|
-
})
|
|
21
|
-
(() => {
|
|
20
|
+
})
|
|
21
|
+
?? (() => {
|
|
22
22
|
console.error(chalk.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`))
|
|
23
23
|
return -1
|
|
24
24
|
})()
|
|
25
|
-
//This allows us to use a previously set exit code
|
|
25
|
+
// This allows us to use a previously set exit code
|
|
26
26
|
process.exit(process.exitCode ?? exitCode)
|
|
27
27
|
}
|
package/src/lib/runSteps.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { checkResult } from './checkResult.ts'
|
|
|
7
7
|
import { safeExit } from './safeExit.ts'
|
|
8
8
|
|
|
9
9
|
export type ScriptStep =
|
|
10
|
-
| [/*command*/ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /*arg*/ string | string[]]
|
|
11
|
-
| [/*command*/ string, /*arg*/ string | string[], /*config*/ SpawnSyncOptionsWithBufferEncoding]
|
|
10
|
+
| [/* command */ 'yarn' | 'node' | 'ts-node-script' | 'tsc' | 'jest', /* arg */ string | string[]]
|
|
11
|
+
| [/* command */ string, /* arg */ string | string[], /* config */ SpawnSyncOptionsWithBufferEncoding]
|
|
12
12
|
|
|
13
13
|
export const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, messages?: string[]): number => {
|
|
14
14
|
return safeExit(() => {
|
|
@@ -23,8 +23,8 @@ export const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, m
|
|
|
23
23
|
if (command === 'node' && !existsSync(argList[0])) {
|
|
24
24
|
throw new Error(`File not found [${argList[0]}]`)
|
|
25
25
|
}
|
|
26
|
-
const status
|
|
27
|
-
spawnSync(command, Array.isArray(args) ? args : args.split(' '), {
|
|
26
|
+
const status
|
|
27
|
+
= spawnSync(command, Array.isArray(args) ? args : args.split(' '), {
|
|
28
28
|
...config,
|
|
29
29
|
encoding: 'utf8',
|
|
30
30
|
env: { FORCE_COLOR: '3', ...process.env },
|
|
@@ -3,7 +3,7 @@ import { spawnSync } from 'node:child_process'
|
|
|
3
3
|
export const isYarnVersionOrGreater = (major: number, minor?: number, patch?: number): [boolean, string] => {
|
|
4
4
|
const result = spawnSync('yarn', ['-v'], { encoding: 'utf8', shell: true })
|
|
5
5
|
const version = result.stdout.toString().replaceAll('\n', '')
|
|
6
|
-
const versionNumbers = version.split('.').map(
|
|
6
|
+
const versionNumbers = version.split('.').map(ver => Number.parseInt(ver))
|
|
7
7
|
const majorDelta = versionNumbers[0] - major
|
|
8
8
|
const minorDelta = versionNumbers[1] - (minor ?? versionNumbers[1])
|
|
9
9
|
const patchDelta = versionNumbers[2] - (patch ?? versionNumbers[2])
|
package/src/xy/xy.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const xy = async () => {
|
|
|
13
13
|
.demandCommand(1)
|
|
14
14
|
.command('*', '', () => {
|
|
15
15
|
console.error(chalk.yellow(`Command not found [${chalk.magenta(process.argv[2])}]`))
|
|
16
|
-
console.log(chalk.gray(
|
|
16
|
+
console.log(chalk.gray('Try \'yarn xy --help\' for list of commands'))
|
|
17
17
|
})
|
|
18
18
|
.version()
|
|
19
19
|
.help().argv
|
|
@@ -68,7 +68,7 @@ export const xyCommonCommands = (args: Argv) => {
|
|
|
68
68
|
.command(
|
|
69
69
|
'clean-docs',
|
|
70
70
|
'CleanDocs - Clean TypeDocs',
|
|
71
|
-
|
|
71
|
+
yargs => yargs,
|
|
72
72
|
(argv) => {
|
|
73
73
|
if (argv.verbose) console.log('Cleaning TypeDocs: all')
|
|
74
74
|
process.exitCode = cleanDocs()
|
package/src/xy/xyLintCommands.ts
CHANGED
|
@@ -28,10 +28,12 @@ export const xyLintCommands = (args: Argv) => {
|
|
|
28
28
|
async (argv) => {
|
|
29
29
|
if (argv.verbose) console.log('Lint')
|
|
30
30
|
const start = Date.now()
|
|
31
|
-
process.exitCode
|
|
32
|
-
argv.fix
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
process.exitCode
|
|
32
|
+
= argv.fix
|
|
33
|
+
? fix()
|
|
34
|
+
: argv.profile
|
|
35
|
+
? lintProfile()
|
|
36
|
+
: await lint({ pkg: argv.package as string })
|
|
35
37
|
console.log(chalk.blue(`Finished in ${Date.now() - start}ms`))
|
|
36
38
|
},
|
|
37
39
|
)
|