@forgehive/forge-cli 0.3.16 → 0.3.17

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.
@@ -1,6 +1,11 @@
1
+ import { type ForgeConf } from '../types';
1
2
  export declare const create: import("@forgehive/task").TaskInstanceType<(argv: {
2
3
  entryPoint: string;
3
4
  outputFile: string;
4
- }, boundaries: import("@forgehive/task").WrappedBoundaries<{}>) => Promise<{
5
+ }, boundaries: import("@forgehive/task").WrappedBoundaries<{
6
+ loadConf: (args: {}) => Promise<Promise<ForgeConf>>;
7
+ }>) => Promise<{
5
8
  outputFile: string;
6
- }>, {}>;
9
+ }>, {
10
+ loadConf: (args: {}) => Promise<Promise<ForgeConf>>;
11
+ }>;
@@ -10,15 +10,22 @@ exports.create = void 0;
10
10
  const task_1 = require("@forgehive/task");
11
11
  const schema_1 = require("@forgehive/schema");
12
12
  const esbuild_1 = __importDefault(require("esbuild"));
13
+ const load_1 = require("../conf/load");
13
14
  const schema = new schema_1.Schema({
14
15
  entryPoint: schema_1.Schema.string(),
15
16
  outputFile: schema_1.Schema.string()
16
17
  });
17
- const boundaries = {};
18
+ const boundaries = {
19
+ loadConf: load_1.load.asBoundary()
20
+ };
18
21
  exports.create = (0, task_1.createTask)({
19
22
  schema,
20
23
  boundaries,
21
- fn: async function ({ entryPoint, outputFile }) {
24
+ fn: async function ({ entryPoint, outputFile }, { loadConf }) {
25
+ // Load forge configuration
26
+ const forge = await loadConf({});
27
+ // Get external packages from config, default to empty array
28
+ const externalPackages = forge.build?.externalPackages ?? [];
22
29
  // Build using esbuild
23
30
  await esbuild_1.default.build({
24
31
  entryPoints: [entryPoint],
@@ -26,7 +33,8 @@ exports.create = (0, task_1.createTask)({
26
33
  bundle: true,
27
34
  minify: true,
28
35
  platform: 'node',
29
- sourcemap: true
36
+ sourcemap: true,
37
+ external: externalPackages
30
38
  });
31
39
  return { outputFile };
32
40
  }
@@ -122,6 +122,8 @@ exports.fingerprint = (0, task_1.createTask)({
122
122
  console.log(`Generating bundle with fingerprints for task: ${descriptorName}`);
123
123
  console.log(`Entry point: ${entryPoint}`);
124
124
  console.log(`Output: ${outputFile}`);
125
+ // Get external packages from config, default to empty array
126
+ const externalPackages = forgeJson.build?.externalPackages ?? [];
125
127
  // Build with fingerprinting plugin
126
128
  const result = await esbuild_1.default.build({
127
129
  entryPoints: [entryPoint],
@@ -131,7 +133,8 @@ exports.fingerprint = (0, task_1.createTask)({
131
133
  platform: 'node',
132
134
  sourcemap: true,
133
135
  plugins: [taskFingerprintPlugin()],
134
- metafile: true
136
+ metafile: true,
137
+ external: externalPackages
135
138
  });
136
139
  // Extract fingerprints from build result
137
140
  const taskFingerprints = result.fingerprints || [];
@@ -56,6 +56,8 @@ exports.bundle = (0, task_1.createTask)({
56
56
  `);
57
57
  // Ensure target directory exists
58
58
  await ensureDir(path_1.default.dirname(targetPath));
59
+ // Get external packages from config, default to empty array
60
+ const externalPackages = forge.build?.externalPackages ?? [];
59
61
  // Build using esbuild
60
62
  await esbuild_1.default.build({
61
63
  entryPoints: [entryPoint],
@@ -63,7 +65,8 @@ exports.bundle = (0, task_1.createTask)({
63
65
  bundle: true,
64
66
  minify: true,
65
67
  platform: 'node',
66
- sourcemap: true
68
+ sourcemap: true,
69
+ external: externalPackages
67
70
  });
68
71
  return {
69
72
  status: 'Success',
@@ -31,6 +31,9 @@ export interface ForgeConf {
31
31
  infra: Infra;
32
32
  tasks: Record<string, TaskDescriptor>;
33
33
  runners: Record<string, RunnerDescriptor>;
34
+ build?: {
35
+ externalPackages?: string[];
36
+ };
34
37
  }
35
38
  export interface TaskName {
36
39
  descriptor: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgehive/forge-cli",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
4
4
  "description": "TypeScript CLI application",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -30,11 +30,11 @@
30
30
  "minimist": "^1.2.8",
31
31
  "typescript": "^5.3.3",
32
32
  "uuid": "^11.1.0",
33
+ "@forgehive/runner": "0.2.7",
33
34
  "@forgehive/schema": "0.1.4",
34
35
  "@forgehive/task": "0.2.7",
35
- "@forgehive/hive-sdk": "0.1.6",
36
- "@forgehive/runner": "0.2.7",
37
- "@forgehive/record-tape": "0.2.7"
36
+ "@forgehive/record-tape": "0.2.7",
37
+ "@forgehive/hive-sdk": "0.1.6"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/archiver": "^6.0.3",
@@ -5,18 +5,28 @@
5
5
  import { createTask } from '@forgehive/task'
6
6
  import { Schema } from '@forgehive/schema'
7
7
  import esbuild from 'esbuild'
8
+ import { load as loadConf } from '../conf/load'
9
+ import { type ForgeConf } from '../types'
8
10
 
9
11
  const schema = new Schema({
10
12
  entryPoint: Schema.string(),
11
13
  outputFile: Schema.string()
12
14
  })
13
15
 
14
- const boundaries = {}
16
+ const boundaries = {
17
+ loadConf: loadConf.asBoundary()
18
+ }
15
19
 
16
20
  export const create = createTask({
17
21
  schema,
18
22
  boundaries,
19
- fn: async function ({ entryPoint, outputFile }) {
23
+ fn: async function ({ entryPoint, outputFile }, { loadConf }) {
24
+ // Load forge configuration
25
+ const forge: ForgeConf = await loadConf({})
26
+
27
+ // Get external packages from config, default to empty array
28
+ const externalPackages = forge.build?.externalPackages ?? []
29
+
20
30
  // Build using esbuild
21
31
  await esbuild.build({
22
32
  entryPoints: [entryPoint],
@@ -24,7 +34,8 @@ export const create = createTask({
24
34
  bundle: true,
25
35
  minify: true,
26
36
  platform: 'node',
27
- sourcemap: true
37
+ sourcemap: true,
38
+ external: externalPackages
28
39
  })
29
40
 
30
41
  return { outputFile }
@@ -174,6 +174,9 @@ export const fingerprint = createTask({
174
174
  console.log(`Entry point: ${entryPoint}`)
175
175
  console.log(`Output: ${outputFile}`)
176
176
 
177
+ // Get external packages from config, default to empty array
178
+ const externalPackages = forgeJson.build?.externalPackages ?? []
179
+
177
180
  // Build with fingerprinting plugin
178
181
  const result = await esbuild.build({
179
182
  entryPoints: [entryPoint],
@@ -183,7 +186,8 @@ export const fingerprint = createTask({
183
186
  platform: 'node',
184
187
  sourcemap: true,
185
188
  plugins: [taskFingerprintPlugin()],
186
- metafile: true
189
+ metafile: true,
190
+ external: externalPackages
187
191
  })
188
192
 
189
193
  // Extract fingerprints from build result
@@ -59,6 +59,9 @@ export const bundle = createTask({
59
59
  // Ensure target directory exists
60
60
  await ensureDir(path.dirname(targetPath))
61
61
 
62
+ // Get external packages from config, default to empty array
63
+ const externalPackages = forge.build?.externalPackages ?? []
64
+
62
65
  // Build using esbuild
63
66
  await esbuild.build({
64
67
  entryPoints: [entryPoint],
@@ -66,7 +69,8 @@ export const bundle = createTask({
66
69
  bundle: true,
67
70
  minify: true,
68
71
  platform: 'node',
69
- sourcemap: true
72
+ sourcemap: true,
73
+ external: externalPackages
70
74
  })
71
75
 
72
76
  return {
@@ -34,6 +34,9 @@ export interface ForgeConf {
34
34
  infra: Infra
35
35
  tasks: Record<string, TaskDescriptor>
36
36
  runners: Record<string, RunnerDescriptor>
37
+ build?: {
38
+ externalPackages?: string[]
39
+ }
37
40
  }
38
41
 
39
42
  export interface TaskName {