@xylabs/ts-scripts-yarn3 6.0.9 → 6.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.
Files changed (161) hide show
  1. package/dist/actions/build.mjs +2 -2
  2. package/dist/actions/build.mjs.map +1 -1
  3. package/dist/actions/index.mjs +16 -2
  4. package/dist/actions/index.mjs.map +1 -1
  5. package/dist/actions/knip.mjs +112 -0
  6. package/dist/actions/knip.mjs.map +1 -0
  7. package/dist/actions/relint.mjs.map +1 -1
  8. package/dist/bin/xy.mjs +22 -2
  9. package/dist/bin/xy.mjs.map +1 -1
  10. package/dist/index.d.ts +3 -1
  11. package/dist/index.mjs +23 -2
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/types/actions/index.d.ts +1 -0
  14. package/dist/types/actions/index.d.ts.map +1 -1
  15. package/dist/types/actions/knip.d.ts +2 -0
  16. package/dist/types/actions/knip.d.ts.map +1 -0
  17. package/dist/types/actions/relint.d.ts.map +1 -1
  18. package/dist/types/xy/xyLintCommands.d.ts.map +1 -1
  19. package/dist/xy/index.mjs +22 -2
  20. package/dist/xy/index.mjs.map +1 -1
  21. package/dist/xy/xy.mjs +22 -2
  22. package/dist/xy/xy.mjs.map +1 -1
  23. package/dist/xy/xyBuildCommands.mjs +2 -2
  24. package/dist/xy/xyBuildCommands.mjs.map +1 -1
  25. package/dist/xy/xyLintCommands.mjs +20 -0
  26. package/dist/xy/xyLintCommands.mjs.map +1 -1
  27. package/package.json +10 -4
  28. package/spec/yarn/workspace/tsconfig.json +0 -3
  29. package/src/actions/build.ts +0 -34
  30. package/src/actions/clean-docs.ts +0 -12
  31. package/src/actions/clean-eslint.ts +0 -15
  32. package/src/actions/clean-jest.ts +0 -7
  33. package/src/actions/clean.ts +0 -26
  34. package/src/actions/compile-types.ts +0 -67
  35. package/src/actions/compile.ts +0 -67
  36. package/src/actions/copy-assets.ts +0 -70
  37. package/src/actions/cycle.ts +0 -15
  38. package/src/actions/dead.ts +0 -5
  39. package/src/actions/deploy-major.ts +0 -11
  40. package/src/actions/deploy-minor.ts +0 -11
  41. package/src/actions/deploy-next.ts +0 -11
  42. package/src/actions/deploy.ts +0 -11
  43. package/src/actions/deps.ts +0 -43
  44. package/src/actions/dupdeps.ts +0 -12
  45. package/src/actions/fix.ts +0 -6
  46. package/src/actions/gen-docs.ts +0 -26
  47. package/src/actions/gitignore-gen.ts +0 -5
  48. package/src/actions/gitlint-fix.ts +0 -27
  49. package/src/actions/gitlint.ts +0 -46
  50. package/src/actions/index.ts +0 -37
  51. package/src/actions/license.ts +0 -81
  52. package/src/actions/lint.ts +0 -61
  53. package/src/actions/npmignore-gen.ts +0 -5
  54. package/src/actions/package/clean-outputs.ts +0 -18
  55. package/src/actions/package/clean-typescript.ts +0 -18
  56. package/src/actions/package/clean.ts +0 -6
  57. package/src/actions/package/compile/XyConfig.ts +0 -60
  58. package/src/actions/package/compile/buildEntries.ts +0 -22
  59. package/src/actions/package/compile/compile.ts +0 -21
  60. package/src/actions/package/compile/compileTypes.ts +0 -13
  61. package/src/actions/package/compile/copyTypeFiles.ts +0 -38
  62. package/src/actions/package/compile/deepMerge.ts +0 -33
  63. package/src/actions/package/compile/getCompilerOptions.ts +0 -30
  64. package/src/actions/package/compile/index.ts +0 -6
  65. package/src/actions/package/compile/inputs.ts +0 -6
  66. package/src/actions/package/compile/packageCompileTsc.ts +0 -67
  67. package/src/actions/package/compile/packageCompileTscTypes.ts +0 -68
  68. package/src/actions/package/compile/packageCompileTsup.ts +0 -154
  69. package/src/actions/package/copy-assets.ts +0 -46
  70. package/src/actions/package/deps.ts +0 -144
  71. package/src/actions/package/gen-docs.ts +0 -126
  72. package/src/actions/package/index.ts +0 -10
  73. package/src/actions/package/lint.ts +0 -86
  74. package/src/actions/package/publint.ts +0 -75
  75. package/src/actions/package/recompile.ts +0 -6
  76. package/src/actions/publint.ts +0 -26
  77. package/src/actions/rebuild.ts +0 -13
  78. package/src/actions/recompile.ts +0 -81
  79. package/src/actions/reinstall.ts +0 -29
  80. package/src/actions/relint.ts +0 -76
  81. package/src/actions/retest.ts +0 -8
  82. package/src/actions/sonar.ts +0 -5
  83. package/src/actions/statics.ts +0 -13
  84. package/src/actions/test.ts +0 -5
  85. package/src/actions/up.ts +0 -5
  86. package/src/actions/updo.ts +0 -9
  87. package/src/actions/upplug.ts +0 -10
  88. package/src/actions/upyarn.ts +0 -5
  89. package/src/actions/yarn3only.ts +0 -9
  90. package/src/bin/package/build-only.ts +0 -16
  91. package/src/bin/package/build.ts +0 -16
  92. package/src/bin/package/clean-outputs.ts +0 -5
  93. package/src/bin/package/clean-typescript.ts +0 -5
  94. package/src/bin/package/clean.ts +0 -12
  95. package/src/bin/package/compile-only.ts +0 -12
  96. package/src/bin/package/compile-tsup.ts +0 -12
  97. package/src/bin/package/compile-types.ts +0 -16
  98. package/src/bin/package/compile.ts +0 -16
  99. package/src/bin/package/copy-assets-cjs.ts +0 -12
  100. package/src/bin/package/copy-assets-esm.ts +0 -12
  101. package/src/bin/package/deps.ts +0 -12
  102. package/src/bin/package/fix.ts +0 -16
  103. package/src/bin/package/gen-docs.ts +0 -12
  104. package/src/bin/package/lint.ts +0 -16
  105. package/src/bin/package/publint.ts +0 -13
  106. package/src/bin/package/recompile.ts +0 -12
  107. package/src/bin/package/relint.ts +0 -16
  108. package/src/bin/xy.ts +0 -12
  109. package/src/index.ts +0 -4
  110. package/src/lib/checkResult.ts +0 -12
  111. package/src/lib/createBuildConfig.ts +0 -37
  112. package/src/lib/defaultBuildConfig.ts +0 -18
  113. package/src/lib/deleteGlob.ts +0 -13
  114. package/src/lib/dependencies/DuplicateDetector.ts +0 -97
  115. package/src/lib/dependencies/detectDuplicateDependencies.ts +0 -41
  116. package/src/lib/dependencies/index.ts +0 -2
  117. package/src/lib/file/ReadFileSyncOptions.ts +0 -6
  118. package/src/lib/file/constants.ts +0 -2
  119. package/src/lib/file/fileLines.ts +0 -25
  120. package/src/lib/file/index.ts +0 -4
  121. package/src/lib/file/tryReadFileSync.ts +0 -9
  122. package/src/lib/generateIgnoreFiles.ts +0 -31
  123. package/src/lib/index.ts +0 -20
  124. package/src/lib/jsonFormatters.ts +0 -6
  125. package/src/lib/loadConfig.ts +0 -19
  126. package/src/lib/parsedPackageJSON.ts +0 -7
  127. package/src/lib/processEx.ts +0 -27
  128. package/src/lib/runSteps.ts +0 -40
  129. package/src/lib/runStepsAsync.ts +0 -53
  130. package/src/lib/runXy.ts +0 -8
  131. package/src/lib/runXyWithWarning.ts +0 -9
  132. package/src/lib/safeExit.ts +0 -29
  133. package/src/lib/string/empty.ts +0 -2
  134. package/src/lib/string/index.ts +0 -2
  135. package/src/lib/string/union.ts +0 -1
  136. package/src/lib/withErrnoException.ts +0 -7
  137. package/src/lib/withError.ts +0 -8
  138. package/src/lib/yarn/index.ts +0 -3
  139. package/src/lib/yarn/isYarnVersionOrGreater.ts +0 -16
  140. package/src/lib/yarn/workspace/Workspace.ts +0 -4
  141. package/src/lib/yarn/workspace/index.ts +0 -3
  142. package/src/lib/yarn/workspace/yarnWorkspace.ts +0 -8
  143. package/src/lib/yarn/workspace/yarnWorkspaces.ts +0 -21
  144. package/src/lib/yarn/yarnInitCwd.ts +0 -4
  145. package/src/loadPackageConfig.ts +0 -13
  146. package/src/types.d.ts +0 -26
  147. package/src/xy/index.ts +0 -7
  148. package/src/xy/param.ts +0 -5
  149. package/src/xy/xy.ts +0 -20
  150. package/src/xy/xyBuildCommands.ts +0 -127
  151. package/src/xy/xyCommonCommands.ts +0 -167
  152. package/src/xy/xyDeployCommands.ts +0 -53
  153. package/src/xy/xyInstallCommands.ts +0 -80
  154. package/src/xy/xyLintCommands.ts +0 -92
  155. package/src/xy/xyParseOptions.ts +0 -58
  156. package/tsconfig.build.json +0 -29
  157. package/tsconfig.json +0 -4
  158. package/tsconfig.test.json +0 -4
  159. package/tsup.config.ts +0 -16
  160. package/types/node-cmd.d.ts +0 -1
  161. package/xy.config.ts +0 -3
@@ -1,67 +0,0 @@
1
- import chalk from 'chalk'
2
-
3
- import { runSteps } from '../lib/index.ts'
4
-
5
- export interface CompileParams {
6
- incremental?: boolean
7
- jobs?: number
8
- pkg?: string
9
- publint?: boolean
10
- target?: 'esm' | 'cjs'
11
- verbose?: boolean
12
- }
13
-
14
- interface CompilePackageParams {
15
- pkg: string
16
- publint?: boolean
17
- target?: 'esm' | 'cjs'
18
- verbose?: boolean
19
- }
20
-
21
- export const compile = ({
22
- verbose, target, pkg, incremental, publint, jobs,
23
- }: CompileParams) => {
24
- return pkg
25
- ? compilePackage({
26
- pkg, publint, target, verbose,
27
- })
28
- : compileAll({
29
- incremental, publint, target, verbose, jobs,
30
- })
31
- }
32
-
33
- export const compilePackage = ({ target, pkg }: CompilePackageParams) => {
34
- const targetOptions = target ? ['-t', target] : []
35
-
36
- return runSteps(
37
- `Compile [${pkg}]`,
38
- [['yarn', ['workspace', pkg, 'run', 'package-compile', ...targetOptions]]],
39
- )
40
- }
41
-
42
- export const compileAll = ({
43
- jobs, verbose, target, incremental,
44
- }: CompileParams) => {
45
- const start = Date.now()
46
- const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
47
- const targetOptions = target ? ['-t', target] : []
48
- const incrementalOptions = incremental ? ['--since', '-Apt', '--topological-dev'] : ['--parallel', '-Apt', '--topological-dev']
49
- const jobsOptions = jobs ? ['-j', `${jobs}`] : []
50
- if (jobs) {
51
- console.log(chalk.blue(`Jobs set to [${jobs}]`))
52
- }
53
-
54
- const result = runSteps(`Compile${incremental ? '-Incremental' : ''} [All]`, [
55
- ['yarn', ['workspaces',
56
- 'foreach',
57
- ...incrementalOptions,
58
- ...jobsOptions,
59
- ...verboseOptions,
60
- 'run',
61
- 'package-compile',
62
- ...targetOptions,
63
- ]],
64
- ])
65
- console.log(`${chalk.gray('Compiled in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)
66
- return result
67
- }
@@ -1,70 +0,0 @@
1
- import path from 'node:path/posix'
2
-
3
- import chalk from 'chalk'
4
- import cpy from 'cpy'
5
-
6
- import { yarnWorkspaces } from '../lib/index.ts'
7
-
8
- export interface CopyAssetsParams {
9
- pkg?: string
10
- target?: 'esm' | 'cjs'
11
- }
12
-
13
- const copyPackageTargetAssets = async (target: 'esm' | 'cjs', name: string, location: string) => {
14
- try {
15
- const values = await cpy(
16
- ['**/*.jpg', '**/*.png', '**/*.gif', '**/*.svg', '**/*.webp', '**/*.sass', '**/*.scss', '**/*.gif', '**/*.css'],
17
- `../dist/${target}`,
18
- {
19
- cwd: path.join(process.cwd(), location, 'src'),
20
- flat: false,
21
- },
22
- )
23
- for (const value of values) {
24
- console.log(`${value.split('/').pop()} => ./dist/${target}`)
25
- }
26
- return 0
27
- } catch (reason) {
28
- console.log(`Copy Failed: ${name}: ${reason}`)
29
- return 1
30
- }
31
- }
32
-
33
- const copyTargetAssets = async (target: 'esm' | 'cjs', pkg?: string) => {
34
- const workspaces = yarnWorkspaces()
35
-
36
- console.log(chalk.green(`Copying Assets [${target.toUpperCase()}]`))
37
-
38
- // finds the package or returns all if undefined
39
- const workspaceList = workspaces.filter(({ name }) => {
40
- return pkg === undefined || name === pkg
41
- })
42
-
43
- if (workspaceList.length === 0) {
44
- console.error(`Package not found [${pkg}]`)
45
- } else {
46
- const results = await Promise.all(
47
- workspaceList.map(async (workspace) => {
48
- const { location, name } = workspace
49
- return await copyPackageTargetAssets(target, name, location)
50
- }),
51
- )
52
- // eslint-disable-next-line unicorn/no-array-reduce
53
- return results.reduce((prev, result) => prev || result, 0)
54
- }
55
- return 0
56
- }
57
-
58
- export const copyAssets = async ({ target, pkg }: CopyAssetsParams) => {
59
- switch (target) {
60
- case 'esm': {
61
- return await copyTargetAssets('esm', pkg)
62
- }
63
- case 'cjs': {
64
- return await copyTargetAssets('cjs', pkg)
65
- }
66
- default: {
67
- return (await copyTargetAssets('esm', pkg)) || (await copyTargetAssets('cjs', pkg))
68
- }
69
- }
70
- }
@@ -1,15 +0,0 @@
1
- import { ESLint } from 'eslint'
2
-
3
- export const cycle = async () => {
4
- const eslint = new ESLint({
5
- fix: false,
6
- overrideConfig: { rules: { 'import-x/no-cycle': ['error', { maxDepth: 10 }] } },
7
- })
8
- const results = await eslint.lintFiles(['src/**/*.ts*', 'packages/**/src/**/*.ts*'])
9
-
10
- const formatter = await eslint.loadFormatter('stylish')
11
- const resultText = formatter.format(results)
12
- console.log(resultText)
13
-
14
- return results.length
15
- }
@@ -1,5 +0,0 @@
1
- import { runSteps } from '../lib/index.ts'
2
-
3
- export const dead = () => {
4
- return runSteps('Dead', [['yarn', ['ts-prune', '-p', 'tsconfig.json']]])
5
- }
@@ -1,11 +0,0 @@
1
- import { runSteps } from '../lib/index.ts'
2
-
3
- export const deployMajor = () => {
4
- return runSteps('Deploy [Major]', [
5
- ['yarn', 'workspaces foreach --all version major --deferred'],
6
- ['yarn', 'xy clean'],
7
- ['yarn', 'xy build'],
8
- ['yarn', 'version apply --all'],
9
- ['yarn', 'workspaces foreach --all --parallel npm publish'],
10
- ])
11
- }
@@ -1,11 +0,0 @@
1
- import { runSteps } from '../lib/index.ts'
2
-
3
- export const deployMinor = () => {
4
- return runSteps('Deploy [Minor]', [
5
- ['yarn', 'workspaces foreach --all version minor --deferred'],
6
- ['yarn', 'xy clean'],
7
- ['yarn', 'xy build'],
8
- ['yarn', 'version apply --all'],
9
- ['yarn', 'workspaces foreach --all --parallel npm publish'],
10
- ])
11
- }
@@ -1,11 +0,0 @@
1
- import { runSteps } from '../lib/index.ts'
2
-
3
- export const deployNext = () => {
4
- return runSteps('Deploy [Next]', [
5
- ['yarn', 'workspaces foreach --all version minor --deferred'],
6
- ['yarn', 'xy clean'],
7
- ['yarn', 'xy build'],
8
- ['yarn', 'version apply --all --prerelease'],
9
- ['yarn', 'workspaces foreach --all --parallel npm publish --tag next'],
10
- ])
11
- }
@@ -1,11 +0,0 @@
1
- import { runSteps } from '../lib/index.ts'
2
-
3
- export const deploy = () => {
4
- return runSteps('Deploy [Patch]', [
5
- ['yarn', 'workspaces foreach --all version patch --deferred'],
6
- ['yarn', 'xy clean'],
7
- ['yarn', 'xy build'],
8
- ['yarn', 'version apply --all'],
9
- ['yarn', 'workspaces foreach --all --parallel npm publish'],
10
- ])
11
- }
@@ -1,43 +0,0 @@
1
- import chalk from 'chalk'
2
-
3
- import type { ScriptStep } from '../lib/index.ts'
4
- import { runSteps } from '../lib/index.ts'
5
-
6
- export interface DepsParams {
7
- incremental?: boolean
8
- jobs?: number
9
- pkg?: string
10
- verbose?: boolean
11
- }
12
-
13
- export interface DepsPackageParams { pkg: string }
14
-
15
- export const deps = ({ pkg, incremental }: DepsParams) => {
16
- // eslint-disable-next-line @typescript-eslint/no-unused-expressions
17
- pkg ? depsPackage({ pkg }) : depsAll({ incremental })
18
- // returning 0 here since we never wants deps to be fatal
19
- return 0
20
- }
21
-
22
- export const depsPackage = ({ pkg }: DepsPackageParams) => {
23
- const steps: ScriptStep[] = [['yarn', ['workspace', pkg, 'run', 'package-deps']]]
24
-
25
- return runSteps(`Deps [${pkg}]`, [...steps])
26
- }
27
-
28
- export const depsAll = ({
29
- incremental, jobs, verbose,
30
- }: DepsParams) => {
31
- const start = Date.now()
32
- const jobsOptions = jobs ? ['-j', `${jobs}`] : []
33
- const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
34
- if (jobs) {
35
- console.log(chalk.blue(`Jobs set to [${jobs}]`))
36
- }
37
- const incrementalOptions = incremental ? ['--since', '-pA'] : ['-pA']
38
- const steps: ScriptStep[] = [['yarn', ['workspaces', 'foreach', ...jobsOptions, ...incrementalOptions, ...verboseOptions, 'run', 'package-deps']]]
39
-
40
- const result = runSteps(`Deps${incremental ? '-Incremental' : ''} [All]`, [...steps])
41
- console.log(`${chalk.gray('Dep checked in')} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`)
42
- return result
43
- }
@@ -1,12 +0,0 @@
1
- import chalk from 'chalk'
2
-
3
- import { detectDuplicateDependencies, parsedPackageJSON } from '../lib/index.ts'
4
-
5
- export const dupdeps = () => {
6
- console.log(chalk.green('Checking all Dependencies for Duplicates'))
7
-
8
- const allDependencies = parsedPackageJSON()?.dependencies
9
- const dependencies = Object.entries(allDependencies).map(([k]) => k)
10
-
11
- return detectDuplicateDependencies(dependencies)
12
- }
@@ -1,6 +0,0 @@
1
- import type { LintParams } from './lint.ts'
2
- import { lint } from './lint.ts'
3
-
4
- export const fix = (params?: LintParams) => {
5
- return lint({ ...params, fix: true })
6
- }
@@ -1,26 +0,0 @@
1
- import type { ScriptStep } from '../lib/index.ts'
2
- import { runSteps } from '../lib/index.ts'
3
-
4
- export interface GenDocsParams {
5
- incremental?: boolean
6
- pkg?: string
7
- }
8
-
9
- export interface GenDocsPackageParams { pkg: string }
10
-
11
- export const genDocs = ({ pkg, incremental }: GenDocsParams) => {
12
- return pkg ? genDocsPackage({ pkg }) : genDocsAll({ incremental })
13
- }
14
-
15
- export const genDocsPackage = ({ pkg }: GenDocsPackageParams) => {
16
- const steps: ScriptStep[] = [['yarn', ['workspace', pkg, 'run', 'package-gen-docs']]]
17
-
18
- return runSteps(`GenDocs [${pkg}]`, [...steps])
19
- }
20
-
21
- export const genDocsAll = ({ incremental }: GenDocsParams) => {
22
- const incrementalOptions = incremental ? ['--since', '-pA'] : ['-pA']
23
- const steps: ScriptStep[] = [['yarn', ['workspaces', 'foreach', ...incrementalOptions, 'run', 'package-gen-docs']]]
24
-
25
- return runSteps(`GenDocs [All${incremental ? '-Incremental' : ''}]`, [...steps])
26
- }
@@ -1,5 +0,0 @@
1
- import { generateIgnoreFiles } from '../lib/index.ts'
2
-
3
- const filename = '.gitignore'
4
-
5
- export const gitignoreGen = (pkg?: string) => generateIgnoreFiles(filename, pkg)
@@ -1,27 +0,0 @@
1
- import { execSync } from 'node:child_process'
2
-
3
- import chalk from 'chalk'
4
- import ParseGitConfig from 'parse-git-config'
5
-
6
- export const gitlintFix = () => {
7
- console.log(`\nGitlint Fix Start [${process.cwd()}]\n`)
8
-
9
- const gitConfig = ParseGitConfig.sync()
10
-
11
- if (gitConfig.core.ignorecase) {
12
- execSync('git config core.ignorecase false', { stdio: 'inherit' })
13
- console.warn(chalk.yellow('\nGitlint Fix: Updated core.ignorecase to be false\n'))
14
- }
15
-
16
- if (gitConfig.core.autocrlf !== false) {
17
- execSync('git config core.autocrlf false', { stdio: 'inherit' })
18
- console.warn(chalk.yellow('\nGitlint Fix: Updated core.autocrlf to be false\n'))
19
- }
20
-
21
- if (gitConfig.core.eol !== 'lf') {
22
- execSync('git config core.eol lf', { stdio: 'inherit' })
23
- console.warn(chalk.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'))
24
- }
25
-
26
- return 1
27
- }
@@ -1,46 +0,0 @@
1
- import chalk from 'chalk'
2
- import ParseGitConfig from 'parse-git-config'
3
-
4
- export const gitlint = () => {
5
- console.log(`\nGitlint Start [${process.cwd()}]\n`)
6
- let valid = 0
7
- let warnings = 0
8
- const errors = 0
9
- const gitConfig = ParseGitConfig.sync()
10
-
11
- const warn = (message: string) => {
12
- console.warn(chalk.yellow(`Warning: ${message}`))
13
- warnings++
14
- }
15
-
16
- if (gitConfig.core.ignorecase) {
17
- warn('Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]')
18
- } else {
19
- valid++
20
- }
21
-
22
- if (gitConfig.core.autocrlf === false) {
23
- valid++
24
- } else {
25
- warn('Please set core.autocrlf to FALSE in .git/config file [run yarn gitlint-fix]')
26
- }
27
-
28
- if (gitConfig.core.eol === 'lf') {
29
- valid++
30
- } else {
31
- warn('Please set core.eol to "lf" in .git/config file [run yarn gitlint-fix]')
32
- }
33
-
34
- const resultMessages: string[] = []
35
- if (valid > 0) {
36
- resultMessages.push(chalk.green(`Passed: ${valid}`))
37
- }
38
- if (warnings > 0) {
39
- resultMessages.push(chalk.yellow(`Warnings: ${warnings}`))
40
- }
41
- if (errors > 0) {
42
- resultMessages.push(chalk.red(` Errors: ${errors}`))
43
- }
44
- console.warn(`Gitlint Finish [ ${resultMessages.join(' | ')} ]\n`)
45
- return warnings + errors === 0 ? 1 : 0
46
- }
@@ -1,37 +0,0 @@
1
- export * from './build.ts'
2
- export * from './clean.ts'
3
- export * from './clean-docs.ts'
4
- export * from './compile.ts'
5
- export * from './compile-types.ts'
6
- export * from './copy-assets.ts'
7
- export * from './cycle.ts'
8
- export * from './dead.ts'
9
- export * from './deploy.ts'
10
- export * from './deploy-major.ts'
11
- export * from './deploy-minor.ts'
12
- export * from './deploy-next.ts'
13
- export * from './deps.ts'
14
- export * from './dupdeps.ts'
15
- export * from './fix.ts'
16
- export * from './gen-docs.ts'
17
- export * from './gitignore-gen.ts'
18
- export * from './gitlint.ts'
19
- export * from './gitlint-fix.ts'
20
- export * from './license.ts'
21
- export * from './lint.ts'
22
- export * from './npmignore-gen.ts'
23
- export * from './package/index.ts'
24
- export * from './publint.ts'
25
- export * from './rebuild.ts'
26
- export * from './recompile.ts'
27
- export * from './reinstall.ts'
28
- export * from './relint.ts'
29
- export * from './retest.ts'
30
- export * from './sonar.ts'
31
- export * from './statics.ts'
32
- export * from './test.ts'
33
- export * from './up.ts'
34
- export * from './updo.ts'
35
- export * from './upplug.ts'
36
- export * from './upyarn.ts'
37
- export * from './yarn3only.ts'
@@ -1,81 +0,0 @@
1
- import chalk from 'chalk'
2
- import { init } from 'license-checker'
3
-
4
- import { yarnWorkspaces } from '../lib/index.ts'
5
-
6
- export const license = async (pkg?: string) => {
7
- const workspaces = yarnWorkspaces()
8
- const workspaceList = workspaces.filter(({ name }) => {
9
- return pkg === undefined || name === pkg
10
- })
11
-
12
- const exclude = new Set([
13
- 'MIT',
14
- 'MIT*',
15
- 'ISC',
16
- 'Apache-2.0',
17
- 'BSD',
18
- 'BSD*',
19
- 'BSD-2-Clause',
20
- 'BSD-3-Clause',
21
- 'CC-BY-4.0',
22
- 'Unlicense',
23
- 'CC-BY-3.0',
24
- 'CC0-1.0',
25
- 'LGPL-3.0-only',
26
- 'LGPL-3.0',
27
- 'LGPL-3.0-or-later',
28
- 'Python-2.0',
29
- ])
30
-
31
- console.log(chalk.green('License Checker'))
32
-
33
- return (
34
- (
35
- await Promise.all(
36
- workspaceList.map(({ location, name }) => {
37
- return new Promise<number>((resolve) => {
38
- init({ production: true, start: location }, (error, packages) => {
39
- if (error) {
40
- console.error(chalk.red(`License Checker [${name}] Error`))
41
- console.error(chalk.gray(error))
42
- console.log('\n')
43
- resolve(1)
44
- } else {
45
- console.log(chalk.green(`License Checker [${name}]`))
46
- let count = 0
47
- for (const [name, info] of Object.entries(packages)) {
48
- const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses]
49
- for (let license of licenses) {
50
- if (license) {
51
- // remove surrounding parens on some string
52
- const processedLicense = (license[0] === '(' && license.at(-1) === ')')
53
- ? license.slice(1, -2)
54
- : license
55
- // get list of OR licenses from string
56
- const orLicenses = processedLicense.split(' OR ')
57
- let orLicenseFound = false
58
- for (const orLicense of orLicenses) {
59
- if (exclude.has(orLicense)) {
60
- orLicenseFound = true
61
- }
62
- }
63
- if (!orLicenseFound) {
64
- count++
65
- console.warn(chalk.yellow(`${name}: Package License not allowed [${license}]`))
66
- }
67
- }
68
- }
69
- }
70
- console.log('\n')
71
- resolve(count)
72
- }
73
- })
74
- })
75
- }),
76
- )
77
- )
78
- // eslint-disable-next-line unicorn/no-array-reduce
79
- .reduce((prev, value) => prev || value, 0)
80
- )
81
- }
@@ -1,61 +0,0 @@
1
- import chalk from 'chalk'
2
-
3
- import { runSteps } from '../lib/index.ts'
4
-
5
- export interface LintParams {
6
- fix?: boolean
7
- incremental?: boolean
8
- pkg?: string
9
- verbose?: boolean
10
- }
11
-
12
- export interface LintPackageParams {
13
- pkg: string
14
- verbose?: boolean
15
- }
16
-
17
- export const lintPackage = ({ pkg, fix }: LintParams & Required<Pick<LintParams, 'pkg'>>) => {
18
- console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))
19
- const start = Date.now()
20
-
21
- const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [
22
- ['yarn', ['workspace',
23
- pkg,
24
- 'run',
25
- fix ? 'package-fix' : 'package-lint',
26
- ]],
27
- ])
28
- console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))
29
- return result
30
- }
31
-
32
- export const lint = ({
33
- pkg, verbose, incremental, fix,
34
- }: LintParams = {}) => {
35
- return pkg
36
- ? lintPackage({ pkg, fix })
37
- : lintAllPackages({
38
- verbose, incremental, fix,
39
- })
40
- }
41
-
42
- export const lintAllPackages = ({
43
- fix, verbose = true, incremental,
44
- }: LintParams = {}) => {
45
- console.log(chalk.gray(`${fix ? 'Fix' : 'Lint'} [All-Packages]`))
46
- const start = Date.now()
47
- const verboseOptions = verbose ? ['--verbose'] : ['--no-verbose']
48
- const incrementalOptions = incremental ? ['--since', '-Ap'] : ['--parallel', '-Ap']
49
-
50
- const result = runSteps(`${fix ? 'Fix' : 'Lint'} [All-Packages]`, [
51
- ['yarn', ['workspaces',
52
- 'foreach',
53
- ...verboseOptions,
54
- ...incrementalOptions,
55
- 'run',
56
- fix ? 'package-fix' : 'package-lint',
57
- ]],
58
- ])
59
- console.log(chalk.gray(`${fix ? 'Fixed in' : 'Linted in'} [${chalk.magenta(((Date.now() - start) / 1000).toFixed(2))}] ${chalk.gray('seconds')}`))
60
- return result
61
- }
@@ -1,5 +0,0 @@
1
- import { generateIgnoreFiles } from '../lib/index.ts'
2
-
3
- const filename = '.npmignore'
4
-
5
- export const npmignoreGen = (pkg?: string) => generateIgnoreFiles(filename, pkg)
@@ -1,18 +0,0 @@
1
- import path from 'node:path'
2
-
3
- import chalk from 'chalk'
4
-
5
- import { deleteGlob } from '../../lib/index.ts'
6
-
7
- export const packageCleanOutputs = () => {
8
- const pkg = process.env.INIT_CWD ?? '.'
9
- const pkgName = process.env.npm_package_name
10
- const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')]
11
- console.log(chalk.green(`Cleaning Outputs [${pkgName}]`))
12
-
13
- for (let folder of folders) {
14
- deleteGlob(folder)
15
- }
16
-
17
- return 0
18
- }
@@ -1,18 +0,0 @@
1
- import path from 'node:path'
2
-
3
- import chalk from 'chalk'
4
-
5
- import { deleteGlob } from '../../lib/index.ts'
6
-
7
- export const packageCleanTypescript = () => {
8
- const pkg = process.env.INIT_CWD ?? '.'
9
- const pkgName = process.env.npm_package_name
10
- console.log(chalk.green(`Cleaning Typescript [${pkgName}]`))
11
- const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')]
12
-
13
- for (let file of files) {
14
- deleteGlob(file)
15
- }
16
-
17
- return 0
18
- }
@@ -1,6 +0,0 @@
1
- import { packageCleanOutputs } from './clean-outputs.ts'
2
- import { packageCleanTypescript } from './clean-typescript.ts'
3
-
4
- export const packageClean = async () => {
5
- return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0)
6
- }