fyn 1.1.38 → 1.1.39

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 +45 -19
  2. package/package.json +1 -1
package/dist/fyn.js CHANGED
@@ -3121,9 +3121,8 @@ class Fyn {
3121
3121
  _cliSource = {},
3122
3122
  _fynpo = true
3123
3123
  }) {
3124
- this._cliSource = _cliSource;
3124
+ this._cliSource = _objectSpread({}, _cliSource);
3125
3125
  const options = this._options = fynConfig(opts);
3126
- this._layout = options.layout;
3127
3126
  this._cwd = options.cwd || process.cwd();
3128
3127
  logger.debug(`fyn options`, JSON.stringify(fynTil.removeAuthInfo(options)));
3129
3128
  this.localPkgWithNestedDep = [];
@@ -3145,11 +3144,49 @@ class Fyn {
3145
3144
  }
3146
3145
  }
3147
3146
 
3147
+ checkLayoutOption() {
3148
+ const {
3149
+ _options,
3150
+ _cliSource
3151
+ } = this;
3152
+
3153
+ if (_options.flattenTop === false && _cliSource.flattenTop !== "default") {
3154
+ //
3155
+ if (_options.layout !== "detail") {
3156
+ if (_cliSource.layout === "default") {
3157
+ logger.info(`flatten-top option turned off by ${_cliSource.flattenTop}, so switching node_modules layout to detail`);
3158
+ _options.layout = "detail";
3159
+ _cliSource.layout = _cliSource.flattenTop;
3160
+ } else {
3161
+ logger.warn(`you try to turn off flatten-top but set node_modules layout to ${_options.layout} and they are not compatible`);
3162
+ }
3163
+ }
3164
+ }
3165
+ }
3166
+
3148
3167
  checkFynLockExist() {
3149
3168
  const fname = Path.join(this._cwd, FYN_LOCK_FILE);
3150
3169
  return Fs.existsSync(fname);
3151
3170
  }
3152
3171
 
3172
+ updateConfigInLockfile(name, newValue) {
3173
+ const valueInLock = this._depLocker.getConfig(name);
3174
+
3175
+ if (valueInLock !== undefined && valueInLock !== newValue) {
3176
+ if (this._cliSource[name] === "cli") {
3177
+ logger.info(`You are changing ${name} in your lockfile from ${valueInLock} to ${newValue}`);
3178
+
3179
+ this._depLocker.setConfig(name, newValue);
3180
+ } else {
3181
+ logger.info(`Setting ${name} to ${valueInLock} from your lockfile`);
3182
+ this._options[name] = valueInLock;
3183
+ this._cliSource[name] = "lock";
3184
+ }
3185
+ } else {
3186
+ this._depLocker.setConfig(name, newValue);
3187
+ }
3188
+ }
3189
+
3153
3190
  async readLockFiles() {
3154
3191
  if (this._depLocker) {
3155
3192
  return null;
@@ -3158,20 +3195,9 @@ class Fyn {
3158
3195
  this._npmLockData = null;
3159
3196
  this._depLocker = new PkgDepLocker(this.lockOnly, this._options.lockfile);
3160
3197
  const foundLock = await this._depLocker.read(Path.join(this._cwd, FYN_LOCK_FILE));
3161
-
3162
- const layout = this._depLocker.getConfig("layout");
3163
-
3164
- if (layout && layout !== this._layout) {
3165
- if (this._cliSource.layout === "cli") {
3166
- logger.info(`You are changing layout in your lockfile from ${layout} to ${this._layout}`);
3167
-
3168
- this._depLocker.setConfig("layout", this._layout);
3169
- } else {
3170
- logger.info(`Setting layout to ${layout} from your lockfile`);
3171
- }
3172
- } else {
3173
- this._depLocker.setConfig("layout", this._layout);
3174
- }
3198
+ this.updateConfigInLockfile("layout", this._options.layout);
3199
+ this.updateConfigInLockfile("flattenTop", this._options.flattenTop);
3200
+ this.checkLayoutOption();
3175
3201
 
3176
3202
  if (this._options.npmLock === true) {// force load npm lock data
3177
3203
  } else if (foundLock || this._options.npmLock === false) {
@@ -3206,7 +3232,7 @@ class Fyn {
3206
3232
  }
3207
3233
 
3208
3234
  get isNormalLayout() {
3209
- return this._layout === "normal";
3235
+ return this._options.layout === "normal";
3210
3236
  }
3211
3237
 
3212
3238
  async _initCentralStore() {
@@ -3300,10 +3326,10 @@ class Fyn {
3300
3326
  this._fynpo = await fynTil.loadFynpo(this._cwd); // TODO: options from CLI should not be override by fynpo config options
3301
3327
 
3302
3328
  _.merge(this._options, _.get(this, "_fynpo.fyn.options"));
3303
-
3304
- this._layout = this._options.layout;
3305
3329
  }
3306
3330
 
3331
+ this.checkLayoutOption();
3332
+
3307
3333
  if (!this._pkg) {
3308
3334
  const options = this._options;
3309
3335
  await this.loadPkg(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fyn",
3
- "version": "1.1.38",
3
+ "version": "1.1.39",
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/",