@xylabs/ts-scripts-yarn3 3.0.12 → 3.0.13
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/package/compile/CompileParams.js.map +1 -1
- package/dist/actions/package/compile/compile.js +27 -15
- package/dist/actions/package/compile/compile.js.map +1 -1
- package/dist/actions/package/compile/compile.mjs +27 -15
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.js.map +1 -1
- package/dist/actions/package/compile/copyTypeFiles.mjs.map +1 -1
- package/dist/actions/package/compile/index.js +3 -3
- package/dist/actions/package/compile/index.js.map +1 -1
- package/dist/actions/package/compile/index.mjs +1 -1
- package/dist/actions/package/compile/index.mjs.map +1 -1
- package/dist/actions/package/compile/inputs.js.map +1 -1
- package/dist/actions/package/compile/inputs.mjs.map +1 -1
- package/dist/actions/package/compile/rollup.js +4 -4
- package/dist/actions/package/compile/rollup.js.map +1 -1
- package/dist/actions/package/compile/rollup.mjs +4 -4
- package/dist/actions/package/compile/rollup.mjs.map +1 -1
- package/dist/actions/package/compile/tsc.js +16 -25
- package/dist/actions/package/compile/tsc.js.map +1 -1
- package/dist/actions/package/compile/tsc.mjs +24 -25
- package/dist/actions/package/compile/tsc.mjs.map +1 -1
- package/dist/actions/package/compile/tscTypes.js +5 -7
- package/dist/actions/package/compile/tscTypes.js.map +1 -1
- package/dist/actions/package/compile/tscTypes.mjs +5 -7
- package/dist/actions/package/compile/tscTypes.mjs.map +1 -1
- package/dist/actions/package/compile/tsup.js +5 -5
- package/dist/actions/package/compile/tsup.js.map +1 -1
- package/dist/actions/package/compile/tsup.mjs +5 -5
- package/dist/actions/package/compile/tsup.mjs.map +1 -1
- package/dist/actions/package/publint.js +1 -1
- package/dist/actions/package/publint.js.map +1 -1
- package/dist/actions/package/publint.mjs +1 -1
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/lib/index.js +3 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/loadConfig.js +1 -1
- package/dist/lib/loadConfig.js.map +1 -1
- package/dist/lib/loadConfig.mjs +1 -1
- package/dist/lib/loadConfig.mjs.map +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/CompileParams.ts +1 -1
- package/src/actions/package/compile/compile.ts +30 -16
- package/src/actions/package/compile/copyTypeFiles.ts +15 -16
- package/src/actions/package/compile/index.ts +1 -1
- package/src/actions/package/compile/inputs.ts +1 -1
- package/src/actions/package/compile/rollup.ts +14 -13
- package/src/actions/package/compile/tsc.ts +51 -46
- package/src/actions/package/compile/tscTypes.ts +7 -9
- package/src/actions/package/compile/tsup.ts +22 -17
- package/src/actions/package/publint.ts +1 -1
- package/src/lib/index.ts +1 -1
- package/src/lib/loadConfig.ts +4 -2
- package/tsconfig.build.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tsc.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsc.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\nimport {\n CompilerOptions,\n createProgram,\n Diagnostic,\n findConfigFile,\n flattenDiagnosticMessageText,\n getLineAndCharacterOfPosition,\n getPreEmitDiagnostics,\n readConfigFile,\n sys,\n} from 'typescript'\n\nimport { loadConfig } from '../../../lib'\nimport { CompileParams } from './CompileParams'\nimport { getAllInputs } from './inputs'\n\nexport type PackageCompileTscParams = Partial<\n CompileParams & {\n compile?: {\n tsc?: {\n compilerOptions?: CompilerOptions\n tsconfig?: string\n }\n }\n }\n>\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst getCompilerOptionsJSONFollowExtends = (filename: string): CompilerOptions => {\n let opts = {}\n const config = readConfigFile(filename, sys.readFile).config\n if (config.extends) {\n const requirePath = require.resolve(config.extends)\n opts = getCompilerOptionsJSONFollowExtends(requirePath)\n }\n if (config?.error) {\n throw Error(`getCompilerOptionsJSONFollowExtends failed ${JSON.stringify(config?.error?.messageText, null, 2)}`)\n }\n\n return { ...opts, ...config.compilerOptions }\n}\n\nconst getCompilerOptions = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json'): CompilerOptions => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n const configFileCompilerOptions = configFileName ? getCompilerOptionsJSONFollowExtends(configFileName) : undefined\n\n return merge({}, configFileCompilerOptions, options)\n}\n\nconst getConfigFile = (options?: CompilerOptions, tsconfig: string = 'tsconfig.json') => {\n const configFileName = findConfigFile('./', sys.fileExists, tsconfig)\n return { ...(configFileName ? readConfigFile(configFileName, sys.readFile).config : {}), compilerOptions: getCompilerOptions(options) }\n}\n\nconst compile = (fileNames: string[], options: CompilerOptions) => {\n console.log(chalk.blue('compile'))\n console.log(chalk.magenta(`options: ${JSON.stringify(options, null, 2)}`))\n const program = createProgram(fileNames, options)\n console.log(chalk.blue('createProgram'))\n const emitResult = program.emit()\n console.log(chalk.blue('emit'))\n\n const allDiagnostics: Diagnostic[] = getPreEmitDiagnostics(program).concat(emitResult.diagnostics)\n\n const errorDiagnostics = allDiagnostics.filter((diagnostic) => diagnostic.category === 1)\n\n allDiagnostics.forEach((diagnostic) => {\n if (diagnostic.file) {\n const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start!)\n const message = flattenDiagnosticMessageText(diagnostic.messageText, '\\n')\n console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`)\n } else {\n console.log(flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n }\n })\n\n if (errorDiagnostics.length) {\n console.log(chalk.red(`Errors: ${errorDiagnostics.length}`))\n process.exit(errorDiagnostics.length)\n }\n\n return errorDiagnostics.length\n}\n\nexport const packageCompileTsc = async (params?: PackageCompileTscParams): Promise<number> => {\n const defaultCompilerOptions: CompilerOptions = {\n declaration: true,\n declarationMap: true,\n outDir: 'dist',\n rootDir: 'src',\n sourceMap: true,\n }\n const compilerOptions = merge({}, defaultCompilerOptions, params?.compile?.tsc?.compilerOptions)\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log('Compiling with TSC')\n }\n\n const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`)\n const configFile = getConfigFile(compilerOptions)\n return compile(fileNames, configFile.compilerOptions)\n}\n"],"mappings":"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","names":[]}
|
|
@@ -21,30 +21,28 @@ __export(tscTypes_exports, {
|
|
|
21
21
|
packageCompileTscTypes: () => packageCompileTscTypes
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(tscTypes_exports);
|
|
24
|
+
var import_process = require("process");
|
|
24
25
|
var import_tsc_prog = require("tsc-prog");
|
|
25
26
|
var import_lib = require("../../../lib");
|
|
26
|
-
var import_inputs = require("./inputs");
|
|
27
|
-
var import_process = require("process");
|
|
28
27
|
const packageCompileTscTypes = async (params) => {
|
|
29
28
|
const pkg = process.env.INIT_CWD;
|
|
30
29
|
const buildOptions = {
|
|
31
30
|
basePath: pkg ?? (0, import_process.cwd)(),
|
|
32
31
|
compilerOptions: {
|
|
33
|
-
sourceMap: true,
|
|
34
32
|
declaration: true,
|
|
35
33
|
declarationMap: true,
|
|
36
34
|
emitDeclarationOnly: true,
|
|
37
35
|
esModuleInterop: true,
|
|
38
|
-
outDir: "dist"
|
|
36
|
+
outDir: "dist",
|
|
37
|
+
sourceMap: true
|
|
39
38
|
},
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
exclude: ["dist", "docs"],
|
|
40
|
+
include: ["src"]
|
|
42
41
|
};
|
|
43
42
|
const config = await (0, import_lib.loadConfig)(params);
|
|
44
43
|
if (config.verbose) {
|
|
45
44
|
console.log(`Compiling types with TSC [${pkg}]`);
|
|
46
45
|
}
|
|
47
|
-
const fileNames = (await (0, import_inputs.getAllInputs)(config.compile?.depth)).map((fileName) => `src/${fileName}`);
|
|
48
46
|
(0, import_tsc_prog.build)(buildOptions);
|
|
49
47
|
return 0;
|
|
50
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { build, BuildOptions } from 'tsc-prog'\n\nimport { loadConfig } from '../../../lib'\nimport { CompileParams } from './CompileParams'\n\nexport const packageCompileTscTypes = async (params?: CompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const buildOptions: BuildOptions = {\n basePath: pkg ?? cwd(),\n compilerOptions: {\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n sourceMap: true,\n },\n exclude: ['dist', 'docs'],\n include: ['src'],\n }\n\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n build(buildOptions)\n return 0\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,sBAAoC;AAEpC,iBAA2B;AAGpB,MAAM,yBAAyB,OAAO,WAA4C;AACvF,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,eAA6B;AAAA,IACjC,UAAU,WAAO,oBAAI;AAAA,IACrB,iBAAiB;AAAA,MACf,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,SAAS,CAAC,QAAQ,MAAM;AAAA,IACxB,SAAS,CAAC,KAAK;AAAA,EACjB;AAEA,QAAM,SAAS,UAAM,uBAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,6BAAM,YAAY;AAClB,SAAO;AACT;","names":[]}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
+
import { cwd } from "process";
|
|
1
2
|
import { build } from "tsc-prog";
|
|
2
3
|
import { loadConfig } from "../../../lib";
|
|
3
|
-
import { getAllInputs } from "./inputs";
|
|
4
|
-
import { cwd } from "process";
|
|
5
4
|
const packageCompileTscTypes = async (params) => {
|
|
6
5
|
const pkg = process.env.INIT_CWD;
|
|
7
6
|
const buildOptions = {
|
|
8
7
|
basePath: pkg ?? cwd(),
|
|
9
8
|
compilerOptions: {
|
|
10
|
-
sourceMap: true,
|
|
11
9
|
declaration: true,
|
|
12
10
|
declarationMap: true,
|
|
13
11
|
emitDeclarationOnly: true,
|
|
14
12
|
esModuleInterop: true,
|
|
15
|
-
outDir: "dist"
|
|
13
|
+
outDir: "dist",
|
|
14
|
+
sourceMap: true
|
|
16
15
|
},
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
exclude: ["dist", "docs"],
|
|
17
|
+
include: ["src"]
|
|
19
18
|
};
|
|
20
19
|
const config = await loadConfig(params);
|
|
21
20
|
if (config.verbose) {
|
|
22
21
|
console.log(`Compiling types with TSC [${pkg}]`);
|
|
23
22
|
}
|
|
24
|
-
const fileNames = (await getAllInputs(config.compile?.depth)).map((fileName) => `src/${fileName}`);
|
|
25
23
|
build(buildOptions);
|
|
26
24
|
return 0;
|
|
27
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tscTypes.ts"],"sourcesContent":["import { cwd } from 'process'\nimport { build, BuildOptions } from 'tsc-prog'\n\nimport { loadConfig } from '../../../lib'\nimport { CompileParams } from './CompileParams'\n\nexport const packageCompileTscTypes = async (params?: CompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n const buildOptions: BuildOptions = {\n basePath: pkg ?? cwd(),\n compilerOptions: {\n declaration: true,\n declarationMap: true,\n emitDeclarationOnly: true,\n esModuleInterop: true,\n outDir: 'dist',\n sourceMap: true,\n },\n exclude: ['dist', 'docs'],\n include: ['src'],\n }\n\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log(`Compiling types with TSC [${pkg}]`)\n }\n\n build(buildOptions)\n return 0\n}\n"],"mappings":"AAAA,SAAS,WAAW;AACpB,SAAS,aAA2B;AAEpC,SAAS,kBAAkB;AAGpB,MAAM,yBAAyB,OAAO,WAA4C;AACvF,QAAM,MAAM,QAAQ,IAAI;AACxB,QAAM,eAA6B;AAAA,IACjC,UAAU,OAAO,IAAI;AAAA,IACrB,iBAAiB;AAAA,MACf,aAAa;AAAA,MACb,gBAAgB;AAAA,MAChB,qBAAqB;AAAA,MACrB,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IACA,SAAS,CAAC,QAAQ,MAAM;AAAA,IACxB,SAAS,CAAC,KAAK;AAAA,EACjB;AAEA,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,6BAA6B,GAAG,GAAG;AAAA,EACjD;AAEA,QAAM,YAAY;AAClB,SAAO;AACT;","names":[]}
|
|
@@ -22,9 +22,9 @@ __export(tsup_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(tsup_exports);
|
|
24
24
|
var import_tsup = require("tsup");
|
|
25
|
-
var import_inputs = require("./inputs");
|
|
26
|
-
var import_publint = require("../publint");
|
|
27
25
|
var import_lib = require("../../../lib");
|
|
26
|
+
var import_publint = require("../publint");
|
|
27
|
+
var import_inputs = require("./inputs");
|
|
28
28
|
var import_tscTypes = require("./tscTypes");
|
|
29
29
|
const compileSubDir = async (subDir, options, verbose) => {
|
|
30
30
|
const dir = subDir === "." ? void 0 : subDir;
|
|
@@ -35,8 +35,8 @@ const compileSubDir = async (subDir, options, verbose) => {
|
|
|
35
35
|
clean: true,
|
|
36
36
|
dts: {
|
|
37
37
|
entry: ["src/index.ts"],
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
only: false,
|
|
39
|
+
resolve: false
|
|
40
40
|
},
|
|
41
41
|
entry: subDir ? input.map((file) => `./src/${file}`) : ["./src/index.ts"],
|
|
42
42
|
format: ["cjs", "esm"],
|
|
@@ -58,7 +58,7 @@ const compileSubDir = async (subDir, options, verbose) => {
|
|
|
58
58
|
const packageCompileTsup = async (params) => {
|
|
59
59
|
const config = await (0, import_lib.loadConfig)(params);
|
|
60
60
|
if (config.verbose) {
|
|
61
|
-
console.log(
|
|
61
|
+
console.log("Compiling with TSUP");
|
|
62
62
|
}
|
|
63
63
|
const inputDirs = await (0, import_inputs.getInputDirs)(config.compile?.depth);
|
|
64
64
|
const result = (await Promise.all(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileSubDir = async (subDir?: string, options?: Options, verbose?: boolean) => {\n const dir = subDir === '.' ? undefined : subDir\n const input = await getInputs(dir)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: {\n entry: ['src/index.ts'],\n only: false,\n resolve: false,\n },\n entry: subDir ? input.map((file) => `./src/${file}`) : ['./src/index.ts'],\n format: ['cjs', 'esm'],\n outDir: 'dist',\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return await packageCompileTscTypes({ verbose })\n}\n\nexport const packageCompileTsup = async (params?: PackageCompileTsupParams) => {\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log('Compiling with TSUP')\n }\n const inputDirs = await getInputDirs(config.compile?.depth)\n\n const result = (\n await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose)\n }),\n )\n ).reduce((prev, result) => prev + result, 0)\n return result + (config.compile?.publint ? await packagePublint() : 0)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA6C;AAE7C,iBAA2B;AAC3B,qBAA+B;AAE/B,oBAAwC;AACxC,sBAAuC;AAYvC,MAAM,gBAAgB,OAAO,QAAiB,SAAmB,YAAsB;AACrF,QAAM,MAAM,WAAW,MAAM,SAAY;AACzC,QAAM,QAAQ,UAAM,yBAAU,GAAG;AACjC,QAAM,oBAAgB,0BAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,MACH,OAAO,CAAC,cAAc;AAAA,MACtB,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,OAAO,SAAS,MAAM,IAAI,CAAC,SAAS,SAAS,IAAI,EAAE,IAAI,CAAC,gBAAgB;AAAA,IACxE,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOA,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,CAAC,EACA,KAAK;AAAA,EACV,GACA,KAAK;AACP,QAAM,QAAQ,IAAI,YAAY,IAAI,CAACA,iBAAY,mBAAMA,QAAO,CAAC,CAAC;AAE9D,SAAO,UAAM,wCAAuB,EAAE,QAAQ,CAAC;AACjD;AAEO,MAAM,qBAAqB,OAAO,WAAsC;AAC7E,QAAM,SAAS,UAAM,uBAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,qBAAqB;AAAA,EACnC;AACA,QAAM,YAAY,UAAM,4BAAa,OAAO,SAAS,KAAK;AAE1D,QAAM,UACJ,MAAM,QAAQ;AAAA,IACZ,UAAU,IAAI,OAAO,aAAa;AAChC,aAAO,MAAM,cAAc,UAAU,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO;AAAA,IACpF,CAAC;AAAA,EACH,GACA,OAAO,CAAC,MAAMC,YAAW,OAAOA,SAAQ,CAAC;AAC3C,SAAO,UAAU,OAAO,SAAS,UAAU,UAAM,+BAAe,IAAI;AACtE;","names":["options","result"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { build, defineConfig } from "tsup";
|
|
2
|
-
import { getInputDirs, getInputs } from "./inputs";
|
|
3
|
-
import { packagePublint } from "../publint";
|
|
4
2
|
import { loadConfig } from "../../../lib";
|
|
3
|
+
import { packagePublint } from "../publint";
|
|
4
|
+
import { getInputDirs, getInputs } from "./inputs";
|
|
5
5
|
import { packageCompileTscTypes } from "./tscTypes";
|
|
6
6
|
const compileSubDir = async (subDir, options, verbose) => {
|
|
7
7
|
const dir = subDir === "." ? void 0 : subDir;
|
|
@@ -12,8 +12,8 @@ const compileSubDir = async (subDir, options, verbose) => {
|
|
|
12
12
|
clean: true,
|
|
13
13
|
dts: {
|
|
14
14
|
entry: ["src/index.ts"],
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
only: false,
|
|
16
|
+
resolve: false
|
|
17
17
|
},
|
|
18
18
|
entry: subDir ? input.map((file) => `./src/${file}`) : ["./src/index.ts"],
|
|
19
19
|
format: ["cjs", "esm"],
|
|
@@ -35,7 +35,7 @@ const compileSubDir = async (subDir, options, verbose) => {
|
|
|
35
35
|
const packageCompileTsup = async (params) => {
|
|
36
36
|
const config = await loadConfig(params);
|
|
37
37
|
if (config.verbose) {
|
|
38
|
-
console.log(
|
|
38
|
+
console.log("Compiling with TSUP");
|
|
39
39
|
}
|
|
40
40
|
const inputDirs = await getInputDirs(config.compile?.depth);
|
|
41
41
|
const result = (await Promise.all(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/tsup.ts"],"sourcesContent":["import { build, defineConfig, Options } from 'tsup'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { getInputDirs, getInputs } from './inputs'\nimport { packageCompileTscTypes } from './tscTypes'\n\nexport type PackageCompileTsupParams = Partial<\n CompileParams & {\n compile?: {\n tsup?: {\n options?: Options\n }\n }\n }\n>\n\nconst compileSubDir = async (subDir?: string, options?: Options, verbose?: boolean) => {\n const dir = subDir === '.' ? undefined : subDir\n const input = await getInputs(dir)\n const optionsResult = defineConfig({\n bundle: true,\n cjsInterop: true,\n clean: true,\n dts: {\n entry: ['src/index.ts'],\n only: false,\n resolve: false,\n },\n entry: subDir ? input.map((file) => `./src/${file}`) : ['./src/index.ts'],\n format: ['cjs', 'esm'],\n outDir: 'dist',\n sourcemap: true,\n splitting: false,\n tsconfig: 'tsconfig.json',\n ...options,\n })\n const optionsList = (\n await Promise.all(\n (Array.isArray(optionsResult) ? optionsResult : [optionsResult])\n .map<Promise<Options[]>>(async (options) => {\n const result = typeof options === 'function' ? await options({}) : [options]\n return Array.isArray(result) ? result : [result]\n })\n .flat(),\n )\n ).flat()\n await Promise.all(optionsList.map((options) => build(options)))\n\n return await packageCompileTscTypes({ verbose })\n}\n\nexport const packageCompileTsup = async (params?: PackageCompileTsupParams) => {\n const config = await loadConfig(params)\n if (config.verbose) {\n console.log('Compiling with TSUP')\n }\n const inputDirs = await getInputDirs(config.compile?.depth)\n\n const result = (\n await Promise.all(\n inputDirs.map(async (inputDir) => {\n return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose)\n }),\n )\n ).reduce((prev, result) => prev + result, 0)\n return result + (config.compile?.publint ? await packagePublint() : 0)\n}\n"],"mappings":"AAAA,SAAS,OAAO,oBAA6B;AAE7C,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAE/B,SAAS,cAAc,iBAAiB;AACxC,SAAS,8BAA8B;AAYvC,MAAM,gBAAgB,OAAO,QAAiB,SAAmB,YAAsB;AACrF,QAAM,MAAM,WAAW,MAAM,SAAY;AACzC,QAAM,QAAQ,MAAM,UAAU,GAAG;AACjC,QAAM,gBAAgB,aAAa;AAAA,IACjC,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,KAAK;AAAA,MACH,OAAO,CAAC,cAAc;AAAA,MACtB,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IACA,OAAO,SAAS,MAAM,IAAI,CAAC,SAAS,SAAS,IAAI,EAAE,IAAI,CAAC,gBAAgB;AAAA,IACxE,QAAQ,CAAC,OAAO,KAAK;AAAA,IACrB,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL,CAAC;AACD,QAAM,eACJ,MAAM,QAAQ;AAAA,KACX,MAAM,QAAQ,aAAa,IAAI,gBAAgB,CAAC,aAAa,GAC3D,IAAwB,OAAOA,aAAY;AAC1C,YAAM,SAAS,OAAOA,aAAY,aAAa,MAAMA,SAAQ,CAAC,CAAC,IAAI,CAACA,QAAO;AAC3E,aAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAAA,IACjD,CAAC,EACA,KAAK;AAAA,EACV,GACA,KAAK;AACP,QAAM,QAAQ,IAAI,YAAY,IAAI,CAACA,aAAY,MAAMA,QAAO,CAAC,CAAC;AAE9D,SAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC;AACjD;AAEO,MAAM,qBAAqB,OAAO,WAAsC;AAC7E,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,qBAAqB;AAAA,EACnC;AACA,QAAM,YAAY,MAAM,aAAa,OAAO,SAAS,KAAK;AAE1D,QAAM,UACJ,MAAM,QAAQ;AAAA,IACZ,UAAU,IAAI,OAAO,aAAa;AAChC,aAAO,MAAM,cAAc,UAAU,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO;AAAA,IACpF,CAAC;AAAA,EACH,GACA,OAAO,CAAC,MAAMC,YAAW,OAAOA,SAAQ,CAAC;AAC3C,SAAO,UAAU,OAAO,SAAS,UAAU,MAAM,eAAe,IAAI;AACtE;","names":["options","result"]}
|
|
@@ -33,7 +33,7 @@ __export(publint_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(publint_exports);
|
|
34
34
|
var import_chalk = __toESM(require("chalk"));
|
|
35
35
|
var import_fs = require("fs");
|
|
36
|
-
const packagePublint = async (
|
|
36
|
+
const packagePublint = async (_params) => {
|
|
37
37
|
const pkgDir = process.env.INIT_CWD;
|
|
38
38
|
const pkg = JSON.parse(await import_fs.promises.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
39
39
|
const { publint } = await import("publint");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (_params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n messages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(formatMessage(message, pkg)))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n return messages.length\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,gBAA+B;AAOxB,MAAM,iBAAiB,OAAO,YAAmC;AACtE,QAAM,SAAS,QAAQ,IAAI;AAE3B,QAAM,MAAM,KAAK,MAAM,MAAM,UAAAA,SAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AAE1E,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,SAAS;AAE1C,QAAM,EAAE,SAAS,IAAI,MAAM,QAAQ;AAAA,IACjC,OAAO;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,eAAe;AAEtD,WAAS,QAAQ,CAAC,YAAqB;AACrC,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AACH,gBAAQ,MAAM,aAAAC,QAAM,IAAI,cAAc,SAAS,GAAG,CAAC,CAAC;AACpD;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,aAAAA,QAAM,OAAO,cAAc,SAAS,GAAG,CAAC,CAAC;AACtD;AAAA,MACF;AACE,gBAAQ,KAAK,aAAAA,QAAM,MAAM,cAAc,SAAS,GAAG,CAAC,CAAC;AACrD;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO,SAAS;AAClB;","names":["fs","chalk"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { promises as fs } from "fs";
|
|
3
|
-
const packagePublint = async (
|
|
3
|
+
const packagePublint = async (_params) => {
|
|
4
4
|
const pkgDir = process.env.INIT_CWD;
|
|
5
5
|
const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
6
6
|
const { publint } = await import("publint");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/package/publint.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { promises as fs } from 'fs'\nimport { Message } from 'publint'\n\nexport interface PackagePublintParams {\n verbose?: boolean\n}\n\nexport const packagePublint = async (_params?: PackagePublintParams) => {\n const pkgDir = process.env.INIT_CWD\n\n const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))\n\n const { publint } = await import('publint')\n\n const { messages } = await publint({\n level: 'suggestion',\n pkgDir,\n strict: true,\n })\n\n // eslint-disable-next-line import/no-internal-modules\n const { formatMessage } = await import('publint/utils')\n\n messages.forEach((message: Message) => {\n switch (message.type) {\n case 'error':\n console.error(chalk.red(formatMessage(message, pkg)))\n break\n case 'warning':\n console.warn(chalk.yellow(formatMessage(message, pkg)))\n break\n default:\n console.info(chalk.white(formatMessage(message, pkg)))\n break\n }\n })\n\n return messages.length\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,YAAY,UAAU;AAOxB,MAAM,iBAAiB,OAAO,YAAmC;AACtE,QAAM,SAAS,QAAQ,IAAI;AAE3B,QAAM,MAAM,KAAK,MAAM,MAAM,GAAG,SAAS,GAAG,MAAM,iBAAiB,MAAM,CAAC;AAE1E,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,SAAS;AAE1C,QAAM,EAAE,SAAS,IAAI,MAAM,QAAQ;AAAA,IACjC,OAAO;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAGD,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,eAAe;AAEtD,WAAS,QAAQ,CAAC,YAAqB;AACrC,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AACH,gBAAQ,MAAM,MAAM,IAAI,cAAc,SAAS,GAAG,CAAC,CAAC;AACpD;AAAA,MACF,KAAK;AACH,gBAAQ,KAAK,MAAM,OAAO,cAAc,SAAS,GAAG,CAAC,CAAC;AACtD;AAAA,MACF;AACE,gBAAQ,KAAK,MAAM,MAAM,cAAc,SAAS,GAAG,CAAC,CAAC;AACrD;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO,SAAS;AAClB;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -141,11 +141,16 @@ type PackageCompileParams = CompileParams & {
|
|
|
141
141
|
};
|
|
142
142
|
declare const packageCompile: (params?: PackageCompileParams) => Promise<number>;
|
|
143
143
|
|
|
144
|
+
interface PackageCompileRollupParams extends CompileParams {
|
|
145
|
+
}
|
|
146
|
+
declare const compileSubDir: (format: 'cjs' | 'esm', ext: string, subDir?: string, _verbose?: boolean) => Promise<number>;
|
|
147
|
+
declare const packageCompileRollup: (params?: PackageCompileRollupParams) => Promise<number>;
|
|
148
|
+
|
|
144
149
|
type PackageCompileTscParams = Partial<CompileParams & {
|
|
145
150
|
compile?: {
|
|
146
151
|
tsc?: {
|
|
147
|
-
tsconfig?: string;
|
|
148
152
|
compilerOptions?: CompilerOptions;
|
|
153
|
+
tsconfig?: string;
|
|
149
154
|
};
|
|
150
155
|
};
|
|
151
156
|
}>;
|
|
@@ -160,11 +165,6 @@ type PackageCompileTsupParams = Partial<CompileParams & {
|
|
|
160
165
|
}>;
|
|
161
166
|
declare const packageCompileTsup: (params?: PackageCompileTsupParams) => Promise<number>;
|
|
162
167
|
|
|
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>;
|
|
167
|
-
|
|
168
168
|
interface PackageCopyAssetsParams {
|
|
169
169
|
target?: 'esm' | 'cjs';
|
|
170
170
|
}
|
|
@@ -177,7 +177,7 @@ declare const packageGenDocs: () => Promise<number | undefined>;
|
|
|
177
177
|
interface PackagePublintParams {
|
|
178
178
|
verbose?: boolean;
|
|
179
179
|
}
|
|
180
|
-
declare const packagePublint: (
|
|
180
|
+
declare const packagePublint: (_params?: PackagePublintParams) => Promise<number>;
|
|
181
181
|
|
|
182
182
|
declare const packageRecompile: () => Promise<number>;
|
|
183
183
|
|
|
@@ -280,6 +280,8 @@ declare const generateIgnoreFiles: (filename: string, pkg?: string) => 1 | 0;
|
|
|
280
280
|
|
|
281
281
|
declare const multiLineToJSONArray: (output: string) => any;
|
|
282
282
|
|
|
283
|
+
declare const loadConfig: <T extends object>(params?: T | undefined) => Promise<T>;
|
|
284
|
+
|
|
283
285
|
declare const parsedPackageJSON: (path?: string) => any;
|
|
284
286
|
|
|
285
287
|
declare const processEx: (ex: any) => never;
|
|
@@ -320,8 +322,6 @@ declare const yarnWorkspaces: () => Workspace[];
|
|
|
320
322
|
|
|
321
323
|
declare const INIT_CWD: () => string | undefined;
|
|
322
324
|
|
|
323
|
-
declare const loadConfig: <T extends object>(params?: T | undefined) => Promise<T>;
|
|
324
|
-
|
|
325
325
|
type PackageJsonEx = PackageJson & {
|
|
326
326
|
type: 'module' | 'commonjs';
|
|
327
327
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -141,11 +141,16 @@ type PackageCompileParams = CompileParams & {
|
|
|
141
141
|
};
|
|
142
142
|
declare const packageCompile: (params?: PackageCompileParams) => Promise<number>;
|
|
143
143
|
|
|
144
|
+
interface PackageCompileRollupParams extends CompileParams {
|
|
145
|
+
}
|
|
146
|
+
declare const compileSubDir: (format: 'cjs' | 'esm', ext: string, subDir?: string, _verbose?: boolean) => Promise<number>;
|
|
147
|
+
declare const packageCompileRollup: (params?: PackageCompileRollupParams) => Promise<number>;
|
|
148
|
+
|
|
144
149
|
type PackageCompileTscParams = Partial<CompileParams & {
|
|
145
150
|
compile?: {
|
|
146
151
|
tsc?: {
|
|
147
|
-
tsconfig?: string;
|
|
148
152
|
compilerOptions?: CompilerOptions;
|
|
153
|
+
tsconfig?: string;
|
|
149
154
|
};
|
|
150
155
|
};
|
|
151
156
|
}>;
|
|
@@ -160,11 +165,6 @@ type PackageCompileTsupParams = Partial<CompileParams & {
|
|
|
160
165
|
}>;
|
|
161
166
|
declare const packageCompileTsup: (params?: PackageCompileTsupParams) => Promise<number>;
|
|
162
167
|
|
|
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>;
|
|
167
|
-
|
|
168
168
|
interface PackageCopyAssetsParams {
|
|
169
169
|
target?: 'esm' | 'cjs';
|
|
170
170
|
}
|
|
@@ -177,7 +177,7 @@ declare const packageGenDocs: () => Promise<number | undefined>;
|
|
|
177
177
|
interface PackagePublintParams {
|
|
178
178
|
verbose?: boolean;
|
|
179
179
|
}
|
|
180
|
-
declare const packagePublint: (
|
|
180
|
+
declare const packagePublint: (_params?: PackagePublintParams) => Promise<number>;
|
|
181
181
|
|
|
182
182
|
declare const packageRecompile: () => Promise<number>;
|
|
183
183
|
|
|
@@ -280,6 +280,8 @@ declare const generateIgnoreFiles: (filename: string, pkg?: string) => 1 | 0;
|
|
|
280
280
|
|
|
281
281
|
declare const multiLineToJSONArray: (output: string) => any;
|
|
282
282
|
|
|
283
|
+
declare const loadConfig: <T extends object>(params?: T | undefined) => Promise<T>;
|
|
284
|
+
|
|
283
285
|
declare const parsedPackageJSON: (path?: string) => any;
|
|
284
286
|
|
|
285
287
|
declare const processEx: (ex: any) => never;
|
|
@@ -320,8 +322,6 @@ declare const yarnWorkspaces: () => Workspace[];
|
|
|
320
322
|
|
|
321
323
|
declare const INIT_CWD: () => string | undefined;
|
|
322
324
|
|
|
323
|
-
declare const loadConfig: <T extends object>(params?: T | undefined) => Promise<T>;
|
|
324
|
-
|
|
325
325
|
type PackageJsonEx = PackageJson & {
|
|
326
326
|
type: 'module' | 'commonjs';
|
|
327
327
|
};
|
package/dist/lib/index.js
CHANGED
|
@@ -22,6 +22,7 @@ __reExport(lib_exports, require("./dependencies"), module.exports);
|
|
|
22
22
|
__reExport(lib_exports, require("./file"), module.exports);
|
|
23
23
|
__reExport(lib_exports, require("./generateIgnoreFiles"), module.exports);
|
|
24
24
|
__reExport(lib_exports, require("./jsonFormatters"), module.exports);
|
|
25
|
+
__reExport(lib_exports, require("./loadConfig"), module.exports);
|
|
25
26
|
__reExport(lib_exports, require("./parsedPackageJSON"), module.exports);
|
|
26
27
|
__reExport(lib_exports, require("./processEx"), module.exports);
|
|
27
28
|
__reExport(lib_exports, require("./runSteps"), module.exports);
|
|
@@ -33,7 +34,6 @@ __reExport(lib_exports, require("./string"), module.exports);
|
|
|
33
34
|
__reExport(lib_exports, require("./withErrnoException"), module.exports);
|
|
34
35
|
__reExport(lib_exports, require("./withError"), module.exports);
|
|
35
36
|
__reExport(lib_exports, require("./yarn"), module.exports);
|
|
36
|
-
__reExport(lib_exports, require("./loadConfig"), module.exports);
|
|
37
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
38
|
0 && (module.exports = {
|
|
39
39
|
...require("./checkResult"),
|
|
@@ -43,6 +43,7 @@ __reExport(lib_exports, require("./loadConfig"), module.exports);
|
|
|
43
43
|
...require("./file"),
|
|
44
44
|
...require("./generateIgnoreFiles"),
|
|
45
45
|
...require("./jsonFormatters"),
|
|
46
|
+
...require("./loadConfig"),
|
|
46
47
|
...require("./parsedPackageJSON"),
|
|
47
48
|
...require("./processEx"),
|
|
48
49
|
...require("./runSteps"),
|
|
@@ -53,7 +54,6 @@ __reExport(lib_exports, require("./loadConfig"), module.exports);
|
|
|
53
54
|
...require("./string"),
|
|
54
55
|
...require("./withErrnoException"),
|
|
55
56
|
...require("./withError"),
|
|
56
|
-
...require("./yarn")
|
|
57
|
-
...require("./loadConfig")
|
|
57
|
+
...require("./yarn")
|
|
58
58
|
});
|
|
59
59
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -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'\
|
|
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 './loadConfig'\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,yBAPd;AAQA,wBAAc,gCARd;AASA,wBAAc,wBATd;AAUA,wBAAc,uBAVd;AAWA,wBAAc,4BAXd;AAYA,wBAAc,oBAZd;AAaA,wBAAc,+BAbd;AAcA,wBAAc,uBAdd;AAeA,wBAAc,qBAfd;AAgBA,wBAAc,iCAhBd;AAiBA,wBAAc,wBAjBd;AAkBA,wBAAc,mBAlBd;","names":[]}
|
package/dist/lib/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./dependencies";
|
|
|
5
5
|
export * from "./file";
|
|
6
6
|
export * from "./generateIgnoreFiles";
|
|
7
7
|
export * from "./jsonFormatters";
|
|
8
|
+
export * from "./loadConfig";
|
|
8
9
|
export * from "./parsedPackageJSON";
|
|
9
10
|
export * from "./processEx";
|
|
10
11
|
export * from "./runSteps";
|
|
@@ -16,5 +17,4 @@ export * from "./string";
|
|
|
16
17
|
export * from "./withErrnoException";
|
|
17
18
|
export * from "./withError";
|
|
18
19
|
export * from "./yarn";
|
|
19
|
-
export * from "./loadConfig";
|
|
20
20
|
//# sourceMappingURL=index.mjs.map
|
package/dist/lib/index.mjs.map
CHANGED
|
@@ -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'\
|
|
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 './loadConfig'\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;AACd,cAAc;","names":[]}
|
package/dist/lib/loadConfig.js
CHANGED
|
@@ -32,8 +32,8 @@ __export(loadConfig_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(loadConfig_exports);
|
|
34
34
|
var import_chalk = __toESM(require("chalk"));
|
|
35
|
-
var import_merge = __toESM(require("lodash/merge"));
|
|
36
35
|
var import_cosmiconfig = require("cosmiconfig");
|
|
36
|
+
var import_merge = __toESM(require("lodash/merge"));
|
|
37
37
|
let config;
|
|
38
38
|
const loadConfig = async (params) => {
|
|
39
39
|
if (config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\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}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,yBAA4B;AAE5B,mBAAkB;AAGlB,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"]}
|
package/dist/lib/loadConfig.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/lib/loadConfig.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { cosmiconfig } from 'cosmiconfig'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\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}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAE5B,OAAO,WAAW;AAGlB,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
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@types/yargs": "^17.0.24",
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
68
68
|
"@typescript-eslint/parser": "^6.7.0",
|
|
69
|
-
"@xylabs/tsconfig": "~3.0.
|
|
69
|
+
"@xylabs/tsconfig": "~3.0.13",
|
|
70
70
|
"chalk": "^4.1.2",
|
|
71
71
|
"cosmiconfig": "^8.3.6",
|
|
72
72
|
"cpy": "^8.1.2",
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"@types/license-checker": "^25.0.4",
|
|
111
111
|
"@types/lodash": "^4.14.198",
|
|
112
112
|
"@types/parse-git-config": "^3.0.1",
|
|
113
|
-
"@xylabs/eslint-config": "^3.0.
|
|
114
|
-
"@xylabs/tsconfig": "^3.0.
|
|
113
|
+
"@xylabs/eslint-config": "^3.0.13",
|
|
114
|
+
"@xylabs/tsconfig": "^3.0.13",
|
|
115
115
|
"publint": "^0.2.2",
|
|
116
116
|
"typescript": "^5.2.2"
|
|
117
117
|
},
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"package-clean": "echo Not cleaning..."
|
|
169
169
|
},
|
|
170
170
|
"sideEffects": false,
|
|
171
|
-
"version": "3.0.
|
|
171
|
+
"version": "3.0.13"
|
|
172
172
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
3
|
+
import merge from 'lodash/merge'
|
|
4
|
+
|
|
5
|
+
import { loadConfig } from '../../../lib'
|
|
6
|
+
import { packagePublint } from '../publint'
|
|
2
7
|
import { CompileParams } from './CompileParams'
|
|
3
|
-
import { packageCompileTsc } from './tsc'
|
|
4
8
|
import { packageCompileRollup } from './rollup'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import merge from 'lodash/merge'
|
|
8
|
-
import chalk from 'chalk'
|
|
9
|
+
import { packageCompileTsc } from './tsc'
|
|
10
|
+
import { packageCompileTsup } from './tsup'
|
|
9
11
|
|
|
10
12
|
export type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'
|
|
11
13
|
|
|
@@ -26,27 +28,39 @@ export const packageCompile = async (params?: PackageCompileParams): Promise<num
|
|
|
26
28
|
const mode = modes[modeIndex]
|
|
27
29
|
switch (mode) {
|
|
28
30
|
case 'rollup': {
|
|
29
|
-
const result = packageCompileRollup(
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const result = packageCompileRollup(
|
|
32
|
+
merge({}, params, {
|
|
33
|
+
compile: {
|
|
34
|
+
publint: false,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
)
|
|
32
38
|
if (result) {
|
|
33
39
|
return result
|
|
34
40
|
}
|
|
35
41
|
break
|
|
36
42
|
}
|
|
37
43
|
case 'tsc': {
|
|
38
|
-
const result = packageCompileTsc(
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
const result = packageCompileTsc(
|
|
45
|
+
merge({}, params, {
|
|
46
|
+
compile: {
|
|
47
|
+
publint: false,
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
)
|
|
41
51
|
if (result) {
|
|
42
52
|
return result
|
|
43
53
|
}
|
|
44
54
|
break
|
|
45
55
|
}
|
|
46
56
|
case 'tsup': {
|
|
47
|
-
const result = packageCompileTsup(
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
const result = packageCompileTsup(
|
|
58
|
+
merge({}, params, {
|
|
59
|
+
compile: {
|
|
60
|
+
publint: false,
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
)
|
|
50
64
|
if (result) {
|
|
51
65
|
return result
|
|
52
66
|
}
|
|
@@ -55,5 +69,5 @@ export const packageCompile = async (params?: PackageCompileParams): Promise<num
|
|
|
55
69
|
}
|
|
56
70
|
modeIndex++
|
|
57
71
|
}
|
|
58
|
-
return
|
|
72
|
+
return config.compile?.publint ? await packagePublint(params) : 0
|
|
59
73
|
}
|