@form8ion/javascript 11.5.6 → 11.6.1

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.
package/lib/index.js CHANGED
@@ -263,9 +263,7 @@ async function test({projectRoot}) {
263
263
  return !!engines?.node;
264
264
  }
265
265
 
266
- async function lift$1({projectRoot}) {
267
- const {name} = JSON.parse(await fs.promises.readFile(`${projectRoot}/package.json`, 'utf8'));
268
-
266
+ async function lift$1({packageDetails: {name}}) {
269
267
  return {
270
268
  devDependencies: ['ls-engines'],
271
269
  scripts: {'lint:engines': 'ls-engines'},
@@ -514,13 +512,11 @@ async function liftPublishable ({projectRoot}) {
514
512
  };
515
513
  }
516
514
 
517
- function liftPackage$1 ({projectRoot}) {
518
- return liftPublishable({projectRoot});
515
+ function liftPackage$1 ({projectRoot, packageDetails}) {
516
+ return liftPublishable({projectRoot, packageDetails});
519
517
  }
520
518
 
521
- async function isPackage ({projectRoot}) {
522
- const {exports, publishConfig, bin} = JSON.parse(await node_fs.promises.readFile(`${projectRoot}/package.json`, 'utf-8'));
523
-
519
+ async function isPackage ({packageDetails: {exports, publishConfig, bin}}) {
524
520
  return !!exports || (!!publishConfig && !bin);
525
521
  }
526
522
 
@@ -598,14 +594,12 @@ async function scaffoldCliType ({packageName, visibility, projectRoot, dialect,
598
594
  );
599
595
  }
600
596
 
601
- async function isCli ({projectRoot}) {
602
- const {bin} = JSON.parse(await node_fs.promises.readFile(`${projectRoot}/package.json`, 'utf-8'));
603
-
597
+ async function isCli ({packageDetails: {bin}}) {
604
598
  return !!bin;
605
599
  }
606
600
 
607
- function liftCli ({projectRoot}) {
608
- return liftPublishable({projectRoot});
601
+ function liftCli ({projectRoot, packageDetails}) {
602
+ return liftPublishable({projectRoot, packageDetails});
609
603
  }
610
604
 
611
605
  async function scaffoldProjectType ({
@@ -652,15 +646,15 @@ async function scaffoldProjectType ({
652
646
  }
653
647
  }
654
648
 
655
- async function lifter$1 ({projectRoot}) {
656
- if (await isPackage({projectRoot})) return liftPackage$1({projectRoot});
657
- if (await isCli({projectRoot})) return liftCli({projectRoot});
649
+ async function lifter$1 ({projectRoot, packageDetails}) {
650
+ if (await isPackage({projectRoot, packageDetails})) return liftPackage$1({projectRoot, packageDetails});
651
+ if (await isCli({projectRoot, packageDetails})) return liftCli({projectRoot, packageDetails});
658
652
 
659
653
  return {};
660
654
  }
661
655
 
662
- async function tester$1 ({projectRoot}) {
663
- return await isPackage({projectRoot}) || isCli({projectRoot});
656
+ async function tester$1 ({projectRoot, packageDetails}) {
657
+ return await isPackage({projectRoot, packageDetails}) || isCli({projectRoot, packageDetails});
664
658
  }
665
659
 
666
660
  var projectTypes = /*#__PURE__*/Object.freeze({
@@ -990,7 +984,10 @@ async function lift ({projectRoot, vcs, results}) {
990
984
  packageManager: manager
991
985
  } = results;
992
986
 
993
- const packageManager = await resolvePackageManager({projectRoot, packageManager: manager});
987
+ const [packageManager, packageContents] = await Promise.all([
988
+ resolvePackageManager({projectRoot, packageManager: manager}),
989
+ node_fs.promises.readFile(`${projectRoot}/package.json`, 'utf8')
990
+ ]);
994
991
 
995
992
  const enhancerResults = await core.applyEnhancers({
996
993
  results,
@@ -1003,7 +1000,7 @@ async function lift ({projectRoot, vcs, results}) {
1003
1000
  codeStylePlugin,
1004
1001
  projectTypes
1005
1002
  ],
1006
- options: {packageManager, projectRoot, vcs}
1003
+ options: {packageManager, projectRoot, vcs, packageDetails: JSON.parse(packageContents)}
1007
1004
  });
1008
1005
 
1009
1006
  await liftPackage(
@@ -1017,7 +1014,7 @@ async function lift ({projectRoot, vcs, results}) {
1017
1014
  }
1018
1015
 
1019
1016
  const pluginSchema = joi__default["default"].object({scaffolder: joi__default["default"].func().arity(1).required()});
1020
- const pluginMapSchema = joi__default["default"].object().pattern(/^/, pluginSchema);
1017
+ const pluginMapSchema = joi__default["default"].object().pattern(joi__default["default"].string(), pluginSchema);
1021
1018
 
1022
1019
  const packageBundlersSchema = pluginMapSchema.default({});
1023
1020