fyn 1.1.15 → 1.1.19

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 +288 -99
  2. package/package.json +2 -2
package/dist/fyn.js CHANGED
@@ -973,7 +973,9 @@ class FynCli {
973
973
  } // run npm scripts from fynpo, with lifecycle scripts added
974
974
 
975
975
 
976
- const fynpoNpmScripts = addNpmLifecycle(_.without(this.fyn._runNpm, ...npmInstallScripts), pkgScripts);
976
+ const _runNpm = this.fyn._runNpm.map(s => Array.isArray(s) ? s.find(s1 => pkgScripts[s1] !== undefined) : s);
977
+
978
+ const fynpoNpmScripts = addNpmLifecycle(_.without(_runNpm, ...npmInstallScripts), pkgScripts);
977
979
 
978
980
  if (fynpoNpmScripts.length > 0) {
979
981
  await runNpmScript({
@@ -2921,7 +2923,7 @@ const semverUtil = __webpack_require__("./lib/util/semver.js");
2921
2923
 
2922
2924
  const Fs = __webpack_require__("./lib/util/file-ops.js");
2923
2925
 
2924
- const fyntil = __webpack_require__("./lib/util/fyntil.js");
2926
+ const fynTil = __webpack_require__("./lib/util/fyntil.js");
2925
2927
 
2926
2928
  const FynCentral = __webpack_require__("./lib/fyn-central.js");
2927
2929
 
@@ -2978,7 +2980,7 @@ class Fyn {
2978
2980
  const options = this._options = fynConfig(opts);
2979
2981
  this._layout = options.layout;
2980
2982
  this._cwd = options.cwd || process.cwd();
2981
- logger.debug(`fyn options`, JSON.stringify(fyntil.removeAuthInfo(options)));
2983
+ logger.debug(`fyn options`, JSON.stringify(fynTil.removeAuthInfo(options)));
2982
2984
  this.localPkgWithNestedDep = [];
2983
2985
 
2984
2986
  if (options.lockTime) {
@@ -3069,13 +3071,21 @@ class Fyn {
3069
3071
  if (this._installConfig.centralDir) {
3070
3072
  centralDir = this._installConfig.centralDir;
3071
3073
  logger.debug(`Enabling central store using dir from install config ${centralDir}`);
3072
- } else if (process.env.FYN_CENTRAL_DIR) {
3074
+ } else if (centralDir = process.env.FYN_CENTRAL_DIR) {
3073
3075
  // env wins
3074
- centralDir = process.env.FYN_CENTRAL_DIR;
3075
- logger.debug(`Enabling central store using dir from env FYN_CENTRAL_DIR ${centralDir}`);
3076
+ if (fynTil.strToBool(centralDir) === false) {
3077
+ logger.debug(`Disabling central store by env FYN_CENTRAL_DIR set to ${centralDir}`);
3078
+ return this._central = false;
3079
+ }
3080
+
3081
+ if (fynTil.isTrueStr(centralDir)) {
3082
+ centralDir = Path.join(this.fynDir, "_central-storage");
3083
+ }
3084
+
3085
+ logger.debug(`Enabling central store by env FYN_CENTRAL_DIR using dir ${centralDir}`);
3076
3086
  } else if (options.centralStore) {
3077
3087
  centralDir = Path.join(this.fynDir, "_central-storage");
3078
- logger.debug(`Enabling central store for flag using dir ${centralDir}`);
3088
+ logger.debug(`Enabling central store by CLI flag using dir ${centralDir}`);
3079
3089
  } else if (!this._fynpo.config) {
3080
3090
  return this._central = false;
3081
3091
  } else {
@@ -3085,7 +3095,7 @@ class Fyn {
3085
3095
  centralDir = Path.join(this._fynpo.dir, ".fynpo", "_store");
3086
3096
  }
3087
3097
 
3088
- logger.info(`fynpo monorepo: enabling central dir ${centralDir}`);
3098
+ logger.info(`Enabling central store by fynpo monorepo using dir ${centralDir}`);
3089
3099
  }
3090
3100
 
3091
3101
  return this._central = new FynCentral({
@@ -3142,7 +3152,7 @@ class Fyn {
3142
3152
 
3143
3153
  async _initializePkg() {
3144
3154
  if (!this._fynpo) {
3145
- this._fynpo = await fyntil.loadFynpo(this._cwd); // TODO: options from CLI should not be override by fynpo config options
3155
+ this._fynpo = await fynTil.loadFynpo(this._cwd); // TODO: options from CLI should not be override by fynpo config options
3146
3156
 
3147
3157
  _.merge(this._options, _.get(this, "_fynpo.fyn.options"));
3148
3158
 
@@ -3187,6 +3197,11 @@ class Fyn {
3187
3197
 
3188
3198
  if (this._fynpo.config) {
3189
3199
  if (this._fynpo.graph.getPackageAtDir(this._cwd)) {
3200
+ // the command.bootstrap.npmRunScripts can be
3201
+ // - a string
3202
+ // - an array of strings
3203
+ // - an array of strings and/or array of strings - each sub array indicates a list of
3204
+ // script names and fyn will run only the first one that exist
3190
3205
  fynpoNpmRun = _.get(this, "_fynpo.config.command.bootstrap.npmRunScripts", undefined);
3191
3206
 
3192
3207
  if (_.isArray(fynpoNpmRun) && !_.isEmpty(fynpoNpmRun)) {
@@ -3235,7 +3250,7 @@ class Fyn {
3235
3250
  retryWait: 500
3236
3251
  });
3237
3252
  const path = posixify(Path.relative(this._fynpo.dir, this.cwd));
3238
- const fynpoData = await fyntil.readJson(dataFile, {
3253
+ const fynpoData = await fynTil.readJson(dataFile, {
3239
3254
  indirects: {
3240
3255
  [path]: []
3241
3256
  }
@@ -3325,7 +3340,7 @@ class Fyn {
3325
3340
  }
3326
3341
 
3327
3342
  async loadPkgFyn() {
3328
- this._pkgFyn = await xaa.try(() => fyntil.readJson(Path.resolve(this._cwd, PACKAGE_FYN_JSON)));
3343
+ this._pkgFyn = await xaa.try(() => fynTil.readJson(Path.resolve(this._cwd, PACKAGE_FYN_JSON)));
3329
3344
  return this._pkgFyn;
3330
3345
  }
3331
3346
 
@@ -3346,11 +3361,11 @@ class Fyn {
3346
3361
  this._pkgFile = pkgFile;
3347
3362
 
3348
3363
  try {
3349
- this._pkg = await fyntil.readPkgJson(pkgFile, true);
3364
+ this._pkg = await fynTil.readPkgJson(pkgFile, true);
3350
3365
  } catch (err) {
3351
3366
  logger.error("failed to read package.json file", pkgFile);
3352
3367
  logger.error(err.message);
3353
- fyntil.exit(err);
3368
+ fynTil.exit(err);
3354
3369
  }
3355
3370
 
3356
3371
  const pkgFyn = await this.loadPkgFyn(options);
@@ -3789,14 +3804,23 @@ class Fyn {
3789
3804
  }
3790
3805
  }
3791
3806
 
3792
- async moveToBackup(dir, reason) {
3793
- // TODO: create backup dir and move
3794
- logger.warn("Removing", dir, "due to", reason);
3795
- return await Fs.$.rimraf(dir);
3807
+ async moveToFv(dir, pkg, pkgJson) {
3808
+ const toDir = this.getInstalledPkgDir(pkgJson.name, pkgJson.version, {});
3809
+
3810
+ try {
3811
+ await Fs.access(toDir); // a copy already exist in FV dir, so remove it
3812
+
3813
+ logger.warn(`Removing ${dir} because its version ${pkgJson.version} is different from ${pkg.version}`);
3814
+ await Fs.$.rimraf(dir);
3815
+ } catch (err) {
3816
+ logger.debug(`Moving ${dir} to ${toDir} to replace with version ${pkg.version}`);
3817
+ await Fs.$.mkdirp(Path.dirname(toDir));
3818
+ await Fs.rename(dir, toDir);
3819
+ }
3796
3820
  }
3797
3821
 
3798
- async unlinkLocalPackage(pkg, dir) {
3799
- logger.warn("Removing symlink", dir);
3822
+ async unlinkLocalPackage(dir, reason) {
3823
+ logger.warn(`Removing ${dir} because it's ${reason}`);
3800
3824
  return await Fs.$.rimraf(dir);
3801
3825
  } //
3802
3826
  // A pkg that's to be extracted must:
@@ -3822,21 +3846,21 @@ class Fyn {
3822
3846
  }
3823
3847
 
3824
3848
  if (ostat.isSymbolicLink()) {
3825
- await this.unlinkLocalPackage(pkg, fullOutDir);
3849
+ await this.unlinkLocalPackage(fullOutDir, "a symlink");
3826
3850
  } else if (!ostat.isDirectory()) {
3827
- await this.moveToBackup(fullOutDir, "not a directory");
3851
+ await this.unlinkLocalPackage(fullOutDir, "not a directory");
3828
3852
  } else {
3829
3853
  try {
3830
3854
  const pkgJson = await this.loadJsonForPkg(pkg, fullOutDir);
3831
3855
 
3832
3856
  if (!pkgJson._invalid) {
3833
3857
  return pkgJson;
3834
- } // no valid package.json found
3835
-
3858
+ }
3836
3859
 
3837
- const id = pkgJson._id ? ` (id ${pkgJson._id})` : "";
3838
- await this.moveToBackup(fullOutDir, `invalid existing package${id}`);
3839
- } catch (err) {}
3860
+ await this.moveToFv(fullOutDir, pkg, pkgJson);
3861
+ } catch (err) {
3862
+ logger.warn(`ensureProperPkgdir:`, err);
3863
+ }
3840
3864
  }
3841
3865
 
3842
3866
  return null;
@@ -3844,7 +3868,7 @@ class Fyn {
3844
3868
 
3845
3869
  async loadJsonForPkg(pkg, dir) {
3846
3870
  const fullOutDir = dir || this.getInstalledPkgDir(pkg.name, pkg.version, pkg);
3847
- const json = await fyntil.readPkgJson(fullOutDir, true);
3871
+ const json = await fynTil.readPkgJson(fullOutDir, true);
3848
3872
  const pkgId = `${pkg.name}@${pkg.version}`;
3849
3873
  const id = `${json.name}@${json.version}`;
3850
3874
 
@@ -3940,7 +3964,7 @@ const logger = __webpack_require__("./lib/logger.js");
3940
3964
 
3941
3965
  const logFormat = __webpack_require__("./lib/util/log-format.js");
3942
3966
 
3943
- const VisualExec = __webpack_require__("./node_modules/.f/_/visual-exec/0.1.13/visual-exec/lib/visual-exec.js");
3967
+ const VisualExec = __webpack_require__("./node_modules/.f/_/visual-exec/0.1.14/visual-exec/lib/visual-exec.js");
3944
3968
 
3945
3969
  const fyntil = __webpack_require__("./lib/util/fyntil.js");
3946
3970
 
@@ -4179,7 +4203,7 @@ const logger = __webpack_require__("./lib/logger.js");
4179
4203
 
4180
4204
  const PromiseQueue = __webpack_require__("./lib/util/promise-queue.js");
4181
4205
 
4182
- const VisualExec = __webpack_require__("./node_modules/.f/_/visual-exec/0.1.13/visual-exec/lib/visual-exec.js");
4206
+ const VisualExec = __webpack_require__("./node_modules/.f/_/visual-exec/0.1.14/visual-exec/lib/visual-exec.js");
4183
4207
 
4184
4208
  const xaa = __webpack_require__("./node_modules/.f/_/xaa/1.7.0/xaa/dist/xaa.js");
4185
4209
 
@@ -4346,7 +4370,7 @@ class LocalPkgBuilder {
4346
4370
  Build local dep package - running npm script 'prepublish' at ${dispPath}
4347
4371
 
4348
4372
  ==NOTE== While fyn will run 'prepublish' as part of installing this local package as a dependency,
4349
- ==NOTE== Please note that npm depreated this script and recommend other npm lifecycle script
4373
+ ==NOTE== Please note that npm deprecated this script and recommend other npm lifecycle script
4350
4374
  ==NOTE== such as 'prepare'. See docs here https://docs.npmjs.com/cli/v7/using-npm/scripts#prepare-and-prepublish
4351
4375
  ==NOTE== If you want to use 'prepublishOnly', please note that fyn won't execute it as part of
4352
4376
  ==NOTE== installing local packages.
@@ -5756,7 +5780,7 @@ const {
5756
5780
  const {
5757
5781
  getDepSection,
5758
5782
  makeDepStep
5759
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/index.js");
5783
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/index.js");
5760
5784
 
5761
5785
  const xaa = __webpack_require__("./lib/util/xaa.js");
5762
5786
 
@@ -6108,6 +6132,32 @@ class PkgDepResolver {
6108
6132
  this._promiseQ.addItem(PromiseQueue.pauseItem, true);
6109
6133
  }
6110
6134
  }
6135
+
6136
+ getAutoSemver(semver) {
6137
+ const autoSemver = _.get(this._fyn._fynpo, "config.localDepAutoSemver");
6138
+
6139
+ if (autoSemver) {
6140
+ const parsedSv = Semver.coerce(semver);
6141
+
6142
+ if (parsedSv && parsedSv.raw) {
6143
+ switch (autoSemver) {
6144
+ case "patch":
6145
+ semver = `~${parsedSv.raw}`;
6146
+ break;
6147
+
6148
+ case "minor":
6149
+ semver = `^${parsedSv.raw}`;
6150
+ break;
6151
+
6152
+ case "major":
6153
+ semver = "*";
6154
+ break;
6155
+ }
6156
+ }
6157
+ }
6158
+
6159
+ return semver;
6160
+ }
6111
6161
  /**
6112
6162
  * create the dep relation items for a package
6113
6163
  *
@@ -6203,26 +6253,26 @@ class PkgDepResolver {
6203
6253
  const fynpo = this._fyn._fynpo;
6204
6254
 
6205
6255
  if (!fromDir) {
6206
- // this case means an downstream pkg has a dep on a monorepo package
6207
- // TODO: should make sure monorepo local copy's version satisfies
6208
- // downstream pkg's semver
6256
+ // this case means a downstream pkg has a dep on a monorepo package
6209
6257
  fromDir = this._fyn.cwd;
6210
6258
  }
6211
6259
 
6212
6260
  for (const name in deps) {
6213
- if (this._fyn.checkNoFynLocal(name)) {
6261
+ if (this._fyn.checkNoFynLocal(name) || !fynpo.graph.getPackageByName(name)) {
6214
6262
  continue;
6215
- } // is pkg 'name@semver' a fynpo package?
6263
+ } //
6264
+ // Check if there is a fynpo package that match 'name@semver'?
6265
+ //
6216
6266
 
6217
6267
 
6218
- const semver = deps[name];
6268
+ const semver = this.getAutoSemver(deps[name]);
6219
6269
  const fynpoPkg = fynpo.graph.resolvePackage(name, semver, false);
6220
6270
 
6221
6271
  if (fynpoPkg) {
6222
6272
  locals.push(fynpoPkg);
6223
6273
  const fullPkgDir = Path.join(fynpo.dir, fynpoPkg.path);
6224
6274
  fynDeps[name] = relativePath(fromDir, fullPkgDir, true);
6225
- } else if (fynpo.graph.getPackageByName(name)) {
6275
+ } else {
6226
6276
  const dispName = logFormat.pkgId(name);
6227
6277
  const versions = fynpo.graph.packages.byName[name].map(x => x.version).join(", ");
6228
6278
  logger.info(`No version of package in fynpo match semver: ${semver} name: ${dispName} versions: ${versions}`);
@@ -6816,7 +6866,7 @@ ${item.depPath.join(" > ")}`);
6816
6866
  return false;
6817
6867
  }
6818
6868
 
6819
- const force = this._lockOnly && isOpt; // check if an already resolved local package satisfies item
6869
+ const force = this._lockOnly && !isOpt; // check if an already resolved local package satisfies item
6820
6870
  // before trying to resolve with lock data
6821
6871
 
6822
6872
  if (!this._fyn.preferLock) {
@@ -7660,7 +7710,7 @@ class PkgInstaller {
7660
7710
  const vdir = this._fyn.getInstalledPkgDir(depInfo.name, depInfo.version, depInfo);
7661
7711
 
7662
7712
  pkgJsonFp = Path.join(vdir, "package.json");
7663
- await Fs.unlink(pkgJsonFp);
7713
+ await xaa.try(() => Fs.unlink(pkgJsonFp));
7664
7714
  } else {
7665
7715
  pkgJsonFp = Path.join(depInfo.dir, "package.json");
7666
7716
  }
@@ -8037,13 +8087,17 @@ class PkgInstaller {
8037
8087
 
8038
8088
  if (scope) await xaa.try(() => Fs.rmdir(Path.join(outDir, scope))); // get rid of potentially empty FV_DIR dir
8039
8089
 
8040
- await xaa.try(() => Fs.rmdir(this._fyn.getFvDir()));
8090
+ await xaa.try(() => Fs.rmdir(this._fyn.getFvDir("_")));
8041
8091
  }
8042
8092
  /**
8043
8093
  * Process detail layout for node_modules.
8044
8094
  *
8045
- * Make links under node_modules for packages that exist app's package.json and
8046
- * flattened packages under node_modules/${FV_DIR}/node_modules
8095
+ * Real copies of packages are store under FV_DIR.
8096
+ *
8097
+ * 1. For top level packages that exist in app's package.json, make symlinks under node_modules.
8098
+ * 2. For packages that could be promoted to the top level:
8099
+ * - If flattenTop enabled, make symlinks under node_modules
8100
+ * - flattenTop disabled, make symlinks under FV_Dir/node_modules
8047
8101
  *
8048
8102
  * @returns {*} none
8049
8103
  */
@@ -8673,7 +8727,7 @@ const {
8673
8727
 
8674
8728
  const PkgPreper = __webpack_require__("./node_modules/.f/_/pkg-preper/0.1.0/pkg-preper/lib/pkg-preper.js");
8675
8729
 
8676
- const VisualExec = __webpack_require__("./node_modules/.f/_/visual-exec/0.1.13/visual-exec/lib/visual-exec.js");
8730
+ const VisualExec = __webpack_require__("./node_modules/.f/_/visual-exec/0.1.14/visual-exec/lib/visual-exec.js");
8677
8731
 
8678
8732
  const {
8679
8733
  readPkgJson,
@@ -8692,11 +8746,11 @@ const {
8692
8746
 
8693
8747
  const {
8694
8748
  prePackObj
8695
- } = __webpack_require__("./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/index.js");
8749
+ } = __webpack_require__("./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/index.js");
8696
8750
 
8697
8751
  const {
8698
8752
  PackageRef
8699
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/index.js");
8753
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/index.js");
8700
8754
 
8701
8755
  const WATCH_TIME = 5000; // consider meta cache stale after this much time (30 minutes)
8702
8756
 
@@ -8883,7 +8937,7 @@ class PkgSrcManager {
8883
8937
  const publishUtilConfig = this.getPublishUtil(json, fullPath);
8884
8938
 
8885
8939
  if (publishUtilConfig) {
8886
- logger.info(`processing local package.json at ${fullPath} with https://www.npmjs.com/package/publish-util prePackObj`);
8940
+ logger.debug(`processing local package.json at ${fullPath} with https://www.npmjs.com/package/publish-util prePackObj`);
8887
8941
  prePackObj(json, _objectSpread(_objectSpread({}, publishUtilConfig), {}, {
8888
8942
  silent: true
8889
8943
  }));
@@ -9712,7 +9766,7 @@ const {
9712
9766
  const {
9713
9767
  FynpoConfigManager,
9714
9768
  FynpoDepGraph
9715
- } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/index.js");
9769
+ } = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/index.js");
9716
9770
  /* eslint-disable no-magic-numbers, max-statements, no-empty, complexity, no-eval */
9717
9771
 
9718
9772
 
@@ -9975,6 +10029,46 @@ const fyntil = {
9975
10029
 
9976
10030
  return true;
9977
10031
  },
10032
+
10033
+ /**
10034
+ * Convert a string to a bool value. Considering 0, off, false, no to be `false`, else true.
10035
+ *
10036
+ * @param {*} v
10037
+ * @returns true or false
10038
+ */
10039
+ strToBool: v => {
10040
+ if (!v) {
10041
+ return false;
10042
+ }
10043
+
10044
+ const lv = v.toLowerCase();
10045
+
10046
+ if (lv === "0" || lv === "off" || lv === "false" || lv === "no") {
10047
+ return false;
10048
+ }
10049
+
10050
+ return true;
10051
+ },
10052
+
10053
+ /**
10054
+ * Check if a string looks like a true bool value, considering 1, on, true, yes to be `true`, else `false`
10055
+ *
10056
+ * @param {*} v
10057
+ * @returns true or false
10058
+ */
10059
+ isTrueStr: v => {
10060
+ if (!v) {
10061
+ return false;
10062
+ }
10063
+
10064
+ const lv = v.toLowerCase();
10065
+
10066
+ if (lv === "1" || lv === "on" || lv === "true" || lv === "yes") {
10067
+ return true;
10068
+ }
10069
+
10070
+ return false;
10071
+ },
9978
10072
  posixify
9979
10073
  };
9980
10074
  module.exports = fyntil;
@@ -10012,6 +10106,18 @@ const {
10012
10106
  } = __webpack_require__("./node_modules/.f/_/source-map/0.7.3/source-map/source-map.js");
10013
10107
 
10014
10108
  const ci = __webpack_require__("./node_modules/.f/_/ci-info/2.0.0/ci-info/index.js");
10109
+ /**
10110
+ * Hard link a file
10111
+ *
10112
+ * - if the link exist and is link to a different file, then remove it
10113
+ * and create a new link that points to the new file.
10114
+ *
10115
+ * @param {*} srcFp
10116
+ * @param {*} destFp
10117
+ * @param {*} srcStat
10118
+ * @returns
10119
+ */
10120
+
10015
10121
 
10016
10122
  async function linkFile(srcFp, destFp, srcStat) {
10017
10123
  try {
@@ -10034,6 +10140,13 @@ async function linkFile(srcFp, destFp, srcStat) {
10034
10140
 
10035
10141
  return undefined;
10036
10142
  }
10143
+ /**
10144
+ * Copy a file
10145
+ * @param {*} srcFp
10146
+ * @param {*} destFp
10147
+ * @returns
10148
+ */
10149
+
10037
10150
 
10038
10151
  async function copyFile(srcFp, destFp) {
10039
10152
  if (Fs.copyFile) {
@@ -10074,10 +10187,17 @@ async function cleanExtraDest(dest, destFiles) {
10074
10187
  }
10075
10188
 
10076
10189
  const FILES = Symbol("files");
10190
+ /**
10191
+ * Generate a tree of files using npm-pack that a package would publish with.
10192
+ *
10193
+ * @param {*} path
10194
+ * @returns
10195
+ */
10077
10196
 
10078
10197
  async function generatePackTree(path) {
10079
10198
  const files = await npmPacklist({
10080
- path
10199
+ path,
10200
+ includeSymlinks: fynTil.strToBool(process.env.FYN_LOCAL_PACK_SYMLINKS)
10081
10201
  });
10082
10202
  logger.debug(`local package linking - pack tree returned ${files.length} files to link`, JSON.stringify(files, null, 2));
10083
10203
 
@@ -10135,7 +10255,9 @@ function getSourceMapConfig(content, sig = SOURCE_MAP_URL_SIG) {
10135
10255
  return lastMatch && lastMatch[1];
10136
10256
  }
10137
10257
  /**
10138
- * process or generate source map back to original file
10258
+ * process or generate source map back to original file.
10259
+ *
10260
+ * - Do nothing if in CI mode
10139
10261
  *
10140
10262
  * @param {*} param0
10141
10263
  */
@@ -10252,6 +10374,8 @@ async function handleSourceMap({
10252
10374
  /**
10253
10375
  * Link tree of files generated from npm pack
10254
10376
  *
10377
+ * - if env `FYN_LOCAL_COPY_MODE` is defined, then copy file instead of linking
10378
+ *
10255
10379
  * @param {*} tree
10256
10380
  * @param {*} src
10257
10381
  * @param {*} dest
@@ -10281,7 +10405,13 @@ async function linkPackTree({
10281
10405
  destFiles[file] = true;
10282
10406
  const srcFp = Path.join(src, file);
10283
10407
  const destFp = Path.join(dest, file);
10284
- await linkFile(srcFp, destFp);
10408
+
10409
+ if (fynTil.strToBool(process.env.FYN_LOCAL_COPY_MODE)) {
10410
+ await copyFile(srcFp, destFp);
10411
+ } else {
10412
+ await linkFile(srcFp, destFp);
10413
+ }
10414
+
10285
10415
  await handleSourceMap({
10286
10416
  file,
10287
10417
  destFiles,
@@ -10969,7 +11099,7 @@ module.exports = __webpack_require__("./node_modules/.f/_/xaa/1.7.0/xaa/dist/xaa
10969
11099
 
10970
11100
  /***/ }),
10971
11101
 
10972
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
11102
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/fynpo-config.js":
10973
11103
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
10974
11104
 
10975
11105
  "use strict";
@@ -11119,7 +11249,7 @@ exports.FynpoConfigManager = FynpoConfigManager;
11119
11249
 
11120
11250
  /***/ }),
11121
11251
 
11122
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11252
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js":
11123
11253
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11124
11254
 
11125
11255
  "use strict";
@@ -11148,9 +11278,9 @@ const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_mod
11148
11278
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
11149
11279
  const semver_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/semver/7.3.5/semver/index.js"));
11150
11280
 
11151
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11281
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11152
11282
 
11153
- const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/util.js");
11283
+ const util_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/util.js");
11154
11284
 
11155
11285
  const is_path_inside_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/is-path-inside/3.0.3/is-path-inside/index.js"));
11156
11286
  const DepSectionMap = {
@@ -11870,7 +12000,7 @@ exports.FynpoDepGraph = FynpoDepGraph;
11870
12000
 
11871
12001
  /***/ }),
11872
12002
 
11873
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/index.js":
12003
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/index.js":
11874
12004
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
11875
12005
 
11876
12006
  "use strict";
@@ -11891,11 +12021,11 @@ const filter_scan_dir_1 = (0, tslib_1.__importDefault)(__webpack_require__("./no
11891
12021
  const minimatch_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/minimatch/3.0.4/minimatch/minimatch.js"));
11892
12022
  const lodash_1 = (0, tslib_1.__importDefault)(__webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js"));
11893
12023
 
11894
- const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
12024
+ const minimatch_group_1 = __webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/minimatch-group.js");
11895
12025
 
11896
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
11897
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
11898
- (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/util.js"), exports);
12026
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/fynpo-dep-graph.js"), exports);
12027
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/fynpo-config.js"), exports);
12028
+ (0, tslib_1.__exportStar)(__webpack_require__("./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/util.js"), exports);
11899
12029
  /**
11900
12030
  * Take an array of packages and figure out their dependencies on each other
11901
12031
  *
@@ -12150,7 +12280,7 @@ exports.makePkgDeps = makePkgDeps;
12150
12280
 
12151
12281
  /***/ }),
12152
12282
 
12153
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12283
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/minimatch-group.js":
12154
12284
  /***/ ((__unused_webpack_module, exports) => {
12155
12285
 
12156
12286
  "use strict";
@@ -12196,7 +12326,7 @@ exports.groupMM = groupMM;
12196
12326
 
12197
12327
  /***/ }),
12198
12328
 
12199
- /***/ "./node_modules/.f/_/@fynpo/base/1.1.5-fynlocal_h/@fynpo/base/dist/util.js":
12329
+ /***/ "./node_modules/.f/_/@fynpo/base/1.1.7-fynlocal_h/@fynpo/base/dist/util.js":
12200
12330
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12201
12331
 
12202
12332
  "use strict";
@@ -54979,6 +55109,14 @@ const npmWalker = Class => class Walker extends Class {
54979
55109
  this.bundledScopes = [];
54980
55110
  this.packageJsonCache = this.parent.packageJsonCache;
54981
55111
  }
55112
+
55113
+ this.includeSymlinks = opt.includeSymlinks;
55114
+ }
55115
+
55116
+ walkerOpt(entry) {
55117
+ const opt = super.walkerOpt(entry);
55118
+ opt.includeSymlinks = this.includeSymlinks;
55119
+ return opt;
54982
55120
  }
54983
55121
 
54984
55122
  onReaddir(entries) {
@@ -55055,7 +55193,7 @@ const npmWalker = Class => class Walker extends Class {
55055
55193
 
55056
55194
 
55057
55195
  onstat(st, entry, file, dir, then) {
55058
- if (st.isSymbolicLink()) then();else super.onstat(st, entry, file, dir, then);
55196
+ if (!this.includeSymlinks && st.isSymbolicLink()) then();else super.onstat(st, entry, file, dir, then);
55059
55197
  }
55060
55198
 
55061
55199
  onReadIgnoreFile(file, data, then) {
@@ -60710,23 +60848,23 @@ function set(data, k, v) {
60710
60848
 
60711
60849
  /***/ }),
60712
60850
 
60713
- /***/ "./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/index.js":
60851
+ /***/ "./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/index.js":
60714
60852
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
60715
60853
 
60716
60854
  const {
60717
60855
  prePackObj,
60718
60856
  prePack
60719
- } = __webpack_require__("./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/prepack.js");
60857
+ } = __webpack_require__("./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/prepack.js");
60720
60858
 
60721
60859
  const {
60722
60860
  postPack
60723
- } = __webpack_require__("./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/postpack.js");
60861
+ } = __webpack_require__("./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/postpack.js");
60724
60862
 
60725
60863
  const {
60726
60864
  npmPublish
60727
- } = __webpack_require__("./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/npm-publish.js");
60865
+ } = __webpack_require__("./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/npm-publish.js");
60728
60866
 
60729
- const utils = __webpack_require__("./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/utils.js");
60867
+ const utils = __webpack_require__("./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/utils.js");
60730
60868
 
60731
60869
  exports.npmPublish = npmPublish;
60732
60870
  exports.prePackObj = prePackObj;
@@ -60736,7 +60874,7 @@ exports.utils = utils;
60736
60874
 
60737
60875
  /***/ }),
60738
60876
 
60739
- /***/ "./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/npm-publish.js":
60877
+ /***/ "./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/npm-publish.js":
60740
60878
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
60741
60879
 
60742
60880
  "use strict";
@@ -60746,7 +60884,7 @@ const execa = __webpack_require__("./node_modules/.f/_/execa/5.1.1/execa/index.j
60746
60884
 
60747
60885
  const {
60748
60886
  getInfo
60749
- } = __webpack_require__("./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/utils.js");
60887
+ } = __webpack_require__("./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/utils.js");
60750
60888
 
60751
60889
  const assert = __webpack_require__("assert");
60752
60890
 
@@ -60754,19 +60892,32 @@ const Fs = __webpack_require__("fs").promises;
60754
60892
 
60755
60893
  const Path = __webpack_require__("path");
60756
60894
 
60757
- function getArg(opt, msg, valids = []) {
60758
- const tagIx = process.argv.indexOf(opt);
60895
+ function getArg({
60896
+ opt,
60897
+ msg,
60898
+ argv,
60899
+ value = true,
60900
+ valids = []
60901
+ }) {
60902
+ const tagIx = argv.indexOf(opt);
60759
60903
 
60760
- if (tagIx > 0) {
60761
- const val = process.argv[tagIx + 1];
60904
+ if (tagIx >= 0) {
60905
+ if (value) {
60906
+ const val = argv[tagIx + 1];
60762
60907
 
60763
- if (valids.length > 0) {
60764
- assert(valids.includes(val), `${opt} must specify a valid ${msg}: ${valids.join(",")}`);
60908
+ if (valids.length > 0) {
60909
+ assert(valids.includes(val), `${opt} has a value ${val} but it must be one of: ${valids.join(", ")}`);
60910
+ } else {
60911
+ assert(val, `${opt} must specify a ${msg}`);
60912
+ }
60913
+
60914
+ argv.splice(tagIx, 2);
60915
+ return [opt, val];
60765
60916
  } else {
60766
- assert(val, `${opt} must specify a ${msg}`);
60917
+ argv.splice(tagIx, 1);
60767
60918
  }
60768
60919
 
60769
- return [opt, val];
60920
+ return [opt];
60770
60921
  }
60771
60922
 
60772
60923
  return [];
@@ -60780,17 +60931,36 @@ async function removeFile(name) {
60780
60931
  } catch (_unused) {}
60781
60932
  }
60782
60933
 
60783
- exports.npmPublish = async function npmPublish() {
60784
- process.on("SIGINT", () => {});
60934
+ exports.npmPublish = async function npmPublish({
60935
+ exit = true,
60936
+ silent = false
60937
+ } = {}) {
60938
+ const noop = () => {};
60939
+
60940
+ process.on("SIGINT", noop);
60941
+ const argv = [].concat(process.argv.slice(2));
60785
60942
  const {
60786
60943
  pkgDir,
60787
60944
  pkgFile,
60788
60945
  pkg,
60789
60946
  pkgData
60790
60947
  } = await getInfo();
60791
- const dryRun = process.argv.indexOf("--dry-run") > 0;
60792
- const tag = getArg("--tag", "tag");
60793
- const access = getArg("--access", "access", ["public", "restricted"]);
60948
+ const dryRun = getArg({
60949
+ opt: "--dry-run",
60950
+ value: false,
60951
+ argv
60952
+ }).length > 0;
60953
+ const tag = getArg({
60954
+ opt: "--tag",
60955
+ msg: "tag",
60956
+ argv
60957
+ });
60958
+ const access = getArg({
60959
+ opt: "--access",
60960
+ msg: "access",
60961
+ argv,
60962
+ valids: ["public", "restricted"]
60963
+ });
60794
60964
  let changedPkg = false;
60795
60965
  let exitCode = 0;
60796
60966
  const tgzName = pkg.name.replace(/@/g, "").replace(/\//g, "-");
@@ -60801,7 +60971,10 @@ exports.npmPublish = async function npmPublish() {
60801
60971
  const restore = async () => {
60802
60972
  try {
60803
60973
  if (changedPkg) {
60804
- console.log("Restoring", pkgFile);
60974
+ if (!silent) {
60975
+ console.log("Restoring", pkgFile);
60976
+ }
60977
+
60805
60978
  await Fs.writeFile(pkgFile, pkgData);
60806
60979
  }
60807
60980
  } catch (_unused2) {}
@@ -60809,6 +60982,8 @@ exports.npmPublish = async function npmPublish() {
60809
60982
  try {
60810
60983
  process.chdir(saveDir);
60811
60984
  } catch (_unused3) {}
60985
+
60986
+ process.removeListener("SIGINT", noop);
60812
60987
  };
60813
60988
 
60814
60989
  try {
@@ -60848,11 +61023,15 @@ exports.npmPublish = async function npmPublish() {
60848
61023
  }
60849
61024
 
60850
61025
  if (!dryRun) {
60851
- const publishArgs = [`publish`].concat(tag, access, fullTgzFile);
60852
- console.log("publishing args:", publishArgs.join(" "));
61026
+ const publishArgs = [`publish`].concat(tag, access, fullTgzFile, argv);
61027
+
61028
+ if (!silent) {
61029
+ console.log("publishing args:", publishArgs.join(" "));
61030
+ }
61031
+
60853
61032
  await execa(`npm`, publishArgs, execaOpts);
60854
61033
  } else {
60855
- console.log(tgzFile);
61034
+ console.log("dry-run", tgzFile, "args:", [].concat(tag, access, argv));
60856
61035
  }
60857
61036
  } catch (err) {
60858
61037
  if (err.message.includes("SIGINT")) {
@@ -60865,13 +61044,18 @@ exports.npmPublish = async function npmPublish() {
60865
61044
  } finally {
60866
61045
  await restore();
60867
61046
  await removeFile(fullTgzFile);
60868
- process.exit(exitCode);
61047
+
61048
+ if (exit) {
61049
+ process.exit(exitCode);
61050
+ }
60869
61051
  }
61052
+
61053
+ return exitCode;
60870
61054
  };
60871
61055
 
60872
61056
  /***/ }),
60873
61057
 
60874
- /***/ "./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/postpack.js":
61058
+ /***/ "./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/postpack.js":
60875
61059
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
60876
61060
 
60877
61061
  "use strict";
@@ -60883,7 +61067,7 @@ const Fs = __webpack_require__("fs").promises;
60883
61067
 
60884
61068
  const {
60885
61069
  getInfo
60886
- } = __webpack_require__("./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/utils.js");
61070
+ } = __webpack_require__("./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/utils.js");
60887
61071
 
60888
61072
  exports.postPack = async function postPack() {
60889
61073
  const {
@@ -60905,7 +61089,7 @@ exports.postPack = async function postPack() {
60905
61089
 
60906
61090
  /***/ }),
60907
61091
 
60908
- /***/ "./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/prepack.js":
61092
+ /***/ "./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/prepack.js":
60909
61093
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
60910
61094
 
60911
61095
  "use strict";
@@ -60921,7 +61105,7 @@ const {
60921
61105
  removeFromObj,
60922
61106
  keepStandardFields,
60923
61107
  renameFromObj
60924
- } = __webpack_require__("./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/utils.js");
61108
+ } = __webpack_require__("./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/utils.js");
60925
61109
 
60926
61110
  const _ = __webpack_require__("./node_modules/.f/_/lodash/4.17.21/lodash/lodash.min.js");
60927
61111
 
@@ -60955,8 +61139,8 @@ function prePackObj(pkg, config = {}) {
60955
61139
  _.set(pkg, "scripts.postpack", "publish-util-postpack");
60956
61140
  }
60957
61141
 
60958
- if (pkg.scripts.prepublishOnly === "publish-util-prepublishonly" || pkg.scripts.prepublishOnly === "publish-util-prepack") {
60959
- delete pkg.scripts.prepublishOnly;
61142
+ if (pkg.scripts.prepack === "publish-util-prepack") {
61143
+ delete pkg.scripts.prepack;
60960
61144
  }
60961
61145
 
60962
61146
  if (keepObj) {
@@ -60993,7 +61177,7 @@ exports.prePack = async function prePack() {
60993
61177
 
60994
61178
  /***/ }),
60995
61179
 
60996
- /***/ "./node_modules/.f/_/publish-util/1.3.3/publish-util/lib/utils.js":
61180
+ /***/ "./node_modules/.f/_/publish-util/2.0.0/publish-util/lib/utils.js":
60997
61181
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
60998
61182
 
60999
61183
  "use strict";
@@ -90789,7 +90973,7 @@ var done = function (warnings, errors) {
90789
90973
 
90790
90974
  /***/ }),
90791
90975
 
90792
- /***/ "./node_modules/.f/_/visual-exec/0.1.13/visual-exec/lib/get-default-logger.js":
90976
+ /***/ "./node_modules/.f/_/visual-exec/0.1.14/visual-exec/lib/get-default-logger.js":
90793
90977
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
90794
90978
 
90795
90979
  "use strict";
@@ -90820,7 +91004,7 @@ module.exports = getLogger;
90820
91004
 
90821
91005
  /***/ }),
90822
91006
 
90823
- /***/ "./node_modules/.f/_/visual-exec/0.1.13/visual-exec/lib/visual-exec.js":
91007
+ /***/ "./node_modules/.f/_/visual-exec/0.1.14/visual-exec/lib/visual-exec.js":
90824
91008
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
90825
91009
 
90826
91010
  "use strict";
@@ -90831,7 +91015,7 @@ const xsh = __webpack_require__("./node_modules/.f/_/xsh/0.4.5/xsh/lib/index.js"
90831
91015
 
90832
91016
  const chalk = __webpack_require__("./node_modules/.f/_/chalk/4.1.2/chalk/source/index.js");
90833
91017
 
90834
- const getDefaultLogger = __webpack_require__("./node_modules/.f/_/visual-exec/0.1.13/visual-exec/lib/get-default-logger.js");
91018
+ const getDefaultLogger = __webpack_require__("./node_modules/.f/_/visual-exec/0.1.14/visual-exec/lib/get-default-logger.js");
90835
91019
 
90836
91020
  const VisualLogger = __webpack_require__("./node_modules/.f/_/visual-logger/1.1.3/visual-logger/lib/visual-logger.js");
90837
91021
 
@@ -90868,6 +91052,7 @@ class VisualExec {
90868
91052
  this._maxBuffer = maxBuffer;
90869
91053
  this._forceStderr = forceStderr;
90870
91054
  this._checkStdoutError = checkStdoutError === true ? /error|warn|fatal|unhandled|reject|exception|failure|fail|failed/i : checkStdoutError;
91055
+ this._startTime = Date.now();
90871
91056
  }
90872
91057
 
90873
91058
  _makeTitle(command) {
@@ -90985,7 +91170,10 @@ class VisualExec {
90985
91170
 
90986
91171
  output = err.output;
90987
91172
  } else {
90988
- this._logger.info(`Done ${this._logLabel} ${chalk.green("exit code 0")}`);
91173
+ const time = ((Date.now() - this._startTime) / 1000).toFixed(2);
91174
+ const dispTime = `${chalk.magenta(time)}secs`;
91175
+
91176
+ this._logger.info(`Done ${this._logLabel} ${dispTime} ${chalk.green("exit code 0")}`);
90989
91177
  }
90990
91178
 
90991
91179
  this.logFinalOutput(err, output);
@@ -91022,6 +91210,7 @@ class VisualExec {
91022
91210
  }
91023
91211
 
91024
91212
  execute(command) {
91213
+ this._startTime = Date.now();
91025
91214
  const child = xsh.exec({
91026
91215
  silent: true,
91027
91216
  cwd: this._cwd,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "1.1.15",
3
+ "version": "1.1.19",
4
4
  "description": "A node package manager, fast, workspace, and better productivity and efficiency",
5
5
  "main": "./bin/fyn.js",
6
6
  "homepage": "https://www.electrode.io/fynpo/",
@@ -13,7 +13,7 @@
13
13
  "coverage": "xrun xarc/check",
14
14
  "ci:check": "xrun xarc/check",
15
15
  "coveralls": "cat coverage/lcov.info | coveralls",
16
- "prepublishOnly": "xrun xarc/check compile-yarn bundle && publish-util-prepublishonly",
16
+ "prepublishOnly": "xrun build",
17
17
  "postpack": "publish-util-postpack"
18
18
  },
19
19
  "bin": {