@forgehive/forge-cli 0.3.14 → 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.
- package/dist/tasks/bundle/zip.d.ts +1 -0
- package/dist/tasks/bundle/zip.js +20 -3
- package/dist/tasks/task/invoke.d.ts +2 -2
- package/dist/tasks/task/invoke.js +8 -5
- package/dist/tasks/task/publish.d.ts +4 -2
- package/dist/tasks/task/publish.js +13 -5
- package/package.json +9 -9
- package/src/tasks/bundle/zip.ts +21 -3
- package/src/tasks/task/invoke.ts +9 -4
- package/src/tasks/task/publish.ts +20 -5
|
@@ -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
|
}
|
|
@@ -7,10 +7,10 @@ export declare const invoke: import("@forgehive/task").TaskInstanceType<(argv: {
|
|
|
7
7
|
loadConf: (args: {}) => Promise<Promise<ForgeConf>>;
|
|
8
8
|
loadCurrentProfile: (args: {}) => Promise<Promise<Profile>>;
|
|
9
9
|
parseJSON: (jsonString: string) => Promise<unknown>;
|
|
10
|
-
invokeTask: (projectUuid: string, profile: Profile, taskName: string, payload: unknown) => Promise<InvokeResult | null>;
|
|
10
|
+
invokeTask: (projectUuid: string, taskUuid: string, profile: Profile, taskName: string, payload: unknown) => Promise<InvokeResult | null>;
|
|
11
11
|
}>) => Promise<unknown>, {
|
|
12
12
|
loadConf: (args: {}) => Promise<Promise<ForgeConf>>;
|
|
13
13
|
loadCurrentProfile: (args: {}) => Promise<Promise<Profile>>;
|
|
14
14
|
parseJSON: (jsonString: string) => Promise<unknown>;
|
|
15
|
-
invokeTask: (projectUuid: string, profile: Profile, taskName: string, payload: unknown) => Promise<InvokeResult | null>;
|
|
15
|
+
invokeTask: (projectUuid: string, taskUuid: string, profile: Profile, taskName: string, payload: unknown) => Promise<InvokeResult | null>;
|
|
16
16
|
}>;
|
|
@@ -26,17 +26,17 @@ const boundaries = {
|
|
|
26
26
|
throw new Error(`Invalid JSON: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
invokeTask: async (projectUuid, profile, taskName, payload) => {
|
|
29
|
+
invokeTask: async (projectUuid, taskUuid, profile, taskName, payload) => {
|
|
30
30
|
const client = (0, hive_sdk_1.createHiveClient)({
|
|
31
31
|
projectUuid,
|
|
32
32
|
apiKey: profile.apiKey,
|
|
33
33
|
apiSecret: profile.apiSecret,
|
|
34
34
|
host: profile.url
|
|
35
35
|
});
|
|
36
|
-
console.log(`Invoking task: ${taskName}`);
|
|
36
|
+
console.log(`Invoking task: ${taskName} (${taskUuid})`);
|
|
37
37
|
console.log('Payload:', payload);
|
|
38
38
|
console.log(`Using profile: ${profile.name} (${profile.url})`);
|
|
39
|
-
return await client.invoke(
|
|
39
|
+
return await client.invoke(taskUuid, payload);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
exports.invoke = (0, task_1.createTask)({
|
|
@@ -51,10 +51,13 @@ exports.invoke = (0, task_1.createTask)({
|
|
|
51
51
|
if (taskDescriptor === undefined) {
|
|
52
52
|
throw new Error(`Task "${descriptorName}" is not defined in forge.json`);
|
|
53
53
|
}
|
|
54
|
-
// Check for
|
|
54
|
+
// Check for required UUIDs
|
|
55
55
|
if (!forge.project.uuid) {
|
|
56
56
|
throw new Error('Project UUID is not defined in forge.json. Please ensure your project has a UUID.');
|
|
57
57
|
}
|
|
58
|
+
if (!taskDescriptor.uuid) {
|
|
59
|
+
throw new Error(`Task "${descriptorName}" does not have a UUID in forge.json. Please ensure your task has a UUID.`);
|
|
60
|
+
}
|
|
58
61
|
// Load profile (required for invoke)
|
|
59
62
|
let profile;
|
|
60
63
|
try {
|
|
@@ -66,7 +69,7 @@ exports.invoke = (0, task_1.createTask)({
|
|
|
66
69
|
// Parse the JSON payload
|
|
67
70
|
const payload = await parseJSON(json);
|
|
68
71
|
// Invoke the task using the boundary
|
|
69
|
-
const result = await invokeTask(forge.project.uuid, profile, descriptorName, payload);
|
|
72
|
+
const result = await invokeTask(forge.project.uuid, taskDescriptor.uuid, profile, descriptorName, payload);
|
|
70
73
|
if ((0, hive_sdk_1.isInvokeError)(result)) {
|
|
71
74
|
throw new Error(`Task invocation failed: ${result.error}`);
|
|
72
75
|
}
|
|
@@ -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;
|
|
@@ -47,7 +48,7 @@ export declare const publish: import("@forgehive/task").TaskInstanceType<(argv:
|
|
|
47
48
|
}>>;
|
|
48
49
|
readFileUtf8: (filePath: string) => Promise<string>;
|
|
49
50
|
readFileBinary: (filePath: string) => Promise<Buffer>;
|
|
50
|
-
publishTask: (data: Record<string, unknown>, profile: Profile) => Promise<{
|
|
51
|
+
publishTask: (projectUuid: string, taskUuid: string, data: Record<string, unknown>, profile: Profile) => Promise<{
|
|
51
52
|
bundleUploadUrl?: string;
|
|
52
53
|
}>;
|
|
53
54
|
uploadBundleWithPresignedUrl: (presignedUrl: string, bundleContent: Buffer) => Promise<boolean>;
|
|
@@ -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;
|
|
@@ -101,7 +103,7 @@ export declare const publish: import("@forgehive/task").TaskInstanceType<(argv:
|
|
|
101
103
|
}>>;
|
|
102
104
|
readFileUtf8: (filePath: string) => Promise<string>;
|
|
103
105
|
readFileBinary: (filePath: string) => Promise<Buffer>;
|
|
104
|
-
publishTask: (data: Record<string, unknown>, profile: Profile) => Promise<{
|
|
106
|
+
publishTask: (projectUuid: string, taskUuid: string, data: Record<string, unknown>, profile: Profile) => Promise<{
|
|
105
107
|
bundleUploadUrl?: string;
|
|
106
108
|
}>;
|
|
107
109
|
uploadBundleWithPresignedUrl: (presignedUrl: string, bundleContent: Buffer) => Promise<boolean>;
|
|
@@ -38,8 +38,8 @@ const boundaries = {
|
|
|
38
38
|
readFileBinary: async (filePath) => {
|
|
39
39
|
return promises_1.default.readFile(filePath);
|
|
40
40
|
},
|
|
41
|
-
publishTask: async (data, profile) => {
|
|
42
|
-
const publishUrl = `${profile.url}/api/tasks/publish`;
|
|
41
|
+
publishTask: async (projectUuid, taskUuid, data, profile) => {
|
|
42
|
+
const publishUrl = `${profile.url}/api/projects/${projectUuid}/tasks/${taskUuid}/publish`;
|
|
43
43
|
const authToken = `${profile.apiKey}:${profile.apiSecret}`;
|
|
44
44
|
try {
|
|
45
45
|
const response = await axios_1.default.post(publishUrl, data, {
|
|
@@ -91,6 +91,13 @@ exports.publish = (0, task_1.createTask)({
|
|
|
91
91
|
if (taskDescriptor === undefined) {
|
|
92
92
|
throw new Error('Task is not defined on forge.json');
|
|
93
93
|
}
|
|
94
|
+
// Check for required UUIDs
|
|
95
|
+
if (!forgeJson.project.uuid) {
|
|
96
|
+
throw new Error('Project UUID is not defined in forge.json. Please ensure your project has a UUID.');
|
|
97
|
+
}
|
|
98
|
+
if (!taskDescriptor.uuid) {
|
|
99
|
+
throw new Error(`Task "${descriptorName}" does not have a UUID in forge.json. Please ensure your task has a UUID.`);
|
|
100
|
+
}
|
|
94
101
|
const entryPoint = path_1.default.join(cwd, taskDescriptor.path);
|
|
95
102
|
const buildsPath = await ensureBuildsFolder();
|
|
96
103
|
const outputFile = path_1.default.join(buildsPath, `${descriptorName}.js`);
|
|
@@ -101,11 +108,12 @@ exports.publish = (0, task_1.createTask)({
|
|
|
101
108
|
outputFile
|
|
102
109
|
});
|
|
103
110
|
console.log('Bundle created...');
|
|
104
|
-
// Zip the bundle
|
|
111
|
+
// Zip the bundle with forge.json included
|
|
105
112
|
await bundleZip({
|
|
106
113
|
dir: buildsPath,
|
|
107
114
|
input: `${descriptorName}.js`,
|
|
108
|
-
output: zipFile
|
|
115
|
+
output: zipFile,
|
|
116
|
+
forgeJsonPath: path_1.default.join(cwd, 'forge.json')
|
|
109
117
|
});
|
|
110
118
|
console.log('Bundle zipped...');
|
|
111
119
|
// Generate task fingerprint
|
|
@@ -158,7 +166,7 @@ exports.publish = (0, task_1.createTask)({
|
|
|
158
166
|
};
|
|
159
167
|
// Publish metadata to hive api server
|
|
160
168
|
console.log(`Publishing metadata and source code to ${profile.url}...`);
|
|
161
|
-
const publishResponse = await publishTask(data, profile);
|
|
169
|
+
const publishResponse = await publishTask(forgeJson.project.uuid, taskDescriptor.uuid, data, profile);
|
|
162
170
|
// Upload zipped bundle using the presigned URL
|
|
163
171
|
if (publishResponse.bundleUploadUrl) {
|
|
164
172
|
console.log('Uploading zipped bundle...');
|
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",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"minimist": "^1.2.8",
|
|
31
31
|
"typescript": "^5.3.3",
|
|
32
32
|
"uuid": "^11.1.0",
|
|
33
|
-
"@forgehive/record-tape": "0.2.6",
|
|
34
|
-
"@forgehive/hive-sdk": "0.1.4",
|
|
35
33
|
"@forgehive/schema": "0.1.4",
|
|
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
|
}
|
package/src/tasks/task/invoke.ts
CHANGED
|
@@ -30,6 +30,7 @@ const boundaries = {
|
|
|
30
30
|
},
|
|
31
31
|
invokeTask: async (
|
|
32
32
|
projectUuid: string,
|
|
33
|
+
taskUuid: string,
|
|
33
34
|
profile: Profile,
|
|
34
35
|
taskName: string,
|
|
35
36
|
payload: unknown
|
|
@@ -41,11 +42,11 @@ const boundaries = {
|
|
|
41
42
|
host: profile.url
|
|
42
43
|
})
|
|
43
44
|
|
|
44
|
-
console.log(`Invoking task: ${taskName}`)
|
|
45
|
+
console.log(`Invoking task: ${taskName} (${taskUuid})`)
|
|
45
46
|
console.log('Payload:', payload)
|
|
46
47
|
console.log(`Using profile: ${profile.name} (${profile.url})`)
|
|
47
48
|
|
|
48
|
-
return await client.invoke(
|
|
49
|
+
return await client.invoke(taskUuid, payload)
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -63,11 +64,15 @@ export const invoke = createTask({
|
|
|
63
64
|
throw new Error(`Task "${descriptorName}" is not defined in forge.json`)
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
// Check for
|
|
67
|
+
// Check for required UUIDs
|
|
67
68
|
if (!forge.project.uuid) {
|
|
68
69
|
throw new Error('Project UUID is not defined in forge.json. Please ensure your project has a UUID.')
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
if (!taskDescriptor.uuid) {
|
|
73
|
+
throw new Error(`Task "${descriptorName}" does not have a UUID in forge.json. Please ensure your task has a UUID.`)
|
|
74
|
+
}
|
|
75
|
+
|
|
71
76
|
// Load profile (required for invoke)
|
|
72
77
|
let profile: Profile
|
|
73
78
|
try {
|
|
@@ -80,7 +85,7 @@ export const invoke = createTask({
|
|
|
80
85
|
const payload = await parseJSON(json)
|
|
81
86
|
|
|
82
87
|
// Invoke the task using the boundary
|
|
83
|
-
const result = await invokeTask(forge.project.uuid, profile, descriptorName, payload)
|
|
88
|
+
const result = await invokeTask(forge.project.uuid, taskDescriptor.uuid, profile, descriptorName, payload)
|
|
84
89
|
|
|
85
90
|
if (isInvokeError(result)) {
|
|
86
91
|
throw new Error(`Task invocation failed: ${result.error}`)
|
|
@@ -39,8 +39,13 @@ const boundaries = {
|
|
|
39
39
|
readFileBinary: async (filePath: string): Promise<Buffer> => {
|
|
40
40
|
return fs.readFile(filePath)
|
|
41
41
|
},
|
|
42
|
-
publishTask: async (
|
|
43
|
-
|
|
42
|
+
publishTask: async (
|
|
43
|
+
projectUuid: string,
|
|
44
|
+
taskUuid: string,
|
|
45
|
+
data: Record<string, unknown>,
|
|
46
|
+
profile: Profile
|
|
47
|
+
): Promise<{ bundleUploadUrl?: string }> => {
|
|
48
|
+
const publishUrl = `${profile.url}/api/projects/${projectUuid}/tasks/${taskUuid}/publish`
|
|
44
49
|
const authToken = `${profile.apiKey}:${profile.apiSecret}`
|
|
45
50
|
|
|
46
51
|
try {
|
|
@@ -112,6 +117,15 @@ export const publish = createTask({
|
|
|
112
117
|
throw new Error('Task is not defined on forge.json')
|
|
113
118
|
}
|
|
114
119
|
|
|
120
|
+
// Check for required UUIDs
|
|
121
|
+
if (!forgeJson.project.uuid) {
|
|
122
|
+
throw new Error('Project UUID is not defined in forge.json. Please ensure your project has a UUID.')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (!taskDescriptor.uuid) {
|
|
126
|
+
throw new Error(`Task "${descriptorName}" does not have a UUID in forge.json. Please ensure your task has a UUID.`)
|
|
127
|
+
}
|
|
128
|
+
|
|
115
129
|
const entryPoint = path.join(cwd, taskDescriptor.path)
|
|
116
130
|
const buildsPath = await ensureBuildsFolder()
|
|
117
131
|
const outputFile = path.join(buildsPath, `${descriptorName}.js`)
|
|
@@ -125,11 +139,12 @@ export const publish = createTask({
|
|
|
125
139
|
|
|
126
140
|
console.log('Bundle created...')
|
|
127
141
|
|
|
128
|
-
// Zip the bundle
|
|
142
|
+
// Zip the bundle with forge.json included
|
|
129
143
|
await bundleZip({
|
|
130
144
|
dir: buildsPath,
|
|
131
145
|
input: `${descriptorName}.js`,
|
|
132
|
-
output: zipFile
|
|
146
|
+
output: zipFile,
|
|
147
|
+
forgeJsonPath: path.join(cwd, 'forge.json')
|
|
133
148
|
})
|
|
134
149
|
|
|
135
150
|
console.log('Bundle zipped...')
|
|
@@ -190,7 +205,7 @@ export const publish = createTask({
|
|
|
190
205
|
|
|
191
206
|
// Publish metadata to hive api server
|
|
192
207
|
console.log(`Publishing metadata and source code to ${profile.url}...`)
|
|
193
|
-
const publishResponse = await publishTask(data, profile)
|
|
208
|
+
const publishResponse = await publishTask(forgeJson.project.uuid, taskDescriptor.uuid, data, profile)
|
|
194
209
|
|
|
195
210
|
// Upload zipped bundle using the presigned URL
|
|
196
211
|
if (publishResponse.bundleUploadUrl) {
|