@intuned/runtime-dev 1.2.0-cli.6 → 1.2.0-cli.8

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.
@@ -156,24 +156,35 @@ async function runDeployProject(projectName, auth) {
156
156
  (0, _terminal.terminal)("\n");
157
157
  const startTime = Date.now();
158
158
  let lastCheckTime = startTime;
159
- const spinner = await _terminal.terminal.spinner("dotSpinner");
160
- (0, _terminal.terminal)("\n");
159
+ let spinner = null;
160
+ if (_terminal.terminalStdout.isTTY) {
161
+ spinner = await _terminal.terminal.spinner("dotSpinner");
162
+ (0, _terminal.terminal)("\n");
163
+ } else {
164
+ (0, _terminal.terminal)(`^cDeploying ^:\n`);
165
+ }
161
166
  try {
162
167
  while (true) {
163
168
  await (0, _promises.setTimeout)(50);
164
- _terminal.terminal.previousLine(1);
165
- _terminal.terminal.column(3);
166
- _terminal.terminal.eraseLineAfter();
167
169
  const timeElapsedText = ((Date.now() - startTime) / (0, _ms.default)("1 second")).toFixed(1);
168
- (0, _terminal.terminal)(`^cDeploying ^:^K(${timeElapsedText}s)^ \n`);
170
+ if (_terminal.terminalStdout.isTTY) {
171
+ _terminal.terminal.previousLine(1);
172
+ _terminal.terminal.column(3);
173
+ _terminal.terminal.eraseLineAfter();
174
+ (0, _terminal.terminal)(`^cDeploying ^:^K(${timeElapsedText}s)^ \n`);
175
+ }
169
176
  if (Date.now() - lastCheckTime < _constants.PROJECT_DEPLOY_CHECK_PERIOD) {
170
177
  continue;
171
178
  }
179
+ if (!_terminal.terminalStdout.isTTY) {
180
+ (0, _terminal.terminal)(`^cDeploying ^:^K(${timeElapsedText}s)^ \n`);
181
+ }
172
182
  lastCheckTime = Date.now();
173
183
  const {
174
184
  status,
175
185
  message,
176
- projectId
186
+ projectId,
187
+ ...rest
177
188
  } = await checkIntunedProjectDeployStatus(workspaceId, projectName, apiKey);
178
189
  if (status === "pending") {
179
190
  const elapsedTime = Date.now() - startTime;
@@ -184,17 +195,24 @@ async function runDeployProject(projectName, auth) {
184
195
  }
185
196
  _terminal.terminal.previousLine(1);
186
197
  _terminal.terminal.eraseLine();
187
- spinner.animate(false);
198
+ spinner?.animate(false);
188
199
  if (status === "completed") {
189
200
  const url = (0, _helpers.getBaseUrl)();
190
201
  (0, _terminal.terminal)(`\n^g^+Project deployed successfully!^:\n`);
191
202
  (0, _terminal.terminal)(`^+You can check your project on the platform:^s ^c^_${url}/projects/${projectId}/details^:\n`);
192
203
  return;
193
204
  }
194
- throw new _helpers.CLIError(`^r^+An error occurred while deploying project:^:\n^R${message}^:\n^r^+Project deployment failed^:\n`);
205
+ let errorMessage = `^r^+An error occurred while deploying project:^:\n^R${message}^:\n`;
206
+ if (rest.reason) {
207
+ errorMessage += `^r^+Reason:^:\n^R${rest.reason}^:\n`;
208
+ }
209
+ errorMessage += `^r^+Project deployment failed^:\n`;
210
+ throw new _helpers.CLIError(errorMessage, {
211
+ autoColor: false
212
+ });
195
213
  }
196
214
  } catch (e) {
197
- spinner.animate(false);
215
+ spinner?.animate(false);
198
216
  }
199
217
  }
200
218
  const projectNameSchema = exports.projectNameSchema = _zod.z.string().min(1, "Project Name is required").max(50, "Name must be 50 characters or less").regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/, "Name can only contain lowercase letters, numbers, hyphens, and underscores in between").refine(value => !_zod.z.string().uuid().safeParse(value).success, {
@@ -328,11 +346,7 @@ const checkIntunedProjectDeployStatus = async (workspaceId, projectName, apiKey)
328
346
  }
329
347
  const data = await response.json();
330
348
  if (data.status) {
331
- return {
332
- status: data.status,
333
- message: data.message,
334
- projectId: data.projectId
335
- };
349
+ return data;
336
350
  }
337
351
  return {
338
352
  status: "failed",
@@ -1 +1,5 @@
1
+ /// <reference types="node" />
2
+ export declare const terminalStdout: NodeJS.WriteStream & {
3
+ fd: 2;
4
+ };
1
5
  export declare const terminal: import("terminal-kit/Terminal");
@@ -3,10 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.terminal = void 0;
6
+ exports.terminalStdout = exports.terminal = void 0;
7
7
  var _terminalKit = require("terminal-kit");
8
+ const terminalStdout = exports.terminalStdout = process.stderr;
8
9
  const terminal = exports.terminal = (0, _terminalKit.createTerminal)({
9
10
  appId: "Intuned CLI",
10
11
  appName: "Intuned CLI",
11
- stdout: process.stderr
12
+ stdout: terminalStdout
12
13
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.2.0-cli.6",
3
+ "version": "1.2.0-cli.8",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",