extension-create 3.5.0-next.13 → 3.5.0-next.15

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.
@@ -17,7 +17,7 @@ export declare function initializingGitForRepositoryProcessError(projectName: st
17
17
  export declare function initializingGitForRepositoryError(projectName: string, error: any): string;
18
18
  export declare function installingDependencies(): string;
19
19
  export declare function installingBuildDependencies(dependencies: string[]): string;
20
- export declare function installingProjectIntegrations(integrations: string[]): string;
20
+ export declare function installingProjectIntegrations(integrations: string[]): string[];
21
21
  export declare function installingDependenciesFailed(gitCommand: string, gitArgs: string[], code: number | null): string;
22
22
  export declare function installingDependenciesProcessError(projectName: string, error: any): string;
23
23
  export declare function cantInstallDependencies(projectName: string, error: any): string;
@@ -2,6 +2,7 @@ type ProgressOptions = {
2
2
  enabled?: boolean;
3
3
  intervalMs?: number;
4
4
  width?: number;
5
+ persistLabel?: boolean;
5
6
  };
6
7
  type ProgressHandle = {
7
8
  stop: () => void;
package/dist/module.cjs CHANGED
@@ -150,13 +150,10 @@ function installingBuildDependencies(dependencies) {
150
150
  return `${statusPrefix} Installing general build dependencies...`;
151
151
  }
152
152
  function installingProjectIntegrations(integrations) {
153
- const formatList = (items)=>{
154
- if (1 === items.length) return items[0];
155
- if (2 === items.length) return `${items[0]} and ${items[1]}`;
156
- return `${items.slice(0, -1).join(', ')}, and ${items[items.length - 1]}`;
157
- };
158
- const tools = integrations.length > 0 ? formatList(integrations.map((name)=>external_pintor_default().yellow(name))) : external_pintor_default().gray('project tooling');
159
- return `${statusPrefix} Installing specialized dependencies for ${tools}...`;
153
+ if (0 === integrations.length) return [
154
+ `${statusPrefix} Installing specialized dependencies for ${external_pintor_default().gray('project tooling')}...`
155
+ ];
156
+ return integrations.map((integration)=>`${statusPrefix} Installing specialized dependencies for ${external_pintor_default().yellow(integration)}...`);
160
157
  }
161
158
  function installingDependenciesFailed(gitCommand, gitArgs, code) {
162
159
  return `${external_pintor_default().red('Error')} Command ${external_pintor_default().yellow(gitCommand)} ${external_pintor_default().yellow(gitArgs.join(' '))} failed.\n${external_pintor_default().red(`Exit code: ${external_pintor_default().yellow(String(code))}`)}\n${external_pintor_default().red('Next step: run the command manually to inspect the error.')}`;
@@ -531,7 +528,10 @@ function startProgressBar(label, options) {
531
528
  return {
532
529
  stop: ()=>{
533
530
  clearInterval(timer);
534
- if (process.stdout.isTTY) process.stdout.write(`\r${' '.repeat(lastVisibleLength)}\r`);
531
+ if (process.stdout.isTTY) {
532
+ process.stdout.write(`\r${' '.repeat(lastVisibleLength)}\r`);
533
+ if (options?.persistLabel) process.stdout.write(`${label}\n`);
534
+ }
535
535
  }
536
536
  };
537
537
  }
@@ -651,7 +651,8 @@ async function installDependencies(projectPath, projectName) {
651
651
  const installMessage = installingDependencies();
652
652
  const progressEnabled = shouldShowProgress();
653
653
  const progress = startProgressBar(installMessage, {
654
- enabled: progressEnabled
654
+ enabled: progressEnabled,
655
+ persistLabel: true
655
656
  });
656
657
  if (!progressEnabled) console.log(installMessage);
657
658
  try {
@@ -671,7 +672,8 @@ async function installDependencies(projectPath, projectName) {
671
672
  const didUpdate = shouldRetry ? await updateExtensionDependencyTag(projectPath, projectName) : false;
672
673
  if (didUpdate) {
673
674
  const retryProgress = startProgressBar(installMessage, {
674
- enabled: progressEnabled
675
+ enabled: progressEnabled,
676
+ persistLabel: true
675
677
  });
676
678
  let retryRun;
677
679
  try {
@@ -1166,7 +1168,8 @@ async function installBuildDependencies(developRoot, plan) {
1166
1168
  const installMessage = installingBuildDependencies(plan.dependencies);
1167
1169
  const progressEnabled = shouldShowProgress();
1168
1170
  const progress = startProgressBar(installMessage, {
1169
- enabled: progressEnabled
1171
+ enabled: progressEnabled,
1172
+ persistLabel: true
1170
1173
  });
1171
1174
  if (!progressEnabled) console.log(installMessage);
1172
1175
  try {
@@ -1184,23 +1187,15 @@ async function installBuildDependencies(developRoot, plan) {
1184
1187
  async function installOptionalDependencies(developRoot, plan) {
1185
1188
  if (0 === plan.dependencies.length) return;
1186
1189
  const pm = detectPackageManagerFromEnv();
1187
- const installMessage = installingProjectIntegrations(plan.integrations);
1188
- const progressEnabled = shouldShowProgress();
1189
- const progress = startProgressBar(installMessage, {
1190
- enabled: progressEnabled
1190
+ const installMessages = installingProjectIntegrations(plan.integrations);
1191
+ installMessages.forEach((message)=>console.log(message));
1192
+ const args = buildOptionalInstallArgs(pm, plan.dependencies, developRoot);
1193
+ const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
1194
+ const result = await runInstall(pm, args, {
1195
+ cwd: developRoot,
1196
+ stdio
1191
1197
  });
1192
- if (!progressEnabled) console.log(installMessage);
1193
- try {
1194
- const args = buildOptionalInstallArgs(pm, plan.dependencies, developRoot);
1195
- const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
1196
- const result = await runInstall(pm, args, {
1197
- cwd: developRoot,
1198
- stdio
1199
- });
1200
- if (0 !== result.code) throw new Error(installingDependenciesFailed(pm, args, result.code));
1201
- } finally{
1202
- progress.stop();
1203
- }
1198
+ if (0 !== result.code) throw new Error(installingDependenciesFailed(pm, args, result.code));
1204
1199
  }
1205
1200
  async function installInternalDependencies(projectPath) {
1206
1201
  if ('test' === process.env.EXTENSION_ENV || 'true' === process.env.EXTENSION_SKIP_INTERNAL_INSTALL) return;
@@ -1211,7 +1206,7 @@ async function installInternalDependencies(projectPath) {
1211
1206
  else await installBuildDependencies(developRoot, buildPlan);
1212
1207
  const optionalPlan = resolveMissingOptionalDeps(developRoot, projectPath);
1213
1208
  if (0 === optionalPlan.dependencies.length) {
1214
- if (optionalPlan.integrations.length > 0) console.log(installingProjectIntegrations(optionalPlan.integrations));
1209
+ if (optionalPlan.integrations.length > 0) installingProjectIntegrations(optionalPlan.integrations).forEach((message)=>console.log(message));
1215
1210
  } else await installOptionalDependencies(developRoot, optionalPlan);
1216
1211
  }
1217
1212
  async function extensionCreate(projectNameInput, { cliVersion, template = 'init', install = false }) {
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "dist"
24
24
  ],
25
25
  "name": "extension-create",
26
- "version": "3.5.0-next.13",
26
+ "version": "3.5.0-next.15",
27
27
  "description": "The standalone extension creation engine for Extension.js",
28
28
  "author": {
29
29
  "name": "Cezar Augusto",