@form8ion/javascript 11.0.0 → 11.2.0

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { questionNames as questionNames$2, questions } from '@travi/language-scaffolder-prompts';
2
2
  import deepmerge from 'deepmerge';
3
- import { validateOptions, scaffoldChoice, projectTypes, dialects as dialects$1, writePackageJson, packageManagers, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE, mergeIntoExistingPackageJson } from '@form8ion/javascript-core';
3
+ import { validateOptions, scaffoldChoice, projectTypes as projectTypes$1, packageManagers, dialects as dialects$1, mergeIntoExistingPackageJson, writePackageJson, DEV_DEPENDENCY_TYPE, PROD_DEPENDENCY_TYPE } from '@form8ion/javascript-core';
4
4
  import joi from 'joi';
5
5
  import { prompt as prompt$1, Separator } from '@form8ion/overridable-prompts';
6
6
  import { scaffold, lift as lift$3 } from '@form8ion/codecov';
@@ -26,7 +26,8 @@ import filedirname from 'filedirname';
26
26
  import * as huskyPlugin from '@form8ion/husky';
27
27
  import { scaffold as scaffold$4 } from '@form8ion/husky';
28
28
  import { scaffold as scaffold$2 } from '@form8ion/prettier';
29
- import { scaffold as scaffold$1, lift as lift$4, test as test$2 } from '@form8ion/eslint';
29
+ import { scaffold as scaffold$1, lift as lift$4, test as test$1 } from '@form8ion/eslint';
30
+ import { promises as promises$1 } from 'node:fs';
30
31
  import sortObjectKeys from 'sort-object-keys';
31
32
 
32
33
  const questionNames$1 = {
@@ -114,7 +115,7 @@ function c8IsConfigured ({projectRoot}) {
114
115
  return fileExists(`${projectRoot}/.c8rc.json`);
115
116
  }
116
117
 
117
- async function tester ({projectRoot}) {
118
+ async function tester$2 ({projectRoot}) {
118
119
  const [c8Exists, nycExists] = await Promise.all([c8IsConfigured({projectRoot}), nycIsConfigured({projectRoot})]);
119
120
 
120
121
  return c8Exists || nycExists;
@@ -124,7 +125,7 @@ var coveragePlugin = /*#__PURE__*/Object.freeze({
124
125
  __proto__: null,
125
126
  scaffold: scaffoldCoverage,
126
127
  lift: lift$2,
127
- test: tester
128
+ test: tester$2
128
129
  });
129
130
 
130
131
  const unitTestFrameworksSchema = joi.object().required().pattern(/^/, joi.object({
@@ -175,7 +176,7 @@ async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
175
176
  plugins: [
176
177
  config,
177
178
  ['remark-toc', {tight: true}],
178
- ...projectTypes.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
179
+ ...projectTypes$1.PACKAGE === projectType ? [['remark-usage', {heading: 'example'}]] : [],
179
180
  ...!vcs ? [['validate-links', {repository: false}]] : []
180
181
  ]
181
182
  }
@@ -189,7 +190,7 @@ async function scaffoldRemark ({config, projectRoot, projectType, vcs}) {
189
190
  'generate:md': 'remark . --output'
190
191
  }
191
192
  },
192
- {...projectTypes.PACKAGE === projectType && {devDependencies: ['remark-usage']}}
193
+ {...projectTypes$1.PACKAGE === projectType && {devDependencies: ['remark-usage']}}
193
194
  );
194
195
  }
195
196
 
@@ -217,11 +218,11 @@ async function scaffoldCodeStyle ({
217
218
  var codeStylePlugin = /*#__PURE__*/Object.freeze({
218
219
  __proto__: null,
219
220
  lift: lift$4,
220
- test: test$2,
221
+ test: test$1,
221
222
  scaffold: scaffoldCodeStyle
222
223
  });
223
224
 
224
- async function test$1({projectRoot}) {
225
+ async function test({projectRoot}) {
225
226
  const {engines} = JSON.parse(await promises.readFile(`${projectRoot}/package.json`, 'utf8'));
226
227
 
227
228
  return !!engines?.node;
@@ -239,10 +240,257 @@ async function lift$1({projectRoot}) {
239
240
 
240
241
  var enginesEnhancer = /*#__PURE__*/Object.freeze({
241
242
  __proto__: null,
242
- test: test$1,
243
+ test: test,
243
244
  lift: lift$1
244
245
  });
245
246
 
247
+ function buildDocumentationCommand (packageManager) {
248
+ if (packageManagers.NPM === packageManager) return 'npm run generate:md';
249
+ if (packageManagers.YARN === packageManager) return 'yarn generate:md';
250
+
251
+ throw new Error(
252
+ `The ${packageManager} package manager is currently not supported. `
253
+ + `Only ${Object.values(packageManagers).join(' and ')} are currently supported.`
254
+ );
255
+ }
256
+
257
+ function getInstallationCommand(packageManager) {
258
+ if (packageManagers.NPM === packageManager) return 'npm install';
259
+ if (packageManagers.YARN === packageManager) return 'yarn add';
260
+
261
+ throw new Error(
262
+ `The ${packageManager} package manager is currently not supported. `
263
+ + `Only ${Object.values(packageManagers).join(' and ')} are currently supported.`
264
+ );
265
+ }
266
+
267
+ function scaffoldPackageDocumentation ({scope, packageName, packageManager, visibility, provideExample}) {
268
+ return {
269
+ usage: `### Installation
270
+ ${'Private' === visibility ? `
271
+ :warning: this is a private package, so you will need to use an npm token with
272
+ access to private packages under \`@${scope}\`
273
+ ` : ''
274
+ }
275
+ \`\`\`sh
276
+ $ ${getInstallationCommand(packageManager)} ${packageName}
277
+ \`\`\`${provideExample
278
+ ? `
279
+
280
+ ### Example
281
+
282
+ run \`${buildDocumentationCommand(packageManager)}\` to inject the usage example`
283
+ : ''
284
+ }`
285
+ };
286
+ }
287
+
288
+ function defineBadges (packageName, visibility) {
289
+ return {
290
+ consumer: {
291
+ ...'Public' === visibility && {
292
+ npm: {
293
+ img: `https://img.shields.io/npm/v/${packageName}?logo=npm`,
294
+ text: 'npm',
295
+ link: `https://www.npmjs.com/package/${packageName}`
296
+ }
297
+ }
298
+ },
299
+ status: {}
300
+ };
301
+ }
302
+
303
+ async function chooseBundler ({bundlers, decisions}) {
304
+ if (!Object.keys(bundlers).length) return 'Other';
305
+
306
+ const answers = await prompt$1([{
307
+ name: questionNames$1.PACKAGE_BUNDLER,
308
+ type: 'list',
309
+ message: 'Which bundler should be used?',
310
+ choices: [...Object.keys(bundlers), new Separator(), 'Other']
311
+ }], decisions);
312
+
313
+ return answers[questionNames$1.PACKAGE_BUNDLER];
314
+ }
315
+
316
+ function determinePathToTemplateFile (fileName) {
317
+ const [, __dirname] = filedirname();
318
+
319
+ return resolve(__dirname, '..', 'templates', fileName);
320
+ }
321
+
322
+ const defaultBuildDirectory$2 = 'lib';
323
+
324
+ async function createExample(projectRoot, projectName) {
325
+ return promises.writeFile(
326
+ `${projectRoot}/example.js`,
327
+ mustache.render(
328
+ await promises.readFile(determinePathToTemplateFile('example.mustache'), 'utf8'),
329
+ {projectName: camelcase(projectName)}
330
+ )
331
+ );
332
+ }
333
+
334
+ async function buildDetailsForCommonJsProject({projectRoot, projectName, provideExample}) {
335
+ await Promise.all([
336
+ touch(`${projectRoot}/index.js`),
337
+ provideExample
338
+ ? promises.writeFile(`${projectRoot}/example.js`, `const ${camelcase(projectName)} = require('.');\n`)
339
+ : Promise.resolve()
340
+ ]);
341
+
342
+ return {};
343
+ }
344
+
345
+ async function buildDetails ({
346
+ projectRoot,
347
+ projectName,
348
+ visibility,
349
+ packageName,
350
+ packageBundlers,
351
+ dialect,
352
+ provideExample,
353
+ decisions
354
+ }) {
355
+ if (dialects$1.COMMON_JS === dialect) return buildDetailsForCommonJsProject({projectRoot, projectName, provideExample});
356
+
357
+ const chosenBundler = await chooseBundler({bundlers: packageBundlers, decisions});
358
+
359
+ const pathToCreatedSrcDirectory = await makeDir(`${projectRoot}/src`);
360
+ const [bundlerResults] = await Promise.all([
361
+ scaffoldChoice(packageBundlers, chosenBundler, {projectRoot, dialect, projectType: projectTypes$1.PACKAGE}),
362
+ provideExample ? await createExample(projectRoot, projectName) : Promise.resolve,
363
+ touch(`${pathToCreatedSrcDirectory}/index.js`)
364
+ ]);
365
+
366
+ return deepmerge(
367
+ bundlerResults,
368
+ {
369
+ devDependencies: ['rimraf'],
370
+ scripts: {
371
+ clean: `rimraf ./${defaultBuildDirectory$2}`,
372
+ prebuild: 'run-s clean',
373
+ build: 'npm-run-all --print-label --parallel build:*',
374
+ prepack: 'run-s build',
375
+ ...provideExample && {'pregenerate:md': 'run-s build'}
376
+ },
377
+ vcsIgnore: {directories: [`/${defaultBuildDirectory$2}/`]},
378
+ buildDirectory: defaultBuildDirectory$2,
379
+ badges: {
380
+ consumer: {
381
+ ...'Public' === visibility && {
382
+ runkit: {
383
+ img: `https://badge.runkitcdn.com/${packageName}.svg`,
384
+ text: `Try ${packageName} on RunKit`,
385
+ link: `https://npm.runkit.com/${packageName}`
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+ );
392
+ }
393
+
394
+ async function scaffoldPackageType ({
395
+ projectRoot,
396
+ projectName,
397
+ packageName,
398
+ packageManager,
399
+ visibility,
400
+ scope,
401
+ packageBundlers,
402
+ decisions,
403
+ dialect,
404
+ provideExample,
405
+ publishRegistry
406
+ }) {
407
+ info('Scaffolding Package Details');
408
+
409
+ const [detailsForBuild] = await Promise.all([
410
+ buildDetails({
411
+ projectRoot,
412
+ projectName,
413
+ packageBundlers,
414
+ visibility,
415
+ packageName,
416
+ dialect,
417
+ provideExample,
418
+ decisions
419
+ }),
420
+ mergeIntoExistingPackageJson({
421
+ projectRoot,
422
+ config: {
423
+ files: ['example.js', ...dialects$1.COMMON_JS === dialect ? ['index.js'] : ['lib/']],
424
+ publishConfig: {
425
+ access: 'Public' === visibility ? 'public' : 'restricted',
426
+ provenance: true,
427
+ ...publishRegistry && {registry: publishRegistry}
428
+ },
429
+ sideEffects: false,
430
+ ...'Public' === visibility && {runkitExampleFilename: './example.js'},
431
+ ...dialects$1.BABEL === dialect && {
432
+ main: './lib/index.js',
433
+ module: './lib/index.mjs',
434
+ exports: {
435
+ require: './lib/index.js',
436
+ import: './lib/index.mjs'
437
+ }
438
+ },
439
+ ...dialects$1.ESM === dialect && {
440
+ main: './lib/index.mjs',
441
+ exports: './lib/index.mjs'
442
+ },
443
+ ...dialects$1.TYPESCRIPT === dialect && {
444
+ main: './lib/index.js',
445
+ module: './lib/index.mjs',
446
+ types: './lib/index.d.ts',
447
+ exports: {
448
+ types: './lib/index.d.ts',
449
+ require: './lib/index.js',
450
+ import: './lib/index.mjs'
451
+ }
452
+ }
453
+ }
454
+ })
455
+ ]);
456
+
457
+ return deepmerge.all([
458
+ {
459
+ documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
460
+ nextSteps: [
461
+ {summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
462
+ {summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
463
+ ],
464
+ scripts: {'lint:publish': 'publint'},
465
+ badges: defineBadges(packageName, visibility),
466
+ devDependencies: ['publint']
467
+ },
468
+ detailsForBuild
469
+ ]);
470
+ }
471
+
472
+ async function lifter$1 ({projectRoot}) {
473
+ await mergeIntoExistingPackageJson({projectRoot, config: {publishConfig: {provenance: true}}});
474
+
475
+ return {
476
+ devDependencies: ['publint'],
477
+ scripts: {'lint:publish': 'publint'}
478
+ };
479
+ }
480
+
481
+ async function tester$1 ({projectRoot}) {
482
+ const {exports, publishConfig} = JSON.parse(await promises$1.readFile(`${projectRoot}/package.json`, 'utf-8'));
483
+
484
+ return !!exports || !!publishConfig;
485
+ }
486
+
487
+ var projectTypes = /*#__PURE__*/Object.freeze({
488
+ __proto__: null,
489
+ scaffold: scaffoldPackageType,
490
+ lift: lifter$1,
491
+ test: tester$1
492
+ });
493
+
246
494
  function write ({projectRoot, config}) {
247
495
  return write$1({path: projectRoot, name: 'babel', format: fileTypes.JSON, config});
248
496
  }
@@ -290,7 +538,7 @@ async function scaffoldTypescript ({config, projectType, projectRoot, testFilena
290
538
  extends: shareableTsConfigPackage,
291
539
  compilerOptions: {
292
540
  rootDir: 'src',
293
- ...projectTypes.PACKAGE === projectType && {
541
+ ...projectTypes$1.PACKAGE === projectType && {
294
542
  outDir: 'lib',
295
543
  declaration: true
296
544
  }
@@ -362,7 +610,7 @@ function defineVcsHostDetails(vcs, packageType, packageName, pathWithinParent) {
362
610
  }
363
611
  : `${vcs.owner}/${vcs.name}`,
364
612
  bugs: `https://github.com/${vcs.owner}/${vcs.name}/issues`,
365
- homepage: (projectTypes.PACKAGE === packageType)
613
+ homepage: (projectTypes$1.PACKAGE === packageType)
366
614
  ? `https://npm.im/${packageName}`
367
615
  : `https://github.com/${vcs.owner}/${vcs.name}#readme`
368
616
  };
@@ -566,7 +814,15 @@ async function lift ({projectRoot, vcs, results}) {
566
814
 
567
815
  const enhancerResults = await applyEnhancers({
568
816
  results,
569
- enhancers: [huskyPlugin, enginesEnhancer, coveragePlugin, commitConventionPlugin, dialects, codeStylePlugin],
817
+ enhancers: [
818
+ huskyPlugin,
819
+ enginesEnhancer,
820
+ coveragePlugin,
821
+ commitConventionPlugin,
822
+ dialects,
823
+ codeStylePlugin,
824
+ projectTypes
825
+ ],
570
826
  options: {packageManager, projectRoot, vcs}
571
827
  });
572
828
 
@@ -676,15 +932,15 @@ function buildDialectChoices ({babelPreset, typescript}) {
676
932
  }
677
933
 
678
934
  function projectIsCLI(answers) {
679
- return projectTypes.CLI === answers[questionNames$1.PROJECT_TYPE];
935
+ return projectTypes$1.CLI === answers[questionNames$1.PROJECT_TYPE];
680
936
  }
681
937
 
682
938
  function projectIsPackage(answers) {
683
- return projectTypes.PACKAGE === answers[questionNames$1.PROJECT_TYPE];
939
+ return projectTypes$1.PACKAGE === answers[questionNames$1.PROJECT_TYPE];
684
940
  }
685
941
 
686
942
  function projectIsApplication(answers) {
687
- return projectTypes.APPLICATION === answers[questionNames$1.PROJECT_TYPE];
943
+ return projectTypes$1.APPLICATION === answers[questionNames$1.PROJECT_TYPE];
688
944
  }
689
945
 
690
946
  function packageShouldBeScoped(visibility, answers) {
@@ -803,8 +1059,8 @@ async function prompt(
803
1059
  name: questionNames$1.PROJECT_TYPE,
804
1060
  message: 'What type of JavaScript project is this?',
805
1061
  type: 'list',
806
- choices: [...Object.values(projectTypes), new Separator(), 'Other'],
807
- default: projectTypes.PACKAGE
1062
+ choices: [...Object.values(projectTypes$1), new Separator(), 'Other'],
1063
+ default: projectTypes$1.PACKAGE
808
1064
  },
809
1065
  ...'Private' === visibility ? [] : [{
810
1066
  name: questionNames$1.SHOULD_BE_SCOPED,
@@ -863,7 +1119,7 @@ async function prompt(
863
1119
  }
864
1120
 
865
1121
  function projectWillNotBeConsumed(projectType) {
866
- return projectTypes.APPLICATION === projectType || projectTypes.CLI === projectType;
1122
+ return projectTypes$1.APPLICATION === projectType || projectTypes$1.CLI === projectType;
867
1123
  }
868
1124
 
869
1125
  async function scaffoldNpmConfig ({
@@ -889,16 +1145,6 @@ async function scaffoldNpmConfig ({
889
1145
  return {scripts: {'lint:peer': 'npm ls >/dev/null'}};
890
1146
  }
891
1147
 
892
- function buildDocumentationCommand (packageManager) {
893
- if (packageManagers.NPM === packageManager) return 'npm run generate:md';
894
- if (packageManagers.YARN === packageManager) return 'yarn generate:md';
895
-
896
- throw new Error(
897
- `The ${packageManager} package manager is currently not supported. `
898
- + `Only ${Object.values(packageManagers).join(' and ')} are currently supported.`
899
- );
900
- }
901
-
902
1148
  function scaffoldDocumentation ({projectTypeResults, packageManager}) {
903
1149
  return {
904
1150
  toc: `Run \`${buildDocumentationCommand(packageManager)}\` to generate a table of contents`,
@@ -977,221 +1223,6 @@ function buildPackageName (projectName, scope) {
977
1223
  throw new Error(`The package name ${name} is invalid:${EOL}\t* ${errors.join(`${EOL}\t* `)}`);
978
1224
  }
979
1225
 
980
- function getInstallationCommand(packageManager) {
981
- if (packageManagers.NPM === packageManager) return 'npm install';
982
- if (packageManagers.YARN === packageManager) return 'yarn add';
983
-
984
- throw new Error(
985
- `The ${packageManager} package manager is currently not supported. `
986
- + `Only ${Object.values(packageManagers).join(' and ')} are currently supported.`
987
- );
988
- }
989
-
990
- function scaffoldPackageDocumentation ({scope, packageName, packageManager, visibility, provideExample}) {
991
- return {
992
- usage: `### Installation
993
- ${'Private' === visibility ? `
994
- :warning: this is a private package, so you will need to use an npm token with
995
- access to private packages under \`@${scope}\`
996
- ` : ''
997
- }
998
- \`\`\`sh
999
- $ ${getInstallationCommand(packageManager)} ${packageName}
1000
- \`\`\`${provideExample
1001
- ? `
1002
-
1003
- ### Example
1004
-
1005
- run \`${buildDocumentationCommand(packageManager)}\` to inject the usage example`
1006
- : ''
1007
- }`
1008
- };
1009
- }
1010
-
1011
- function defineBadges (packageName, visibility) {
1012
- return {
1013
- consumer: {
1014
- ...'Public' === visibility && {
1015
- npm: {
1016
- img: `https://img.shields.io/npm/v/${packageName}?logo=npm`,
1017
- text: 'npm',
1018
- link: `https://www.npmjs.com/package/${packageName}`
1019
- }
1020
- }
1021
- },
1022
- status: {}
1023
- };
1024
- }
1025
-
1026
- async function chooseBundler ({bundlers, decisions}) {
1027
- if (!Object.keys(bundlers).length) return 'Other';
1028
-
1029
- const answers = await prompt$1([{
1030
- name: questionNames$1.PACKAGE_BUNDLER,
1031
- type: 'list',
1032
- message: 'Which bundler should be used?',
1033
- choices: [...Object.keys(bundlers), new Separator(), 'Other']
1034
- }], decisions);
1035
-
1036
- return answers[questionNames$1.PACKAGE_BUNDLER];
1037
- }
1038
-
1039
- function determinePathToTemplateFile (fileName) {
1040
- const [, __dirname] = filedirname();
1041
-
1042
- return resolve(__dirname, '..', 'templates', fileName);
1043
- }
1044
-
1045
- const defaultBuildDirectory$2 = 'lib';
1046
-
1047
- async function createExample(projectRoot, projectName) {
1048
- return promises.writeFile(
1049
- `${projectRoot}/example.js`,
1050
- mustache.render(
1051
- await promises.readFile(determinePathToTemplateFile('example.mustache'), 'utf8'),
1052
- {projectName: camelcase(projectName)}
1053
- )
1054
- );
1055
- }
1056
-
1057
- async function buildDetailsForCommonJsProject({projectRoot, projectName, provideExample}) {
1058
- await Promise.all([
1059
- touch(`${projectRoot}/index.js`),
1060
- provideExample
1061
- ? promises.writeFile(`${projectRoot}/example.js`, `const ${camelcase(projectName)} = require('.');\n`)
1062
- : Promise.resolve()
1063
- ]);
1064
-
1065
- return {};
1066
- }
1067
-
1068
- async function buildDetails ({
1069
- projectRoot,
1070
- projectName,
1071
- visibility,
1072
- packageName,
1073
- packageBundlers,
1074
- dialect,
1075
- provideExample,
1076
- decisions
1077
- }) {
1078
- if (dialects$1.COMMON_JS === dialect) return buildDetailsForCommonJsProject({projectRoot, projectName, provideExample});
1079
-
1080
- const chosenBundler = await chooseBundler({bundlers: packageBundlers, decisions});
1081
-
1082
- const pathToCreatedSrcDirectory = await makeDir(`${projectRoot}/src`);
1083
- const [bundlerResults] = await Promise.all([
1084
- scaffoldChoice(packageBundlers, chosenBundler, {projectRoot, dialect, projectType: projectTypes.PACKAGE}),
1085
- provideExample ? await createExample(projectRoot, projectName) : Promise.resolve,
1086
- touch(`${pathToCreatedSrcDirectory}/index.js`)
1087
- ]);
1088
-
1089
- return deepmerge(
1090
- bundlerResults,
1091
- {
1092
- devDependencies: ['rimraf'],
1093
- scripts: {
1094
- clean: `rimraf ./${defaultBuildDirectory$2}`,
1095
- prebuild: 'run-s clean',
1096
- build: 'npm-run-all --print-label --parallel build:*',
1097
- prepack: 'run-s build',
1098
- ...provideExample && {'pregenerate:md': 'run-s build'}
1099
- },
1100
- vcsIgnore: {directories: [`/${defaultBuildDirectory$2}/`]},
1101
- buildDirectory: defaultBuildDirectory$2,
1102
- badges: {
1103
- consumer: {
1104
- ...'Public' === visibility && {
1105
- runkit: {
1106
- img: `https://badge.runkitcdn.com/${packageName}.svg`,
1107
- text: `Try ${packageName} on RunKit`,
1108
- link: `https://npm.runkit.com/${packageName}`
1109
- }
1110
- }
1111
- }
1112
- }
1113
- }
1114
- );
1115
- }
1116
-
1117
- async function scaffoldPackageType ({
1118
- projectRoot,
1119
- projectName,
1120
- packageName,
1121
- packageManager,
1122
- visibility,
1123
- scope,
1124
- packageBundlers,
1125
- decisions,
1126
- dialect,
1127
- provideExample,
1128
- publishRegistry
1129
- }) {
1130
- info('Scaffolding Package Details');
1131
-
1132
- const [detailsForBuild] = await Promise.all([
1133
- buildDetails({
1134
- projectRoot,
1135
- projectName,
1136
- packageBundlers,
1137
- visibility,
1138
- packageName,
1139
- dialect,
1140
- provideExample,
1141
- decisions
1142
- }),
1143
- mergeIntoExistingPackageJson({
1144
- projectRoot,
1145
- config: {
1146
- files: ['example.js', ...dialects$1.COMMON_JS === dialect ? ['index.js'] : ['lib/']],
1147
- publishConfig: {
1148
- access: 'Public' === visibility ? 'public' : 'restricted',
1149
- provenance: true,
1150
- ...publishRegistry && {registry: publishRegistry}
1151
- },
1152
- sideEffects: false,
1153
- ...'Public' === visibility && {runkitExampleFilename: './example.js'},
1154
- ...dialects$1.BABEL === dialect && {
1155
- main: './lib/index.js',
1156
- module: './lib/index.mjs',
1157
- exports: {
1158
- require: './lib/index.js',
1159
- import: './lib/index.mjs'
1160
- }
1161
- },
1162
- ...dialects$1.ESM === dialect && {
1163
- main: './lib/index.mjs',
1164
- exports: './lib/index.mjs'
1165
- },
1166
- ...dialects$1.TYPESCRIPT === dialect && {
1167
- main: './lib/index.js',
1168
- module: './lib/index.mjs',
1169
- types: './lib/index.d.ts',
1170
- exports: {
1171
- types: './lib/index.d.ts',
1172
- require: './lib/index.js',
1173
- import: './lib/index.mjs'
1174
- }
1175
- }
1176
- }
1177
- })
1178
- ]);
1179
-
1180
- return deepmerge.all([
1181
- {
1182
- documentation: scaffoldPackageDocumentation({packageName, visibility, scope, packageManager, provideExample}),
1183
- nextSteps: [
1184
- {summary: 'Add the appropriate `save` flag to the installation instructions in the README'},
1185
- {summary: 'Publish pre-release versions to npm until package is stable enough to publish v1.0.0'}
1186
- ],
1187
- scripts: {'lint:publish': 'publint'},
1188
- badges: defineBadges(packageName, visibility),
1189
- devDependencies: ['publint']
1190
- },
1191
- detailsForBuild
1192
- ]);
1193
- }
1194
-
1195
1226
  const defaultBuildDirectory$1 = 'public';
1196
1227
 
1197
1228
  async function scaffoldApplicationType ({projectRoot}) {
@@ -1233,7 +1264,7 @@ const defaultBuildDirectory = 'bin';
1233
1264
 
1234
1265
  async function scaffoldCliType ({packageName, visibility, projectRoot, dialect, publishRegistry}) {
1235
1266
  const [rollupResults] = await Promise.all([
1236
- scaffold$3({projectRoot, dialect, projectType: projectTypes.CLI}),
1267
+ scaffold$3({projectRoot, dialect, projectType: projectTypes$1.CLI}),
1237
1268
  mergeIntoExistingPackageJson({
1238
1269
  projectRoot,
1239
1270
  config: {
@@ -1283,7 +1314,7 @@ async function scaffoldProjectType ({
1283
1314
  publishRegistry
1284
1315
  }) {
1285
1316
  switch (projectType) {
1286
- case projectTypes.PACKAGE:
1317
+ case projectTypes$1.PACKAGE:
1287
1318
  return scaffoldPackageType({
1288
1319
  projectRoot,
1289
1320
  projectName,
@@ -1298,11 +1329,11 @@ async function scaffoldProjectType ({
1298
1329
  provideExample,
1299
1330
  publishRegistry
1300
1331
  });
1301
- case projectTypes.APPLICATION:
1332
+ case projectTypes$1.APPLICATION:
1302
1333
  return scaffoldApplicationType({projectRoot});
1303
- case projectTypes.CLI:
1334
+ case projectTypes$1.CLI:
1304
1335
  return scaffoldCliType({packageName, visibility, projectRoot, dialect, publishRegistry});
1305
- case projectTypes.MONOREPO:
1336
+ case projectTypes$1.MONOREPO:
1306
1337
  return scaffoldMonorepoType({projectRoot});
1307
1338
  case 'Other':
1308
1339
  return {};
@@ -1571,9 +1602,9 @@ async function scaffolder (options) {
1571
1602
  tests,
1572
1603
  decisions,
1573
1604
  plugins: {
1574
- [projectTypes.PACKAGE]: packageTypes,
1575
- [projectTypes.APPLICATION]: applicationTypes,
1576
- [projectTypes.MONOREPO]: monorepoTypes
1605
+ [projectTypes$1.PACKAGE]: packageTypes,
1606
+ [projectTypes$1.APPLICATION]: applicationTypes,
1607
+ [projectTypes$1.MONOREPO]: monorepoTypes
1577
1608
  }
1578
1609
  });
1579
1610
  const mergedContributions = deepmerge.all([
@@ -1612,7 +1643,7 @@ async function scaffolder (options) {
1612
1643
  };
1613
1644
  }
1614
1645
 
1615
- async function test ({projectRoot}) {
1646
+ async function tester ({projectRoot}) {
1616
1647
  const [nvmIsConfigured, packageLockExists, yarnLockExists] = await Promise.all([
1617
1648
  fileExists(`${projectRoot}/.nvmrc`),
1618
1649
  fileExists(`${projectRoot}/package-lock.json`),
@@ -1624,5 +1655,5 @@ async function test ({projectRoot}) {
1624
1655
 
1625
1656
  const questionNames = {...questionNames$2, ...questionNames$1};
1626
1657
 
1627
- export { lift, questionNames, scaffolder as scaffold, scaffoldUnitTesting, test };
1658
+ export { lift, questionNames, scaffolder as scaffold, scaffoldUnitTesting, tester as test };
1628
1659
  //# sourceMappingURL=index.mjs.map