@stencil/cli 5.0.0-alpha.26 → 5.0.0-alpha.27

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/index.mjs +32 -7
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -1197,7 +1197,7 @@ async function isExistingStencilProject(dir) {
1197
1197
  }
1198
1198
  //#endregion
1199
1199
  //#region src/wizard/splash.ts
1200
- const CLI_VERSION = "5.0.0-alpha.26";
1200
+ const CLI_VERSION = "5.0.0-alpha.27";
1201
1201
  const isTTY = process.stdout.isTTY;
1202
1202
  const noColor = !isTTY || "NO_COLOR" in process.env;
1203
1203
  const RESET = noColor ? "" : "\x1B[0m";
@@ -4037,6 +4037,31 @@ function failInstallVerification(missing, rootDir) {
4037
4037
  p.log.error(`Install reported success but ${missing.join(", ")} could not be found in ${rootDir}. Your package manager may have silently failed to write to node_modules - check its logs and try again.`);
4038
4038
  process.exit(1);
4039
4039
  }
4040
+ const NPM_CONFIG_ENV_PATTERN = /^npm_config_/i;
4041
+ /**
4042
+ * `stencil init` is commonly run via `npx create-stencil` / `npm init stencil`, which means
4043
+ * this process itself is a nested child of an active npm/npx invocation. npm sets `npm_config_*`
4044
+ * env vars on every process it spawns, and a nested `npm install` inherits and gets confused by
4045
+ * the *outer* invocation's config (observed: silently reifying zero changes despite an empty
4046
+ * node_modules - see docs.npmjs.com/cli/using-npm/config and nestjs/nest-cli#153 for the same
4047
+ * class of bug). Stripping them for the duration of our own install calls forces the nested
4048
+ * npm to compute its config fresh from cwd instead of inheriting the outer process's state.
4049
+ *
4050
+ * @param fn - install call to run with a clean environment.
4051
+ * @returns whatever `fn` resolves to.
4052
+ */
4053
+ async function withoutInheritedNpmConfig(fn) {
4054
+ const saved = {};
4055
+ for (const key of Object.keys(process.env)) if (NPM_CONFIG_ENV_PATTERN.test(key)) {
4056
+ saved[key] = process.env[key];
4057
+ delete process.env[key];
4058
+ }
4059
+ try {
4060
+ return await fn();
4061
+ } finally {
4062
+ for (const [key, value] of Object.entries(saved)) process.env[key] = value;
4063
+ }
4064
+ }
4040
4065
  function outputKeysToTargets(keys) {
4041
4066
  const map = {
4042
4067
  loader: "loader-bundle",
@@ -4108,10 +4133,10 @@ async function taskInit(coreCompiler, strictConfig, loadProjectConfig) {
4108
4133
  s1.stop("Project files created");
4109
4134
  const s2 = p.spinner();
4110
4135
  s2.start("Installing dependencies");
4111
- await installDependencies({
4136
+ await withoutInheritedNpmConfig(() => installDependencies({
4112
4137
  cwd,
4113
4138
  silent: true
4114
- });
4139
+ }));
4115
4140
  s2.stop("Dependencies installed");
4116
4141
  const missingBase = await verifyInstalled(coreDir, ["@stencil/core"]);
4117
4142
  if (missingBase.length > 0) failInstallVerification(missingBase, coreDir);
@@ -4119,10 +4144,10 @@ async function taskInit(coreCompiler, strictConfig, loadProjectConfig) {
4119
4144
  const s3 = p.spinner();
4120
4145
  const pkgs = selectedIntegrations.map((i) => i.package);
4121
4146
  s3.start(`Installing ${pkgs.join(", ")}`);
4122
- await addDevDependency(withVersionRanges(pkgs), {
4147
+ await withoutInheritedNpmConfig(() => addDevDependency(withVersionRanges(pkgs), {
4123
4148
  cwd: coreDir,
4124
4149
  silent: true
4125
- });
4150
+ }));
4126
4151
  s3.stop("Integrations installed");
4127
4152
  const missingIntegrations = await verifyInstalled(coreDir, pkgs);
4128
4153
  if (missingIntegrations.length > 0) failInstallVerification(missingIntegrations, coreDir);
@@ -4185,10 +4210,10 @@ async function addCapabilities(cwd, strictConfig) {
4185
4210
  const s = p.spinner();
4186
4211
  const pkgs = toInstall.map((i) => i.package);
4187
4212
  s.start(`Installing ${pkgs.join(", ")}`);
4188
- await addDevDependency(withVersionRanges(pkgs), {
4213
+ await withoutInheritedNpmConfig(() => addDevDependency(withVersionRanges(pkgs), {
4189
4214
  cwd,
4190
4215
  silent: true
4191
- });
4216
+ }));
4192
4217
  s.stop("Dependencies installed");
4193
4218
  const missing = await verifyInstalled(cwd, pkgs);
4194
4219
  if (missing.length > 0) failInstallVerification(missing, cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/cli",
3
- "version": "5.0.0-alpha.26",
3
+ "version": "5.0.0-alpha.27",
4
4
  "description": "CLI for Stencil - Web component compiler",
5
5
  "keywords": [
6
6
  "components",
@@ -42,16 +42,16 @@
42
42
  "nypm": "^0.3.12",
43
43
  "std-env": "^3.8.0",
44
44
  "typescript": ">4.0.0 <7.0.0",
45
- "@stencil/dev-server": "5.0.0-alpha.26",
46
- "@stencil/templates": "5.0.0-alpha.26"
45
+ "@stencil/templates": "5.0.0-alpha.27",
46
+ "@stencil/dev-server": "5.0.0-alpha.27"
47
47
  },
48
48
  "devDependencies": {
49
49
  "tsdown": ">=0.21.0 <1.0.0",
50
50
  "vitest": "^4.1.7",
51
- "@stencil/core": "5.0.0-alpha.26"
51
+ "@stencil/core": "5.0.0-alpha.27"
52
52
  },
53
53
  "peerDependencies": {
54
- "@stencil/core": "^5.0.0 || 5.0.0-alpha.26"
54
+ "@stencil/core": "^5.0.0 || 5.0.0-alpha.27"
55
55
  },
56
56
  "volta": {
57
57
  "extends": "../../package.json"