extension-create 3.6.3 → 3.7.0

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 (2) hide show
  1. package/dist/module.cjs +20 -104
  2. package/package.json +1 -1
package/dist/module.cjs CHANGED
@@ -506,52 +506,6 @@ async function overridePackageJson(projectPath, projectName, { template: _templa
506
506
  throw error;
507
507
  }
508
508
  }
509
- function clearLine() {
510
- if (!process.stdout.isTTY) return;
511
- process.stdout.write('\r');
512
- process.stdout.write('\x1b[2K');
513
- }
514
- function stripAnsi(input) {
515
- return input.replace(/\x1b\[[0-9;]*m/g, '');
516
- }
517
- function shouldShowProgress() {
518
- return Boolean(process.stdout.isTTY) && !process.env.CI;
519
- }
520
- function startProgressBar(label, options) {
521
- const enabled = (options?.enabled ?? true) && shouldShowProgress();
522
- if (!enabled) return {
523
- stop: ()=>void 0
524
- };
525
- const width = Math.max(10, options?.width ?? 24);
526
- const intervalMs = Math.max(50, options?.intervalMs ?? 90);
527
- let tick = 0;
528
- let lastVisibleLength = 0;
529
- const render = ()=>{
530
- const filled = tick % (width + 1);
531
- const empty = width - filled;
532
- const bar = `[${'='.repeat(filled)}${' '.repeat(empty)}]`;
533
- const line = `${label} ${bar}`;
534
- lastVisibleLength = stripAnsi(line).length;
535
- clearLine();
536
- process.stdout.write(line);
537
- tick = (tick + 1) % (width + 1);
538
- };
539
- render();
540
- const timer = setInterval(render, intervalMs);
541
- return {
542
- stop: ()=>{
543
- clearInterval(timer);
544
- if (process.stdout.isTTY) {
545
- clearLine();
546
- if (lastVisibleLength > 0) {
547
- process.stdout.write(' '.repeat(lastVisibleLength));
548
- process.stdout.write('\r');
549
- }
550
- if (options?.persistLabel) process.stdout.write(`${label}\n`);
551
- }
552
- }
553
- };
554
- }
555
509
  const external_cross_spawn_namespaceObject = require("cross-spawn");
556
510
  function buildExecEnv() {
557
511
  if ('win32' !== process.platform) return;
@@ -652,38 +606,19 @@ async function installDependencies(projectPath, projectName) {
652
606
  const command = await getInstallCommand();
653
607
  const dependenciesArgs = getInstallArgs();
654
608
  const installMessage = installingDependencies();
655
- const progressEnabled = shouldShowProgress();
656
- const progress = startProgressBar(installMessage, {
657
- enabled: progressEnabled,
658
- persistLabel: true
659
- });
660
- if (!progressEnabled) console.log(installMessage);
609
+ console.log(installMessage);
661
610
  try {
662
611
  await external_fs_namespaceObject.promises.mkdir(nodeModulesPath, {
663
612
  recursive: true
664
613
  });
665
614
  const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'pipe';
666
- let firstRun;
667
- try {
668
- firstRun = await install_dependencies_runInstall(command, dependenciesArgs, projectPath, stdio);
669
- } finally{
670
- progress.stop();
671
- }
615
+ const firstRun = await install_dependencies_runInstall(command, dependenciesArgs, projectPath, stdio);
672
616
  if (0 !== firstRun.code) {
673
617
  const output = `${firstRun.stdout}\n${firstRun.stderr}`;
674
618
  const shouldRetry = shouldRetryWithTagFallback(output);
675
619
  const didUpdate = shouldRetry ? await updateExtensionDependencyTag(projectPath, projectName) : false;
676
620
  if (didUpdate) {
677
- const retryProgress = startProgressBar(installMessage, {
678
- enabled: progressEnabled,
679
- persistLabel: true
680
- });
681
- let retryRun;
682
- try {
683
- retryRun = await install_dependencies_runInstall(command, dependenciesArgs, projectPath, stdio);
684
- } finally{
685
- retryProgress.stop();
686
- }
621
+ const retryRun = await install_dependencies_runInstall(command, dependenciesArgs, projectPath, stdio);
687
622
  if (0 === retryRun.code) return;
688
623
  }
689
624
  throw new Error(installingDependenciesFailed(command, dependenciesArgs, firstRun.code));
@@ -1183,29 +1118,19 @@ async function installBuildDependencies(developRoot, plan) {
1183
1118
  if (0 === plan.dependencies.length) return;
1184
1119
  const pm = detectPackageManagerFromEnv();
1185
1120
  const installMessage = installingBuildDependencies(plan.dependencies);
1186
- const progressEnabled = shouldShowProgress();
1187
- const progress = startProgressBar(installMessage, {
1188
- enabled: progressEnabled,
1189
- persistLabel: true
1121
+ console.log(installMessage);
1122
+ const args = buildBuildInstallArgs(pm, plan.dependencies, plan.dependencyMap);
1123
+ const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
1124
+ const result = await runInstall(pm, args, {
1125
+ cwd: developRoot,
1126
+ stdio
1190
1127
  });
1191
- if (!progressEnabled) console.log(installMessage);
1192
- try {
1193
- const args = buildBuildInstallArgs(pm, plan.dependencies, plan.dependencyMap);
1194
- const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
1195
- const result = await runInstall(pm, args, {
1196
- cwd: developRoot,
1197
- stdio
1198
- });
1199
- if (0 !== result.code) throw new Error(installingDependenciesFailed(pm, args, result.code));
1200
- } finally{
1201
- progress.stop();
1202
- }
1128
+ if (0 !== result.code) throw new Error(installingDependenciesFailed(pm, args, result.code));
1203
1129
  }
1204
1130
  async function installOptionalDependencies(developRoot, projectPath, plan) {
1205
1131
  if (0 === plan.dependencies.length) return;
1206
1132
  const pm = detectPackageManagerFromEnv();
1207
1133
  const stdio = 'development' === process.env.EXTENSION_ENV ? 'inherit' : 'ignore';
1208
- const progressEnabled = shouldShowProgress();
1209
1134
  console.log(foundSpecializedDependencies(plan.integrations.length));
1210
1135
  for (const [index, integration] of plan.integrations.entries()){
1211
1136
  const missingDeps = plan.dependenciesByIntegration[integration] || [];
@@ -1213,25 +1138,16 @@ async function installOptionalDependencies(developRoot, projectPath, plan) {
1213
1138
  integration
1214
1139
  ]);
1215
1140
  const installMessage = baseMessage.replace('►►► ', `►►► [${index + 1}/${plan.integrations.length}] `);
1216
- const progress = startProgressBar(installMessage, {
1217
- enabled: progressEnabled,
1218
- persistLabel: true
1219
- });
1220
- if (!progressEnabled) console.log(installMessage);
1221
- try {
1222
- if (0 === missingDeps.length) continue;
1223
- for (const dep of missingDeps){
1224
- const args = buildOptionalInstallArgs(pm, [
1225
- dep
1226
- ], developRoot);
1227
- const result = await runInstall(pm, args, {
1228
- cwd: developRoot,
1229
- stdio
1230
- });
1231
- if (0 !== result.code) throw new Error(installingDependenciesFailed(pm, args, result.code));
1232
- }
1233
- } finally{
1234
- progress.stop();
1141
+ console.log(installMessage);
1142
+ if (0 !== missingDeps.length) for (const dep of missingDeps){
1143
+ const args = buildOptionalInstallArgs(pm, [
1144
+ dep
1145
+ ], developRoot);
1146
+ const result = await runInstall(pm, args, {
1147
+ cwd: developRoot,
1148
+ stdio
1149
+ });
1150
+ if (0 !== result.code) throw new Error(installingDependenciesFailed(pm, args, result.code));
1235
1151
  }
1236
1152
  }
1237
1153
  }
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "dist"
24
24
  ],
25
25
  "name": "extension-create",
26
- "version": "3.6.3",
26
+ "version": "3.7.0",
27
27
  "description": "The standalone extension creation engine for Extension.js",
28
28
  "author": {
29
29
  "name": "Cezar Augusto",