@jpp-toolkit/plugin-build-lib 0.0.15 → 0.0.16
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/index.mjs +10 -23
- package/dist/index.mjs.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
- package/src/lib-build-command.ts +9 -14
package/dist/index.mjs
CHANGED
|
@@ -9,6 +9,11 @@ const Preset = {
|
|
|
9
9
|
CJS: "cjs",
|
|
10
10
|
HYBRID: "hybrid"
|
|
11
11
|
};
|
|
12
|
+
const presetFormatMap = {
|
|
13
|
+
[Preset.ESM]: ["esm"],
|
|
14
|
+
[Preset.CJS]: ["cjs"],
|
|
15
|
+
[Preset.HYBRID]: ["esm", "cjs"]
|
|
16
|
+
};
|
|
12
17
|
var LibBuildCommand = class LibBuildCommand extends Command {
|
|
13
18
|
static summary = "Build the project using predefined library build presets.";
|
|
14
19
|
static args = { preset: Args.string({
|
|
@@ -41,29 +46,11 @@ var LibBuildCommand = class LibBuildCommand extends Command {
|
|
|
41
46
|
const preset = args.preset;
|
|
42
47
|
const { watch } = flags;
|
|
43
48
|
this.logger.info(`Building library using the '${preset}' preset...`);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}));
|
|
50
|
-
break;
|
|
51
|
-
case Preset.CJS:
|
|
52
|
-
await build(createTsdownConfig({
|
|
53
|
-
format: ["cjs"],
|
|
54
|
-
watch
|
|
55
|
-
}));
|
|
56
|
-
break;
|
|
57
|
-
case Preset.HYBRID:
|
|
58
|
-
await build(createTsdownConfig({
|
|
59
|
-
format: ["esm", "cjs"],
|
|
60
|
-
watch
|
|
61
|
-
}));
|
|
62
|
-
break;
|
|
63
|
-
default:
|
|
64
|
-
this.logger.error(`Unknown preset: ${preset}`);
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
49
|
+
const format = presetFormatMap[preset];
|
|
50
|
+
await build(createTsdownConfig({
|
|
51
|
+
format,
|
|
52
|
+
watch
|
|
53
|
+
}));
|
|
67
54
|
}
|
|
68
55
|
};
|
|
69
56
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["tsdownBuild"],"sources":["../src/lib-build-command.ts","../src/index.ts"],"sourcesContent":["import { Command } from '@jpp-toolkit/core';\nimport { createTsdownConfig } from '@jpp-toolkit/tsdown-config';\nimport { Args, Flags } from '@oclif/core';\nimport { build as tsdownBuild } from 'tsdown';\n\nconst Preset = {\n ESM: 'esm',\n CJS: 'cjs',\n HYBRID: 'hybrid',\n} as const;\ntype Preset = (typeof Preset)[keyof typeof Preset];\n\nexport class LibBuildCommand extends Command {\n static override summary = 'Build the project using predefined library build presets.';\n\n static override args = {\n preset: Args.string({\n name: 'preset',\n required: true,\n description: 'The build preset to use.',\n options: Object.values(Preset),\n }),\n };\n\n static override flags = {\n watch: Flags.boolean({\n char: 'w',\n description: 'Watch files for changes and rebuild automatically.',\n default: false,\n }),\n };\n\n static override examples = [\n {\n description: 'Build the library using the esm preset.',\n command: '<%= config.bin %> <%= command.id %> esm',\n },\n {\n description: 'Build the library using the cjs preset.',\n command: '<%= config.bin %> <%= command.id %> cjs',\n },\n {\n description: 'Build the library using the hybrid preset.',\n command: '<%= config.bin %> <%= command.id %> hybrid',\n },\n ];\n\n public async run(): Promise<void> {\n const { args, flags } = await this.parse(LibBuildCommand);\n const preset = args.preset as Preset;\n const { watch } = flags;\n\n this.logger.info(`Building library using the '${preset}' preset...`);\n\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["tsdownBuild"],"sources":["../src/lib-build-command.ts","../src/index.ts"],"sourcesContent":["import { Command } from '@jpp-toolkit/core';\nimport { createTsdownConfig } from '@jpp-toolkit/tsdown-config';\nimport { Args, Flags } from '@oclif/core';\nimport { build as tsdownBuild } from 'tsdown';\n\nconst Preset = {\n ESM: 'esm',\n CJS: 'cjs',\n HYBRID: 'hybrid',\n} as const;\ntype Preset = (typeof Preset)[keyof typeof Preset];\n\nconst presetFormatMap = {\n [Preset.ESM]: ['esm' as const],\n [Preset.CJS]: ['cjs' as const],\n [Preset.HYBRID]: ['esm' as const, 'cjs' as const],\n};\n\nexport class LibBuildCommand extends Command {\n static override summary = 'Build the project using predefined library build presets.';\n\n static override args = {\n preset: Args.string({\n name: 'preset',\n required: true,\n description: 'The build preset to use.',\n options: Object.values(Preset),\n }),\n };\n\n static override flags = {\n watch: Flags.boolean({\n char: 'w',\n description: 'Watch files for changes and rebuild automatically.',\n default: false,\n }),\n };\n\n static override examples = [\n {\n description: 'Build the library using the esm preset.',\n command: '<%= config.bin %> <%= command.id %> esm',\n },\n {\n description: 'Build the library using the cjs preset.',\n command: '<%= config.bin %> <%= command.id %> cjs',\n },\n {\n description: 'Build the library using the hybrid preset.',\n command: '<%= config.bin %> <%= command.id %> hybrid',\n },\n ];\n\n public async run(): Promise<void> {\n const { args, flags } = await this.parse(LibBuildCommand);\n const preset = args.preset as Preset;\n const { watch } = flags;\n\n this.logger.info(`Building library using the '${preset}' preset...`);\n\n const format = presetFormatMap[preset];\n const config = createTsdownConfig({ format, watch });\n await tsdownBuild(config);\n }\n}\n","import { LibBuildCommand } from './lib-build-command';\n\nexport const commands = {\n 'build:lib': LibBuildCommand,\n};\n"],"mappings":";;;;;;AAKA,MAAM,SAAS;CACX,KAAK;CACL,KAAK;CACL,QAAQ;CACX;AAGD,MAAM,kBAAkB;EACnB,OAAO,MAAM,CAAC,MAAe;EAC7B,OAAO,MAAM,CAAC,MAAe;EAC7B,OAAO,SAAS,CAAC,OAAgB,MAAe;CACpD;AAED,IAAa,kBAAb,MAAa,wBAAwB,QAAQ;CACzC,OAAgB,UAAU;CAE1B,OAAgB,OAAO,EACnB,QAAQ,KAAK,OAAO;EAChB,MAAM;EACN,UAAU;EACV,aAAa;EACb,SAAS,OAAO,OAAO,OAAO;EACjC,CAAC,EACL;CAED,OAAgB,QAAQ,EACpB,OAAO,MAAM,QAAQ;EACjB,MAAM;EACN,aAAa;EACb,SAAS;EACZ,CAAC,EACL;CAED,OAAgB,WAAW;EACvB;GACI,aAAa;GACb,SAAS;GACZ;EACD;GACI,aAAa;GACb,SAAS;GACZ;EACD;GACI,aAAa;GACb,SAAS;GACZ;EACJ;CAED,MAAa,MAAqB;EAC9B,MAAM,EAAE,MAAM,UAAU,MAAM,KAAK,MAAM,gBAAgB;EACzD,MAAM,SAAS,KAAK;EACpB,MAAM,EAAE,UAAU;AAElB,OAAK,OAAO,KAAK,+BAA+B,OAAO,aAAa;EAEpE,MAAM,SAAS,gBAAgB;AAE/B,QAAMA,MADS,mBAAmB;GAAE;GAAQ;GAAO,CAAC,CAC3B;;;;;;AC5DjC,MAAa,WAAW,EACpB,aAAa,iBAChB"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jpp-toolkit/plugin-build-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Plugin that add the library build command to the jpp cli.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jpp",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@oclif/core": "4.8.0",
|
|
38
38
|
"tsdown": "0.17.2",
|
|
39
39
|
"@jpp-toolkit/core": "0.0.14",
|
|
40
|
-
"@jpp-toolkit/tsdown-config": "0.0.
|
|
40
|
+
"@jpp-toolkit/tsdown-config": "0.0.16",
|
|
41
41
|
"@jpp-toolkit/utils": "0.0.14"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
package/src/lib-build-command.ts
CHANGED
|
@@ -10,6 +10,12 @@ const Preset = {
|
|
|
10
10
|
} as const;
|
|
11
11
|
type Preset = (typeof Preset)[keyof typeof Preset];
|
|
12
12
|
|
|
13
|
+
const presetFormatMap = {
|
|
14
|
+
[Preset.ESM]: ['esm' as const],
|
|
15
|
+
[Preset.CJS]: ['cjs' as const],
|
|
16
|
+
[Preset.HYBRID]: ['esm' as const, 'cjs' as const],
|
|
17
|
+
};
|
|
18
|
+
|
|
13
19
|
export class LibBuildCommand extends Command {
|
|
14
20
|
static override summary = 'Build the project using predefined library build presets.';
|
|
15
21
|
|
|
@@ -52,19 +58,8 @@ export class LibBuildCommand extends Command {
|
|
|
52
58
|
|
|
53
59
|
this.logger.info(`Building library using the '${preset}' preset...`);
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
break;
|
|
59
|
-
case Preset.CJS:
|
|
60
|
-
await tsdownBuild(createTsdownConfig({ format: ['cjs'], watch }));
|
|
61
|
-
break;
|
|
62
|
-
case Preset.HYBRID:
|
|
63
|
-
await tsdownBuild(createTsdownConfig({ format: ['esm', 'cjs'], watch }));
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
this.logger.error(`Unknown preset: ${preset}`);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
61
|
+
const format = presetFormatMap[preset];
|
|
62
|
+
const config = createTsdownConfig({ format, watch });
|
|
63
|
+
await tsdownBuild(config);
|
|
69
64
|
}
|
|
70
65
|
}
|