@xylabs/ts-scripts-yarn3 3.0.10 → 3.0.12

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 (73) hide show
  1. package/dist/actions/package/compile/CompileParams.js +17 -0
  2. package/dist/actions/package/compile/CompileParams.js.map +1 -0
  3. package/dist/actions/package/compile/CompileParams.mjs +1 -0
  4. package/dist/actions/package/compile/CompileParams.mjs.map +1 -0
  5. package/dist/actions/package/compile/compile.js +86 -0
  6. package/dist/actions/package/compile/compile.js.map +1 -0
  7. package/dist/actions/package/compile/compile.mjs +52 -0
  8. package/dist/actions/package/compile/compile.mjs.map +1 -0
  9. package/dist/actions/package/compile/copyTypeFiles.js +49 -0
  10. package/dist/actions/package/compile/copyTypeFiles.js.map +1 -0
  11. package/dist/actions/package/compile/copyTypeFiles.mjs +25 -0
  12. package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -0
  13. package/dist/actions/package/compile/index.js +29 -0
  14. package/dist/actions/package/compile/index.js.map +1 -0
  15. package/dist/actions/package/compile/index.mjs +5 -0
  16. package/dist/actions/package/compile/index.mjs.map +1 -0
  17. package/dist/actions/package/compile/inputs.js +58 -0
  18. package/dist/actions/package/compile/inputs.js.map +1 -0
  19. package/dist/actions/package/compile/inputs.mjs +32 -0
  20. package/dist/actions/package/compile/inputs.mjs.map +1 -0
  21. package/dist/actions/package/{compile.js → compile/rollup.js} +26 -76
  22. package/dist/actions/package/compile/rollup.js.map +1 -0
  23. package/dist/actions/package/compile/rollup.mjs +98 -0
  24. package/dist/actions/package/compile/rollup.mjs.map +1 -0
  25. package/dist/actions/package/compile/tsc.js +114 -0
  26. package/dist/actions/package/compile/tsc.js.map +1 -0
  27. package/dist/actions/package/compile/tsc.mjs +80 -0
  28. package/dist/actions/package/compile/tsc.mjs.map +1 -0
  29. package/dist/actions/package/compile/tscTypes.js +55 -0
  30. package/dist/actions/package/compile/tscTypes.js.map +1 -0
  31. package/dist/actions/package/compile/tscTypes.mjs +31 -0
  32. package/dist/actions/package/compile/tscTypes.mjs.map +1 -0
  33. package/dist/actions/package/compile/tsup.js +75 -0
  34. package/dist/actions/package/compile/tsup.js.map +1 -0
  35. package/dist/actions/package/compile/tsup.mjs +51 -0
  36. package/dist/actions/package/compile/tsup.mjs.map +1 -0
  37. package/dist/actions/package/publint.js +1 -1
  38. package/dist/actions/package/publint.js.map +1 -1
  39. package/dist/actions/package/publint.mjs +1 -1
  40. package/dist/actions/package/publint.mjs.map +1 -1
  41. package/dist/bin/package/compile-tsup.js +31 -0
  42. package/dist/bin/package/compile-tsup.js.map +1 -0
  43. package/dist/bin/package/compile-tsup.mjs +8 -0
  44. package/dist/bin/package/compile-tsup.mjs.map +1 -0
  45. package/dist/index.d.mts +53 -10
  46. package/dist/index.d.ts +53 -10
  47. package/dist/lib/index.js +3 -1
  48. package/dist/lib/index.js.map +1 -1
  49. package/dist/lib/index.mjs +1 -0
  50. package/dist/lib/index.mjs.map +1 -1
  51. package/dist/lib/loadConfig.js +54 -0
  52. package/dist/lib/loadConfig.js.map +1 -0
  53. package/dist/lib/loadConfig.mjs +20 -0
  54. package/dist/lib/loadConfig.mjs.map +1 -0
  55. package/package.json +6 -6
  56. package/src/actions/package/compile/CompileParams.ts +10 -0
  57. package/src/actions/package/compile/compile.ts +59 -0
  58. package/src/actions/package/compile/copyTypeFiles.ts +27 -0
  59. package/src/actions/package/compile/index.ts +4 -0
  60. package/src/actions/package/compile/inputs.ts +33 -0
  61. package/src/actions/package/compile/rollup.ts +108 -0
  62. package/src/actions/package/compile/tsc.ts +100 -0
  63. package/src/actions/package/compile/tscTypes.ts +32 -0
  64. package/src/actions/package/compile/tsup.ts +64 -0
  65. package/src/actions/package/publint.ts +5 -1
  66. package/src/bin/package/compile-tsup.ts +9 -0
  67. package/src/lib/index.ts +1 -0
  68. package/src/lib/loadConfig.ts +19 -0
  69. package/tsconfig.json +1 -7
  70. package/dist/actions/package/compile.js.map +0 -1
  71. package/dist/actions/package/compile.mjs +0 -149
  72. package/dist/actions/package/compile.mjs.map +0 -1
  73. package/src/actions/package/compile.ts +0 -176
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+ var import_chalk = __toESM(require("chalk"));
26
+ var import_actions = require("../../actions");
27
+ (0, import_actions.packageCompileTsup)({ verbose: true }).then((value) => process.exitCode = value).catch((reason) => {
28
+ console.error(import_chalk.default.red(reason));
29
+ process.exitCode = 1;
30
+ });
31
+ //# sourceMappingURL=compile-tsup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/bin/package/compile-tsup.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\nimport { packageCompileTsup } from '../../actions'\n\npackageCompileTsup({verbose: true}).then((value) => process.exitCode = value).catch((reason) => {\n console.error(chalk.red(reason))\n process.exitCode = 1\n})"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,mBAAkB;AAClB,qBAAmC;AAAA,IAEnC,mCAAmB,EAAC,SAAS,KAAI,CAAC,EAAE,KAAK,CAAC,UAAU,QAAQ,WAAW,KAAK,EAAE,MAAM,CAAC,WAAW;AAC9F,UAAQ,MAAM,aAAAA,QAAM,IAAI,MAAM,CAAC;AAC/B,UAAQ,WAAW;AACrB,CAAC;","names":["chalk"]}
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import chalk from "chalk";
3
+ import { packageCompileTsup } from "../../actions";
4
+ packageCompileTsup({ verbose: true }).then((value) => process.exitCode = value).catch((reason) => {
5
+ console.error(chalk.red(reason));
6
+ process.exitCode = 1;
7
+ });
8
+ //# sourceMappingURL=compile-tsup.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/bin/package/compile-tsup.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport chalk from 'chalk'\nimport { packageCompileTsup } from '../../actions'\n\npackageCompileTsup({verbose: true}).then((value) => process.exitCode = value).catch((reason) => {\n console.error(chalk.red(reason))\n process.exitCode = 1\n})"],"mappings":";AAEA,OAAO,WAAW;AAClB,SAAS,0BAA0B;AAEnC,mBAAmB,EAAC,SAAS,KAAI,CAAC,EAAE,KAAK,CAAC,UAAU,QAAQ,WAAW,KAAK,EAAE,MAAM,CAAC,WAAW;AAC9F,UAAQ,MAAM,MAAM,IAAI,MAAM,CAAC;AAC/B,UAAQ,WAAW;AACrB,CAAC;","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { CompilerOptions } from 'typescript';
2
+ import { Options } from 'tsup';
1
3
  import { PathLike, WriteFileOptions } from 'node:fs';
2
4
  import { SpawnSyncOptionsWithBufferEncoding } from 'child_process';
3
5
  import { PackageJson } from 'types-package-json';
@@ -26,7 +28,7 @@ declare const cleanAll: ({ verbose }: CleanParams) => number;
26
28
 
27
29
  declare const cleanDocs: () => number;
28
30
 
29
- interface CompileParams {
31
+ interface CompileParams$1 {
30
32
  incremental?: boolean;
31
33
  jobs?: number;
32
34
  pkg?: string;
@@ -34,15 +36,15 @@ interface CompileParams {
34
36
  target?: 'esm' | 'cjs';
35
37
  verbose?: boolean;
36
38
  }
37
- interface CompilePackageParams$1 {
39
+ interface CompilePackageParams {
38
40
  pkg: string;
39
41
  publint?: boolean;
40
42
  target?: 'esm' | 'cjs';
41
43
  verbose?: boolean;
42
44
  }
43
- declare const compile: ({ verbose, target, pkg, incremental, publint }: CompileParams) => number;
44
- declare const compilePackage: ({ verbose, target, pkg, publint }: CompilePackageParams$1) => number;
45
- declare const compileAll: ({ jobs, verbose, target, incremental }: CompileParams) => number;
45
+ declare const compile: ({ verbose, target, pkg, incremental, publint }: CompileParams$1) => number;
46
+ declare const compilePackage: ({ verbose, target, pkg, publint }: CompilePackageParams) => number;
47
+ declare const compileAll: ({ jobs, verbose, target, incremental }: CompileParams$1) => number;
46
48
 
47
49
  interface CopyAssetsParams {
48
50
  pkg?: string;
@@ -121,11 +123,47 @@ declare const packageCleanOutputs: () => number;
121
123
 
122
124
  declare const packageCleanTypescript: () => number;
123
125
 
124
- interface CompilePackageParams {
125
- publint?: boolean;
126
+ interface RootParams {
126
127
  verbose?: boolean;
127
128
  }
128
- declare const packageCompile: ({ publint, verbose }?: CompilePackageParams) => Promise<number>;
129
+ interface CompileParams extends RootParams {
130
+ compile?: {
131
+ depth?: number;
132
+ publint?: boolean;
133
+ };
134
+ }
135
+
136
+ type PackageCompileMode = 'tsup' | 'tsc' | 'rollup';
137
+ type PackageCompileParams = CompileParams & {
138
+ compile?: {
139
+ modes?: PackageCompileMode[];
140
+ };
141
+ };
142
+ declare const packageCompile: (params?: PackageCompileParams) => Promise<number>;
143
+
144
+ type PackageCompileTscParams = Partial<CompileParams & {
145
+ compile?: {
146
+ tsc?: {
147
+ tsconfig?: string;
148
+ compilerOptions?: CompilerOptions;
149
+ };
150
+ };
151
+ }>;
152
+ declare const packageCompileTsc: (params?: PackageCompileTscParams) => Promise<number>;
153
+
154
+ type PackageCompileTsupParams = Partial<CompileParams & {
155
+ compile?: {
156
+ tsup?: {
157
+ options?: Options;
158
+ };
159
+ };
160
+ }>;
161
+ declare const packageCompileTsup: (params?: PackageCompileTsupParams) => Promise<number>;
162
+
163
+ interface PackageCompileRollupParams extends CompileParams {
164
+ }
165
+ declare const compileSubDir: (format: 'cjs' | 'esm', ext: string, subDir?: string, verbose?: boolean) => Promise<number>;
166
+ declare const packageCompileRollup: (params?: PackageCompileRollupParams) => Promise<number>;
129
167
 
130
168
  interface PackageCopyAssetsParams {
131
169
  target?: 'esm' | 'cjs';
@@ -136,7 +174,10 @@ declare const packageDeps: () => Promise<number>;
136
174
 
137
175
  declare const packageGenDocs: () => Promise<number | undefined>;
138
176
 
139
- declare const packagePublint: () => Promise<number>;
177
+ interface PackagePublintParams {
178
+ verbose?: boolean;
179
+ }
180
+ declare const packagePublint: (params?: PackagePublintParams) => Promise<number>;
140
181
 
141
182
  declare const packageRecompile: () => Promise<number>;
142
183
 
@@ -279,6 +320,8 @@ declare const yarnWorkspaces: () => Workspace[];
279
320
 
280
321
  declare const INIT_CWD: () => string | undefined;
281
322
 
323
+ declare const loadConfig: <T extends object>(params?: T | undefined) => Promise<T>;
324
+
282
325
  type PackageJsonEx = PackageJson & {
283
326
  type: 'module' | 'commonjs';
284
327
  };
@@ -306,4 +349,4 @@ declare const xyLintCommands: (args: Argv) => Argv<{}>;
306
349
 
307
350
  declare const xyParseOptions: () => Argv;
308
351
 
309
- export { BuildParams, CROSS_PLATFORM_NEWLINE, CleanPackageParams, CleanParams, CompilePackageParams, CompileParams, CopyAssetsParams, DepsPackageParams, DepsParams, DuplicateDetector, GenDocsPackageParams, GenDocsParams, INIT_CWD, LintPackageParams, LintParams, PackageCopyAssetsParams, PackageJsonEx, PublintPackageParams, PublintParams, ReadFileSyncOptions, RebuildParams, RecompilePackageParams, RecompileParams, ScriptStep, WINDOWS_NEWLINE_REGEX, Workspace, build, checkResult, clean, cleanAll, cleanDocs, cleanPackage, compile, compileAll, compilePackage, copyAssets, createBuildConfig, cycle, dead, defaultBuildConfig, defaultReadFileSyncOptions, deploy, deployMajor, deployMinor, deployNext, deps, depsAll, depsPackage, detectDuplicateDependencies, dupdeps, empty, fix, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, gitignoreGen, gitlint, gitlintFix, isYarnVersionOrGreater, license, lint, lintAll, lintClean, lintPackage, lintProfile, loadPackageConfig, multiLineToJSONArray, notEmpty, npmignoreGen, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCopyAssets, packageDeps, packageGenDocs, packagePublint, packageRecompile, parsedPackageJSON, processEx, publint, publintAll, publintPackage, readLines, readNonEmptyLines, rebuild, recompile, recompileAll, recompilePackage, reinstall, relint, retest, runStepAsync, runSteps, runStepsAsync, runXy, runXyWithWarning, safeExit, safeExitAsync, sonar, statics, test, tryReadFileSync, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, yarn3Only, yarnWorkspace, yarnWorkspaces };
352
+ export { BuildParams, CROSS_PLATFORM_NEWLINE, CleanPackageParams, CleanParams, CompileParams$1 as CompileParams, CopyAssetsParams, DepsPackageParams, DepsParams, DuplicateDetector, GenDocsPackageParams, GenDocsParams, INIT_CWD, LintPackageParams, LintParams, PackageCompileMode, PackageCompileParams, PackageCompileRollupParams, PackageCompileTscParams, PackageCompileTsupParams, PackageCopyAssetsParams, PackageJsonEx, PackagePublintParams, PublintPackageParams, PublintParams, ReadFileSyncOptions, RebuildParams, RecompilePackageParams, RecompileParams, ScriptStep, WINDOWS_NEWLINE_REGEX, Workspace, build, checkResult, clean, cleanAll, cleanDocs, cleanPackage, compile, compileAll, compilePackage, compileSubDir, copyAssets, createBuildConfig, cycle, dead, defaultBuildConfig, defaultReadFileSyncOptions, deploy, deployMajor, deployMinor, deployNext, deps, depsAll, depsPackage, detectDuplicateDependencies, dupdeps, empty, fix, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, gitignoreGen, gitlint, gitlintFix, isYarnVersionOrGreater, license, lint, lintAll, lintClean, lintPackage, lintProfile, loadConfig, loadPackageConfig, multiLineToJSONArray, notEmpty, npmignoreGen, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCompileRollup, packageCompileTsc, packageCompileTsup, packageCopyAssets, packageDeps, packageGenDocs, packagePublint, packageRecompile, parsedPackageJSON, processEx, publint, publintAll, publintPackage, readLines, readNonEmptyLines, rebuild, recompile, recompileAll, recompilePackage, reinstall, relint, retest, runStepAsync, runSteps, runStepsAsync, runXy, runXyWithWarning, safeExit, safeExitAsync, sonar, statics, test, tryReadFileSync, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, yarn3Only, yarnWorkspace, yarnWorkspaces };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { CompilerOptions } from 'typescript';
2
+ import { Options } from 'tsup';
1
3
  import { PathLike, WriteFileOptions } from 'node:fs';
2
4
  import { SpawnSyncOptionsWithBufferEncoding } from 'child_process';
3
5
  import { PackageJson } from 'types-package-json';
@@ -26,7 +28,7 @@ declare const cleanAll: ({ verbose }: CleanParams) => number;
26
28
 
27
29
  declare const cleanDocs: () => number;
28
30
 
29
- interface CompileParams {
31
+ interface CompileParams$1 {
30
32
  incremental?: boolean;
31
33
  jobs?: number;
32
34
  pkg?: string;
@@ -34,15 +36,15 @@ interface CompileParams {
34
36
  target?: 'esm' | 'cjs';
35
37
  verbose?: boolean;
36
38
  }
37
- interface CompilePackageParams$1 {
39
+ interface CompilePackageParams {
38
40
  pkg: string;
39
41
  publint?: boolean;
40
42
  target?: 'esm' | 'cjs';
41
43
  verbose?: boolean;
42
44
  }
43
- declare const compile: ({ verbose, target, pkg, incremental, publint }: CompileParams) => number;
44
- declare const compilePackage: ({ verbose, target, pkg, publint }: CompilePackageParams$1) => number;
45
- declare const compileAll: ({ jobs, verbose, target, incremental }: CompileParams) => number;
45
+ declare const compile: ({ verbose, target, pkg, incremental, publint }: CompileParams$1) => number;
46
+ declare const compilePackage: ({ verbose, target, pkg, publint }: CompilePackageParams) => number;
47
+ declare const compileAll: ({ jobs, verbose, target, incremental }: CompileParams$1) => number;
46
48
 
47
49
  interface CopyAssetsParams {
48
50
  pkg?: string;
@@ -121,11 +123,47 @@ declare const packageCleanOutputs: () => number;
121
123
 
122
124
  declare const packageCleanTypescript: () => number;
123
125
 
124
- interface CompilePackageParams {
125
- publint?: boolean;
126
+ interface RootParams {
126
127
  verbose?: boolean;
127
128
  }
128
- declare const packageCompile: ({ publint, verbose }?: CompilePackageParams) => Promise<number>;
129
+ interface CompileParams extends RootParams {
130
+ compile?: {
131
+ depth?: number;
132
+ publint?: boolean;
133
+ };
134
+ }
135
+
136
+ type PackageCompileMode = 'tsup' | 'tsc' | 'rollup';
137
+ type PackageCompileParams = CompileParams & {
138
+ compile?: {
139
+ modes?: PackageCompileMode[];
140
+ };
141
+ };
142
+ declare const packageCompile: (params?: PackageCompileParams) => Promise<number>;
143
+
144
+ type PackageCompileTscParams = Partial<CompileParams & {
145
+ compile?: {
146
+ tsc?: {
147
+ tsconfig?: string;
148
+ compilerOptions?: CompilerOptions;
149
+ };
150
+ };
151
+ }>;
152
+ declare const packageCompileTsc: (params?: PackageCompileTscParams) => Promise<number>;
153
+
154
+ type PackageCompileTsupParams = Partial<CompileParams & {
155
+ compile?: {
156
+ tsup?: {
157
+ options?: Options;
158
+ };
159
+ };
160
+ }>;
161
+ declare const packageCompileTsup: (params?: PackageCompileTsupParams) => Promise<number>;
162
+
163
+ interface PackageCompileRollupParams extends CompileParams {
164
+ }
165
+ declare const compileSubDir: (format: 'cjs' | 'esm', ext: string, subDir?: string, verbose?: boolean) => Promise<number>;
166
+ declare const packageCompileRollup: (params?: PackageCompileRollupParams) => Promise<number>;
129
167
 
130
168
  interface PackageCopyAssetsParams {
131
169
  target?: 'esm' | 'cjs';
@@ -136,7 +174,10 @@ declare const packageDeps: () => Promise<number>;
136
174
 
137
175
  declare const packageGenDocs: () => Promise<number | undefined>;
138
176
 
139
- declare const packagePublint: () => Promise<number>;
177
+ interface PackagePublintParams {
178
+ verbose?: boolean;
179
+ }
180
+ declare const packagePublint: (params?: PackagePublintParams) => Promise<number>;
140
181
 
141
182
  declare const packageRecompile: () => Promise<number>;
142
183
 
@@ -279,6 +320,8 @@ declare const yarnWorkspaces: () => Workspace[];
279
320
 
280
321
  declare const INIT_CWD: () => string | undefined;
281
322
 
323
+ declare const loadConfig: <T extends object>(params?: T | undefined) => Promise<T>;
324
+
282
325
  type PackageJsonEx = PackageJson & {
283
326
  type: 'module' | 'commonjs';
284
327
  };
@@ -306,4 +349,4 @@ declare const xyLintCommands: (args: Argv) => Argv<{}>;
306
349
 
307
350
  declare const xyParseOptions: () => Argv;
308
351
 
309
- export { BuildParams, CROSS_PLATFORM_NEWLINE, CleanPackageParams, CleanParams, CompilePackageParams, CompileParams, CopyAssetsParams, DepsPackageParams, DepsParams, DuplicateDetector, GenDocsPackageParams, GenDocsParams, INIT_CWD, LintPackageParams, LintParams, PackageCopyAssetsParams, PackageJsonEx, PublintPackageParams, PublintParams, ReadFileSyncOptions, RebuildParams, RecompilePackageParams, RecompileParams, ScriptStep, WINDOWS_NEWLINE_REGEX, Workspace, build, checkResult, clean, cleanAll, cleanDocs, cleanPackage, compile, compileAll, compilePackage, copyAssets, createBuildConfig, cycle, dead, defaultBuildConfig, defaultReadFileSyncOptions, deploy, deployMajor, deployMinor, deployNext, deps, depsAll, depsPackage, detectDuplicateDependencies, dupdeps, empty, fix, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, gitignoreGen, gitlint, gitlintFix, isYarnVersionOrGreater, license, lint, lintAll, lintClean, lintPackage, lintProfile, loadPackageConfig, multiLineToJSONArray, notEmpty, npmignoreGen, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCopyAssets, packageDeps, packageGenDocs, packagePublint, packageRecompile, parsedPackageJSON, processEx, publint, publintAll, publintPackage, readLines, readNonEmptyLines, rebuild, recompile, recompileAll, recompilePackage, reinstall, relint, retest, runStepAsync, runSteps, runStepsAsync, runXy, runXyWithWarning, safeExit, safeExitAsync, sonar, statics, test, tryReadFileSync, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, yarn3Only, yarnWorkspace, yarnWorkspaces };
352
+ export { BuildParams, CROSS_PLATFORM_NEWLINE, CleanPackageParams, CleanParams, CompileParams$1 as CompileParams, CopyAssetsParams, DepsPackageParams, DepsParams, DuplicateDetector, GenDocsPackageParams, GenDocsParams, INIT_CWD, LintPackageParams, LintParams, PackageCompileMode, PackageCompileParams, PackageCompileRollupParams, PackageCompileTscParams, PackageCompileTsupParams, PackageCopyAssetsParams, PackageJsonEx, PackagePublintParams, PublintPackageParams, PublintParams, ReadFileSyncOptions, RebuildParams, RecompilePackageParams, RecompileParams, ScriptStep, WINDOWS_NEWLINE_REGEX, Workspace, build, checkResult, clean, cleanAll, cleanDocs, cleanPackage, compile, compileAll, compilePackage, compileSubDir, copyAssets, createBuildConfig, cycle, dead, defaultBuildConfig, defaultReadFileSyncOptions, deploy, deployMajor, deployMinor, deployNext, deps, depsAll, depsPackage, detectDuplicateDependencies, dupdeps, empty, fix, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, gitignoreGen, gitlint, gitlintFix, isYarnVersionOrGreater, license, lint, lintAll, lintClean, lintPackage, lintProfile, loadConfig, loadPackageConfig, multiLineToJSONArray, notEmpty, npmignoreGen, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCompileRollup, packageCompileTsc, packageCompileTsup, packageCopyAssets, packageDeps, packageGenDocs, packagePublint, packageRecompile, parsedPackageJSON, processEx, publint, publintAll, publintPackage, readLines, readNonEmptyLines, rebuild, recompile, recompileAll, recompilePackage, reinstall, relint, retest, runStepAsync, runSteps, runStepsAsync, runXy, runXyWithWarning, safeExit, safeExitAsync, sonar, statics, test, tryReadFileSync, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, yarn3Only, yarnWorkspace, yarnWorkspaces };
package/dist/lib/index.js CHANGED
@@ -33,6 +33,7 @@ __reExport(lib_exports, require("./string"), module.exports);
33
33
  __reExport(lib_exports, require("./withErrnoException"), module.exports);
34
34
  __reExport(lib_exports, require("./withError"), module.exports);
35
35
  __reExport(lib_exports, require("./yarn"), module.exports);
36
+ __reExport(lib_exports, require("./loadConfig"), module.exports);
36
37
  // Annotate the CommonJS export names for ESM import in node:
37
38
  0 && (module.exports = {
38
39
  ...require("./checkResult"),
@@ -52,6 +53,7 @@ __reExport(lib_exports, require("./yarn"), module.exports);
52
53
  ...require("./string"),
53
54
  ...require("./withErrnoException"),
54
55
  ...require("./withError"),
55
- ...require("./yarn")
56
+ ...require("./yarn"),
57
+ ...require("./loadConfig")
56
58
  });
57
59
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/index.ts"],"sourcesContent":["export * from './checkResult'\nexport * from './createBuildConfig'\nexport * from './defaultBuildConfig'\nexport * from './dependencies'\nexport * from './file'\nexport * from './generateIgnoreFiles'\nexport * from './jsonFormatters'\nexport * from './parsedPackageJSON'\nexport * from './processEx'\nexport * from './runSteps'\nexport * from './runStepsAsync'\nexport * from './runXy'\nexport * from './runXyWithWarning'\nexport * from './safeExit'\nexport * from './string'\nexport * from './withErrnoException'\nexport * from './withError'\nexport * from './yarn'\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;AACA,wBAAc,gCADd;AAEA,wBAAc,iCAFd;AAGA,wBAAc,2BAHd;AAIA,wBAAc,mBAJd;AAKA,wBAAc,kCALd;AAMA,wBAAc,6BANd;AAOA,wBAAc,gCAPd;AAQA,wBAAc,wBARd;AASA,wBAAc,uBATd;AAUA,wBAAc,4BAVd;AAWA,wBAAc,oBAXd;AAYA,wBAAc,+BAZd;AAaA,wBAAc,uBAbd;AAcA,wBAAc,qBAdd;AAeA,wBAAc,iCAfd;AAgBA,wBAAc,wBAhBd;AAiBA,wBAAc,mBAjBd;","names":[]}
1
+ {"version":3,"sources":["../../src/lib/index.ts"],"sourcesContent":["export * from './checkResult'\nexport * from './createBuildConfig'\nexport * from './defaultBuildConfig'\nexport * from './dependencies'\nexport * from './file'\nexport * from './generateIgnoreFiles'\nexport * from './jsonFormatters'\nexport * from './parsedPackageJSON'\nexport * from './processEx'\nexport * from './runSteps'\nexport * from './runStepsAsync'\nexport * from './runXy'\nexport * from './runXyWithWarning'\nexport * from './safeExit'\nexport * from './string'\nexport * from './withErrnoException'\nexport * from './withError'\nexport * from './yarn'\nexport * from './loadConfig'"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,0BAAd;AACA,wBAAc,gCADd;AAEA,wBAAc,iCAFd;AAGA,wBAAc,2BAHd;AAIA,wBAAc,mBAJd;AAKA,wBAAc,kCALd;AAMA,wBAAc,6BANd;AAOA,wBAAc,gCAPd;AAQA,wBAAc,wBARd;AASA,wBAAc,uBATd;AAUA,wBAAc,4BAVd;AAWA,wBAAc,oBAXd;AAYA,wBAAc,+BAZd;AAaA,wBAAc,uBAbd;AAcA,wBAAc,qBAdd;AAeA,wBAAc,iCAfd;AAgBA,wBAAc,wBAhBd;AAiBA,wBAAc,mBAjBd;AAkBA,wBAAc,yBAlBd;","names":[]}
@@ -16,4 +16,5 @@ export * from "./string";
16
16
  export * from "./withErrnoException";
17
17
  export * from "./withError";
18
18
  export * from "./yarn";
19
+ export * from "./loadConfig";
19
20
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/index.ts"],"sourcesContent":["export * from './checkResult'\nexport * from './createBuildConfig'\nexport * from './defaultBuildConfig'\nexport * from './dependencies'\nexport * from './file'\nexport * from './generateIgnoreFiles'\nexport * from './jsonFormatters'\nexport * from './parsedPackageJSON'\nexport * from './processEx'\nexport * from './runSteps'\nexport * from './runStepsAsync'\nexport * from './runXy'\nexport * from './runXyWithWarning'\nexport * from './safeExit'\nexport * from './string'\nexport * from './withErrnoException'\nexport * from './withError'\nexport * from './yarn'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/lib/index.ts"],"sourcesContent":["export * from './checkResult'\nexport * from './createBuildConfig'\nexport * from './defaultBuildConfig'\nexport * from './dependencies'\nexport * from './file'\nexport * from './generateIgnoreFiles'\nexport * from './jsonFormatters'\nexport * from './parsedPackageJSON'\nexport * from './processEx'\nexport * from './runSteps'\nexport * from './runStepsAsync'\nexport * from './runXy'\nexport * from './runXyWithWarning'\nexport * from './safeExit'\nexport * from './string'\nexport * from './withErrnoException'\nexport * from './withError'\nexport * from './yarn'\nexport * from './loadConfig'"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var loadConfig_exports = {};
30
+ __export(loadConfig_exports, {
31
+ loadConfig: () => loadConfig
32
+ });
33
+ module.exports = __toCommonJS(loadConfig_exports);
34
+ var import_chalk = __toESM(require("chalk"));
35
+ var import_merge = __toESM(require("lodash/merge"));
36
+ var import_cosmiconfig = require("cosmiconfig");
37
+ let config;
38
+ const loadConfig = async (params) => {
39
+ if (config) {
40
+ return (0, import_merge.default)({}, config, params);
41
+ }
42
+ const cosmicConfigResult = await (0, import_cosmiconfig.cosmiconfig)("xy").search();
43
+ config = cosmicConfigResult?.config;
44
+ const configFilePath = cosmicConfigResult?.filepath;
45
+ if (configFilePath) {
46
+ console.log(import_chalk.default.gray(`Loading config from ${configFilePath}`));
47
+ }
48
+ return (0, import_merge.default)({}, config, params);
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ loadConfig
53
+ });
54
+ //# sourceMappingURL=loadConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport merge from 'lodash/merge'\nimport { cosmiconfig } from 'cosmiconfig'\n\nlet config: Record<string, any>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\n }\n\n const cosmicConfigResult = await cosmiconfig('xy').search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return merge({}, config, params)\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,mBAAkB;AAClB,yBAA4B;AAE5B,IAAI;AAEG,MAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,QAAQ;AACV,eAAO,aAAAA,SAAM,CAAC,GAAG,QAAQ,MAAM;AAAA,EACjC;AAEA,QAAM,qBAAqB,UAAM,gCAAY,IAAI,EAAE,OAAO;AAC1D,WAAS,oBAAoB;AAC7B,QAAM,iBAAiB,oBAAoB;AAC3C,MAAI,gBAAgB;AAClB,YAAQ,IAAI,aAAAC,QAAM,KAAK,uBAAuB,cAAc,EAAE,CAAC;AAAA,EACjE;AACA,aAAO,aAAAD,SAAM,CAAC,GAAG,QAAQ,MAAM;AACjC;","names":["merge","chalk"]}
@@ -0,0 +1,20 @@
1
+ import chalk from "chalk";
2
+ import merge from "lodash/merge";
3
+ import { cosmiconfig } from "cosmiconfig";
4
+ let config;
5
+ const loadConfig = async (params) => {
6
+ if (config) {
7
+ return merge({}, config, params);
8
+ }
9
+ const cosmicConfigResult = await cosmiconfig("xy").search();
10
+ config = cosmicConfigResult?.config;
11
+ const configFilePath = cosmicConfigResult?.filepath;
12
+ if (configFilePath) {
13
+ console.log(chalk.gray(`Loading config from ${configFilePath}`));
14
+ }
15
+ return merge({}, config, params);
16
+ };
17
+ export {
18
+ loadConfig
19
+ };
20
+ //# sourceMappingURL=loadConfig.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport merge from 'lodash/merge'\nimport { cosmiconfig } from 'cosmiconfig'\n\nlet config: Record<string, any>\n\nexport const loadConfig = async <T extends object>(params?: T): Promise<T> => {\n if (config) {\n return merge({}, config, params)\n }\n\n const cosmicConfigResult = await cosmiconfig('xy').search()\n config = cosmicConfigResult?.config\n const configFilePath = cosmicConfigResult?.filepath\n if (configFilePath) {\n console.log(chalk.gray(`Loading config from ${configFilePath}`))\n }\n return merge({}, config, params)\n}"],"mappings":"AAAA,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAE5B,IAAI;AAEG,MAAM,aAAa,OAAyB,WAA2B;AAC5E,MAAI,QAAQ;AACV,WAAO,MAAM,CAAC,GAAG,QAAQ,MAAM;AAAA,EACjC;AAEA,QAAM,qBAAqB,MAAM,YAAY,IAAI,EAAE,OAAO;AAC1D,WAAS,oBAAoB;AAC7B,QAAM,iBAAiB,oBAAoB;AAC3C,MAAI,gBAAgB;AAClB,YAAQ,IAAI,MAAM,KAAK,uBAAuB,cAAc,EAAE,CAAC;AAAA,EACjE;AACA,SAAO,MAAM,CAAC,GAAG,QAAQ,MAAM;AACjC;","names":[]}
package/package.json CHANGED
@@ -60,12 +60,13 @@
60
60
  "@babel/core": "^7.22.19",
61
61
  "@babel/preset-env": "^7.22.15",
62
62
  "@rollup/plugin-commonjs": "^25.0.4",
63
+ "@rollup/plugin-json": "^6.0.0",
63
64
  "@rollup/plugin-typescript": "^11.1.3",
64
65
  "@types/node": "^20.6.0",
65
66
  "@types/yargs": "^17.0.24",
66
67
  "@typescript-eslint/eslint-plugin": "^6.7.0",
67
68
  "@typescript-eslint/parser": "^6.7.0",
68
- "@xylabs/tsconfig": "~3.0.10",
69
+ "@xylabs/tsconfig": "~3.0.12",
69
70
  "chalk": "^4.1.2",
70
71
  "cosmiconfig": "^8.3.6",
71
72
  "cpy": "^8.1.2",
@@ -75,7 +76,6 @@
75
76
  "eslint-plugin-prettier": "^5.0.0",
76
77
  "eslint-plugin-sonarjs": "^0.21.0",
77
78
  "jest": "^29.7.0",
78
- "jest-environment-jsdom": "^29.7.0",
79
79
  "jest-extended": "^4.0.1",
80
80
  "jest-mock-extended": "^3.0.5",
81
81
  "jest-sorted": "^1.0.14",
@@ -97,6 +97,7 @@
97
97
  "ts-jest": "^29.1.1",
98
98
  "ts-node": "^10.9.1",
99
99
  "ts-prune": "^0.10.3",
100
+ "tsc-prog": "^2.3.0",
100
101
  "tslib": "^2.6.2",
101
102
  "tsup": "^7.2.0",
102
103
  "typedoc": "^0.24.8",
@@ -109,10 +110,9 @@
109
110
  "@types/license-checker": "^25.0.4",
110
111
  "@types/lodash": "^4.14.198",
111
112
  "@types/parse-git-config": "^3.0.1",
112
- "@xylabs/eslint-config": "^3.0.10",
113
- "@xylabs/tsconfig": "^3.0.10",
113
+ "@xylabs/eslint-config": "^3.0.12",
114
+ "@xylabs/tsconfig": "^3.0.12",
114
115
  "publint": "^0.2.2",
115
- "tsup": "^7.2.0",
116
116
  "typescript": "^5.2.2"
117
117
  },
118
118
  "peerDependencies": {
@@ -168,5 +168,5 @@
168
168
  "package-clean": "echo Not cleaning..."
169
169
  },
170
170
  "sideEffects": false,
171
- "version": "3.0.10"
171
+ "version": "3.0.12"
172
172
  }
@@ -0,0 +1,10 @@
1
+ export interface RootParams {
2
+ verbose?: boolean
3
+ }
4
+
5
+ export interface CompileParams extends RootParams {
6
+ compile?: {
7
+ depth?: number
8
+ publint?: boolean
9
+ }
10
+ }
@@ -0,0 +1,59 @@
1
+ import { packageCompileTsup } from './tsup'
2
+ import { CompileParams } from './CompileParams'
3
+ import { packageCompileTsc } from './tsc'
4
+ import { packageCompileRollup } from './rollup'
5
+ import { packagePublint } from '../publint'
6
+ import { loadConfig } from '../../../lib'
7
+ import merge from 'lodash/merge'
8
+ import chalk from 'chalk'
9
+
10
+ export type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'
11
+
12
+ export type PackageCompileParams = CompileParams & {
13
+ compile?: {
14
+ modes?: PackageCompileMode[]
15
+ }
16
+ }
17
+
18
+ export const packageCompile = async (params?: PackageCompileParams): Promise<number> => {
19
+ const pkg = process.env.INIT_CWD
20
+ console.log(chalk.green(`Compiling ${pkg}`))
21
+ const config = await loadConfig(params)
22
+
23
+ const modes = config.compile?.modes ?? ['tsup']
24
+ let modeIndex = 0
25
+ while (modeIndex < modes.length) {
26
+ const mode = modes[modeIndex]
27
+ switch (mode) {
28
+ case 'rollup': {
29
+ const result = packageCompileRollup(merge({}, params, {compile: {
30
+ publint: false
31
+ }}))
32
+ if (result) {
33
+ return result
34
+ }
35
+ break
36
+ }
37
+ case 'tsc': {
38
+ const result = packageCompileTsc(merge({}, params, {compile: {
39
+ publint: false
40
+ }}))
41
+ if (result) {
42
+ return result
43
+ }
44
+ break
45
+ }
46
+ case 'tsup': {
47
+ const result = packageCompileTsup(merge({}, params, {compile: {
48
+ publint: false
49
+ }}))
50
+ if (result) {
51
+ return result
52
+ }
53
+ break
54
+ }
55
+ }
56
+ modeIndex++
57
+ }
58
+ return (config.compile?.publint ? await packagePublint(params) : 0)
59
+ }
@@ -0,0 +1,27 @@
1
+ import { copyFile, readdir } from 'fs/promises'
2
+
3
+
4
+ const getDistTypeFiles = async () => {
5
+ return (await readdir('dist', { recursive: true })).filter((file) => file.endsWith('d.ts')).map((file) => `dist/${file}`)
6
+ }
7
+
8
+ const getDistTypeMapFiles = async () => {
9
+ return (await readdir('dist', { recursive: true })).filter((file) => file.endsWith('d.ts.map')).map((file) => `dist/${file}`)
10
+ }
11
+
12
+ export const copyTypeFiles = async () => {
13
+ //hybrid packages want two copies of the types
14
+ const distTypeFiles = await getDistTypeFiles()
15
+ await Promise.all(
16
+ distTypeFiles.map(async (file) => {
17
+ await copyFile(file, file.replace('d.ts', 'd.mts'))
18
+ }),
19
+ )
20
+
21
+ const distTypeMapFiles = await getDistTypeMapFiles()
22
+ await Promise.all(
23
+ distTypeMapFiles.map(async (file) => {
24
+ await copyFile(file, file.replace('d.ts.map', 'd.mts.map'))
25
+ }),
26
+ )
27
+ }
@@ -0,0 +1,4 @@
1
+ export * from './compile'
2
+ export * from './tsc'
3
+ export * from './tsup'
4
+ export * from './rollup'
@@ -0,0 +1,33 @@
1
+ import { readdir } from 'fs/promises'
2
+
3
+ export const getInputs = async (subDir?: string) => {
4
+ return (await readdir(subDir ? `src/${subDir}` : 'src', { recursive: false }))
5
+ .filter((file) => (file.endsWith('.ts') || file.endsWith('.tsx')) && !file.endsWith('d.ts') && !file.endsWith('spec.ts'))
6
+ .map((file) => (subDir ? `${subDir}/${file}` : file))
7
+ }
8
+
9
+ export const getInputDirs = async (depth: number = 0) => {
10
+ if (depth === 0) {
11
+ return []
12
+ }
13
+ return [
14
+ '.',
15
+ ...(await readdir('src', { recursive: depth > 1, withFileTypes: true }))
16
+ .filter((file) => file.isDirectory())
17
+ .map((file) => {
18
+ const pathParts = file.path.split('/')
19
+ pathParts.shift()
20
+ if (pathParts.length) {
21
+ const root = pathParts.join('/')
22
+ return `${root}/${file.name}`
23
+ } else {
24
+ return file.name
25
+ }
26
+ }),
27
+ ]
28
+ }
29
+
30
+ export const getAllInputs = async (depth: number = 100) => {
31
+ const dirs = await getInputDirs(depth)
32
+ return (await Promise.all(dirs.map(async (dir) => await getInputs(dir)))).flat()
33
+ }