@jpp-toolkit/plugin-build-lib 0.0.83 → 0.0.84
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.d.mts +1 -0
- package/dist/index.mjs +24 -7
- package/dist/index.mjs.map +1 -1
- package/oclif.manifest.json +17 -1
- package/package.json +1 -1
- package/src/lib-build-command.ts +24 -2
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,7 @@ declare class LibBuildCommand extends Command {
|
|
|
9
9
|
};
|
|
10
10
|
static flags: {
|
|
11
11
|
watch: _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
12
|
+
entry: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
12
13
|
};
|
|
13
14
|
static examples: {
|
|
14
15
|
description: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
import { Command } from "@jpp-toolkit/core";
|
|
2
3
|
import { createTsdownConfig } from "@jpp-toolkit/tsdown-config";
|
|
3
4
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -21,11 +22,17 @@ var LibBuildCommand = class LibBuildCommand extends Command {
|
|
|
21
22
|
description: "The build preset to use.",
|
|
22
23
|
options: Object.values(Preset)
|
|
23
24
|
}) };
|
|
24
|
-
static flags = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
static flags = {
|
|
26
|
+
watch: Flags.boolean({
|
|
27
|
+
char: "w",
|
|
28
|
+
description: "Watch files for changes and rebuild automatically.",
|
|
29
|
+
default: false
|
|
30
|
+
}),
|
|
31
|
+
entry: Flags.string({
|
|
32
|
+
char: "e",
|
|
33
|
+
description: "The entry file for the build process."
|
|
34
|
+
})
|
|
35
|
+
};
|
|
29
36
|
static examples = [
|
|
30
37
|
{
|
|
31
38
|
description: "Build the library using the esm preset.",
|
|
@@ -38,17 +45,27 @@ var LibBuildCommand = class LibBuildCommand extends Command {
|
|
|
38
45
|
{
|
|
39
46
|
description: "Build the library using the hybrid preset.",
|
|
40
47
|
command: "<%= config.bin %> <%= command.id %> hybrid"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
description: "Build the library and watch for changes.",
|
|
51
|
+
command: "<%= config.bin %> <%= command.id %> esm --watch"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
description: "Build the library with a custom entry file.",
|
|
55
|
+
command: "<%= config.bin %> <%= command.id %> esm --entry src/main.ts"
|
|
41
56
|
}
|
|
42
57
|
];
|
|
43
58
|
async run() {
|
|
44
59
|
const { args, flags } = await this.parse(LibBuildCommand);
|
|
45
60
|
const preset = args.preset;
|
|
46
|
-
const { watch } = flags;
|
|
61
|
+
const { watch, entry } = flags;
|
|
47
62
|
this.logger.info(`Building library using the '${preset}' preset...`);
|
|
63
|
+
if (entry) this.logger.info(`Using custom entry file: ${entry}`);
|
|
48
64
|
const format = presetFormatMap[preset];
|
|
49
65
|
await build(createTsdownConfig({
|
|
50
66
|
format,
|
|
51
|
-
watch
|
|
67
|
+
watch,
|
|
68
|
+
...entry ? { entry: path.resolve(process.cwd(), entry) } : {}
|
|
52
69
|
}));
|
|
53
70
|
}
|
|
54
71
|
};
|
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\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({
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["tsdownBuild"],"sources":["../src/lib-build-command.ts","../src/index.ts"],"sourcesContent":["import path from 'node:path';\n\nimport { 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 entry: Flags.string({\n char: 'e',\n description: 'The entry file for the build process.',\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 description: 'Build the library and watch for changes.',\n command: '<%= config.bin %> <%= command.id %> esm --watch',\n },\n {\n description: 'Build the library with a custom entry file.',\n command: '<%= config.bin %> <%= command.id %> esm --entry src/main.ts',\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, entry } = flags;\n\n this.logger.info(`Building library using the '${preset}' preset...`);\n\n if (entry) {\n this.logger.info(`Using custom entry file: ${entry}`);\n }\n\n const format = presetFormatMap[preset];\n const config = createTsdownConfig({\n format,\n watch,\n ...(entry ? { entry: path.resolve(process.cwd(), entry) } : {}),\n });\n await tsdownBuild(config);\n }\n}\n","import { LibBuildCommand } from './lib-build-command';\n\nexport const commands = {\n 'build:lib': LibBuildCommand,\n};\n"],"mappings":";;;;;;AAOA,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;GACjB,MAAM;GACN,aAAa;GACb,SAAS;GACZ,CAAC;EACF,OAAO,MAAM,OAAO;GAChB,MAAM;GACN,aAAa;GAChB,CAAC;EACL;CAED,OAAgB,WAAW;EACvB;GACI,aAAa;GACb,SAAS;GACZ;EACD;GACI,aAAa;GACb,SAAS;GACZ;EACD;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,OAAO,UAAU;AAEzB,OAAK,OAAO,KAAK,+BAA+B,OAAO,aAAa;AAEpE,MAAI,MACA,MAAK,OAAO,KAAK,4BAA4B,QAAQ;EAGzD,MAAM,SAAS,gBAAgB;AAM/B,QAAMA,MALS,mBAAmB;GAC9B;GACA;GACA,GAAI,QAAQ,EAAE,OAAO,KAAK,QAAQ,QAAQ,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE;GACjE,CAAC,CACuB;;;;;AClFjC,MAAa,WAAW,EACpB,aAAa,iBAChB"}
|
package/oclif.manifest.json
CHANGED
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
{
|
|
27
27
|
"description": "Build the library using the hybrid preset.",
|
|
28
28
|
"command": "<%= config.bin %> <%= command.id %> hybrid"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"description": "Build the library and watch for changes.",
|
|
32
|
+
"command": "<%= config.bin %> <%= command.id %> esm --watch"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"description": "Build the library with a custom entry file.",
|
|
36
|
+
"command": "<%= config.bin %> <%= command.id %> esm --entry src/main.ts"
|
|
29
37
|
}
|
|
30
38
|
],
|
|
31
39
|
"flags": {
|
|
@@ -35,6 +43,14 @@
|
|
|
35
43
|
"name": "watch",
|
|
36
44
|
"allowNo": false,
|
|
37
45
|
"type": "boolean"
|
|
46
|
+
},
|
|
47
|
+
"entry": {
|
|
48
|
+
"char": "e",
|
|
49
|
+
"description": "The entry file for the build process.",
|
|
50
|
+
"name": "entry",
|
|
51
|
+
"hasDynamicHelp": false,
|
|
52
|
+
"multiple": false,
|
|
53
|
+
"type": "option"
|
|
38
54
|
}
|
|
39
55
|
},
|
|
40
56
|
"hasDynamicHelp": false,
|
|
@@ -47,5 +63,5 @@
|
|
|
47
63
|
"summary": "Build the project using predefined library build presets."
|
|
48
64
|
}
|
|
49
65
|
},
|
|
50
|
-
"version": "0.0.
|
|
66
|
+
"version": "0.0.84"
|
|
51
67
|
}
|
package/package.json
CHANGED
package/src/lib-build-command.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
1
3
|
import { Command } from '@jpp-toolkit/core';
|
|
2
4
|
import { createTsdownConfig } from '@jpp-toolkit/tsdown-config';
|
|
3
5
|
import { Args, Flags } from '@oclif/core';
|
|
@@ -34,6 +36,10 @@ export class LibBuildCommand extends Command {
|
|
|
34
36
|
description: 'Watch files for changes and rebuild automatically.',
|
|
35
37
|
default: false,
|
|
36
38
|
}),
|
|
39
|
+
entry: Flags.string({
|
|
40
|
+
char: 'e',
|
|
41
|
+
description: 'The entry file for the build process.',
|
|
42
|
+
}),
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
static override examples = [
|
|
@@ -49,17 +55,33 @@ export class LibBuildCommand extends Command {
|
|
|
49
55
|
description: 'Build the library using the hybrid preset.',
|
|
50
56
|
command: '<%= config.bin %> <%= command.id %> hybrid',
|
|
51
57
|
},
|
|
58
|
+
{
|
|
59
|
+
description: 'Build the library and watch for changes.',
|
|
60
|
+
command: '<%= config.bin %> <%= command.id %> esm --watch',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
description: 'Build the library with a custom entry file.',
|
|
64
|
+
command: '<%= config.bin %> <%= command.id %> esm --entry src/main.ts',
|
|
65
|
+
},
|
|
52
66
|
];
|
|
53
67
|
|
|
54
68
|
public async run(): Promise<void> {
|
|
55
69
|
const { args, flags } = await this.parse(LibBuildCommand);
|
|
56
70
|
const preset = args.preset as Preset;
|
|
57
|
-
const { watch } = flags;
|
|
71
|
+
const { watch, entry } = flags;
|
|
58
72
|
|
|
59
73
|
this.logger.info(`Building library using the '${preset}' preset...`);
|
|
60
74
|
|
|
75
|
+
if (entry) {
|
|
76
|
+
this.logger.info(`Using custom entry file: ${entry}`);
|
|
77
|
+
}
|
|
78
|
+
|
|
61
79
|
const format = presetFormatMap[preset];
|
|
62
|
-
const config = createTsdownConfig({
|
|
80
|
+
const config = createTsdownConfig({
|
|
81
|
+
format,
|
|
82
|
+
watch,
|
|
83
|
+
...(entry ? { entry: path.resolve(process.cwd(), entry) } : {}),
|
|
84
|
+
});
|
|
63
85
|
await tsdownBuild(config);
|
|
64
86
|
}
|
|
65
87
|
}
|