@emulsify/cli 2.4.2 → 2.5.1

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.
Files changed (39) hide show
  1. package/README.md +10 -3
  2. package/dist/handlers/cacheClear.js +5 -6
  3. package/dist/handlers/componentCreate.js +8 -8
  4. package/dist/handlers/componentEjectTemplates.js +22 -20
  5. package/dist/handlers/componentInstall.js +101 -73
  6. package/dist/handlers/componentList.js +51 -4
  7. package/dist/handlers/hofs/withEmulsifySystem.js +3 -1
  8. package/dist/handlers/hofs/withSession.js +8 -0
  9. package/dist/handlers/init.js +144 -132
  10. package/dist/handlers/systemCreate.js +31 -25
  11. package/dist/handlers/systemDetach.js +5 -5
  12. package/dist/handlers/systemInstall.js +62 -55
  13. package/dist/handlers/systemList.js +13 -2
  14. package/dist/index.js +57 -34
  15. package/dist/lib/log.js +21 -24
  16. package/dist/lib/rootHelp.js +30 -5
  17. package/dist/lib/session.js +141 -0
  18. package/dist/schemas/emulsifyProjectConfig.json +11 -0
  19. package/dist/schemas/system.json +1 -0
  20. package/dist/schemas/variant.json +8 -0
  21. package/dist/util/cache/cloneIntoCache.js +25 -8
  22. package/dist/util/cache/copyItemFromCache.js +7 -1
  23. package/dist/util/cache/getCachedItemPath.js +3 -1
  24. package/dist/util/fs/writeToJsonFile.js +4 -1
  25. package/dist/util/getGitRepoNameFromUrl.js +21 -10
  26. package/dist/util/getNonInteractiveGitEnvironment.js +1 -1
  27. package/dist/util/platform/getInitSuccessMessageForPlatform.js +15 -9
  28. package/dist/util/project/componentNpmDependencies.js +169 -0
  29. package/dist/util/project/componentNpmManifest.js +164 -0
  30. package/dist/util/project/generateComponent.js +98 -39
  31. package/dist/util/project/installComponentNpmDependencies.js +197 -0
  32. package/dist/util/project/installDependencies.js +10 -3
  33. package/dist/util/project/installGeneralAssetsFromCache.js +2 -1
  34. package/dist/util/project/resolveComponentTemplate.js +11 -1
  35. package/dist/util/project/rewriteComponentIds.js +69 -0
  36. package/dist/util/prompt/index.js +21 -6
  37. package/dist/util/system/validateSystemConfig.js +13 -27
  38. package/package.json +16 -18
  39. package/dist/handlers/hofs/withProgressBar.js +0 -10
@@ -1,7 +1,7 @@
1
1
  import { join } from 'path';
2
- import { existsSync, promises as fs } from 'fs';
2
+ import { existsSync, promises as fs, rmSync } from 'fs';
3
3
  import { simpleGit } from 'simple-git';
4
- import { input, select } from '@inquirer/prompts';
4
+ import { select, text } from '@clack/prompts';
5
5
  import { EMULSIFY_PROJECT_CONFIG_FILE, EMULSIFY_PROJECT_HOOK_INIT, EMULSIFY_PROJECT_HOOK_FOLDER, } from '../lib/constants.js';
6
6
  import getPlatformInfo from '../util/platform/getPlatformInfo.js';
7
7
  import getAvailableStarters from '../util/getAvailableStarters.js';
@@ -13,6 +13,7 @@ import executeScript from '../util/fs/executeScript.js';
13
13
  import getInitSuccessMessageForPlatform from '../util/platform/getInitSuccessMessageForPlatform.js';
14
14
  import log from '../lib/log.js';
15
15
  import CliError from '../lib/CliError.js';
16
+ import { markSessionMayHaveChanges, note, onAbort, spinner, } from '../lib/session.js';
16
17
  import { isPlatform } from '../util/platform/platformCompatibility.js';
17
18
  import { runPrompt } from '../util/prompt/index.js';
18
19
  const git = simpleGit();
@@ -20,9 +21,9 @@ export const DIRECTORY = 1;
20
21
  const DEFAULT_PROJECT_NAME = 'emulsifyTheme';
21
22
  const DEFAULT_PLATFORM = 'drupal';
22
23
  const PLATFORM_CHOICES = [
23
- 'drupal',
24
- 'wordpress',
25
- 'none',
24
+ { value: 'drupal', label: 'Drupal', hint: 'Drupal 10 or 11 theme' },
25
+ { value: 'wordpress', label: 'WordPress', hint: 'WordPress theme' },
26
+ { value: 'none', label: 'None', hint: 'standalone front end' },
26
27
  ];
27
28
  function isAlreadyExistsError(error) {
28
29
  return (error !== null &&
@@ -40,141 +41,152 @@ async function rollbackFailedInitialization(target, phase, error) {
40
41
  return new CliError(`${failure}. Automatic cleanup of the incomplete target "${target}" also failed: ${String(cleanupError)}. Remove it manually before retrying.`);
41
42
  }
42
43
  }
43
- export default function init(progress) {
44
- return async (name, targetDirectory, options) => {
45
- const { name: autoPlatformName, emulsifyParentDirectory } = (await getPlatformInfo()) || {};
46
- const isDetectedDrupalProject = autoPlatformName === 'drupal';
47
- const acceptDefaults = options?.yes === true;
48
- let projectName = name || options?.machineName;
49
- if (!projectName) {
50
- projectName = await runPrompt({
51
- prompt: () => input({
52
- message: 'Project name:',
53
- default: DEFAULT_PROJECT_NAME,
54
- }),
55
- nonInteractive: {
56
- error: 'Unable to determine the project name. Please provide a valid project name.',
57
- },
58
- accept: {
59
- when: acceptDefaults,
60
- value: DEFAULT_PROJECT_NAME,
61
- },
62
- });
63
- }
64
- if (!projectName) {
65
- throw new CliError('Unable to determine the project name. Please provide a valid project name.');
66
- }
67
- let targetParent = targetDirectory || emulsifyParentDirectory;
68
- if (!targetParent) {
69
- targetParent = await runPrompt({
70
- prompt: () => input({
71
- message: 'Target directory:',
72
- default: './',
73
- }),
74
- nonInteractive: { value: undefined },
75
- accept: { when: acceptDefaults, value: './' },
76
- });
77
- }
78
- const requestedPlatformName = options?.platform || autoPlatformName;
79
- let platformName = isPlatform(requestedPlatformName)
80
- ? requestedPlatformName
81
- : undefined;
82
- if (requestedPlatformName && !platformName) {
83
- throw new CliError(`Unsupported platform "${requestedPlatformName}". Supported platforms are "none", "drupal", and "wordpress".`);
84
- }
85
- if (!platformName) {
86
- platformName = await runPrompt({
87
- prompt: () => select({
88
- message: 'Platform:',
89
- choices: PLATFORM_CHOICES,
90
- default: DEFAULT_PLATFORM,
91
- }),
92
- nonInteractive: {
93
- error: 'Unable to determine which platform you are installing Emulsify within. Please specify a platform (such as "drupal" or "wordpress") by passing a -p or --platform flag with your init command.',
94
- },
95
- accept: { when: acceptDefaults, value: DEFAULT_PLATFORM },
96
- });
97
- }
98
- if (!platformName) {
99
- throw new CliError('Unable to determine which platform you are installing Emulsify within. Please specify a platform (such as "drupal" or "wordpress") by passing a -p or --platform flag with your init command.');
100
- }
101
- progress.tick(10, {
102
- message: `using starter for ${platformName} as the selected platform, validating config`,
44
+ export default async function init(name, targetDirectory, options) {
45
+ const { name: autoPlatformName, emulsifyParentDirectory } = (await getPlatformInfo()) || {};
46
+ const isDetectedDrupalProject = autoPlatformName === 'drupal';
47
+ const acceptDefaults = options?.yes === true;
48
+ let projectName = name || options?.machineName;
49
+ if (!projectName) {
50
+ projectName = await runPrompt({
51
+ prompt: () => text({
52
+ message: 'Project name',
53
+ placeholder: DEFAULT_PROJECT_NAME,
54
+ defaultValue: DEFAULT_PROJECT_NAME,
55
+ }),
56
+ nonInteractive: {
57
+ error: 'Unable to determine the project name. Please provide a valid project name.',
58
+ },
59
+ accept: {
60
+ when: acceptDefaults,
61
+ value: DEFAULT_PROJECT_NAME,
62
+ },
103
63
  });
104
- const machineName = options?.machineName || strToMachineName(projectName, platformName);
105
- const starters = getAvailableStarters();
106
- const starter = starters.find((s) => s.platform === platformName);
107
- const target = targetParent ? join(targetParent, machineName) : undefined;
108
- const repository = options?.starter || starter?.repository;
109
- const checkout = options?.checkout || (options?.starter ? undefined : starter?.checkout);
110
- if (!target) {
111
- throw new CliError('Unable to find a directory to put Emulsify in. Please specify a directory using the "path" argument: emulsify init myTheme ./themes');
112
- }
113
- if (!repository) {
114
- throw new CliError(`Unable to find an Emulsify starter for your project. Please specify one using the --starter flag: emulsify init myTheme --starter ${getAvailableStarters()[0].repository}`);
115
- }
116
- if (existsSync(target)) {
64
+ }
65
+ if (!projectName) {
66
+ throw new CliError('Unable to determine the project name. Please provide a valid project name.');
67
+ }
68
+ let targetParent = targetDirectory || emulsifyParentDirectory;
69
+ if (!targetParent) {
70
+ targetParent = await runPrompt({
71
+ prompt: () => text({
72
+ message: 'Target directory',
73
+ placeholder: './',
74
+ defaultValue: './',
75
+ }),
76
+ nonInteractive: { value: undefined },
77
+ accept: { when: acceptDefaults, value: './' },
78
+ });
79
+ }
80
+ const requestedPlatformName = options?.platform || autoPlatformName;
81
+ let platformName = isPlatform(requestedPlatformName)
82
+ ? requestedPlatformName
83
+ : undefined;
84
+ if (requestedPlatformName && !platformName) {
85
+ throw new CliError(`Unsupported platform "${requestedPlatformName}". Supported platforms are "none", "drupal", and "wordpress".`);
86
+ }
87
+ if (!platformName) {
88
+ platformName = await runPrompt({
89
+ prompt: () => select({
90
+ message: 'Platform',
91
+ options: [...PLATFORM_CHOICES],
92
+ initialValue: DEFAULT_PLATFORM,
93
+ }),
94
+ nonInteractive: {
95
+ error: 'Unable to determine which platform you are installing Emulsify within. Please specify a platform (such as "drupal" or "wordpress") by passing a -p or --platform flag with your init command.',
96
+ },
97
+ accept: { when: acceptDefaults, value: DEFAULT_PLATFORM },
98
+ });
99
+ }
100
+ if (!platformName) {
101
+ throw new CliError('Unable to determine which platform you are installing Emulsify within. Please specify a platform (such as "drupal" or "wordpress") by passing a -p or --platform flag with your init command.');
102
+ }
103
+ const machineName = options?.machineName || strToMachineName(projectName, platformName);
104
+ const starters = getAvailableStarters();
105
+ const starter = starters.find((s) => s.platform === platformName);
106
+ const target = targetParent ? join(targetParent, machineName) : undefined;
107
+ const repository = options?.starter || starter?.repository;
108
+ const checkout = options?.checkout || (options?.starter ? undefined : starter?.checkout);
109
+ if (!target) {
110
+ throw new CliError('Unable to find a directory to put Emulsify in. Please specify a directory using the "path" argument: emulsify init myTheme ./themes');
111
+ }
112
+ if (!repository) {
113
+ throw new CliError(`Unable to find an Emulsify starter for your project. Please specify one using the --starter flag: emulsify init myTheme --starter ${getAvailableStarters()[0].repository}`);
114
+ }
115
+ if (existsSync(target)) {
116
+ throw new CliError(`The intended target is already occupied: ${target}`);
117
+ }
118
+ try {
119
+ await fs.mkdir(target);
120
+ }
121
+ catch (error) {
122
+ if (isAlreadyExistsError(error)) {
117
123
  throw new CliError(`The intended target is already occupied: ${target}`);
118
124
  }
125
+ throw new CliError(`Unable to initialize project while creating the target directory "${target}": ${String(error)}`);
126
+ }
127
+ markSessionMayHaveChanges();
128
+ let phase = 'cloning the starter';
129
+ const progress = spinner();
130
+ const unregisterAbort = onAbort(() => {
119
131
  try {
120
- await fs.mkdir(target);
132
+ rmSync(target, { recursive: true, force: true });
121
133
  }
122
134
  catch (error) {
123
- if (isAlreadyExistsError(error)) {
124
- throw new CliError(`The intended target is already occupied: ${target}`);
125
- }
126
- throw new CliError(`Unable to initialize project while creating the target directory "${target}": ${String(error)}`);
135
+ throw new CliError(`Unable to remove the incomplete target "${target}" after cancellation: ${String(error)}. Remove it manually before retrying.`);
127
136
  }
128
- let phase = 'cloning the starter';
129
- try {
130
- progress.tick(10, { message: 'validation complete, cloning starter' });
131
- await git.clone(repository, target, checkout
132
- ? {
133
- '--branch': checkout,
134
- }
135
- : {});
136
- phase = 'reading the starter project configuration';
137
- const configPath = join(target, EMULSIFY_PROJECT_CONFIG_FILE);
138
- const starterConfig = await loadJsonFile(configPath);
139
- phase = 'writing the project configuration';
140
- await writeToJsonFile(configPath, {
141
- ...starterConfig,
142
- project: {
143
- ...starterConfig?.project,
144
- platform: platformName,
145
- name: projectName,
146
- machineName,
147
- },
148
- starter: {
149
- ...starterConfig?.starter,
150
- repository,
151
- },
152
- });
153
- progress.tick(30, {
154
- message: 'starter cloned, installing dependencies (this will take a moment)',
155
- });
156
- phase = 'installing dependencies';
157
- await installDependencies(target);
158
- progress.tick(40, {
159
- message: 'dependencies installed, executing init script',
160
- });
161
- const initPath = join(target, EMULSIFY_PROJECT_HOOK_FOLDER, EMULSIFY_PROJECT_HOOK_INIT);
162
- if (existsSync(initPath)) {
163
- phase = 'executing the starter init hook';
164
- await executeScript(initPath);
137
+ });
138
+ try {
139
+ progress.start(`Cloning ${repository}`);
140
+ await git.clone(repository, target, checkout
141
+ ? {
142
+ '--branch': checkout,
165
143
  }
166
- phase = 'removing the starter Git metadata';
167
- await fs.rm(join(target, '.git'), { recursive: true });
144
+ : {});
145
+ phase = 'reading the starter project configuration';
146
+ const configPath = join(target, EMULSIFY_PROJECT_CONFIG_FILE);
147
+ const starterConfig = await loadJsonFile(configPath);
148
+ phase = 'writing the project configuration';
149
+ await writeToJsonFile(configPath, {
150
+ ...starterConfig,
151
+ project: {
152
+ ...starterConfig?.project,
153
+ platform: platformName,
154
+ name: projectName,
155
+ machineName,
156
+ },
157
+ starter: {
158
+ ...starterConfig?.starter,
159
+ repository,
160
+ },
161
+ });
162
+ progress.message('Installing dependencies');
163
+ phase = 'installing dependencies';
164
+ await installDependencies(target);
165
+ progress.message('Running the starter init hook');
166
+ const initPath = join(target, EMULSIFY_PROJECT_HOOK_FOLDER, EMULSIFY_PROJECT_HOOK_INIT);
167
+ if (existsSync(initPath)) {
168
+ phase = 'executing the starter init hook';
169
+ await executeScript(initPath);
168
170
  }
169
- catch (e) {
170
- throw await rollbackFailedInitialization(target, phase, e);
171
+ phase = 'removing the starter Git metadata';
172
+ await fs.rm(join(target, '.git'), { recursive: true });
173
+ }
174
+ catch (e) {
175
+ progress.error(`Could not finish ${phase}`);
176
+ throw await rollbackFailedInitialization(target, phase, e);
177
+ }
178
+ finally {
179
+ unregisterAbort();
180
+ }
181
+ progress.stop(`Created ${machineName} in ${target}`);
182
+ for (const { method, message, title } of getInitSuccessMessageForPlatform(platformName, target, {
183
+ includeDrupalInstallReminder: isDetectedDrupalProject && platformName === 'drupal',
184
+ })) {
185
+ if (title) {
186
+ note(message, title);
187
+ continue;
171
188
  }
172
- progress.tick(10, {
173
- message: 'init script executed, initialization complete',
174
- });
175
- log('success', `Created an Emulsify project in ${target}.`);
176
- getInitSuccessMessageForPlatform(platformName, target, {
177
- includeDrupalInstallReminder: isDetectedDrupalProject && platformName === 'drupal',
178
- }).map(({ method, message }) => log(method, message));
179
- };
189
+ log(method, message);
190
+ }
191
+ return `${machineName} is ready`;
180
192
  }
@@ -1,9 +1,10 @@
1
- import { checkbox, confirm, input } from '@inquirer/prompts';
1
+ import { confirm, multiselect, text } from '@clack/prompts';
2
2
  import { existsSync, promises as fs } from 'fs';
3
3
  import { dirname, join, resolve } from 'path';
4
4
  import { simpleGit } from 'simple-git';
5
5
  import CliError from '../lib/CliError.js';
6
6
  import log from '../lib/log.js';
7
+ import { markSessionMayHaveChanges } from '../lib/session.js';
7
8
  import { EMULSIFY_SYSTEM_CONFIG_FILE } from '../lib/constants.js';
8
9
  import strToMachineName from '../util/strToMachineName.js';
9
10
  import safeResolveWithin from '../util/fs/safeResolveWithin.js';
@@ -15,14 +16,10 @@ import validateSystemConfig from '../util/system/validateSystemConfig.js';
15
16
  const DEFAULT_SYSTEM_NAME = 'custom-system';
16
17
  const DEFAULT_TARGET_DIRECTORY = './';
17
18
  const DEFAULT_PLATFORM = 'none';
18
- const PLATFORM_CHOICES = [
19
- {
20
- name: 'Generic / no platform',
21
- value: 'none',
22
- checked: true,
23
- },
24
- { name: 'Drupal', value: 'drupal' },
25
- { name: 'WordPress', value: 'wordpress' },
19
+ const PLATFORM_OPTIONS = [
20
+ { value: 'none', label: 'Generic / no platform' },
21
+ { value: 'drupal', label: 'Drupal' },
22
+ { value: 'wordpress', label: 'WordPress' },
26
23
  ];
27
24
  export function normalizeSystemName(name) {
28
25
  const trimmedName = name?.trim() || '';
@@ -34,8 +31,8 @@ export function normalizeSystemName(name) {
34
31
  }
35
32
  function validatePromptedSystemName(name) {
36
33
  try {
37
- normalizeSystemName(name);
38
- return true;
34
+ normalizeSystemName(name || DEFAULT_SYSTEM_NAME);
35
+ return undefined;
39
36
  }
40
37
  catch (error) {
41
38
  return error instanceof Error ? error.message : String(error);
@@ -106,9 +103,10 @@ export default async function systemCreate(name, options = {}) {
106
103
  let requestedName = name?.trim();
107
104
  if (!requestedName) {
108
105
  requestedName = await runPrompt({
109
- prompt: () => input({
110
- message: 'System name:',
111
- default: DEFAULT_SYSTEM_NAME,
106
+ prompt: () => text({
107
+ message: 'System name',
108
+ placeholder: DEFAULT_SYSTEM_NAME,
109
+ defaultValue: DEFAULT_SYSTEM_NAME,
112
110
  validate: validatePromptedSystemName,
113
111
  }),
114
112
  nonInteractive: {
@@ -121,10 +119,13 @@ export default async function systemCreate(name, options = {}) {
121
119
  let targetParent = options.directory?.trim();
122
120
  if (!targetParent) {
123
121
  targetParent = await runPrompt({
124
- prompt: () => input({
125
- message: 'Target directory:',
126
- default: DEFAULT_TARGET_DIRECTORY,
127
- validate: (value) => value.trim().length > 0 || 'Target directory cannot be empty.',
122
+ prompt: () => text({
123
+ message: 'Target directory',
124
+ placeholder: DEFAULT_TARGET_DIRECTORY,
125
+ defaultValue: DEFAULT_TARGET_DIRECTORY,
126
+ validate: (value) => !value || value.trim().length > 0
127
+ ? undefined
128
+ : 'Target directory cannot be empty.',
128
129
  }),
129
130
  nonInteractive: {
130
131
  error: 'Target directory is required in non-interactive mode. Pass --directory <directory> or use --yes.',
@@ -137,16 +138,20 @@ export default async function systemCreate(name, options = {}) {
137
138
  : undefined;
138
139
  if (!platform) {
139
140
  const platforms = await runPrompt({
140
- prompt: () => checkbox({
141
- message: 'Platform targets:',
142
- choices: PLATFORM_CHOICES,
143
- validate: (values) => values.length > 0 || 'Select at least one platform target.',
141
+ prompt: () => multiselect({
142
+ message: 'Platform targets',
143
+ options: PLATFORM_OPTIONS,
144
+ initialValues: [DEFAULT_PLATFORM],
145
+ required: true,
144
146
  }),
145
147
  nonInteractive: {
146
148
  error: 'A platform target is required in non-interactive mode. Pass --platform <platform-expression> or use --yes.',
147
149
  },
148
150
  accept: { when: acceptDefaults, value: [DEFAULT_PLATFORM] },
149
151
  });
152
+ if (platforms.length === 0) {
153
+ throw new CliError('Select at least one platform target.');
154
+ }
150
155
  platform = normalizeRequestedPlatform(platforms.join(' || '));
151
156
  }
152
157
  let initializeGit = options.git;
@@ -154,7 +159,7 @@ export default async function systemCreate(name, options = {}) {
154
159
  initializeGit = await runPrompt({
155
160
  prompt: () => confirm({
156
161
  message: 'Initialize a Git repository?',
157
- default: true,
162
+ initialValue: true,
158
163
  }),
159
164
  nonInteractive: {
160
165
  error: 'Git initialization choice is required in non-interactive mode. Pass --git or --no-git, or use --yes.',
@@ -188,9 +193,10 @@ export default async function systemCreate(name, options = {}) {
188
193
  ];
189
194
  if (dryRun) {
190
195
  logDryRun(target, targetExists, platform, initializeGit, plannedDestinations);
191
- return;
196
+ return 'Dry run complete';
192
197
  }
193
198
  try {
199
+ markSessionMayHaveChanges();
194
200
  await fs.mkdir(dirname(target), { recursive: true });
195
201
  try {
196
202
  await fs.mkdir(target, { recursive: false });
@@ -215,8 +221,8 @@ export default async function systemCreate(name, options = {}) {
215
221
  }
216
222
  throw new CliError(`Unable to create the system in ${target}: ${getErrorMessage(error)}`);
217
223
  }
218
- log('success', `Created the ${systemName} system in ${target}.`);
219
224
  if (initializeGit) {
220
225
  log('info', 'Git was initialized on branch main. Review the generated metadata, then commit the scaffold before installing it.');
221
226
  }
227
+ return `Created the ${systemName} system in ${target}.`;
222
228
  }
@@ -1,4 +1,4 @@
1
- import { confirm } from '@inquirer/prompts';
1
+ import { confirm } from '@clack/prompts';
2
2
  import CliError from '../lib/CliError.js';
3
3
  import log from '../lib/log.js';
4
4
  import getGitRepoNameFromUrl from '../util/getGitRepoNameFromUrl.js';
@@ -6,6 +6,7 @@ import getEmulsifyConfig from '../util/project/getEmulsifyConfig.js';
6
6
  import unsetEmulsifyConfig from '../util/project/unsetEmulsifyConfig.js';
7
7
  import { runPrompt } from '../util/prompt/index.js';
8
8
  const CONFIGURED_SYSTEM_LABEL = 'configured component system';
9
+ const DECLINED_SUMMARY = 'System detach cancelled. No project files were changed.';
9
10
  function getSystemLabel(repository) {
10
11
  try {
11
12
  const name = getGitRepoNameFromUrl(repository);
@@ -28,7 +29,7 @@ export default async function systemDetach({ yes = false, } = {}) {
28
29
  const confirmed = await runPrompt({
29
30
  prompt: () => confirm({
30
31
  message: `Detach the ${systemReference} from this project? Component files will be left in place.`,
31
- default: false,
32
+ initialValue: false,
32
33
  }),
33
34
  nonInteractive: {
34
35
  error: 'System detachment requires confirmation in non-interactive mode. Pass --yes to detach the configured system.',
@@ -36,8 +37,7 @@ export default async function systemDetach({ yes = false, } = {}) {
36
37
  accept: { when: yes, value: true },
37
38
  });
38
39
  if (!confirmed) {
39
- log('info', 'System detach cancelled. No project files were changed.');
40
- return;
40
+ return DECLINED_SUMMARY;
41
41
  }
42
42
  try {
43
43
  await unsetEmulsifyConfig('system', 'variant');
@@ -45,6 +45,6 @@ export default async function systemDetach({ yes = false, } = {}) {
45
45
  catch {
46
46
  throw new CliError('Unable to detach the configured system from project.emulsify.json.');
47
47
  }
48
- log('success', `Detached the ${systemReference}. All component files were left in place.`);
49
48
  log('info', 'Next: run "emulsify system create" to scaffold your own system repository, then replace its example content with the components preserved in this project.');
49
+ return `Detached the ${systemReference}. All component files were left in place.`;
50
50
  }