@xylabs/ts-scripts-yarn3 4.0.0-rc.25 → 4.0.0-rc.26
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.map +1 -1
- package/dist/actions/clean-docs.mjs.map +1 -1
- package/dist/actions/clean-eslint.mjs.map +1 -1
- package/dist/actions/clean-jest.mjs.map +1 -1
- package/dist/actions/clean.mjs.map +1 -1
- package/dist/actions/compile.mjs.map +1 -1
- package/dist/actions/copy-assets.mjs.map +1 -1
- package/dist/actions/cycle.mjs.map +1 -1
- package/dist/actions/dead.mjs.map +1 -1
- package/dist/actions/deploy-major.mjs.map +1 -1
- package/dist/actions/deploy-minor.mjs.map +1 -1
- package/dist/actions/deploy-next.mjs.map +1 -1
- package/dist/actions/deploy.mjs.map +1 -1
- package/dist/actions/deps.mjs.map +1 -1
- package/dist/actions/dupdeps.mjs.map +1 -1
- package/dist/actions/fix.mjs.map +1 -1
- package/dist/actions/gen-docs.mjs.map +1 -1
- package/dist/actions/gitignore-gen.mjs.map +1 -1
- package/dist/actions/index.mjs.map +1 -1
- package/dist/actions/license.mjs.map +1 -1
- package/dist/actions/lint-clean.mjs.map +1 -1
- package/dist/actions/lint-profile.mjs.map +1 -1
- package/dist/actions/lint.mjs.map +1 -1
- package/dist/actions/npmignore-gen.mjs.map +1 -1
- package/dist/actions/package/clean-outputs.mjs.map +1 -1
- package/dist/actions/package/clean-typescript.mjs.map +1 -1
- package/dist/actions/package/clean.mjs.map +1 -1
- package/dist/actions/package/compile/buildEntries.mjs.map +1 -1
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/getCompilerOptions.mjs.map +1 -1
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsc.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/packageCompileTsup.mjs.map +1 -1
- package/dist/actions/package/copy-assets.mjs.map +1 -1
- package/dist/actions/package/deps.mjs.map +1 -1
- package/dist/actions/package/gen-docs.mjs.map +1 -1
- package/dist/actions/package/index.mjs.map +1 -1
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/actions/package/recompile.mjs.map +1 -1
- package/dist/actions/publint.mjs.map +1 -1
- package/dist/actions/rebuild.mjs.map +1 -1
- package/dist/actions/recompile.mjs.map +1 -1
- package/dist/actions/reinstall.mjs.map +1 -1
- package/dist/actions/relint.mjs.map +1 -1
- package/dist/actions/retest.mjs.map +1 -1
- package/dist/actions/sonar.mjs.map +1 -1
- package/dist/actions/statics.mjs.map +1 -1
- package/dist/actions/test.mjs.map +1 -1
- package/dist/actions/up.mjs.map +1 -1
- package/dist/actions/updo.mjs.map +1 -1
- package/dist/actions/upplug.mjs.map +1 -1
- package/dist/actions/upyarn.mjs.map +1 -1
- package/dist/actions/yarn3only.mjs.map +1 -1
- package/dist/bin/package/clean-outputs.mjs.map +1 -1
- package/dist/bin/package/clean-typescript.mjs.map +1 -1
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile-only.mjs.map +1 -1
- package/dist/bin/package/compile-tsup.mjs.map +1 -1
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/copy-assets-cjs.mjs.map +1 -1
- package/dist/bin/package/copy-assets-esm.mjs.map +1 -1
- package/dist/bin/package/deps.mjs.map +1 -1
- package/dist/bin/package/gen-docs.mjs.map +1 -1
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/xy-ts.mjs.map +1 -1
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.mjs.map +1 -1
- package/dist/lib/deleteGlob.mjs.map +1 -1
- package/dist/lib/dependencies/DuplicateDetector.mjs.map +1 -1
- package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +1 -1
- package/dist/lib/dependencies/index.mjs.map +1 -1
- package/dist/lib/file/ReadFileSyncOptions.mjs.map +1 -1
- package/dist/lib/file/fileLines.mjs.map +1 -1
- package/dist/lib/file/index.mjs.map +1 -1
- package/dist/lib/file/tryReadFileSync.mjs.map +1 -1
- package/dist/lib/generateIgnoreFiles.mjs.map +1 -1
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/runSteps.mjs.map +1 -1
- package/dist/lib/runStepsAsync.mjs.map +1 -1
- package/dist/lib/runXy.mjs.map +1 -1
- package/dist/lib/safeExit.mjs.map +1 -1
- package/dist/lib/yarn/index.mjs.map +1 -1
- package/dist/lib/yarn/isYarnVersionOrGreater.mjs.map +1 -1
- package/dist/lib/yarn/workspace/index.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspace.mjs.map +1 -1
- package/dist/lib/yarn/workspace/yarnWorkspaces.mjs.map +1 -1
- package/dist/xy/index.mjs.map +1 -1
- package/dist/xy/param.mjs.map +1 -1
- package/dist/xy/xy.mjs.map +1 -1
- package/dist/xy/xyBuildCommands.mjs.map +1 -1
- package/dist/xy/xyCommonCommands.mjs.map +1 -1
- package/dist/xy/xyDeployCommands.mjs.map +1 -1
- package/dist/xy/xyInstallCommands.mjs.map +1 -1
- package/dist/xy/xyLintCommands.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/build.ts +3 -1
- package/src/actions/clean-docs.ts +3 -1
- package/src/actions/clean.ts +8 -2
- package/src/actions/compile.ts +16 -4
- package/src/actions/copy-assets.ts +6 -2
- package/src/actions/cycle.ts +7 -7
- package/src/actions/deps.ts +7 -5
- package/src/actions/dupdeps.ts +3 -1
- package/src/actions/gen-docs.ts +4 -4
- package/src/actions/license.ts +6 -2
- package/src/actions/lint-clean.ts +6 -2
- package/src/actions/lint-profile.ts +5 -1
- package/src/actions/lint.ts +3 -1
- package/src/actions/package/compile/XyConfig.ts +4 -12
- package/src/actions/package/compile/compile.ts +3 -1
- package/src/actions/package/compile/copyTypeFiles.ts +3 -1
- package/src/actions/package/compile/getCompilerOptions.ts +3 -1
- package/src/actions/package/compile/inputs.ts +6 -2
- package/src/actions/package/compile/packageCompileTsc.ts +7 -2
- package/src/actions/package/compile/packageCompileTsup.ts +8 -3
- package/src/actions/package/copy-assets.ts +1 -3
- package/src/actions/package/deps.ts +15 -5
- package/src/actions/package/gen-docs.ts +3 -1
- package/src/actions/package/publint.ts +1 -3
- package/src/actions/publint.ts +11 -3
- package/src/actions/recompile.ts +16 -4
- package/src/actions/reinstall.ts +12 -4
- package/src/actions/relint.ts +9 -3
- package/src/actions/statics.ts +3 -1
- package/src/actions/yarn3only.ts +3 -1
- package/src/bin/package/compile-only.ts +3 -1
- package/src/lib/deleteGlob.ts +3 -1
- package/src/lib/dependencies/DuplicateDetector.ts +6 -2
- package/src/lib/file/ReadFileSyncOptions.ts +4 -1
- package/src/lib/file/fileLines.ts +9 -3
- package/src/lib/file/tryReadFileSync.ts +3 -1
- package/src/lib/generateIgnoreFiles.ts +9 -3
- package/src/lib/runSteps.ts +3 -1
- package/src/lib/runStepsAsync.ts +3 -1
- package/src/lib/safeExit.ts +3 -1
- package/src/lib/yarn/isYarnVersionOrGreater.ts +3 -1
- package/src/lib/yarn/workspace/yarnWorkspaces.ts +3 -1
- package/src/xy/param.ts +1 -3
- package/src/xy/xyBuildCommands.ts +9 -19
- package/src/xy/xyCommonCommands.ts +6 -2
- package/src/xy/xyDeployCommands.ts +3 -1
- package/src/xy/xyInstallCommands.ts +4 -4
- package/src/xy/xyLintCommands.ts +6 -2
- package/tsup.config.ts +2 -6
- package/xy.config.ts +1 -5
|
@@ -4,7 +4,9 @@ import { loadConfig } from '../../../lib/index.ts'
|
|
|
4
4
|
import { packagePublint } from '../publint.ts'
|
|
5
5
|
import { packageCompileTsc } from './packageCompileTsc.ts'
|
|
6
6
|
import { packageCompileTsup } from './packageCompileTsup.ts'
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
XyConfig, XyTscConfig, XyTsupConfig,
|
|
9
|
+
} from './XyConfig.ts'
|
|
8
10
|
|
|
9
11
|
export const packageCompile = async (inConfig: XyConfig = {}): Promise<number> => {
|
|
10
12
|
const pkg = process.env.INIT_CWD
|
|
@@ -3,7 +3,9 @@ import { createRequire } from 'node:module'
|
|
|
3
3
|
import deepmerge from 'deepmerge'
|
|
4
4
|
import type { TsConfig } from 'tsc-prog'
|
|
5
5
|
import type { CompilerOptions } from 'typescript'
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
findConfigFile, readConfigFile, sys,
|
|
8
|
+
} from 'typescript'
|
|
7
9
|
|
|
8
10
|
const getNested = (config: TsConfig): CompilerOptions => {
|
|
9
11
|
if (config.extends) {
|
|
@@ -16,7 +16,9 @@ export const getInputDirs = async (depth: number = 0) => {
|
|
|
16
16
|
}
|
|
17
17
|
return [
|
|
18
18
|
'.',
|
|
19
|
-
...(await readdir('src', {
|
|
19
|
+
...(await readdir('src', {
|
|
20
|
+
recursive: true, withFileTypes: true,
|
|
21
|
+
}))
|
|
20
22
|
.filter(file => file.isDirectory())
|
|
21
23
|
.map((file) => {
|
|
22
24
|
const pathParts = file.path?.split('/') ?? []
|
|
@@ -38,5 +40,7 @@ export const getAllInputs = async (depth = 100) => {
|
|
|
38
40
|
|
|
39
41
|
export const getAllInputs2 = (folder: string) => {
|
|
40
42
|
/* tsup wants posix paths */
|
|
41
|
-
return glob.sync(`${folder}/**/*.*`, {
|
|
43
|
+
return glob.sync(`${folder}/**/*.*`, {
|
|
44
|
+
ignore: ['**/*.spec.*', '**/*.stories.*', '**/spec/**/*'], posix: true,
|
|
45
|
+
})
|
|
42
46
|
}
|
|
@@ -6,7 +6,8 @@ import { createProgramFromConfig } from 'tsc-prog'
|
|
|
6
6
|
import type {
|
|
7
7
|
CompilerOptions,
|
|
8
8
|
FormatDiagnosticsHost,
|
|
9
|
-
LineAndCharacter
|
|
9
|
+
LineAndCharacter,
|
|
10
|
+
} from 'typescript'
|
|
10
11
|
import {
|
|
11
12
|
DiagnosticCategory,
|
|
12
13
|
formatDiagnosticsWithColorAndContext,
|
|
@@ -54,7 +55,11 @@ export const packageCompileTsc = async (noEmit?: boolean, config?: XyTscConfig,
|
|
|
54
55
|
const results = getPreEmitDiagnostics(program)
|
|
55
56
|
|
|
56
57
|
for (const diag of results) {
|
|
57
|
-
const lineAndChar: LineAndCharacter = diag.file
|
|
58
|
+
const lineAndChar: LineAndCharacter = diag.file
|
|
59
|
+
? getLineAndCharacterOfPosition(diag.file, diag.start ?? 0)
|
|
60
|
+
: {
|
|
61
|
+
character: 0, line: 0,
|
|
62
|
+
}
|
|
58
63
|
console.log(chalk.cyan(`${diag.file?.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`))
|
|
59
64
|
console.log(formatDiagnosticsWithColorAndContext([diag], formatHost))
|
|
60
65
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { Loader } from 'esbuild'
|
|
2
2
|
import type { Options } from 'tsup'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
build, defineConfig,
|
|
5
|
+
} from 'tsup'
|
|
4
6
|
|
|
5
7
|
import { packagePublint } from '../publint.ts'
|
|
6
8
|
import { buildEntries } from './buildEntries.ts'
|
|
7
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
EntryMode, XyTsupConfig,
|
|
11
|
+
} from './XyConfig.ts'
|
|
8
12
|
|
|
9
13
|
const compileFolder = async (folder: string, entryMode: EntryMode = 'single', options?: Options, _verbose?: boolean) => {
|
|
10
14
|
const outDir = options?.outDir ?? 'dist'
|
|
@@ -51,7 +55,8 @@ export const packageCompileTsup = async (config?: XyTsupConfig) => {
|
|
|
51
55
|
const compileForNeutral = compile?.neutral ?? { src: {} }
|
|
52
56
|
|
|
53
57
|
const standardLoaders: Record<string, Loader> = {
|
|
54
|
-
'.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy'
|
|
58
|
+
'.gif': 'copy', '.html': 'copy', '.jpg': 'copy', '.json': 'json', '.png': 'copy', '.svg': 'copy', '.webp': 'copy',
|
|
59
|
+
}
|
|
55
60
|
const standardOptions: Options = {
|
|
56
61
|
bundle: true,
|
|
57
62
|
format: ['esm'],
|
|
@@ -3,9 +3,7 @@ import path from 'node:path/posix'
|
|
|
3
3
|
import chalk from 'chalk'
|
|
4
4
|
import cpy from 'cpy'
|
|
5
5
|
|
|
6
|
-
export interface PackageCopyAssetsParams {
|
|
7
|
-
target?: 'esm' | 'cjs'
|
|
8
|
-
}
|
|
6
|
+
export interface PackageCopyAssetsParams { target?: 'esm' | 'cjs' }
|
|
9
7
|
|
|
10
8
|
const copyTargetAssets = async (target: 'esm' | 'cjs', name: string, location: string) => {
|
|
11
9
|
try {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-statements */
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
existsSync, readFileSync,
|
|
4
|
+
} from 'node:fs'
|
|
3
5
|
import { cwd } from 'node:process'
|
|
4
6
|
|
|
5
7
|
import chalk from 'chalk'
|
|
@@ -57,10 +59,16 @@ const analyzeDeps = async (pkg: string, ignoreMatches: string[]) => {
|
|
|
57
59
|
const unusedDevDeps = allUnused.devDependencies
|
|
58
60
|
const usedDeps = srcUnused.using
|
|
59
61
|
const usedDevDeps = allUnused.using
|
|
60
|
-
const missing = {
|
|
61
|
-
|
|
62
|
+
const missing = {
|
|
63
|
+
...srcUnused.missing, ...allUnused.missing,
|
|
64
|
+
}
|
|
65
|
+
const {
|
|
66
|
+
invalidDirs, invalidFiles,
|
|
67
|
+
} = allUnused
|
|
62
68
|
|
|
63
|
-
return {
|
|
69
|
+
return {
|
|
70
|
+
invalidDirs, invalidFiles, missing, unusedDeps, unusedDevDeps, usedDeps, usedDevDeps,
|
|
71
|
+
}
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
export const packageDeps = async () => {
|
|
@@ -79,7 +87,9 @@ export const packageDeps = async () => {
|
|
|
79
87
|
console.log(`${pkgName} [${error.message}] Failed to parse .depcheckrc [${rawIgnore}]`)
|
|
80
88
|
}
|
|
81
89
|
|
|
82
|
-
const {
|
|
90
|
+
const {
|
|
91
|
+
invalidDirs, invalidFiles, unusedDeps, unusedDevDeps, usedDeps, usedDevDeps, missing,
|
|
92
|
+
} = await analyzeDeps(pkg, ignoreMatches)
|
|
83
93
|
|
|
84
94
|
const declaredDeps = Object.keys(packageContent.dependencies ?? {})
|
|
85
95
|
const declaredPeerDeps = Object.keys(packageContent.peerDependencies ?? {})
|
|
@@ -4,7 +4,9 @@ import { existsSync } from 'node:fs'
|
|
|
4
4
|
import path from 'node:path'
|
|
5
5
|
|
|
6
6
|
import chalk from 'chalk'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Application, ArgumentsReader, TSConfigReader, TypeDocReader,
|
|
9
|
+
} from 'typedoc'
|
|
8
10
|
|
|
9
11
|
const ExitCodes = {
|
|
10
12
|
CompileError: 3,
|
|
@@ -3,9 +3,7 @@ import { promises as fs } from 'node:fs'
|
|
|
3
3
|
import chalk from 'chalk'
|
|
4
4
|
import type { Message } from 'publint'
|
|
5
5
|
|
|
6
|
-
export interface PackagePublintParams {
|
|
7
|
-
verbose?: boolean
|
|
8
|
-
}
|
|
6
|
+
export interface PackagePublintParams { verbose?: boolean }
|
|
9
7
|
|
|
10
8
|
export const packagePublint = async (params?: PackagePublintParams) => {
|
|
11
9
|
const pkgDir = process.env.INIT_CWD
|
package/src/actions/publint.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
runSteps, runStepsAsync,
|
|
3
|
+
} from '../lib/index.ts'
|
|
2
4
|
|
|
3
5
|
export interface PublintParams {
|
|
4
6
|
pkg?: string
|
|
@@ -10,8 +12,14 @@ export interface PublintPackageParams {
|
|
|
10
12
|
verbose?: boolean
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export const publint = async ({
|
|
14
|
-
|
|
15
|
+
export const publint = async ({
|
|
16
|
+
verbose, pkg,
|
|
17
|
+
}: PublintParams) => {
|
|
18
|
+
return pkg
|
|
19
|
+
? await publintPackage({
|
|
20
|
+
pkg, verbose,
|
|
21
|
+
})
|
|
22
|
+
: publintAll({ verbose })
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
export const publintPackage = ({ pkg }: PublintPackageParams) => {
|
package/src/actions/recompile.ts
CHANGED
|
@@ -16,11 +16,21 @@ export interface RecompilePackageParams {
|
|
|
16
16
|
verbose?: boolean
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const recompile = async ({
|
|
20
|
-
|
|
19
|
+
export const recompile = async ({
|
|
20
|
+
verbose, target, pkg, incremental,
|
|
21
|
+
}: RecompileParams) => {
|
|
22
|
+
return pkg
|
|
23
|
+
? await recompilePackage({
|
|
24
|
+
pkg, target, verbose,
|
|
25
|
+
})
|
|
26
|
+
: await recompileAll({
|
|
27
|
+
incremental, target, verbose,
|
|
28
|
+
})
|
|
21
29
|
}
|
|
22
30
|
|
|
23
|
-
export const recompilePackage = ({
|
|
31
|
+
export const recompilePackage = ({
|
|
32
|
+
verbose, target, pkg,
|
|
33
|
+
}: RecompilePackageParams) => {
|
|
24
34
|
const targetOptions = target ? ['-t', target] : []
|
|
25
35
|
const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
|
|
26
36
|
|
|
@@ -30,7 +40,9 @@ export const recompilePackage = ({ verbose, target, pkg }: RecompilePackageParam
|
|
|
30
40
|
)
|
|
31
41
|
}
|
|
32
42
|
|
|
33
|
-
export const recompileAll = async ({
|
|
43
|
+
export const recompileAll = async ({
|
|
44
|
+
jobs, verbose, target, incremental,
|
|
45
|
+
}: RecompileParams) => {
|
|
34
46
|
const start = Date.now()
|
|
35
47
|
const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
|
|
36
48
|
const targetOptions = target ? ['-t', target] : []
|
package/src/actions/reinstall.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
closeSync, openSync, rmSync,
|
|
3
|
+
} from 'node:fs'
|
|
2
4
|
|
|
3
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
runSteps, yarnWorkspaces,
|
|
7
|
+
} from '../lib/index.ts'
|
|
4
8
|
|
|
5
9
|
export const reinstall = () => {
|
|
6
10
|
console.log('Reinstall [Clear Lock File]')
|
|
@@ -9,10 +13,14 @@ export const reinstall = () => {
|
|
|
9
13
|
console.log('Reinstall [Clear Node Modules]')
|
|
10
14
|
const workspaces = yarnWorkspaces()
|
|
11
15
|
const result = workspaces
|
|
12
|
-
.map(({
|
|
16
|
+
.map(({
|
|
17
|
+
location, name,
|
|
18
|
+
}) => {
|
|
13
19
|
const dist = `${location}/node_modules`
|
|
14
20
|
try {
|
|
15
|
-
rmSync(dist, {
|
|
21
|
+
rmSync(dist, {
|
|
22
|
+
force: true, recursive: true,
|
|
23
|
+
})
|
|
16
24
|
return 0
|
|
17
25
|
} catch (ex) {
|
|
18
26
|
const error = ex as Error
|
package/src/actions/relint.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { rmSync } from 'node:fs'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
runSteps, yarnWorkspaces,
|
|
5
|
+
} from '../lib/index.ts'
|
|
4
6
|
|
|
5
7
|
export const relint = () => {
|
|
6
8
|
console.log('Relint - Cleaning [.eslintcache]')
|
|
7
9
|
const workspaces = yarnWorkspaces()
|
|
8
10
|
const result = workspaces
|
|
9
|
-
.map(({
|
|
11
|
+
.map(({
|
|
12
|
+
location, name,
|
|
13
|
+
}) => {
|
|
10
14
|
const dist = `${location}/.eslintcache`
|
|
11
15
|
try {
|
|
12
|
-
rmSync(dist, {
|
|
16
|
+
rmSync(dist, {
|
|
17
|
+
force: true, recursive: true,
|
|
18
|
+
})
|
|
13
19
|
return 0
|
|
14
20
|
} catch (ex) {
|
|
15
21
|
const error = ex as Error
|
package/src/actions/statics.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
detectDuplicateDependencies, parsedPackageJSON,
|
|
5
|
+
} from '../lib/index.ts'
|
|
4
6
|
|
|
5
7
|
const DefaultDependencies = ['axios', '@xylabs/pixel', 'react', 'graphql', 'react-router', '@mui/material', '@mui/system']
|
|
6
8
|
|
package/src/actions/yarn3only.ts
CHANGED
|
@@ -4,7 +4,9 @@ import chalk from 'chalk'
|
|
|
4
4
|
|
|
5
5
|
import { packageCompile } from '../../actions/index.ts'
|
|
6
6
|
|
|
7
|
-
packageCompile({
|
|
7
|
+
packageCompile({
|
|
8
|
+
verbose: true, publint: false,
|
|
9
|
+
})
|
|
8
10
|
.then(value => (process.exitCode = value))
|
|
9
11
|
.catch((reason) => {
|
|
10
12
|
console.error(chalk.red(reason))
|
package/src/lib/deleteGlob.ts
CHANGED
|
@@ -32,7 +32,9 @@ const trimObjectDependencyVirtualMeta = (obj: Record<string, ChildFields>): Reco
|
|
|
32
32
|
|
|
33
33
|
const trimDependencyVirtualMeta = (dependencies: DependencyEntries): DependencyEntries => {
|
|
34
34
|
return dependencies.map((dependency) => {
|
|
35
|
-
return {
|
|
35
|
+
return {
|
|
36
|
+
children: trimObjectDependencyVirtualMeta(dependency.children), value: trimVirtualMeta(dependency.value),
|
|
37
|
+
}
|
|
36
38
|
})
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -91,5 +93,7 @@ export class DuplicateDetector {
|
|
|
91
93
|
return acc
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
private resultsFactory = (dependency: string): Results => ({
|
|
96
|
+
private resultsFactory = (dependency: string): Results => ({
|
|
97
|
+
currentVersion: undefined, dependency, duplicateVersions: [],
|
|
98
|
+
})
|
|
95
99
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export type ReadFileSyncOptions = BufferEncoding | {
|
|
1
|
+
export type ReadFileSyncOptions = BufferEncoding | {
|
|
2
|
+
encoding: BufferEncoding
|
|
3
|
+
flags?: string
|
|
4
|
+
}
|
|
2
5
|
|
|
3
6
|
export const defaultReadFileSyncOptions: ReadFileSyncOptions = { encoding: 'utf8' }
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
PathLike, WriteFileOptions,
|
|
3
|
+
} from 'node:fs'
|
|
4
|
+
import {
|
|
5
|
+
existsSync, readFileSync, writeFileSync,
|
|
6
|
+
} from 'node:fs'
|
|
3
7
|
|
|
4
8
|
import { notEmpty } from '../string/index.ts'
|
|
5
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
CROSS_PLATFORM_NEWLINE, WINDOWS_NEWLINE_REGEX,
|
|
11
|
+
} from './constants.ts'
|
|
6
12
|
import type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'
|
|
7
13
|
import { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'
|
|
8
14
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PathLike } from 'node:fs'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
existsSync, readFileSync,
|
|
4
|
+
} from 'node:fs'
|
|
3
5
|
|
|
4
6
|
import type { ReadFileSyncOptions } from './ReadFileSyncOptions.ts'
|
|
5
7
|
import { defaultReadFileSyncOptions } from './ReadFileSyncOptions.ts'
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
readNonEmptyLines, writeLines,
|
|
5
|
+
} from './file/index.ts'
|
|
4
6
|
import { union } from './string/index.ts'
|
|
5
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
INIT_CWD, yarnWorkspace, yarnWorkspaces,
|
|
9
|
+
} from './yarn/index.ts'
|
|
6
10
|
|
|
7
11
|
const mergeEntries = (a: string[], b: string[]): string[] => [...union(a, b)].sort()
|
|
8
12
|
|
|
@@ -12,7 +16,9 @@ export const generateIgnoreFiles = (filename: string, pkg?: string) => {
|
|
|
12
16
|
const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces()
|
|
13
17
|
const readEntries = (location: string): string[] => readNonEmptyLines(`${location}/${filename}`)
|
|
14
18
|
const writeEntries = (location: string, entries: string[]) => writeLines(`${location}/${filename}`, entries)
|
|
15
|
-
const results = workspaces.map(({
|
|
19
|
+
const results = workspaces.map(({
|
|
20
|
+
location, name,
|
|
21
|
+
}) => {
|
|
16
22
|
try {
|
|
17
23
|
writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)))
|
|
18
24
|
return 0
|
package/src/lib/runSteps.ts
CHANGED
|
@@ -28,7 +28,9 @@ export const runSteps = (name: string, steps: ScriptStep[], exitOnFail = true, m
|
|
|
28
28
|
= spawnSync(command, Array.isArray(args) ? args : args.split(' '), {
|
|
29
29
|
...config,
|
|
30
30
|
encoding: 'utf8',
|
|
31
|
-
env: {
|
|
31
|
+
env: {
|
|
32
|
+
FORCE_COLOR: '3', ...process.env,
|
|
33
|
+
},
|
|
32
34
|
shell: true,
|
|
33
35
|
stdio: 'inherit',
|
|
34
36
|
}).status ?? 0
|
package/src/lib/runStepsAsync.ts
CHANGED
|
@@ -19,7 +19,9 @@ export const runStepAsync = (name: string, step: ScriptStep, exitOnFail = true,
|
|
|
19
19
|
}
|
|
20
20
|
spawn(command, Array.isArray(args) ? args : args.split(' '), {
|
|
21
21
|
...config,
|
|
22
|
-
env: {
|
|
22
|
+
env: {
|
|
23
|
+
FORCE_COLOR: '3', ...process.env,
|
|
24
|
+
},
|
|
23
25
|
shell: true,
|
|
24
26
|
stdio: 'inherit',
|
|
25
27
|
}).on('close', (code) => {
|
package/src/lib/safeExit.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process'
|
|
2
2
|
|
|
3
3
|
export const isYarnVersionOrGreater = (major: number, minor?: number, patch?: number): [boolean, string] => {
|
|
4
|
-
const result = spawnSync('yarn', ['-v'], {
|
|
4
|
+
const result = spawnSync('yarn', ['-v'], {
|
|
5
|
+
encoding: 'utf8', shell: true,
|
|
6
|
+
})
|
|
5
7
|
const version = result.stdout.toString().replaceAll('\n', '')
|
|
6
8
|
const versionNumbers = version.split('.').map(ver => Number.parseInt(ver))
|
|
7
9
|
const majorDelta = versionNumbers[0] - major
|
|
@@ -3,7 +3,9 @@ import { spawnSync } from 'node:child_process'
|
|
|
3
3
|
import type { Workspace } from './Workspace.ts'
|
|
4
4
|
|
|
5
5
|
export const yarnWorkspaces = (): Workspace[] => {
|
|
6
|
-
const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], {
|
|
6
|
+
const result = spawnSync('yarn', ['workspaces', 'list', '--json', '--recursive'], {
|
|
7
|
+
encoding: 'utf8', shell: true,
|
|
8
|
+
})
|
|
7
9
|
if (result.error) {
|
|
8
10
|
throw result.error
|
|
9
11
|
}
|
package/src/xy/param.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Argv } from 'yargs'
|
|
2
2
|
|
|
3
3
|
export const packagePositionalParam = (yargs: Argv<unknown>) => {
|
|
4
|
-
return yargs.positional('package', {
|
|
5
|
-
describe: 'Specific package to target',
|
|
6
|
-
})
|
|
4
|
+
return yargs.positional('package', { describe: 'Specific package to target' })
|
|
7
5
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Argv } from 'yargs'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
build, compile, copyAssets, rebuild, recompile,
|
|
5
|
+
} from '../actions/index.ts'
|
|
4
6
|
|
|
5
7
|
export const xyBuildCommands = (args: Argv) => {
|
|
6
8
|
return args
|
|
@@ -8,9 +10,7 @@ export const xyBuildCommands = (args: Argv) => {
|
|
|
8
10
|
'build [package]',
|
|
9
11
|
'Build - Compile & Lint',
|
|
10
12
|
(yargs) => {
|
|
11
|
-
return yargs.positional('package', {
|
|
12
|
-
describe: 'Specific package to build',
|
|
13
|
-
})
|
|
13
|
+
return yargs.positional('package', { describe: 'Specific package to build' })
|
|
14
14
|
},
|
|
15
15
|
async (argv) => {
|
|
16
16
|
if (argv.verbose) {
|
|
@@ -30,9 +30,7 @@ export const xyBuildCommands = (args: Argv) => {
|
|
|
30
30
|
'compile [package]',
|
|
31
31
|
'Compile with Typescript & Copy Images',
|
|
32
32
|
(yargs) => {
|
|
33
|
-
return yargs.positional('package', {
|
|
34
|
-
describe: 'Specific package to compile',
|
|
35
|
-
})
|
|
33
|
+
return yargs.positional('package', { describe: 'Specific package to compile' })
|
|
36
34
|
},
|
|
37
35
|
async (argv) => {
|
|
38
36
|
if (argv.verbose) {
|
|
@@ -51,9 +49,7 @@ export const xyBuildCommands = (args: Argv) => {
|
|
|
51
49
|
'compile-only [package]',
|
|
52
50
|
'Compile with Typescript & Copy Images (No Publint)',
|
|
53
51
|
(yargs) => {
|
|
54
|
-
return yargs.positional('package', {
|
|
55
|
-
describe: 'Specific package to compile',
|
|
56
|
-
})
|
|
52
|
+
return yargs.positional('package', { describe: 'Specific package to compile' })
|
|
57
53
|
},
|
|
58
54
|
async (argv) => {
|
|
59
55
|
if (argv.verbose) {
|
|
@@ -73,9 +69,7 @@ export const xyBuildCommands = (args: Argv) => {
|
|
|
73
69
|
'recompile [package]',
|
|
74
70
|
'Re-compile with Typescript & Copy Images',
|
|
75
71
|
(yargs) => {
|
|
76
|
-
return yargs.positional('package', {
|
|
77
|
-
describe: 'Specific package to re-compile',
|
|
78
|
-
})
|
|
72
|
+
return yargs.positional('package', { describe: 'Specific package to re-compile' })
|
|
79
73
|
},
|
|
80
74
|
async (argv) => {
|
|
81
75
|
if (argv.verbose) {
|
|
@@ -94,9 +88,7 @@ export const xyBuildCommands = (args: Argv) => {
|
|
|
94
88
|
'rebuild [package]',
|
|
95
89
|
'Rebuild - Clean, Compile & Lint',
|
|
96
90
|
(yargs) => {
|
|
97
|
-
return yargs.positional('package', {
|
|
98
|
-
describe: 'Specific package to rebuild',
|
|
99
|
-
})
|
|
91
|
+
return yargs.positional('package', { describe: 'Specific package to rebuild' })
|
|
100
92
|
},
|
|
101
93
|
(argv) => {
|
|
102
94
|
if (argv.verbose) console.log(`Rebuilding: ${argv.package ?? 'all'}`)
|
|
@@ -107,9 +99,7 @@ export const xyBuildCommands = (args: Argv) => {
|
|
|
107
99
|
'copy-assets [package]',
|
|
108
100
|
'Copy Assets - Copy the assets from src to dist',
|
|
109
101
|
(yargs) => {
|
|
110
|
-
return yargs.positional('package', {
|
|
111
|
-
describe: 'Specific package to copy assets',
|
|
112
|
-
})
|
|
102
|
+
return yargs.positional('package', { describe: 'Specific package to copy assets' })
|
|
113
103
|
},
|
|
114
104
|
async (argv) => {
|
|
115
105
|
if (argv.verbose) console.log(`Copying Assets: ${argv.package ?? 'all'}`)
|
|
@@ -51,7 +51,9 @@ export const xyCommonCommands = (args: Argv) => {
|
|
|
51
51
|
},
|
|
52
52
|
(argv) => {
|
|
53
53
|
if (argv.verbose) console.log(`Checking Dependencies: ${argv.package ?? 'all'}`)
|
|
54
|
-
process.exitCode = deps({
|
|
54
|
+
process.exitCode = deps({
|
|
55
|
+
incremental: !!argv.incremental, jobs: argv.jobs as number, pkg: argv.package as string,
|
|
56
|
+
})
|
|
55
57
|
},
|
|
56
58
|
)
|
|
57
59
|
.command(
|
|
@@ -62,7 +64,9 @@ export const xyCommonCommands = (args: Argv) => {
|
|
|
62
64
|
},
|
|
63
65
|
(argv) => {
|
|
64
66
|
if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? 'all'}`)
|
|
65
|
-
process.exitCode = genDocs({
|
|
67
|
+
process.exitCode = genDocs({
|
|
68
|
+
incremental: !!argv.incremental, pkg: argv.package as string,
|
|
69
|
+
})
|
|
66
70
|
},
|
|
67
71
|
)
|
|
68
72
|
.command(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Argv } from 'yargs'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
deploy, deployMajor, deployMinor, deployNext,
|
|
5
|
+
} from '../actions/index.ts'
|
|
4
6
|
|
|
5
7
|
export const xyDeployCommands = (args: Argv) => {
|
|
6
8
|
return args
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Argv } from 'yargs'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
clean, dupdeps, reinstall, statics, up, updo,
|
|
5
|
+
} from '../actions/index.ts'
|
|
4
6
|
|
|
5
7
|
export const xyInstallCommands = (args: Argv) => {
|
|
6
8
|
return args
|
|
@@ -8,9 +10,7 @@ export const xyInstallCommands = (args: Argv) => {
|
|
|
8
10
|
'clean [package]',
|
|
9
11
|
'Clean',
|
|
10
12
|
(yargs) => {
|
|
11
|
-
return yargs.positional('package', {
|
|
12
|
-
describe: 'Specific package to clean',
|
|
13
|
-
})
|
|
13
|
+
return yargs.positional('package', { describe: 'Specific package to clean' })
|
|
14
14
|
},
|
|
15
15
|
async (argv) => {
|
|
16
16
|
if (argv.verbose) {
|
package/src/xy/xyLintCommands.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import type { Argv } from 'yargs'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
cycle, fix, lint, lintProfile, publint, relint, sonar,
|
|
6
|
+
} from '../actions/index.ts'
|
|
5
7
|
import { packagePositionalParam } from './param.ts'
|
|
6
8
|
|
|
7
9
|
export const xyLintCommands = (args: Argv) => {
|
|
@@ -72,7 +74,9 @@ export const xyLintCommands = (args: Argv) => {
|
|
|
72
74
|
async (argv) => {
|
|
73
75
|
if (argv.verbose) console.log('Publint')
|
|
74
76
|
const start = Date.now()
|
|
75
|
-
process.exitCode = await publint({
|
|
77
|
+
process.exitCode = await publint({
|
|
78
|
+
pkg: argv.package as string, verbose: !!argv.verbose,
|
|
79
|
+
})
|
|
76
80
|
console.log(chalk.blue(`Finished in ${Date.now() - start}ms`))
|
|
77
81
|
},
|
|
78
82
|
)
|