@intuned/runtime-dev 1.0.6-cli.8.2.3 → 1.0.6-cli.8.2.5
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/commands/common/projectExclusions.js +1 -1
- package/dist/commands/deploy/deploy.js +8 -4
- package/dist/commands/deploy/utils.d.ts +5 -1
- package/dist/commands/deploy/utils.js +30 -41
- package/dist/common/cli/constants.d.ts +4 -0
- package/dist/common/cli/constants.js +4 -0
- package/package.json +1 -1
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
const exclusions = ["node_modules/**", ".git/**", "dist/**", "build/**", "coverage/**", ".next/**", ".cache/**", "out/**", "tmp/**", ".DS_Store", "npm-debug.log*", "yarn-debug.log*", "yarn-error.log*", ".env", ".env.*", "**/*.map", "**/*.tsbuildinfo", "tsconfig.json"];
|
|
7
|
+
const exclusions = ["node_modules/**", ".git/**", "dist/**", "build/**", "coverage/**", ".next/**", ".cache/**", "out/**", "tmp/**", ".DS_Store", "npm-debug.log*", "yarn-debug.log*", "yarn-error.log*", ".env", ".env.*", "**/*.map", "**/*.tsbuildinfo", "tsconfig.json", "parameters/**", "output/**"];
|
|
8
8
|
var _default = exports.default = exclusions;
|
|
@@ -29,12 +29,16 @@ _commander.program.description("Deploy an Intuned project to be public").argumen
|
|
|
29
29
|
throw new Error(projectNameValidation.errorMessage);
|
|
30
30
|
}
|
|
31
31
|
const auth = await (0, _utils2.getAuthCredentials)(options);
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const {
|
|
33
|
+
deployDone,
|
|
34
|
+
projectId,
|
|
35
|
+
deployErrorMessage
|
|
36
|
+
} = await (0, _utils.deployProject)(_projectName, auth);
|
|
37
|
+
if (!deployDone) {
|
|
38
|
+
throw new Error(`Project not deployed: ${deployErrorMessage}`);
|
|
35
39
|
}
|
|
36
40
|
const url = process.env.DOMAIN || `https://app.intuned.io`;
|
|
37
|
-
console.log(_chalk.default.green(`\n✅ Project "${_projectName}" deployed successfully!` + `\n\nYou can check your project on the platform: ${_chalk.default.bold(`${url}/projects`)}\n`));
|
|
41
|
+
console.log(_chalk.default.green(`\n✅ Project "${_projectName}" deployed successfully!` + `\n\nYou can check your project on the platform: ${_chalk.default.bold(`${url}/projects/${projectId}/details`)}\n`));
|
|
38
42
|
} catch (error) {
|
|
39
43
|
console.error(_chalk.default.red(`\n${error.message}`));
|
|
40
44
|
process.exit(1);
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { AuthCredentials, FileSystemTree } from "../../common/cli/types";
|
|
2
2
|
export declare function convertProjectToCodeTree(projectPath: string): Promise<FileSystemTree>;
|
|
3
|
-
export declare function deployProject(projectName: string, auth: AuthCredentials): Promise<
|
|
3
|
+
export declare function deployProject(projectName: string, auth: AuthCredentials): Promise<{
|
|
4
|
+
deployDone: boolean;
|
|
5
|
+
projectId: string;
|
|
6
|
+
deployErrorMessage?: string;
|
|
7
|
+
}>;
|
|
4
8
|
export declare const validateProjectName: (projectName: string) => {
|
|
5
9
|
isValid: boolean;
|
|
6
10
|
errorMessage?: string;
|
|
@@ -18,13 +18,6 @@ var _constants = require("../../common/cli/constants");
|
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
-
function formatBytes(bytes) {
|
|
22
|
-
if (bytes === 0) return "0 Bytes";
|
|
23
|
-
const k = 1024;
|
|
24
|
-
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
25
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
26
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
27
|
-
}
|
|
28
21
|
const execPromise = (0, _util.promisify)(_child_process.exec);
|
|
29
22
|
function matchesGitignorePatterns(filePath, patterns, projectPath) {
|
|
30
23
|
const relativePath = path.relative(projectPath, filePath);
|
|
@@ -72,42 +65,17 @@ function listFilesNotIgnored(projectPath, ignorePatterns) {
|
|
|
72
65
|
return results;
|
|
73
66
|
}
|
|
74
67
|
async function convertProjectToCodeTree(projectPath) {
|
|
75
|
-
|
|
76
|
-
let currentDir = path.normalize(projectPath);
|
|
77
|
-
while (currentDir !== path.parse(currentDir).root) {
|
|
78
|
-
const gitignorePath = path.join(currentDir, ".gitignore");
|
|
79
|
-
if (fs.existsSync(gitignorePath)) {
|
|
80
|
-
const gitignoreContent = fs.readFileSync(gitignorePath, "utf-8").split("\n");
|
|
81
|
-
ignorePatterns = [...ignorePatterns, ...gitignoreContent];
|
|
82
|
-
console.log(`Found .gitignore file: ${_chalk.default.cyan.bold(gitignorePath)}`);
|
|
83
|
-
break;
|
|
84
|
-
} else {
|
|
85
|
-
currentDir = path.dirname(currentDir);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const filesToDeploy = listFilesNotIgnored(projectPath, ignorePatterns);
|
|
89
|
-
let totalSize = 0;
|
|
90
|
-
for (const file of filesToDeploy) {
|
|
91
|
-
try {
|
|
92
|
-
const stats = fs.statSync(path.join(projectPath, file));
|
|
93
|
-
totalSize += stats.size;
|
|
94
|
-
} catch (error) {}
|
|
95
|
-
}
|
|
68
|
+
const filesToDeploy = listFilesNotIgnored(projectPath, _projectExclusions.default);
|
|
96
69
|
console.log(_chalk.default.cyan("\nFiles to be deployed:"));
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
} else {
|
|
100
|
-
const filesToDeployText = "\n " + filesToDeploy.join("\n ");
|
|
101
|
-
console.log(filesToDeployText);
|
|
102
|
-
}
|
|
103
|
-
console.log(_chalk.default.cyan(`\nSummary: ${filesToDeploy.length} files, ${formatBytes(totalSize)}`));
|
|
70
|
+
const filesToDeployText = "\n " + filesToDeploy.join("\n ");
|
|
71
|
+
console.log(filesToDeployText);
|
|
104
72
|
function readDirectory(dirPath) {
|
|
105
73
|
const tree = {};
|
|
106
74
|
try {
|
|
107
75
|
const entries = fs.readdirSync(dirPath);
|
|
108
76
|
for (const entry of entries) {
|
|
109
77
|
const entryPath = path.join(dirPath, entry);
|
|
110
|
-
if (matchesGitignorePatterns(entryPath,
|
|
78
|
+
if (matchesGitignorePatterns(entryPath, _projectExclusions.default, projectPath)) {
|
|
111
79
|
continue;
|
|
112
80
|
}
|
|
113
81
|
try {
|
|
@@ -179,10 +147,21 @@ async function deployProject(projectName, auth) {
|
|
|
179
147
|
return new Promise((resolve, reject) => {
|
|
180
148
|
const checkInterval = setInterval(async () => {
|
|
181
149
|
try {
|
|
182
|
-
const
|
|
150
|
+
const {
|
|
151
|
+
status,
|
|
152
|
+
message,
|
|
153
|
+
result
|
|
154
|
+
} = await checkIntunedProjectDeployStatus(workspaceId, projectName, apiKey);
|
|
183
155
|
if (status === "completed" || status === "failed" || status === "not_found") {
|
|
184
156
|
clearInterval(checkInterval);
|
|
185
|
-
resolve(status === "completed"
|
|
157
|
+
resolve(status === "completed" ? {
|
|
158
|
+
deployDone: true,
|
|
159
|
+
projectId: result.projectId
|
|
160
|
+
} : {
|
|
161
|
+
deployDone: false,
|
|
162
|
+
projectId: "",
|
|
163
|
+
deployErrorMessage: message
|
|
164
|
+
});
|
|
186
165
|
}
|
|
187
166
|
const elapsedTime = Date.now() - startTime;
|
|
188
167
|
if (elapsedTime > _constants.PROJECT_DEPLOY_TIMEOUT) {
|
|
@@ -319,16 +298,26 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
|
|
|
319
298
|
method: "GET"
|
|
320
299
|
});
|
|
321
300
|
if (response.status === 404) {
|
|
322
|
-
return
|
|
301
|
+
return {
|
|
302
|
+
status: "not_found",
|
|
303
|
+
message: "Project not found"
|
|
304
|
+
};
|
|
323
305
|
}
|
|
324
306
|
if (!response.ok) {
|
|
325
307
|
throw new Error("Error querying deployment status");
|
|
326
308
|
}
|
|
327
309
|
const data = await response.json();
|
|
328
310
|
if (data.status) {
|
|
329
|
-
return
|
|
311
|
+
return {
|
|
312
|
+
status: data.status,
|
|
313
|
+
message: data.message,
|
|
314
|
+
result: data.result
|
|
315
|
+
};
|
|
330
316
|
}
|
|
331
|
-
return
|
|
317
|
+
return {
|
|
318
|
+
status: "failed",
|
|
319
|
+
message: `Deployment failed, please try again: ${data.message}`
|
|
320
|
+
};
|
|
332
321
|
} catch (e) {
|
|
333
322
|
throw new Error(`Error during deployment`);
|
|
334
323
|
}
|
|
@@ -2,6 +2,10 @@ export declare const CURRENT_PLAYWRIGHT_VERSION = "1.44.1";
|
|
|
2
2
|
export declare const ProjectDeploymentStatus: string[];
|
|
3
3
|
export declare const PROJECT_DEPLOY_TIMEOUT = 600000;
|
|
4
4
|
export declare const userCLIScripts: {
|
|
5
|
+
build: string;
|
|
6
|
+
"types-check": string;
|
|
7
|
+
"pre-publish": string;
|
|
8
|
+
start: string;
|
|
5
9
|
"intuned-run": string;
|
|
6
10
|
"intuned-build": string;
|
|
7
11
|
"intuned-deploy": string;
|
|
@@ -8,6 +8,10 @@ const CURRENT_PLAYWRIGHT_VERSION = exports.CURRENT_PLAYWRIGHT_VERSION = "1.44.1"
|
|
|
8
8
|
const ProjectDeploymentStatus = exports.ProjectDeploymentStatus = ["completed", "failed", "pending", "not_found"];
|
|
9
9
|
const PROJECT_DEPLOY_TIMEOUT = exports.PROJECT_DEPLOY_TIMEOUT = 600000;
|
|
10
10
|
const userCLIScripts = exports.userCLIScripts = {
|
|
11
|
+
build: "intuned-build",
|
|
12
|
+
"types-check": "intuned-ts-check",
|
|
13
|
+
"pre-publish": "intuned-ts-check && intuned-build",
|
|
14
|
+
start: "node ./output/bundle_v2.js",
|
|
11
15
|
"intuned-run": "intuned-run",
|
|
12
16
|
"intuned-build": "intuned-build-project",
|
|
13
17
|
"intuned-deploy": "intuned-deploy"
|