@intuned/runtime-dev 1.0.6-cli.8.1.3 → 1.0.6-cli.8.1.4
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/bin/intuned-build-project +3 -0
- package/dist/commands/deploy/utils.d.ts +1 -0
- package/dist/commands/deploy/utils.js +47 -3
- package/dist/commands/intuned-build-project/intuned-build-project.d.ts +2 -0
- package/dist/commands/intuned-build-project/intuned-build-project.js +20 -0
- package/dist/common/cli/utils.js +1 -1
- package/package.json +1 -1
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.convertProjectToCodeTree = convertProjectToCodeTree;
|
|
7
7
|
exports.deployProject = deployProject;
|
|
8
|
-
exports.validateProjectName = exports.validateIntunedProject = void 0;
|
|
8
|
+
exports.validateProjectName = exports.validateIntunedProject = exports.runBuild = void 0;
|
|
9
9
|
var fs = _interopRequireWildcard(require("fs-extra"));
|
|
10
10
|
var path = _interopRequireWildcard(require("path"));
|
|
11
11
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
12
12
|
var _minimatch = require("minimatch");
|
|
13
13
|
var _zod = require("zod");
|
|
14
|
+
var _child_process = require("child_process");
|
|
15
|
+
var _util = require("util");
|
|
14
16
|
var _projectExclusions = _interopRequireDefault(require("../common/projectExclusions"));
|
|
15
17
|
var _constants = require("../../common/cli/constants");
|
|
16
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -23,6 +25,7 @@ function formatBytes(bytes) {
|
|
|
23
25
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
24
26
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
25
27
|
}
|
|
28
|
+
const execPromise = (0, _util.promisify)(_child_process.exec);
|
|
26
29
|
function matchesGitignorePatterns(filePath, patterns, projectPath) {
|
|
27
30
|
const relativePath = path.relative(projectPath, filePath);
|
|
28
31
|
if (relativePath.startsWith("node_modules")) {
|
|
@@ -212,6 +215,27 @@ exports.validateProjectName = validateProjectName;
|
|
|
212
215
|
const validateIntunedProject = async () => {
|
|
213
216
|
const currentDirectoryToDeploy = process.cwd();
|
|
214
217
|
const validationSteps = [{
|
|
218
|
+
name: "build",
|
|
219
|
+
check: async () => {
|
|
220
|
+
try {
|
|
221
|
+
const buildResult = await runBuild();
|
|
222
|
+
if (!buildResult) {
|
|
223
|
+
return {
|
|
224
|
+
isValid: false,
|
|
225
|
+
errorMessage: "Build failed"
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
isValid: true
|
|
230
|
+
};
|
|
231
|
+
} catch (error) {
|
|
232
|
+
return {
|
|
233
|
+
isValid: false,
|
|
234
|
+
errorMessage: "Build failed"
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}, {
|
|
215
239
|
name: "package.json",
|
|
216
240
|
check: async () => {
|
|
217
241
|
try {
|
|
@@ -298,7 +322,7 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
|
|
|
298
322
|
return "not_found";
|
|
299
323
|
}
|
|
300
324
|
if (!response.ok) {
|
|
301
|
-
throw new Error("Error
|
|
325
|
+
throw new Error("Error querying deployment status");
|
|
302
326
|
}
|
|
303
327
|
const data = await response.json();
|
|
304
328
|
if (data.status) {
|
|
@@ -308,4 +332,24 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
|
|
|
308
332
|
} catch (e) {
|
|
309
333
|
throw new Error(`Error during deployment`);
|
|
310
334
|
}
|
|
311
|
-
};
|
|
335
|
+
};
|
|
336
|
+
const runBuild = async () => {
|
|
337
|
+
const currentProjectDirectory = process.cwd();
|
|
338
|
+
console.log(_chalk.default.yellow("Running build..."));
|
|
339
|
+
const distPath = path.join(currentProjectDirectory, "dist");
|
|
340
|
+
if (await fs.exists(distPath)) {
|
|
341
|
+
await fs.remove(distPath);
|
|
342
|
+
}
|
|
343
|
+
const buildCommand = "npx tsc";
|
|
344
|
+
try {
|
|
345
|
+
await execPromise(buildCommand, {
|
|
346
|
+
cwd: currentProjectDirectory
|
|
347
|
+
});
|
|
348
|
+
console.log(_chalk.default.green("🏗️ Build completed successfully"));
|
|
349
|
+
return true;
|
|
350
|
+
} catch (error) {
|
|
351
|
+
console.error(_chalk.default.red(`Build failed: ${error.message}`));
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
exports.runBuild = runBuild;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _commander = require("commander");
|
|
5
|
+
var _dotenv = _interopRequireDefault(require("dotenv"));
|
|
6
|
+
var _utils = require("../deploy/utils");
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
_dotenv.default.config({
|
|
9
|
+
path: `.env`
|
|
10
|
+
});
|
|
11
|
+
_commander.program.name("intuned-build-project").description("Build your current Inuned project").action(async () => {
|
|
12
|
+
try {
|
|
13
|
+
await (0, _utils.runBuild)();
|
|
14
|
+
} catch (error) {
|
|
15
|
+
process.exit(1);
|
|
16
|
+
} finally {
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
_commander.program.parse(process.argv);
|
package/dist/common/cli/utils.js
CHANGED
|
@@ -14,7 +14,7 @@ async function getAuthCredentials(options) {
|
|
|
14
14
|
const workspaceId = options.workspaceId || (await getSettingIntunedJSON("workspaceId"));
|
|
15
15
|
const apiKey = options.apiKey || process.env.INTUNED_API_KEY;
|
|
16
16
|
if (!workspaceId || !workspaceId) {
|
|
17
|
-
throw new Error("Authentication details are required. Please provide them via command line options or environment variables.");
|
|
17
|
+
throw new Error("Authentication details are required. Please provide them via command line options(api key, workspace id), intuned.json(workspace id) or environment variables(api key).");
|
|
18
18
|
}
|
|
19
19
|
return {
|
|
20
20
|
workspaceId,
|