directus-template-cli 0.7.5 → 0.7.6

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.
@@ -11,6 +11,7 @@ export default class ApplyCommand extends BaseCommand {
11
11
  extensions: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
12
  files: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
13
  flows: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ noExit: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
15
  partial: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
16
  permissions: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
17
  programmatic: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -50,6 +50,10 @@ export default class ApplyCommand extends BaseCommand {
50
50
  default: undefined,
51
51
  description: 'Load Flows (operations, flows)',
52
52
  }),
53
+ noExit: Flags.boolean({
54
+ default: false,
55
+ hidden: true,
56
+ }),
53
57
  partial: Flags.boolean({
54
58
  dependsOn: ['programmatic'],
55
59
  description: 'Enable partial template application (all components enabled by default)',
@@ -147,7 +151,9 @@ export default class ApplyCommand extends BaseCommand {
147
151
  case 'directus-plus': {
148
152
  openUrl('https://directus.io/plus?utm_source=directus-template-cli&utm_content=apply-command');
149
153
  log.info('Redirecting to Directus website.');
150
- ux.exit(0);
154
+ if (!validatedFlags.noExit)
155
+ process.exit(0);
156
+ return;
151
157
  }
152
158
  }
153
159
  log.info(`You selected ${ux.colorize(DIRECTUS_PINK, template.templateName)}`);
@@ -214,7 +220,9 @@ export default class ApplyCommand extends BaseCommand {
214
220
  log.info(BSL_LICENSE_TEXT);
215
221
  log.info(BSL_LICENSE_CTA);
216
222
  ux.stdout('Template applied successfully.');
217
- ux.exit(0);
223
+ if (!validatedFlags.noExit)
224
+ process.exit(0);
225
+ return;
218
226
  }
219
227
  }
220
228
  /**
@@ -286,11 +294,12 @@ export default class ApplyCommand extends BaseCommand {
286
294
  }
287
295
  ux.stdout(SEPARATOR);
288
296
  ux.stdout('Template applied successfully.');
297
+ if (!validatedFlags.noExit)
298
+ process.exit(0);
289
299
  // Hide BSL license info if running programatically for now
290
300
  // log.warn(BSL_LICENSE_HEADLINE)
291
301
  // log.info(BSL_LICENSE_TEXT)
292
302
  // log.info(BSL_LICENSE_CTA)
293
- ux.exit(0);
294
303
  }
295
304
  /**
296
305
  * INTERACTIVE
@@ -1,5 +1,5 @@
1
1
  import { cancel, log as clackLog, confirm, intro, isCancel, select, text } from '@clack/prompts';
2
- import { Args, Flags, ux } from '@oclif/core';
2
+ import { Args, Flags } from '@oclif/core';
3
3
  import chalk from 'chalk';
4
4
  import { downloadTemplate } from 'giget';
5
5
  import fs from 'node:fs';
@@ -257,6 +257,6 @@ export default class InitCommand extends BaseCommand {
257
257
  });
258
258
  await shutdown();
259
259
  }
260
- ux.exit(0);
260
+ process.exit(0);
261
261
  }
262
262
  }
@@ -118,6 +118,7 @@ export async function init({ dir, flags }) {
118
118
  await ApplyCommand.run([
119
119
  `--directusUrl=${directusInfo.url || 'http://localhost:8055'}`,
120
120
  '-p',
121
+ '--noExit',
121
122
  `--userEmail=${directusInfo.email}`,
122
123
  `--userPassword=${directusInfo.password}`,
123
124
  `--templateLocation=${templatePath}`,
@@ -7,6 +7,7 @@ export interface ApplyFlags {
7
7
  extensions: boolean;
8
8
  files: boolean;
9
9
  flows: boolean;
10
+ noExit?: boolean;
10
11
  partial: boolean;
11
12
  permissions: boolean;
12
13
  programmatic: boolean;
@@ -1,6 +1,7 @@
1
1
  import { isCancel, log, password, text } from '@clack/prompts';
2
2
  import { readMe } from '@directus/sdk';
3
3
  import { ux } from '@oclif/core';
4
+ import process from 'node:process';
4
5
  import { DEFAULT_DIRECTUS_URL } from '../../lib/constants.js';
5
6
  import { api } from '../sdk.js';
6
7
  import catchError from './catch-error.js';
@@ -16,7 +17,7 @@ export async function getDirectusUrl() {
16
17
  });
17
18
  if (isCancel(directusUrl)) {
18
19
  log.info('Exiting...');
19
- ux.exit(0);
20
+ process.exit(0);
20
21
  }
21
22
  if (!directusUrl) {
22
23
  ux.warn(`No URL provided, using default: ${DEFAULT_DIRECTUS_URL}`);
@@ -42,7 +43,7 @@ export async function getDirectusToken(directusUrl) {
42
43
  });
43
44
  if (isCancel(directusToken)) {
44
45
  log.info('Exiting...');
45
- ux.exit(0);
46
+ process.exit(0);
46
47
  }
47
48
  // Validate token by fetching the user
48
49
  try {
@@ -72,7 +73,7 @@ export async function getDirectusEmailAndPassword() {
72
73
  });
73
74
  if (isCancel(userEmail)) {
74
75
  log.info('Exiting...');
75
- ux.exit(0);
76
+ process.exit(0);
76
77
  }
77
78
  const userPassword = await password({
78
79
  message: 'What is your password?',
@@ -84,7 +85,7 @@ export async function getDirectusEmailAndPassword() {
84
85
  });
85
86
  if (isCancel(userPassword)) {
86
87
  log.info('Exiting...');
87
- ux.exit(0);
88
+ process.exit(0);
88
89
  }
89
90
  return { userEmail, userPassword };
90
91
  }
@@ -67,6 +67,12 @@
67
67
  "allowNo": true,
68
68
  "type": "boolean"
69
69
  },
70
+ "noExit": {
71
+ "hidden": true,
72
+ "name": "noExit",
73
+ "allowNo": false,
74
+ "type": "boolean"
75
+ },
70
76
  "partial": {
71
77
  "dependsOn": [
72
78
  "programmatic"
@@ -395,5 +401,5 @@
395
401
  ]
396
402
  }
397
403
  },
398
- "version": "0.7.5"
404
+ "version": "0.7.6"
399
405
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus-template-cli",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "CLI Utility for applying templates to a Directus instance.",
5
5
  "author": "bryantgillespie @bryantgillespie",
6
6
  "type": "module",