@xylabs/ts-scripts-yarn3 3.0.16 → 3.0.18
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/compile.js +6 -13
- package/dist/actions/package/compile/compile.js.map +1 -1
- package/dist/actions/package/compile/compile.mjs +6 -13
- package/dist/actions/package/compile/compile.mjs.map +1 -1
- package/dist/actions/package/compile/tsup.js +3 -2
- package/dist/actions/package/compile/tsup.js.map +1 -1
- package/dist/actions/package/compile/tsup.mjs +3 -2
- package/dist/actions/package/compile/tsup.mjs.map +1 -1
- package/dist/actions/package/publint.js +7 -1
- package/dist/actions/package/publint.js.map +1 -1
- package/dist/actions/package/publint.mjs +7 -1
- package/dist/actions/package/publint.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +4 -4
- package/src/actions/package/compile/compile.ts +6 -13
- package/src/actions/package/compile/tsup.ts +3 -2
- package/src/actions/package/publint.ts +9 -1
|
@@ -42,54 +42,47 @@ const packageCompile = async (params) => {
|
|
|
42
42
|
const pkg = process.env.INIT_CWD;
|
|
43
43
|
console.log(import_chalk.default.green(`Compiling ${pkg}`));
|
|
44
44
|
const config = await (0, import_lib.loadConfig)(params);
|
|
45
|
+
const publint = config.compile?.publint ?? true;
|
|
45
46
|
const modes = config.compile?.modes ?? ["tsup"];
|
|
46
47
|
let modeIndex = 0;
|
|
48
|
+
let result = 0;
|
|
47
49
|
while (modeIndex < modes.length) {
|
|
48
50
|
const mode = modes[modeIndex];
|
|
49
51
|
switch (mode) {
|
|
50
52
|
case "rollup": {
|
|
51
|
-
|
|
53
|
+
result += await (0, import_rollup.packageCompileRollup)(
|
|
52
54
|
(0, import_merge.default)({}, params, {
|
|
53
55
|
compile: {
|
|
54
56
|
publint: false
|
|
55
57
|
}
|
|
56
58
|
})
|
|
57
59
|
);
|
|
58
|
-
if (result) {
|
|
59
|
-
return result;
|
|
60
|
-
}
|
|
61
60
|
break;
|
|
62
61
|
}
|
|
63
62
|
case "tsc": {
|
|
64
|
-
|
|
63
|
+
result += await (0, import_tsc.packageCompileTsc)(
|
|
65
64
|
(0, import_merge.default)({}, params, {
|
|
66
65
|
compile: {
|
|
67
66
|
publint: false
|
|
68
67
|
}
|
|
69
68
|
})
|
|
70
69
|
);
|
|
71
|
-
if (result) {
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
70
|
break;
|
|
75
71
|
}
|
|
76
72
|
case "tsup": {
|
|
77
|
-
|
|
73
|
+
result += await (0, import_tsup.packageCompileTsup)(
|
|
78
74
|
(0, import_merge.default)({}, params, {
|
|
79
75
|
compile: {
|
|
80
76
|
publint: false
|
|
81
77
|
}
|
|
82
78
|
})
|
|
83
79
|
);
|
|
84
|
-
if (result) {
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
80
|
break;
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
83
|
modeIndex++;
|
|
91
84
|
}
|
|
92
|
-
return
|
|
85
|
+
return result + (publint ? await (0, import_publint.packagePublint)(params) : 0);
|
|
93
86
|
};
|
|
94
87
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
88
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileRollup } from './rollup'\nimport { packageCompileTsc } from './tsc'\nimport { packageCompileTsup } from './tsup'\n\nexport type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'\n\nexport type PackageCompileParams = CompileParams & {\n compile?: {\n modes?: PackageCompileMode[]\n }\n}\n\nexport const packageCompile = async (params?: PackageCompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(params)\n\n const modes = config.compile?.modes ?? ['tsup']\n let modeIndex = 0\n while (modeIndex < modes.length) {\n const mode = modes[modeIndex]\n switch (mode) {\n case 'rollup': {\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileRollup } from './rollup'\nimport { packageCompileTsc } from './tsc'\nimport { packageCompileTsup } from './tsup'\n\nexport type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'\n\nexport type PackageCompileParams = CompileParams & {\n compile?: {\n modes?: PackageCompileMode[]\n }\n}\n\nexport const packageCompile = async (params?: PackageCompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(params)\n const publint = config.compile?.publint ?? true\n\n const modes = config.compile?.modes ?? ['tsup']\n let modeIndex = 0\n let result: number = 0\n while (modeIndex < modes.length) {\n const mode = modes[modeIndex]\n switch (mode) {\n case 'rollup': {\n result += await packageCompileRollup(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n case 'tsc': {\n result += await packageCompileTsc(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n case 'tsup': {\n result += await packageCompileTsup(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n }\n modeIndex++\n }\n return result + (publint ? await packagePublint(params) : 0)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,mBAAkB;AAElB,iBAA2B;AAC3B,qBAA+B;AAE/B,oBAAqC;AACrC,iBAAkC;AAClC,kBAAmC;AAU5B,MAAM,iBAAiB,OAAO,WAAmD;AACtF,QAAM,MAAM,QAAQ,IAAI;AACxB,UAAQ,IAAI,aAAAA,QAAM,MAAM,aAAa,GAAG,EAAE,CAAC;AAC3C,QAAM,SAAS,UAAM,uBAAW,MAAM;AACtC,QAAM,UAAU,OAAO,SAAS,WAAW;AAE3C,QAAM,QAAQ,OAAO,SAAS,SAAS,CAAC,MAAM;AAC9C,MAAI,YAAY;AAChB,MAAI,SAAiB;AACrB,SAAO,YAAY,MAAM,QAAQ;AAC/B,UAAM,OAAO,MAAM,SAAS;AAC5B,YAAQ,MAAM;AAAA,MACZ,KAAK,UAAU;AACb,kBAAU,UAAM;AAAA,cACd,aAAAC,SAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,MACA,KAAK,OAAO;AACV,kBAAU,UAAM;AAAA,cACd,aAAAA,SAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,MACA,KAAK,QAAQ;AACX,kBAAU,UAAM;AAAA,cACd,aAAAA,SAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,IACF;AACA;AAAA,EACF;AACA,SAAO,UAAU,UAAU,UAAM,+BAAe,MAAM,IAAI;AAC5D;","names":["chalk","merge"]}
|
|
@@ -9,54 +9,47 @@ const packageCompile = async (params) => {
|
|
|
9
9
|
const pkg = process.env.INIT_CWD;
|
|
10
10
|
console.log(chalk.green(`Compiling ${pkg}`));
|
|
11
11
|
const config = await loadConfig(params);
|
|
12
|
+
const publint = config.compile?.publint ?? true;
|
|
12
13
|
const modes = config.compile?.modes ?? ["tsup"];
|
|
13
14
|
let modeIndex = 0;
|
|
15
|
+
let result = 0;
|
|
14
16
|
while (modeIndex < modes.length) {
|
|
15
17
|
const mode = modes[modeIndex];
|
|
16
18
|
switch (mode) {
|
|
17
19
|
case "rollup": {
|
|
18
|
-
|
|
20
|
+
result += await packageCompileRollup(
|
|
19
21
|
merge({}, params, {
|
|
20
22
|
compile: {
|
|
21
23
|
publint: false
|
|
22
24
|
}
|
|
23
25
|
})
|
|
24
26
|
);
|
|
25
|
-
if (result) {
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
27
|
break;
|
|
29
28
|
}
|
|
30
29
|
case "tsc": {
|
|
31
|
-
|
|
30
|
+
result += await packageCompileTsc(
|
|
32
31
|
merge({}, params, {
|
|
33
32
|
compile: {
|
|
34
33
|
publint: false
|
|
35
34
|
}
|
|
36
35
|
})
|
|
37
36
|
);
|
|
38
|
-
if (result) {
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
37
|
break;
|
|
42
38
|
}
|
|
43
39
|
case "tsup": {
|
|
44
|
-
|
|
40
|
+
result += await packageCompileTsup(
|
|
45
41
|
merge({}, params, {
|
|
46
42
|
compile: {
|
|
47
43
|
publint: false
|
|
48
44
|
}
|
|
49
45
|
})
|
|
50
46
|
);
|
|
51
|
-
if (result) {
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
47
|
break;
|
|
55
48
|
}
|
|
56
49
|
}
|
|
57
50
|
modeIndex++;
|
|
58
51
|
}
|
|
59
|
-
return
|
|
52
|
+
return result + (publint ? await packagePublint(params) : 0);
|
|
60
53
|
};
|
|
61
54
|
export {
|
|
62
55
|
packageCompile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileRollup } from './rollup'\nimport { packageCompileTsc } from './tsc'\nimport { packageCompileTsup } from './tsup'\n\nexport type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'\n\nexport type PackageCompileParams = CompileParams & {\n compile?: {\n modes?: PackageCompileMode[]\n }\n}\n\nexport const packageCompile = async (params?: PackageCompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(params)\n\n const modes = config.compile?.modes ?? ['tsup']\n let modeIndex = 0\n while (modeIndex < modes.length) {\n const mode = modes[modeIndex]\n switch (mode) {\n case 'rollup': {\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/package/compile/compile.ts"],"sourcesContent":["import chalk from 'chalk'\n// eslint-disable-next-line import/no-internal-modules\nimport merge from 'lodash/merge'\n\nimport { loadConfig } from '../../../lib'\nimport { packagePublint } from '../publint'\nimport { CompileParams } from './CompileParams'\nimport { packageCompileRollup } from './rollup'\nimport { packageCompileTsc } from './tsc'\nimport { packageCompileTsup } from './tsup'\n\nexport type PackageCompileMode = 'tsup' | 'tsc' | 'rollup'\n\nexport type PackageCompileParams = CompileParams & {\n compile?: {\n modes?: PackageCompileMode[]\n }\n}\n\nexport const packageCompile = async (params?: PackageCompileParams): Promise<number> => {\n const pkg = process.env.INIT_CWD\n console.log(chalk.green(`Compiling ${pkg}`))\n const config = await loadConfig(params)\n const publint = config.compile?.publint ?? true\n\n const modes = config.compile?.modes ?? ['tsup']\n let modeIndex = 0\n let result: number = 0\n while (modeIndex < modes.length) {\n const mode = modes[modeIndex]\n switch (mode) {\n case 'rollup': {\n result += await packageCompileRollup(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n case 'tsc': {\n result += await packageCompileTsc(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n case 'tsup': {\n result += await packageCompileTsup(\n merge({}, params, {\n compile: {\n publint: false,\n },\n }),\n )\n break\n }\n }\n modeIndex++\n }\n return result + (publint ? await packagePublint(params) : 0)\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAElB,OAAO,WAAW;AAElB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAE/B,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AAU5B,MAAM,iBAAiB,OAAO,WAAmD;AACtF,QAAM,MAAM,QAAQ,IAAI;AACxB,UAAQ,IAAI,MAAM,MAAM,aAAa,GAAG,EAAE,CAAC;AAC3C,QAAM,SAAS,MAAM,WAAW,MAAM;AACtC,QAAM,UAAU,OAAO,SAAS,WAAW;AAE3C,QAAM,QAAQ,OAAO,SAAS,SAAS,CAAC,MAAM;AAC9C,MAAI,YAAY;AAChB,MAAI,SAAiB;AACrB,SAAO,YAAY,MAAM,QAAQ;AAC/B,UAAM,OAAO,MAAM,SAAS;AAC5B,YAAQ,MAAM;AAAA,MACZ,KAAK,UAAU;AACb,kBAAU,MAAM;AAAA,UACd,MAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,MACA,KAAK,OAAO;AACV,kBAAU,MAAM;AAAA,UACd,MAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,MACA,KAAK,QAAQ;AACX,kBAAU,MAAM;AAAA,UACd,MAAM,CAAC,GAAG,QAAQ;AAAA,YAChB,SAAS;AAAA,cACP,SAAS;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH;AACA;AAAA,MACF;AAAA,IACF;AACA;AAAA,EACF;AACA,SAAO,UAAU,UAAU,MAAM,eAAe,MAAM,IAAI;AAC5D;","names":[]}
|
|
@@ -57,6 +57,7 @@ const compileSubDir = async (subDir, options, verbose) => {
|
|
|
57
57
|
};
|
|
58
58
|
const packageCompileTsup = async (params) => {
|
|
59
59
|
const config = await (0, import_lib.loadConfig)(params);
|
|
60
|
+
const publint = config.compile?.publint ?? true;
|
|
60
61
|
if (config.verbose) {
|
|
61
62
|
console.log("Compiling with TSUP");
|
|
62
63
|
}
|
|
@@ -67,10 +68,10 @@ const packageCompileTsup = async (params) => {
|
|
|
67
68
|
return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose);
|
|
68
69
|
})
|
|
69
70
|
)).reduce((prev, result2) => prev + result2, 0);
|
|
70
|
-
return result + (
|
|
71
|
+
return result + (publint ? await (0, import_publint.packagePublint)() : 0);
|
|
71
72
|
} else {
|
|
72
73
|
const result = await compileSubDir(void 0, config.compile?.tsup?.options, config.verbose);
|
|
73
|
-
return result + (
|
|
74
|
+
return result + (publint ? await (0, import_publint.packagePublint)() : 0);
|
|
74
75
|
}
|
|
75
76
|
};
|
|
76
77
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
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 if (inputDirs.length) {\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 + (
|
|
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 const publint = config.compile?.publint ?? true\n if (config.verbose) {\n console.log('Compiling with TSUP')\n }\n const inputDirs = await getInputDirs(config.compile?.depth)\n\n if (inputDirs.length) {\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 + (publint ? await packagePublint() : 0)\n } else {\n const result = await compileSubDir(undefined, config.compile?.tsup?.options, config.verbose)\n return result + (publint ? await packagePublint() : 0)\n }\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,QAAM,UAAU,OAAO,SAAS,WAAW;AAC3C,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,qBAAqB;AAAA,EACnC;AACA,QAAM,YAAY,UAAM,4BAAa,OAAO,SAAS,KAAK;AAE1D,MAAI,UAAU,QAAQ;AACpB,UAAM,UACJ,MAAM,QAAQ;AAAA,MACZ,UAAU,IAAI,OAAO,aAAa;AAChC,eAAO,MAAM,cAAc,UAAU,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO;AAAA,MACpF,CAAC;AAAA,IACH,GACA,OAAO,CAAC,MAAMC,YAAW,OAAOA,SAAQ,CAAC;AAC3C,WAAO,UAAU,UAAU,UAAM,+BAAe,IAAI;AAAA,EACtD,OAAO;AACL,UAAM,SAAS,MAAM,cAAc,QAAW,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO;AAC3F,WAAO,UAAU,UAAU,UAAM,+BAAe,IAAI;AAAA,EACtD;AACF;","names":["options","result"]}
|
|
@@ -34,6 +34,7 @@ const compileSubDir = async (subDir, options, verbose) => {
|
|
|
34
34
|
};
|
|
35
35
|
const packageCompileTsup = async (params) => {
|
|
36
36
|
const config = await loadConfig(params);
|
|
37
|
+
const publint = config.compile?.publint ?? true;
|
|
37
38
|
if (config.verbose) {
|
|
38
39
|
console.log("Compiling with TSUP");
|
|
39
40
|
}
|
|
@@ -44,10 +45,10 @@ const packageCompileTsup = async (params) => {
|
|
|
44
45
|
return await compileSubDir(inputDir, config.compile?.tsup?.options, config.verbose);
|
|
45
46
|
})
|
|
46
47
|
)).reduce((prev, result2) => prev + result2, 0);
|
|
47
|
-
return result + (
|
|
48
|
+
return result + (publint ? await packagePublint() : 0);
|
|
48
49
|
} else {
|
|
49
50
|
const result = await compileSubDir(void 0, config.compile?.tsup?.options, config.verbose);
|
|
50
|
-
return result + (
|
|
51
|
+
return result + (publint ? await packagePublint() : 0);
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
export {
|
|
@@ -1 +1 @@
|
|
|
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 if (inputDirs.length) {\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 + (
|
|
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 const publint = config.compile?.publint ?? true\n if (config.verbose) {\n console.log('Compiling with TSUP')\n }\n const inputDirs = await getInputDirs(config.compile?.depth)\n\n if (inputDirs.length) {\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 + (publint ? await packagePublint() : 0)\n } else {\n const result = await compileSubDir(undefined, config.compile?.tsup?.options, config.verbose)\n return result + (publint ? await packagePublint() : 0)\n }\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,QAAM,UAAU,OAAO,SAAS,WAAW;AAC3C,MAAI,OAAO,SAAS;AAClB,YAAQ,IAAI,qBAAqB;AAAA,EACnC;AACA,QAAM,YAAY,MAAM,aAAa,OAAO,SAAS,KAAK;AAE1D,MAAI,UAAU,QAAQ;AACpB,UAAM,UACJ,MAAM,QAAQ;AAAA,MACZ,UAAU,IAAI,OAAO,aAAa;AAChC,eAAO,MAAM,cAAc,UAAU,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO;AAAA,MACpF,CAAC;AAAA,IACH,GACA,OAAO,CAAC,MAAMC,YAAW,OAAOA,SAAQ,CAAC;AAC3C,WAAO,UAAU,UAAU,MAAM,eAAe,IAAI;AAAA,EACtD,OAAO;AACL,UAAM,SAAS,MAAM,cAAc,QAAW,OAAO,SAAS,MAAM,SAAS,OAAO,OAAO;AAC3F,WAAO,UAAU,UAAU,MAAM,eAAe,IAAI;AAAA,EACtD;AACF;","names":["options","result"]}
|
|
@@ -33,8 +33,11 @@ __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
|
+
if (params?.verbose) {
|
|
39
|
+
console.log(import_chalk.default.gray(`Publint [Start]: ${pkgDir}`));
|
|
40
|
+
}
|
|
38
41
|
const pkg = JSON.parse(await import_fs.promises.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
39
42
|
const { publint } = await import("publint");
|
|
40
43
|
const { messages } = await publint({
|
|
@@ -56,6 +59,9 @@ const packagePublint = async (_params) => {
|
|
|
56
59
|
break;
|
|
57
60
|
}
|
|
58
61
|
});
|
|
62
|
+
if (params?.verbose) {
|
|
63
|
+
console.log(import_chalk.default.gray(`Publint [Finish]: ${pkgDir} [${messages.length}]`));
|
|
64
|
+
}
|
|
59
65
|
return messages.length;
|
|
60
66
|
};
|
|
61
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -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 if (params?.verbose) {\n console.log(chalk.gray(`Publint [Start]: ${pkgDir}`))\n }\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 if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${messages.length}]`))\n }\n\n return messages.length\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,gBAA+B;AAOxB,MAAM,iBAAiB,OAAO,WAAkC;AACrE,QAAM,SAAS,QAAQ,IAAI;AAE3B,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,aAAAA,QAAM,KAAK,oBAAoB,MAAM,EAAE,CAAC;AAAA,EACtD;AAEA,QAAM,MAAM,KAAK,MAAM,MAAM,UAAAC,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,aAAAD,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,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,aAAAA,QAAM,KAAK,qBAAqB,MAAM,KAAK,SAAS,MAAM,GAAG,CAAC;AAAA,EAC5E;AAEA,SAAO,SAAS;AAClB;","names":["chalk","fs"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
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
|
+
if (params?.verbose) {
|
|
6
|
+
console.log(chalk.gray(`Publint [Start]: ${pkgDir}`));
|
|
7
|
+
}
|
|
5
8
|
const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, "utf8"));
|
|
6
9
|
const { publint } = await import("publint");
|
|
7
10
|
const { messages } = await publint({
|
|
@@ -23,6 +26,9 @@ const packagePublint = async (_params) => {
|
|
|
23
26
|
break;
|
|
24
27
|
}
|
|
25
28
|
});
|
|
29
|
+
if (params?.verbose) {
|
|
30
|
+
console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${messages.length}]`));
|
|
31
|
+
}
|
|
26
32
|
return messages.length;
|
|
27
33
|
};
|
|
28
34
|
export {
|
|
@@ -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 if (params?.verbose) {\n console.log(chalk.gray(`Publint [Start]: ${pkgDir}`))\n }\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 if (params?.verbose) {\n console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${messages.length}]`))\n }\n\n return messages.length\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,YAAY,UAAU;AAOxB,MAAM,iBAAiB,OAAO,WAAkC;AACrE,QAAM,SAAS,QAAQ,IAAI;AAE3B,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,MAAM,KAAK,oBAAoB,MAAM,EAAE,CAAC;AAAA,EACtD;AAEA,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,MAAI,QAAQ,SAAS;AACnB,YAAQ,IAAI,MAAM,KAAK,qBAAqB,MAAM,KAAK,SAAS,MAAM,GAAG,CAAC;AAAA,EAC5E;AAEA,SAAO,SAAS;AAClB;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -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
|
|
package/dist/index.d.ts
CHANGED
|
@@ -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
|
|
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.18",
|
|
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.18",
|
|
114
|
+
"@xylabs/tsconfig": "^3.0.18",
|
|
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.18"
|
|
172
172
|
}
|
|
@@ -21,53 +21,46 @@ export const packageCompile = async (params?: PackageCompileParams): Promise<num
|
|
|
21
21
|
const pkg = process.env.INIT_CWD
|
|
22
22
|
console.log(chalk.green(`Compiling ${pkg}`))
|
|
23
23
|
const config = await loadConfig(params)
|
|
24
|
+
const publint = config.compile?.publint ?? true
|
|
24
25
|
|
|
25
26
|
const modes = config.compile?.modes ?? ['tsup']
|
|
26
27
|
let modeIndex = 0
|
|
28
|
+
let result: number = 0
|
|
27
29
|
while (modeIndex < modes.length) {
|
|
28
30
|
const mode = modes[modeIndex]
|
|
29
31
|
switch (mode) {
|
|
30
32
|
case 'rollup': {
|
|
31
|
-
|
|
33
|
+
result += await packageCompileRollup(
|
|
32
34
|
merge({}, params, {
|
|
33
35
|
compile: {
|
|
34
36
|
publint: false,
|
|
35
37
|
},
|
|
36
38
|
}),
|
|
37
39
|
)
|
|
38
|
-
if (result) {
|
|
39
|
-
return result
|
|
40
|
-
}
|
|
41
40
|
break
|
|
42
41
|
}
|
|
43
42
|
case 'tsc': {
|
|
44
|
-
|
|
43
|
+
result += await packageCompileTsc(
|
|
45
44
|
merge({}, params, {
|
|
46
45
|
compile: {
|
|
47
46
|
publint: false,
|
|
48
47
|
},
|
|
49
48
|
}),
|
|
50
49
|
)
|
|
51
|
-
if (result) {
|
|
52
|
-
return result
|
|
53
|
-
}
|
|
54
50
|
break
|
|
55
51
|
}
|
|
56
52
|
case 'tsup': {
|
|
57
|
-
|
|
53
|
+
result += await packageCompileTsup(
|
|
58
54
|
merge({}, params, {
|
|
59
55
|
compile: {
|
|
60
56
|
publint: false,
|
|
61
57
|
},
|
|
62
58
|
}),
|
|
63
59
|
)
|
|
64
|
-
if (result) {
|
|
65
|
-
return result
|
|
66
|
-
}
|
|
67
60
|
break
|
|
68
61
|
}
|
|
69
62
|
}
|
|
70
63
|
modeIndex++
|
|
71
64
|
}
|
|
72
|
-
return
|
|
65
|
+
return result + (publint ? await packagePublint(params) : 0)
|
|
73
66
|
}
|
|
@@ -53,6 +53,7 @@ const compileSubDir = async (subDir?: string, options?: Options, verbose?: boole
|
|
|
53
53
|
|
|
54
54
|
export const packageCompileTsup = async (params?: PackageCompileTsupParams) => {
|
|
55
55
|
const config = await loadConfig(params)
|
|
56
|
+
const publint = config.compile?.publint ?? true
|
|
56
57
|
if (config.verbose) {
|
|
57
58
|
console.log('Compiling with TSUP')
|
|
58
59
|
}
|
|
@@ -66,9 +67,9 @@ export const packageCompileTsup = async (params?: PackageCompileTsupParams) => {
|
|
|
66
67
|
}),
|
|
67
68
|
)
|
|
68
69
|
).reduce((prev, result) => prev + result, 0)
|
|
69
|
-
return result + (
|
|
70
|
+
return result + (publint ? await packagePublint() : 0)
|
|
70
71
|
} else {
|
|
71
72
|
const result = await compileSubDir(undefined, config.compile?.tsup?.options, config.verbose)
|
|
72
|
-
return result + (
|
|
73
|
+
return result + (publint ? await packagePublint() : 0)
|
|
73
74
|
}
|
|
74
75
|
}
|
|
@@ -6,9 +6,13 @@ export interface PackagePublintParams {
|
|
|
6
6
|
verbose?: boolean
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const packagePublint = async (
|
|
9
|
+
export const packagePublint = async (params?: PackagePublintParams) => {
|
|
10
10
|
const pkgDir = process.env.INIT_CWD
|
|
11
11
|
|
|
12
|
+
if (params?.verbose) {
|
|
13
|
+
console.log(chalk.gray(`Publint [Start]: ${pkgDir}`))
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
const pkg = JSON.parse(await fs.readFile(`${pkgDir}/package.json`, 'utf8'))
|
|
13
17
|
|
|
14
18
|
const { publint } = await import('publint')
|
|
@@ -36,5 +40,9 @@ export const packagePublint = async (_params?: PackagePublintParams) => {
|
|
|
36
40
|
}
|
|
37
41
|
})
|
|
38
42
|
|
|
43
|
+
if (params?.verbose) {
|
|
44
|
+
console.log(chalk.gray(`Publint [Finish]: ${pkgDir} [${messages.length}]`))
|
|
45
|
+
}
|
|
46
|
+
|
|
39
47
|
return messages.length
|
|
40
48
|
}
|