fyn 1.1.32 → 1.1.33

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/fyn.js +67 -9
  2. package/package.json +1 -1
package/dist/fyn.js CHANGED
@@ -1146,7 +1146,31 @@ const defaultRc = __webpack_require__("./cli/default-rc.js");
1146
1146
 
1147
1147
  const npmConfig = __webpack_require__("./cli/config/npm-config.js");
1148
1148
 
1149
- const fynTil = __webpack_require__("./lib/util/fyntil.js");
1149
+ const fynTil = __webpack_require__("./lib/util/fyntil.js"); // replace any ${ENV} values with the appropriate environ.
1150
+ // copied from https://github.com/npm/config/blob/1f47a6c6ae7864b412d45c6a4a74930cf3365395/lib/env-replace.js
1151
+
1152
+
1153
+ const envExpr = /(?<!\\)(\\*)\$\{([^${}]+)\}/g;
1154
+
1155
+ function replaceEnv(f, env) {
1156
+ return f.replace(envExpr, (orig, esc, name) => {
1157
+ const val = env[name] !== undefined ? env[name] : `$\{${name}}`; // consume the escape chars that are relevant.
1158
+
1159
+ if (esc.length % 2) {
1160
+ return orig.slice((esc.length + 1) / 2);
1161
+ }
1162
+
1163
+ return esc.slice(esc.length / 2) + val;
1164
+ });
1165
+ }
1166
+
1167
+ function replaceRcEnv(rc, env) {
1168
+ for (const k in rc) {
1169
+ if (rc[k] && rc[k].replace) {
1170
+ rc[k] = replaceEnv(rc[k], env);
1171
+ }
1172
+ }
1173
+ }
1150
1174
 
1151
1175
  function readRc(fname) {
1152
1176
  const rcFname = Path.basename(fname);
@@ -1200,6 +1224,8 @@ function loadRc(cwd, fynpoDir) {
1200
1224
 
1201
1225
  const npmrc = _.merge.apply(_, [{}, npmConfig.defaults].concat(npmrcData));
1202
1226
 
1227
+ replaceRcEnv(all, process.env);
1228
+ replaceRcEnv(npmrc, process.env);
1203
1229
  return {
1204
1230
  all,
1205
1231
  npmrc,
@@ -4048,6 +4074,10 @@ const {
4048
4074
 
4049
4075
  const npmConfigEnv = __webpack_require__("./lib/util/npm-config-env.js");
4050
4076
 
4077
+ const {
4078
+ AggregateError
4079
+ } = __webpack_require__("./node_modules/.f/_/@jchip/error/1.0.3/@jchip/error/dist/index.js");
4080
+
4051
4081
  const readPkgJson = dir => {
4052
4082
  return fyntil.readPkgJson(dir).catch(() => {
4053
4083
  return {};
@@ -4169,7 +4199,12 @@ class LifecycleScripts {
4169
4199
  logLabel: `${pkgName} npm script ${scriptName}`,
4170
4200
  outputLabel: `${dimPkgName} npm script ${scriptName}`
4171
4201
  });
4172
- return ve.show(child);
4202
+
4203
+ try {
4204
+ return await ve.show(child);
4205
+ } catch (err) {
4206
+ throw new AggregateError([err], `Failed running npm script '${name}' for package ${pkgName} at ${pkgDir}`);
4207
+ }
4173
4208
  }
4174
4209
 
4175
4210
  }
@@ -4211,11 +4246,16 @@ const {
4211
4246
  runNpmScript
4212
4247
  } = __webpack_require__("./lib/util/run-npm-script.js");
4213
4248
 
4249
+ const {
4250
+ AggregateError
4251
+ } = __webpack_require__("./node_modules/.f/_/@jchip/error/1.0.3/@jchip/error/dist/index.js");
4252
+
4214
4253
  class LocalPkgBuilder {
4215
4254
  constructor(options) {
4216
4255
  this._options = options;
4217
4256
  this._fyn = options.fyn;
4218
4257
  this._waitItems = {};
4258
+ this._failedItems = {};
4219
4259
  }
4220
4260
 
4221
4261
  async start() {
@@ -4238,11 +4278,17 @@ class LocalPkgBuilder {
4238
4278
  } = this._options;
4239
4279
 
4240
4280
  this._promiseQ.on("doneItem", data => {
4241
- this._waitItems[data.item.fullPath].resolve();
4281
+ this._waitItems[data.item.fullPath].resolve({});
4242
4282
  });
4243
4283
 
4244
4284
  this._promiseQ.on("failItem", data => {
4245
- this._waitItems[data.item.fullPath].reject(data.error);
4285
+ const itemRes = {
4286
+ error: new AggregateError([data.error], `failed build local package at ${data.item.fullPath}`)
4287
+ };
4288
+
4289
+ this._waitItems[data.item.fullPath].resolve(itemRes);
4290
+
4291
+ this._failedItems[data.item.fullPath] = itemRes;
4246
4292
  });
4247
4293
 
4248
4294
  this._defer = xaa.makeDefer();
@@ -4254,7 +4300,7 @@ class LocalPkgBuilder {
4254
4300
  });
4255
4301
 
4256
4302
  this._promiseQ.on("fail", data => {
4257
- this._defer.reject(data.error);
4303
+ this._defer.reject(new AggregateError([data.error], `failed to build local packages`));
4258
4304
  }); //
4259
4305
  // localsByDepth is array of array: level 1 depths, level 2 packages
4260
4306
  //
@@ -4340,6 +4386,10 @@ class LocalPkgBuilder {
4340
4386
  }
4341
4387
 
4342
4388
  async processItem(item) {
4389
+ if (!_.isEmpty(this._failedItems)) {
4390
+ return;
4391
+ }
4392
+
4343
4393
  const dispPath = Path.relative(this._options.fyn._cwd, item.fullPath);
4344
4394
  const command = [process.argv[0], this._fynJs, this._fyn._options.registry && `--reg=${this._fyn._options.registry}`, "-q=d --pg=simple --no-build-local", !this._fyn._options.sourceMaps && "--no-source-maps"].filter(x => x).join(" ");
4345
4395
  const displayTitle = `building local pkg at ${dispPath}`;
@@ -6254,7 +6304,7 @@ class PkgDepResolver {
6254
6304
  }
6255
6305
 
6256
6306
  for (const name in deps) {
6257
- if (this._fyn.checkNoFynLocal(name) || !fynpo.graph.getPackageByName(name)) {
6307
+ if (this._fyn.checkNoFynLocal(name) || !fynpo.graph.getPackageByName(name) || semverUtil.checkUrl(deps[name])) {
6258
6308
  continue;
6259
6309
  } //
6260
6310
  // Check if there is a fynpo package that match 'name@semver'?
@@ -7592,6 +7642,10 @@ const {
7592
7642
 
7593
7643
  const xaa = __webpack_require__("./lib/util/xaa.js");
7594
7644
 
7645
+ const {
7646
+ AggregateError
7647
+ } = __webpack_require__("./node_modules/.f/_/@jchip/error/1.0.3/@jchip/error/dist/index.js");
7648
+
7595
7649
  const {
7596
7650
  RESOLVE_ORDER,
7597
7651
  RSEMVERS,
@@ -7968,7 +8022,11 @@ class PkgInstaller {
7968
8022
 
7969
8023
  async _buildLocalPkg(depInfo) {
7970
8024
  if (this._fyn._options.buildLocal && this._fyn._localPkgBuilder) {
7971
- await this._fyn._localPkgBuilder.waitForItem(depInfo.dir);
8025
+ const itemRes = await this._fyn._localPkgBuilder.waitForItem(depInfo.dir);
8026
+
8027
+ if (itemRes && itemRes.error) {
8028
+ throw new AggregateError([itemRes.error], `install fail because local package build failed`);
8029
+ }
7972
8030
  }
7973
8031
  }
7974
8032
 
@@ -10855,7 +10913,7 @@ function localSplit(v) {
10855
10913
 
10856
10914
 
10857
10915
  function getAsFilepath(semver) {
10858
- if (semver.startsWith("file:")) {
10916
+ if (semver.startsWith("file:") || semver.startsWith("link:")) {
10859
10917
  return semver.substr(5);
10860
10918
  }
10861
10919
 
@@ -10975,7 +11033,7 @@ function analyze(semver) {
10975
11033
  } else if (urlType === "sym1") {
10976
11034
  sv.path = semver.substr(5);
10977
11035
  sv.localType = "sym1";
10978
- } else if (urlType === "file") {
11036
+ } else if (urlType === "file" || urlType === "link") {
10979
11037
  setHardLocal(semver.substr(5));
10980
11038
  } else {
10981
11039
  sv.urlType = urlType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "1.1.32",
3
+ "version": "1.1.33",
4
4
  "description": "The package manager for fynpo, a zero setup monorepo manager",
5
5
  "main": "./bin/fyn.js",
6
6
  "homepage": "https://jchip.github.io/fynpo/",