@forgehive/forge-cli 0.3.15 → 0.3.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.
|
@@ -5,6 +5,7 @@ export declare const zip: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
|
5
5
|
dir: string;
|
|
6
6
|
input: string;
|
|
7
7
|
output: string;
|
|
8
|
+
forgeJsonPath?: string | undefined;
|
|
8
9
|
}, boundaries: import("@forgehive/task").WrappedBoundaries<{
|
|
9
10
|
createWriteStream: (outputPath: string) => Promise<fs.WriteStream>;
|
|
10
11
|
createArchiver: (format: "zip", options: {
|
package/dist/tasks/bundle/zip.js
CHANGED
|
@@ -16,7 +16,8 @@ const description = 'Zip a bundle file for distribution';
|
|
|
16
16
|
const schema = new schema_1.Schema({
|
|
17
17
|
dir: schema_1.Schema.string(),
|
|
18
18
|
input: schema_1.Schema.string(),
|
|
19
|
-
output: schema_1.Schema.string()
|
|
19
|
+
output: schema_1.Schema.string(),
|
|
20
|
+
forgeJsonPath: schema_1.Schema.string().optional() // Optional path to forge.json - if provided, it will be included
|
|
20
21
|
});
|
|
21
22
|
const boundaries = {
|
|
22
23
|
createWriteStream: async (outputPath) => {
|
|
@@ -36,7 +37,7 @@ const boundaries = {
|
|
|
36
37
|
catch {
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
|
-
}
|
|
40
|
+
},
|
|
40
41
|
};
|
|
41
42
|
const bytesToMB = (bytes) => {
|
|
42
43
|
const MB = bytes / (1024 * 1024);
|
|
@@ -46,7 +47,7 @@ exports.bytesToMB = bytesToMB;
|
|
|
46
47
|
exports.zip = (0, task_1.createTask)({
|
|
47
48
|
schema,
|
|
48
49
|
boundaries,
|
|
49
|
-
fn: async function ({ dir, input, output }, { createWriteStream, createArchiver, resolvePathDir, fileExists }) {
|
|
50
|
+
fn: async function ({ dir, input, output, forgeJsonPath }, { createWriteStream, createArchiver, resolvePathDir, fileExists }) {
|
|
50
51
|
const outputPath = await resolvePathDir(dir, output);
|
|
51
52
|
const inputPath = await resolvePathDir(dir, input);
|
|
52
53
|
const inputMapPath = inputPath + '.map';
|
|
@@ -57,6 +58,17 @@ exports.zip = (0, task_1.createTask)({
|
|
|
57
58
|
}
|
|
58
59
|
// Check if source map exists before creating Promise
|
|
59
60
|
const mapExists = await fileExists(inputMapPath);
|
|
61
|
+
// Handle forge.json inclusion - only if path is provided
|
|
62
|
+
let finalForgeJsonPath = null;
|
|
63
|
+
if (forgeJsonPath) {
|
|
64
|
+
const exists = await fileExists(forgeJsonPath);
|
|
65
|
+
if (exists) {
|
|
66
|
+
finalForgeJsonPath = forgeJsonPath;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.warn(`forge.json not found at provided path: ${forgeJsonPath}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
60
72
|
// Handle async operations outside of Promise constructor
|
|
61
73
|
const outStream = await createWriteStream(outputPath);
|
|
62
74
|
const archive = await createArchiver('zip', {
|
|
@@ -93,6 +105,11 @@ exports.zip = (0, task_1.createTask)({
|
|
|
93
105
|
if (mapExists) {
|
|
94
106
|
archive.file(inputMapPath, { name: 'index.js.map' });
|
|
95
107
|
}
|
|
108
|
+
// Add forge.json if path was provided and found
|
|
109
|
+
if (finalForgeJsonPath) {
|
|
110
|
+
archive.file(finalForgeJsonPath, { name: 'forge.json' });
|
|
111
|
+
console.log(`Added forge.json from: ${finalForgeJsonPath}`);
|
|
112
|
+
}
|
|
96
113
|
archive.finalize();
|
|
97
114
|
});
|
|
98
115
|
}
|
|
@@ -19,6 +19,7 @@ export declare const publish: import("@forgehive/task").TaskInstanceType<(argv:
|
|
|
19
19
|
dir: string;
|
|
20
20
|
input: string;
|
|
21
21
|
output: string;
|
|
22
|
+
forgeJsonPath?: string | undefined;
|
|
22
23
|
}) => Promise<Promise<unknown>>;
|
|
23
24
|
bundleFingerprint: (args: {
|
|
24
25
|
descriptorName: string;
|
|
@@ -73,6 +74,7 @@ export declare const publish: import("@forgehive/task").TaskInstanceType<(argv:
|
|
|
73
74
|
dir: string;
|
|
74
75
|
input: string;
|
|
75
76
|
output: string;
|
|
77
|
+
forgeJsonPath?: string | undefined;
|
|
76
78
|
}) => Promise<Promise<unknown>>;
|
|
77
79
|
bundleFingerprint: (args: {
|
|
78
80
|
descriptorName: string;
|
|
@@ -108,11 +108,12 @@ exports.publish = (0, task_1.createTask)({
|
|
|
108
108
|
outputFile
|
|
109
109
|
});
|
|
110
110
|
console.log('Bundle created...');
|
|
111
|
-
// Zip the bundle
|
|
111
|
+
// Zip the bundle with forge.json included
|
|
112
112
|
await bundleZip({
|
|
113
113
|
dir: buildsPath,
|
|
114
114
|
input: `${descriptorName}.js`,
|
|
115
|
-
output: zipFile
|
|
115
|
+
output: zipFile,
|
|
116
|
+
forgeJsonPath: path_1.default.join(cwd, 'forge.json')
|
|
116
117
|
});
|
|
117
118
|
console.log('Bundle zipped...');
|
|
118
119
|
// Generate task fingerprint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgehive/forge-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.16",
|
|
4
4
|
"description": "TypeScript CLI application",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@forgehive/hive-sdk": "^0.1.
|
|
14
|
-
"@forgehive/record-tape": "^0.2.
|
|
15
|
-
"@forgehive/runner": "^0.2.
|
|
13
|
+
"@forgehive/hive-sdk": "^0.1.6",
|
|
14
|
+
"@forgehive/record-tape": "^0.2.7",
|
|
15
|
+
"@forgehive/runner": "^0.2.7",
|
|
16
16
|
"@forgehive/schema": "^0.1.4",
|
|
17
|
-
"@forgehive/task": "^0.2.
|
|
17
|
+
"@forgehive/task": "^0.2.7",
|
|
18
18
|
"esbuild": "^0.25.0",
|
|
19
19
|
"handlebars": "^4.7.8",
|
|
20
20
|
"minimist": "^1.2.8",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"typescript": "^5.3.3",
|
|
32
32
|
"uuid": "^11.1.0",
|
|
33
33
|
"@forgehive/schema": "0.1.4",
|
|
34
|
-
"@forgehive/task": "0.2.
|
|
35
|
-
"@forgehive/hive-sdk": "0.1.
|
|
36
|
-
"@forgehive/
|
|
37
|
-
"@forgehive/
|
|
34
|
+
"@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"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/archiver": "^6.0.3",
|
package/src/tasks/bundle/zip.ts
CHANGED
|
@@ -13,7 +13,8 @@ const description = 'Zip a bundle file for distribution'
|
|
|
13
13
|
const schema = new Schema({
|
|
14
14
|
dir: Schema.string(),
|
|
15
15
|
input: Schema.string(),
|
|
16
|
-
output: Schema.string()
|
|
16
|
+
output: Schema.string(),
|
|
17
|
+
forgeJsonPath: Schema.string().optional() // Optional path to forge.json - if provided, it will be included
|
|
17
18
|
})
|
|
18
19
|
|
|
19
20
|
const boundaries = {
|
|
@@ -33,7 +34,7 @@ const boundaries = {
|
|
|
33
34
|
} catch {
|
|
34
35
|
return false
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
+
},
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export const bytesToMB = (bytes: number): string => {
|
|
@@ -44,7 +45,7 @@ export const bytesToMB = (bytes: number): string => {
|
|
|
44
45
|
export const zip = createTask({
|
|
45
46
|
schema,
|
|
46
47
|
boundaries,
|
|
47
|
-
fn: async function ({ dir, input, output }, { createWriteStream, createArchiver, resolvePathDir, fileExists }) {
|
|
48
|
+
fn: async function ({ dir, input, output, forgeJsonPath }, { createWriteStream, createArchiver, resolvePathDir, fileExists }) {
|
|
48
49
|
const outputPath = await resolvePathDir(dir, output)
|
|
49
50
|
const inputPath = await resolvePathDir(dir, input)
|
|
50
51
|
const inputMapPath = inputPath + '.map'
|
|
@@ -58,6 +59,17 @@ export const zip = createTask({
|
|
|
58
59
|
// Check if source map exists before creating Promise
|
|
59
60
|
const mapExists = await fileExists(inputMapPath)
|
|
60
61
|
|
|
62
|
+
// Handle forge.json inclusion - only if path is provided
|
|
63
|
+
let finalForgeJsonPath: string | null = null
|
|
64
|
+
if (forgeJsonPath) {
|
|
65
|
+
const exists = await fileExists(forgeJsonPath)
|
|
66
|
+
if (exists) {
|
|
67
|
+
finalForgeJsonPath = forgeJsonPath
|
|
68
|
+
} else {
|
|
69
|
+
console.warn(`forge.json not found at provided path: ${forgeJsonPath}`)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
61
73
|
// Handle async operations outside of Promise constructor
|
|
62
74
|
const outStream = await createWriteStream(outputPath)
|
|
63
75
|
const archive = await createArchiver('zip', {
|
|
@@ -101,6 +113,12 @@ export const zip = createTask({
|
|
|
101
113
|
archive.file(inputMapPath, { name: 'index.js.map' })
|
|
102
114
|
}
|
|
103
115
|
|
|
116
|
+
// Add forge.json if path was provided and found
|
|
117
|
+
if (finalForgeJsonPath) {
|
|
118
|
+
archive.file(finalForgeJsonPath, { name: 'forge.json' })
|
|
119
|
+
console.log(`Added forge.json from: ${finalForgeJsonPath}`)
|
|
120
|
+
}
|
|
121
|
+
|
|
104
122
|
archive.finalize()
|
|
105
123
|
})
|
|
106
124
|
}
|
|
@@ -139,11 +139,12 @@ export const publish = createTask({
|
|
|
139
139
|
|
|
140
140
|
console.log('Bundle created...')
|
|
141
141
|
|
|
142
|
-
// Zip the bundle
|
|
142
|
+
// Zip the bundle with forge.json included
|
|
143
143
|
await bundleZip({
|
|
144
144
|
dir: buildsPath,
|
|
145
145
|
input: `${descriptorName}.js`,
|
|
146
|
-
output: zipFile
|
|
146
|
+
output: zipFile,
|
|
147
|
+
forgeJsonPath: path.join(cwd, 'forge.json')
|
|
147
148
|
})
|
|
148
149
|
|
|
149
150
|
console.log('Bundle zipped...')
|