@intuned/runtime-dev 1.0.6-cli.8.1.0 → 1.0.6-cli.8.1.2

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.
@@ -12,15 +12,6 @@ _dotenv.default.config({
12
12
  });
13
13
  _commander.program.description("Deploy an Intuned project to be public").argument("[project-name]", "Name of the project to deploy").option("-w, --workspace-id <id>", "Your Intuned workspace ID").option("-k, --api-key <key>", "Your Intuned API key").action(async (projectName, options) => {
14
14
  try {
15
- const _projectName = projectName || (await (0, _utils2.getSettingIntunedJSON)("projectName"));
16
- console.log("Project name: ", _projectName);
17
- if (!_projectName) {
18
- throw new Error("Project name is required");
19
- }
20
- const projectNameValidation = (0, _utils.validateProjectName)(_projectName);
21
- if (!projectNameValidation.isValid) {
22
- throw new Error(projectNameValidation.errorMessage);
23
- }
24
15
  const {
25
16
  isValid,
26
17
  errorMessage
@@ -29,13 +20,21 @@ _commander.program.description("Deploy an Intuned project to be public").argumen
29
20
  const userErrorMesage = `Project to be deployed is not a valid Intuned project: ${errorMessage}, modify and check again`;
30
21
  throw new Error(userErrorMesage);
31
22
  }
23
+ const _projectName = projectName || (await (0, _utils2.getSettingIntunedJSON)("projectName"));
24
+ if (!_projectName) {
25
+ throw new Error("Project name is required");
26
+ }
27
+ const projectNameValidation = (0, _utils.validateProjectName)(_projectName);
28
+ if (!projectNameValidation.isValid) {
29
+ throw new Error(projectNameValidation.errorMessage);
30
+ }
32
31
  const auth = await (0, _utils2.getAuthCredentials)(options);
33
32
  const deployStarted = await (0, _utils.deployProject)(_projectName, auth);
34
33
  if (!deployStarted) {
35
34
  throw new Error("Project not deployed");
36
35
  }
37
36
  const url = `https://rauf-2.intuned-team-local.com/projects`;
38
- console.log(_chalk.default.green(`\nšŸš€ Project "${_projectName}" started deployment successfully!` + `\n\nYou can check your project on the platform: ${_chalk.default.bold(url)}\n`));
37
+ console.log(_chalk.default.green(`\nāœ… Project "${_projectName}" deployed successfully!` + `\n\nYou can check your project on the platform: ${_chalk.default.bold(url)}\n`));
39
38
  } catch (error) {
40
39
  console.error(_chalk.default.red(`\n${error.message}`));
41
40
  process.exit(1);
@@ -137,7 +137,7 @@ async function convertProjectToCodeTree(projectPath) {
137
137
  }
138
138
  return tree;
139
139
  }
140
- console.log(_chalk.default.cyan("\nBuilding project..."));
140
+ console.log(_chalk.default.cyan("\nšŸ“¦ Building project..."));
141
141
  const tree = readDirectory(projectPath);
142
142
  return tree;
143
143
  }
@@ -166,9 +166,13 @@ async function deployProject(projectName, auth) {
166
166
  body: JSON.stringify(deployProjectPayload)
167
167
  });
168
168
  if (!response.ok) {
169
+ if (response.status === 401) {
170
+ throw new Error(`Invalid API key. Please check your API key and try again.`);
171
+ }
169
172
  throw new Error(`Error deploying project`);
170
173
  }
171
174
  const startTime = Date.now();
175
+ console.log(_chalk.default.greenBright(`\nšŸš€ Deploying project...`));
172
176
  return new Promise((resolve, reject) => {
173
177
  const checkInterval = setInterval(async () => {
174
178
  try {
@@ -210,9 +214,9 @@ const validateIntunedProject = async () => {
210
214
  const validationSteps = [{
211
215
  name: "package.json",
212
216
  check: async () => {
213
- const packageJsonPath = path.join(currentDirectoryToDeploy, "package.json");
214
217
  try {
215
218
  var _packageJson$dependen;
219
+ const packageJsonPath = path.join(currentDirectoryToDeploy, "package.json");
216
220
  await fs.exists(packageJsonPath);
217
221
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, {
218
222
  encoding: "utf-8"
@@ -237,8 +241,8 @@ const validateIntunedProject = async () => {
237
241
  }, {
238
242
  name: "intuned.json",
239
243
  check: async () => {
240
- const intunedJsonPath = path.join(currentDirectoryToDeploy, "intuned.json");
241
244
  try {
245
+ const intunedJsonPath = path.join(currentDirectoryToDeploy, "intuned.json");
242
246
  await fs.exists(intunedJsonPath);
243
247
  return {
244
248
  isValid: true
@@ -253,8 +257,8 @@ const validateIntunedProject = async () => {
253
257
  }, {
254
258
  name: "api folder",
255
259
  check: async () => {
256
- const apiFolderPath = path.join(currentDirectoryToDeploy, "api");
257
260
  try {
261
+ const apiFolderPath = path.join(currentDirectoryToDeploy, "api");
258
262
  await fs.access(apiFolderPath);
259
263
  return {
260
264
  isValid: true
@@ -298,7 +302,7 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
298
302
  }
299
303
  const data = await response.json();
300
304
  if (data.status) {
301
- return data.status.name;
305
+ return data.status;
302
306
  }
303
307
  return "failed";
304
308
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.0.6-cli.8.1.0",
3
+ "version": "1.0.6-cli.8.1.2",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",