@xylabs/ts-scripts-yarn3 3.2.42 → 3.3.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/clean-docs.js +2 -2
- package/dist/actions/clean-docs.js.map +1 -1
- package/dist/actions/clean-docs.mjs +1 -1
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.js +2 -2
- package/dist/actions/clean-eslint.js.map +1 -1
- package/dist/actions/clean-eslint.mjs +1 -1
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/compile.js.map +1 -1
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.js +9 -6
- package/dist/actions/copy-assets.js.map +1 -1
- package/dist/actions/copy-assets.mjs +9 -6
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.js +1 -1
- package/dist/actions/cycle.js.map +1 -1
- package/dist/actions/cycle.mjs +1 -1
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/gitlint-fix.js +4 -4
- package/dist/actions/gitlint-fix.js.map +1 -1
- package/dist/actions/gitlint-fix.mjs +1 -1
- package/dist/actions/gitlint-fix.mjs.map +1 -1
- package/dist/actions/gitlint.js +6 -6
- package/dist/actions/gitlint.js.map +1 -1
- package/dist/actions/gitlint.mjs +6 -6
- package/dist/actions/gitlint.mjs.map +1 -1
- package/dist/actions/license.js +11 -11
- package/dist/actions/license.js.map +1 -1
- package/dist/actions/license.mjs +11 -11
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint-clean.js +2 -2
- package/dist/actions/lint-clean.js.map +1 -1
- package/dist/actions/lint-clean.mjs +1 -1
- package/dist/actions/lint-clean.mjs.map +1 -1
- package/dist/actions/lint.js +4 -4
- package/dist/actions/lint.js.map +1 -1
- package/dist/actions/lint.mjs +4 -4
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.js +6 -6
- package/dist/actions/package/clean-outputs.js.map +1 -1
- package/dist/actions/package/clean-outputs.mjs +2 -2
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.js +3 -3
- package/dist/actions/package/clean-typescript.js.map +1 -1
- package/dist/actions/package/clean-typescript.mjs +1 -1
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.js +6 -4
- package/dist/actions/package/compile/buildEntries.js.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs +6 -4
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.js +1 -1
- package/dist/actions/package/compile/copyTypeFiles.js.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.js +1 -1
- package/dist/actions/package/compile/getCompilerOptions.js.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.js +2 -2
- package/dist/actions/package/compile/inputs.js.map +1 -1
- package/dist/actions/package/compile/inputs.mjs +2 -2
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.js +8 -8
- package/dist/actions/package/compile/packageCompileTsc.js.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs +6 -6
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.js +13 -10
- package/dist/actions/package/compile/packageCompileTscTypes.js.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs +11 -8
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.js +5 -5
- package/dist/actions/package/compile/packageCompileTsup.js.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs +5 -5
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.js +9 -6
- package/dist/actions/package/copy-assets.js.map +1 -1
- package/dist/actions/package/copy-assets.mjs +9 -6
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/deps.js +23 -21
- package/dist/actions/package/deps.js.map +1 -1
- package/dist/actions/package/deps.mjs +19 -17
- package/dist/actions/package/deps.mjs.map +1 -1
- package/dist/actions/package/gen-docs.js +2 -4
- package/dist/actions/package/gen-docs.js.map +1 -1
- package/dist/actions/package/gen-docs.mjs +2 -4
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/publint.js +10 -7
- package/dist/actions/package/publint.js.map +1 -1
- package/dist/actions/package/publint.mjs +9 -6
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/reinstall.js +3 -3
- package/dist/actions/reinstall.js.map +1 -1
- package/dist/actions/reinstall.mjs +1 -1
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.js +2 -2
- package/dist/actions/relint.js.map +1 -1
- package/dist/actions/relint.mjs +1 -1
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/lib/createBuildConfig.js +4 -4
- package/dist/lib/createBuildConfig.js.map +1 -1
- package/dist/lib/createBuildConfig.mjs +3 -3
- package/dist/lib/createBuildConfig.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.js +6 -6
- package/dist/lib/dependencies/DuplicateDetector.js.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs +4 -4
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.js +10 -7
- package/dist/lib/dependencies/detectDuplicateDependencies.js.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs +9 -6
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.js +1 -1
- package/dist/lib/file/ReadFileSyncOptions.js.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/jsonFormatters.js +2 -2
- package/dist/lib/jsonFormatters.js.map +1 -1
- package/dist/lib/jsonFormatters.mjs +2 -2
- package/dist/lib/jsonFormatters.mjs.map +1 -1
- package/dist/lib/parsedPackageJSON.js +2 -2
- package/dist/lib/parsedPackageJSON.js.map +1 -1
- package/dist/lib/parsedPackageJSON.mjs +1 -1
- package/dist/lib/parsedPackageJSON.mjs.map +1 -1
- package/dist/lib/runSteps.js +6 -7
- package/dist/lib/runSteps.js.map +1 -1
- package/dist/lib/runSteps.mjs +4 -5
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.js +7 -7
- package/dist/lib/runStepsAsync.js.map +1 -1
- package/dist/lib/runStepsAsync.mjs +5 -5
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.js +3 -3
- package/dist/lib/yarn/isYarnVersionOrGreater.js.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs +2 -2
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.js +2 -2
- package/dist/lib/yarn/workspace/yarnWorkspaces.js.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/loadPackageConfig.js +1 -1
- package/dist/loadPackageConfig.js.map +1 -1
- package/dist/loadPackageConfig.mjs +1 -1
- package/dist/loadPackageConfig.mjs.map +1 -1
- package/dist/xy/xyLintCommands.js.map +1 -1
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +13 -13
- package/src/actions/clean-docs.ts +2 -1
- package/src/actions/clean-eslint.ts +2 -1
- package/src/actions/compile.ts +2 -2
- package/src/actions/copy-assets.ts +11 -6
- package/src/actions/cycle.ts +1 -1
- package/src/actions/gitlint-fix.ts +2 -1
- package/src/actions/gitlint.ts +6 -6
- package/src/actions/license.ts +44 -40
- package/src/actions/lint-clean.ts +2 -1
- package/src/actions/lint.ts +4 -4
- package/src/actions/package/clean-outputs.ts +3 -2
- package/src/actions/package/clean-typescript.ts +2 -1
- package/src/actions/package/compile/buildEntries.ts +6 -4
- package/src/actions/package/compile/copyTypeFiles.ts +2 -1
- package/src/actions/package/compile/getCompilerOptions.ts +1 -1
- package/src/actions/package/compile/inputs.ts +3 -2
- package/src/actions/package/compile/packageCompileTsc.ts +7 -5
- package/src/actions/package/compile/packageCompileTscTypes.ts +11 -7
- package/src/actions/package/compile/packageCompileTsup.ts +11 -13
- package/src/actions/package/copy-assets.ts +10 -6
- package/src/actions/package/deps.ts +19 -20
- package/src/actions/package/gen-docs.ts +2 -4
- package/src/actions/package/publint.ts +10 -6
- package/src/actions/reinstall.ts +2 -1
- package/src/actions/relint.ts +2 -1
- package/src/lib/createBuildConfig.ts +3 -3
- package/src/lib/dependencies/DuplicateDetector.ts +6 -4
- package/src/lib/dependencies/detectDuplicateDependencies.ts +9 -6
- package/src/lib/file/ReadFileSyncOptions.ts +1 -1
- package/src/lib/jsonFormatters.ts +2 -2
- package/src/lib/parsedPackageJSON.ts +1 -1
- package/src/lib/runSteps.ts +5 -5
- package/src/lib/runStepsAsync.ts +6 -5
- package/src/lib/yarn/isYarnVersionOrGreater.ts +2 -2
- package/src/lib/yarn/workspace/yarnWorkspaces.ts +1 -1
- package/src/loadPackageConfig.ts +2 -1
- package/src/xy/xyLintCommands.ts +4 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import path from 'node:path/posix'
|
|
2
|
+
|
|
1
3
|
import chalk from 'chalk'
|
|
2
4
|
import cpy from 'cpy'
|
|
3
|
-
import path from 'path/posix'
|
|
4
5
|
|
|
5
6
|
export interface PackageCopyAssetsParams {
|
|
6
7
|
target?: 'esm' | 'cjs'
|
|
@@ -19,9 +20,9 @@ const copyTargetAssets = async (target: 'esm' | 'cjs', name: string, location: s
|
|
|
19
20
|
if (values.length > 0) {
|
|
20
21
|
console.log(chalk.green(`Copying Assets [${target.toUpperCase()}] - ${name} - ${location}`))
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
for (const value of values) {
|
|
23
24
|
console.log(`${value.split('/').pop()} => ./dist/${target}`)
|
|
24
|
-
}
|
|
25
|
+
}
|
|
25
26
|
return 0
|
|
26
27
|
} catch (ex) {
|
|
27
28
|
const error = ex as Error
|
|
@@ -34,11 +35,14 @@ export const packageCopyAssets = async ({ target }: PackageCopyAssetsParams) =>
|
|
|
34
35
|
const pkg = process.env.INIT_CWD ?? './'
|
|
35
36
|
const pkgName = process.env.npm_package_name ?? 'Unknown'
|
|
36
37
|
switch (target) {
|
|
37
|
-
case 'esm':
|
|
38
|
+
case 'esm': {
|
|
38
39
|
return await copyTargetAssets('esm', pkgName, pkg)
|
|
39
|
-
|
|
40
|
+
}
|
|
41
|
+
case 'cjs': {
|
|
40
42
|
return await copyTargetAssets('cjs', pkgName, pkg)
|
|
41
|
-
|
|
43
|
+
}
|
|
44
|
+
default: {
|
|
42
45
|
return (await copyTargetAssets('esm', pkgName, pkg)) || (await copyTargetAssets('cjs', pkgName, pkg))
|
|
46
|
+
}
|
|
43
47
|
}
|
|
44
48
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* eslint-disable max-statements */
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
3
|
+
import { cwd } from 'node:process'
|
|
4
|
+
|
|
2
5
|
import chalk from 'chalk'
|
|
3
6
|
import depcheck, { special } from 'depcheck'
|
|
4
|
-
import { existsSync, readFileSync } from 'fs'
|
|
5
|
-
import { cwd } from 'process'
|
|
6
7
|
|
|
7
8
|
import { checkResult } from '../../lib'
|
|
8
9
|
|
|
@@ -18,20 +19,19 @@ const defaultIgnoreDevDeps = [
|
|
|
18
19
|
const defaultIgnoreDevPatterns = ['*.stories.*', '*.spec.*', 'spec', 'stories', 'tsconfig.json']
|
|
19
20
|
|
|
20
21
|
const reportUnused = (name: string, unused: depcheck.Results['dependencies']) => {
|
|
21
|
-
if (unused.length) {
|
|
22
|
+
if (unused.length > 0) {
|
|
22
23
|
const message = [chalk.yellow(`${unused.length} Unused ${name}`)]
|
|
23
|
-
|
|
24
|
+
for (const value of unused) message.push(chalk.gray(` ${value}`))
|
|
24
25
|
console.log(message.join('\n'))
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
const reportMissing = (name: string, missing: depcheck.Results['missing']) => {
|
|
29
|
-
if (Object.keys(missing).length) {
|
|
30
|
+
if (Object.keys(missing).length > 0) {
|
|
30
31
|
const message = [chalk.yellow(`${Object.entries(missing).length} Missing ${name}`)]
|
|
31
|
-
|
|
32
|
-
message.push(`${key}`)
|
|
33
|
-
|
|
34
|
-
})
|
|
32
|
+
for (const [key, value] of Object.entries(missing)) {
|
|
33
|
+
message.push(`${key}`, chalk.gray(` ${value.at(0)}`))
|
|
34
|
+
}
|
|
35
35
|
console.log(chalk.yellow(message.join('\n')))
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -68,9 +68,8 @@ export const packageDeps = async () => {
|
|
|
68
68
|
|
|
69
69
|
const packageContent = existsSync(`${pkg}/package.json`) ? JSON.parse(readFileSync(`${pkg}/package.json`, { encoding: 'utf8' })) : undefined
|
|
70
70
|
|
|
71
|
-
const rawIgnore =
|
|
72
|
-
? readFileSync(`${pkg}/.depcheckrc`, { encoding: 'utf8' }).replace('ignores:', '"ignores":')
|
|
73
|
-
: undefined
|
|
71
|
+
const rawIgnore =
|
|
72
|
+
existsSync(`${pkg}/.depcheckrc`) ? readFileSync(`${pkg}/.depcheckrc`, { encoding: 'utf8' }).replace('ignores:', '"ignores":') : undefined
|
|
74
73
|
let ignoreMatches: string[] = []
|
|
75
74
|
try {
|
|
76
75
|
ignoreMatches = rawIgnore ? (JSON.parse(`{${rawIgnore}}`).ignores as string[]) : []
|
|
@@ -92,16 +91,16 @@ export const packageDeps = async () => {
|
|
|
92
91
|
const missingDevDeps = Object.keys(usedDevDeps).filter((key) => !declaredDevDeps.includes(key) && !declaredDeps.includes(key))
|
|
93
92
|
|
|
94
93
|
const missingDepsObject: Record<string, string[]> = {}
|
|
95
|
-
|
|
94
|
+
for (const key of missingDeps) {
|
|
96
95
|
missingDepsObject[key] = missing[key] ?? [`devDep should be dep [${key}]`]
|
|
97
|
-
}
|
|
96
|
+
}
|
|
98
97
|
|
|
99
98
|
const missingDevDepsObject: Record<string, string[]> = {}
|
|
100
|
-
|
|
99
|
+
for (const key of missingDevDeps) {
|
|
101
100
|
if (missing[key]) {
|
|
102
101
|
missingDevDepsObject[key] = missing[key]
|
|
103
102
|
}
|
|
104
|
-
}
|
|
103
|
+
}
|
|
105
104
|
|
|
106
105
|
const errorCounts = [
|
|
107
106
|
unusedDeps.length,
|
|
@@ -123,12 +122,12 @@ export const packageDeps = async () => {
|
|
|
123
122
|
reportUnused('dependencies', unusedDeps)
|
|
124
123
|
reportUnused('devDependencies', unusedDevDeps)
|
|
125
124
|
|
|
126
|
-
if (Object.entries(invalidDirs).length) {
|
|
127
|
-
|
|
125
|
+
if (Object.entries(invalidDirs).length > 0) {
|
|
126
|
+
for (const [key, value] of Object.entries(invalidDirs)) console.warn(chalk.gray(`Invalid Dir: ${key}: ${value}`))
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
if (Object.entries(invalidFiles).length) {
|
|
131
|
-
|
|
129
|
+
if (Object.entries(invalidFiles).length > 0) {
|
|
130
|
+
for (const [key, value] of Object.entries(invalidFiles)) console.warn(chalk.gray(`Invalid File: ${key}: ${value}`))
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
reportMissing('dependencies', missingDepsObject)
|
|
@@ -19,10 +19,8 @@ const ExitCodes = {
|
|
|
19
19
|
export const packageGenDocs = async () => {
|
|
20
20
|
const pkg = process.env.INIT_CWD
|
|
21
21
|
|
|
22
|
-
if (pkg) {
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
}
|
|
22
|
+
if (pkg && !existsSync(path.join(pkg, 'typedoc.json'))) {
|
|
23
|
+
return
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
const app = await Application.bootstrap({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs'
|
|
2
|
+
|
|
1
3
|
import chalk from 'chalk'
|
|
2
|
-
import { promises as fs } from 'fs'
|
|
3
4
|
import { Message } from 'publint'
|
|
4
5
|
|
|
5
6
|
export interface PackagePublintParams {
|
|
@@ -46,19 +47,22 @@ export const packagePublint = async (params?: PackagePublintParams) => {
|
|
|
46
47
|
|
|
47
48
|
//we filter out invalid file formats for the esm folder since it is intentionally done
|
|
48
49
|
const validMessages = messages.filter(validMessage)
|
|
49
|
-
|
|
50
|
+
for (const message of validMessages) {
|
|
50
51
|
switch (message.type) {
|
|
51
|
-
case 'error':
|
|
52
|
+
case 'error': {
|
|
52
53
|
console.error(chalk.red(`[${message.code}] ${formatMessage(message, pkg)}`))
|
|
53
54
|
break
|
|
54
|
-
|
|
55
|
+
}
|
|
56
|
+
case 'warning': {
|
|
55
57
|
console.warn(chalk.yellow(`[${message.code}] ${formatMessage(message, pkg)}`))
|
|
56
58
|
break
|
|
57
|
-
|
|
59
|
+
}
|
|
60
|
+
default: {
|
|
58
61
|
console.log(chalk.white(`[${message.code}] ${formatMessage(message, pkg)}`))
|
|
59
62
|
break
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
|
-
}
|
|
65
|
+
}
|
|
62
66
|
|
|
63
67
|
if (params?.verbose) {
|
|
64
68
|
console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${validMessages.length}]`))
|
package/src/actions/reinstall.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { closeSync, openSync, rmSync } from 'fs'
|
|
1
|
+
import { closeSync, openSync, rmSync } from 'node:fs'
|
|
2
2
|
|
|
3
3
|
import { runSteps, yarnWorkspaces } from '../lib'
|
|
4
4
|
|
|
@@ -20,6 +20,7 @@ export const reinstall = () => {
|
|
|
20
20
|
return 1
|
|
21
21
|
}
|
|
22
22
|
})
|
|
23
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
23
24
|
.reduce((prev, result) => prev || result, 0)
|
|
24
25
|
|
|
25
26
|
return result || runSteps('Reinstall', [['yarn', 'install --network-timeout 10000']])
|
package/src/actions/relint.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rmSync } from 'fs'
|
|
1
|
+
import { rmSync } from 'node:fs'
|
|
2
2
|
|
|
3
3
|
import { runSteps, yarnWorkspaces } from '../lib'
|
|
4
4
|
|
|
@@ -17,6 +17,7 @@ export const relint = () => {
|
|
|
17
17
|
return 1
|
|
18
18
|
}
|
|
19
19
|
})
|
|
20
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
20
21
|
.reduce((prev, result) => prev || result, 0)
|
|
21
22
|
return result || runSteps('Relint', [['yarn', ['eslint', '.', '--cache']]])
|
|
22
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from 'fs'
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
2
|
|
|
3
3
|
import { defaultBuildConfig } from './defaultBuildConfig'
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ const getGeneralTypescriptConfig = (location: string) => {
|
|
|
6
6
|
let generalConfig: string | undefined
|
|
7
7
|
try {
|
|
8
8
|
generalConfig = readFileSync(`${location}/tsconfig.json`, { encoding: 'utf8' })
|
|
9
|
-
} catch
|
|
9
|
+
} catch {
|
|
10
10
|
return false
|
|
11
11
|
}
|
|
12
12
|
return JSON.parse(generalConfig)
|
|
@@ -27,7 +27,7 @@ export const createBuildConfig = (
|
|
|
27
27
|
...generalConfigObject,
|
|
28
28
|
compilerOptions: {
|
|
29
29
|
...defaultBuildConfig.compilerOptions,
|
|
30
|
-
...
|
|
30
|
+
...generalConfigObject.compilerOptions,
|
|
31
31
|
module,
|
|
32
32
|
outDir: `./${generalConfigObject.compilerOptions?.outDir ?? 'dist'}/${outDirSuffix}`,
|
|
33
33
|
target,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { EOL } from 'node:os'
|
|
2
|
+
|
|
1
3
|
import chalk from 'chalk'
|
|
2
4
|
// eslint-disable-next-line import/no-internal-modules
|
|
3
5
|
import uniq from 'lodash/uniq'
|
|
4
|
-
import { EOL } from 'os'
|
|
5
6
|
|
|
6
7
|
import { multiLineToJSONArray } from '../jsonFormatters'
|
|
7
8
|
|
|
@@ -22,12 +23,12 @@ const trimVirtualMeta = (value: string): string => {
|
|
|
22
23
|
|
|
23
24
|
const trimObjectDependencyVirtualMeta = (obj: Record<string, ChildFields>): Record<string, ChildFields> => {
|
|
24
25
|
const resultObj: Record<string, ChildFields> = {}
|
|
25
|
-
|
|
26
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
26
27
|
resultObj[trimVirtualMeta(key)] = {
|
|
27
28
|
descriptor: trimVirtualMeta(value.descriptor),
|
|
28
29
|
locator: trimVirtualMeta(value.locator),
|
|
29
30
|
}
|
|
30
|
-
}
|
|
31
|
+
}
|
|
31
32
|
return resultObj
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -60,8 +61,9 @@ export class DuplicateDetector {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
public detect() {
|
|
64
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
63
65
|
const result = this.dependencyEntries.reduce(this.detectReducer, this.resultsFactory(this.dependency))
|
|
64
|
-
if (result.duplicateVersions.length) {
|
|
66
|
+
if (result.duplicateVersions.length > 0) {
|
|
65
67
|
console.log(chalk.yellow(`${EOL}Duplicates found for: ${this.dependency}`))
|
|
66
68
|
console.log(chalk.grey(` ${result.duplicateVersions.toString().replaceAll(',', `${EOL} `)}`, EOL))
|
|
67
69
|
return 1
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execSync } from 'child_process'
|
|
1
|
+
import { execSync } from 'node:child_process'
|
|
2
2
|
|
|
3
3
|
import { safeExit } from '../safeExit'
|
|
4
4
|
import { DuplicateDetector } from './DuplicateDetector'
|
|
@@ -10,7 +10,7 @@ export const detectDuplicateDependencies = (depsFromPackageJSON?: string[], Defa
|
|
|
10
10
|
|
|
11
11
|
return safeExit(() => {
|
|
12
12
|
if (dependencies) {
|
|
13
|
-
|
|
13
|
+
for (const dependency of dependencies) {
|
|
14
14
|
let output: string
|
|
15
15
|
|
|
16
16
|
try {
|
|
@@ -19,21 +19,24 @@ export const detectDuplicateDependencies = (depsFromPackageJSON?: string[], Defa
|
|
|
19
19
|
} catch (e) {
|
|
20
20
|
console.error(`Error running yarn why: ${e}`)
|
|
21
21
|
exitCode = 1
|
|
22
|
-
|
|
22
|
+
exitCode
|
|
23
|
+
continue
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
if (output) {
|
|
26
27
|
exitCode = new DuplicateDetector(output, dependency).detect()
|
|
27
|
-
|
|
28
|
+
exitCode
|
|
29
|
+
continue
|
|
28
30
|
} else {
|
|
29
31
|
console.log(`${dependency} - N/A`)
|
|
30
32
|
if (depsFromPackageJSON) {
|
|
31
33
|
exitCode = 1
|
|
32
34
|
console.log(`🚨 Library ${dependency} was requested in package.json but not found`)
|
|
33
35
|
}
|
|
34
|
-
|
|
36
|
+
exitCode
|
|
37
|
+
continue
|
|
35
38
|
}
|
|
36
|
-
}
|
|
39
|
+
}
|
|
37
40
|
return exitCode
|
|
38
41
|
} else {
|
|
39
42
|
console.log('🚨 No dependencies where passed')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const multiLineToJSONArray = (output: string) => {
|
|
2
|
-
const withCommas = output.
|
|
3
|
-
const cleanCollection = withCommas.
|
|
2
|
+
const withCommas = output.replaceAll('\r\n', '').replaceAll('\n', ',')
|
|
3
|
+
const cleanCollection = withCommas.slice(0, Math.max(0, withCommas.length - 1))
|
|
4
4
|
const collection = `[${cleanCollection}]`
|
|
5
5
|
return JSON.parse(collection)
|
|
6
6
|
}
|
package/src/lib/runSteps.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { spawnSync, SpawnSyncOptionsWithBufferEncoding } from 'node:child_process'
|
|
2
|
+
import { existsSync } from 'node:fs'
|
|
3
|
+
|
|
1
4
|
import chalk from 'chalk'
|
|
2
|
-
import { spawnSync, SpawnSyncOptionsWithBufferEncoding } from 'child_process'
|
|
3
|
-
import { existsSync } from 'fs'
|
|
4
5
|
|
|
5
6
|
import { checkResult } from './checkResult'
|
|
6
7
|
import { safeExit } from './safeExit'
|
|
@@ -14,14 +15,13 @@ export const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, m
|
|
|
14
15
|
const pkgName = process.env.npm_package_name
|
|
15
16
|
console.log(chalk.green(`${name} [${pkgName}]`))
|
|
16
17
|
let totalStatus = 0
|
|
17
|
-
for (
|
|
18
|
-
const [command, args, config] = steps[i]
|
|
18
|
+
for (const [i, [command, args, config]] of steps.entries()) {
|
|
19
19
|
if (messages?.[i]) {
|
|
20
20
|
console.log(chalk.gray(messages?.[i]))
|
|
21
21
|
}
|
|
22
22
|
const argList = Array.isArray(args) ? args : args.split(' ')
|
|
23
23
|
if (command === 'node' && !existsSync(argList[0])) {
|
|
24
|
-
throw Error(`File not found [${argList[0]}]`)
|
|
24
|
+
throw new Error(`File not found [${argList[0]}]`)
|
|
25
25
|
}
|
|
26
26
|
const status =
|
|
27
27
|
spawnSync(command, Array.isArray(args) ? args : args.split(' '), {
|
package/src/lib/runStepsAsync.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
2
|
+
import { existsSync } from 'node:fs'
|
|
3
|
+
|
|
1
4
|
import chalk from 'chalk'
|
|
2
|
-
import { spawn } from 'child_process'
|
|
3
|
-
import { existsSync } from 'fs'
|
|
4
5
|
|
|
5
6
|
import { checkResult } from './checkResult'
|
|
6
7
|
import { ScriptStep } from './runSteps'
|
|
@@ -14,7 +15,7 @@ export const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true,
|
|
|
14
15
|
}
|
|
15
16
|
const argList = Array.isArray(args) ? args : args.split(' ')
|
|
16
17
|
if (command === 'node' && !existsSync(argList[0])) {
|
|
17
|
-
throw Error(`File not found [${argList[0]}]`)
|
|
18
|
+
throw new Error(`File not found [${argList[0]}]`)
|
|
18
19
|
}
|
|
19
20
|
spawn(command, Array.isArray(args) ? args : args.split(' '), {
|
|
20
21
|
...config,
|
|
@@ -44,8 +45,8 @@ export const runStepsAsync = async (name: string, steps: ScriptStep[], exitOnFai
|
|
|
44
45
|
const pkgName = process.env.npm_package_name
|
|
45
46
|
console.log(chalk.green(`${name} [${pkgName}]`))
|
|
46
47
|
let result = 0
|
|
47
|
-
for (
|
|
48
|
-
result += await runStepAsync(name,
|
|
48
|
+
for (const [i, step] of steps.entries()) {
|
|
49
|
+
result += await runStepAsync(name, step, exitOnFail, messages?.[i])
|
|
49
50
|
}
|
|
50
51
|
return result
|
|
51
52
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { spawnSync } from 'child_process'
|
|
1
|
+
import { spawnSync } from 'node:child_process'
|
|
2
2
|
|
|
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((ver) => parseInt(ver))
|
|
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/loadPackageConfig.ts
CHANGED
package/src/xy/xyLintCommands.ts
CHANGED
|
@@ -31,7 +31,10 @@ export const xyLintCommands = (args: Argv) => {
|
|
|
31
31
|
async (argv) => {
|
|
32
32
|
if (argv.verbose) console.log('Lint')
|
|
33
33
|
const start = Date.now()
|
|
34
|
-
process.exitCode =
|
|
34
|
+
process.exitCode =
|
|
35
|
+
argv.fix ? fix()
|
|
36
|
+
: argv.profile ? lintProfile()
|
|
37
|
+
: await lint({ pkg: argv.package as string })
|
|
35
38
|
console.log(chalk.blue(`Finished in ${Date.now() - start}ms`))
|
|
36
39
|
},
|
|
37
40
|
)
|