@form8ion/project 22.0.0-beta.2 → 22.0.0-beta.3

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/README.md CHANGED
@@ -71,43 +71,48 @@ a wrapper.
71
71
  #### Import
72
72
 
73
73
  ```javascript
74
+ import {ungroupObject} from '@form8ion/core';
74
75
  import {lift, questionNames, scaffold} from '@form8ion/project';
75
76
  ```
76
77
 
77
78
  #### Execute
78
79
 
79
80
  ```javascript
80
- await scaffold({
81
- decisions: {
82
- [questionNames.PROJECT_NAME]: 'my-project',
83
- [questionNames.LICENSE]: 'MIT',
84
- [questionNames.VISIBILITY]: 'Public',
85
- [questionNames.DESCRIPTION]: 'My project',
86
- [questionNames.GIT_REPO]: false,
87
- [questionNames.COPYRIGHT_HOLDER]: 'John Smith',
88
- [questionNames.COPYRIGHT_YEAR]: '2022',
89
- [questionNames.PROJECT_LANGUAGE]: 'foo'
81
+ const plugins = {
82
+ dependencyUpdaters: {
83
+ bar: {scaffold: options => options}
90
84
  },
91
- plugins: {
92
- dependencyUpdaters: {
93
- bar: {scaffold: options => options}
94
- },
95
- languages: {
96
- foo: {scaffold: options => options}
97
- },
98
- vcsHosts: {
99
- baz: {
100
- scaffold: options => options,
101
- prompt: () => ({repoOwner: 'form8ion'})
102
- }
85
+ languages: {
86
+ foo: {scaffold: options => options}
87
+ },
88
+ vcsHosts: {
89
+ baz: {
90
+ scaffold: options => options,
91
+ prompt: () => ({repoOwner: 'form8ion'})
103
92
  }
104
93
  }
105
- });
94
+ };
95
+
96
+ await scaffold(
97
+ {plugins},
98
+ {
99
+ prompt: () => ({
100
+ [questionNames.PROJECT_NAME]: 'my-project',
101
+ [questionNames.LICENSE]: 'MIT',
102
+ [questionNames.VISIBILITY]: 'Public',
103
+ [questionNames.DESCRIPTION]: 'My project',
104
+ [questionNames.GIT_REPO]: false,
105
+ [questionNames.COPYRIGHT_HOLDER]: 'John Smith',
106
+ [questionNames.COPYRIGHT_YEAR]: '2022',
107
+ [questionNames.PROJECT_LANGUAGE]: 'foo'
108
+ })
109
+ }
110
+ );
106
111
 
107
112
  await lift({
108
113
  projectRoot: process.cwd(),
109
114
  results: {},
110
- enhancers: {foo: {test: () => true, lift: () => ({})}},
115
+ enhancers: ungroupObject(plugins),
111
116
  vcs: {}
112
117
  });
113
118
  ```
package/lib/index.js CHANGED
@@ -1,10 +1,9 @@
1
- import { fileExists, questionsForBaseDetails, optionsSchemas, validateOptions, applyEnhancers, questionNames as questionNames$2 } from '@form8ion/core';
1
+ import { questionsForBaseDetails, questionNames as questionNames$2, fileExists, optionsSchemas, validateOptions, applyEnhancers } from '@form8ion/core';
2
2
  import deepmerge from 'deepmerge';
3
3
  import { execa } from 'execa';
4
4
  import { reportResults } from '@form8ion/results-reporter';
5
5
  import { lift as lift$1, scaffold as scaffold$2 } from '@form8ion/readme';
6
6
  import { warn, info } from '@travi/cli-messages';
7
- import { prompt } from '@form8ion/overridable-prompts';
8
7
  import * as gitPlugin from '@form8ion/git';
9
8
  import { test, scaffold as scaffold$1 } from '@form8ion/git';
10
9
  import { simpleGit } from 'simple-git';
@@ -18,6 +17,15 @@ import { promises as promises$1 } from 'node:fs';
18
17
  import { resolve } from 'path';
19
18
  import filedirname from 'filedirname';
20
19
 
20
+ const BASE_DETAILS_PROMPT_ID = 'BASE_DETAILS';
21
+
22
+ function promptForBaseDetails(projectRoot, {prompt}) {
23
+ return prompt({
24
+ id: BASE_DETAILS_PROMPT_ID,
25
+ questions: questionsForBaseDetails(projectRoot)
26
+ });
27
+ }
28
+
21
29
  const questionNames$1 = {
22
30
  GIT_REPO: 'gitRepo',
23
31
  REPO_HOST: 'repoHost',
@@ -26,37 +34,88 @@ const questionNames$1 = {
26
34
  DEPENDENCY_UPDATER: 'dependencyUpdater'
27
35
  };
28
36
 
29
- function promptForLanguageDetails (languages, decisions) {
30
- return prompt([{
31
- name: questionNames$1.PROJECT_LANGUAGE,
32
- type: 'list',
33
- message: 'What type of project is this?',
34
- choices: [...Object.keys(languages), 'Other']
35
- }], decisions);
37
+ const GIT_REPOSITORY_PROMPT_ID = 'GIT_REPOSITORY';
38
+
39
+ async function promptForRepoCreation({prompt}) {
40
+ const {[questionNames$1.GIT_REPO]: gitRepoShouldBeCreated} = await prompt({
41
+ id: GIT_REPOSITORY_PROMPT_ID,
42
+ questions: [{
43
+ name: questionNames$1.GIT_REPO,
44
+ type: 'confirm',
45
+ default: true,
46
+ message: 'Should a git repository be initialized?'
47
+ }]
48
+ });
49
+
50
+ return gitRepoShouldBeCreated;
36
51
  }
37
52
 
38
- async function scaffoldLanguage (languagePlugins, decisions, options) {
39
- const {[questionNames$1.PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, decisions);
53
+ const PROJECT_LANGUAGE_PROMPT_ID = 'PROJECT_LANGUAGE';
54
+
55
+ function promptForProjectLanguage(languages, {prompt}) {
56
+ return prompt({
57
+ id: PROJECT_LANGUAGE_PROMPT_ID,
58
+ questions: [{
59
+ name: questionNames$1.PROJECT_LANGUAGE,
60
+ type: 'list',
61
+ message: 'What type of project is this?',
62
+ choices: [...Object.keys(languages), 'Other']
63
+ }]
64
+ });
65
+ }
40
66
 
41
- const plugin = languagePlugins[chosenLanguage];
67
+ const REPOSITORY_HOST_PROMPT_ID = 'REPOSITORY_HOST';
68
+
69
+ async function promptForVcsHostChoice(hosts, {prompt}) {
70
+ const answers = await prompt({
71
+ id: REPOSITORY_HOST_PROMPT_ID,
72
+ questions: [{
73
+ name: questionNames$1.REPO_HOST,
74
+ type: 'list',
75
+ message: 'Where will the repository be hosted?',
76
+ choices: Object.keys(hosts)
77
+ }]
78
+ });
79
+ const host = hosts[answers[questionNames$1.REPO_HOST]];
42
80
 
43
- if (plugin) return plugin.scaffold(options);
81
+ return {...answers, ...host};
82
+ }
44
83
 
45
- return undefined;
84
+ const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';
85
+
86
+ async function promptForDependencyUpdaterChoice(updaters, {prompt}) {
87
+ return prompt({
88
+ id: DEPENDENCY_UPDATER_PROMPT_ID,
89
+ questions: [{
90
+ name: questionNames$1.DEPENDENCY_UPDATER,
91
+ type: 'list',
92
+ message: 'Which dependency-update service do you want to manage this project?',
93
+ choices: [...Object.keys(updaters), 'Other']
94
+ }]
95
+ });
46
96
  }
47
97
 
48
- async function promptForRepoCreation(decisions) {
49
- const {[questionNames$1.GIT_REPO]: gitRepoShouldBeCreated} = await prompt(
50
- [{
51
- name: questionNames$1.GIT_REPO,
52
- type: 'confirm',
53
- default: true,
54
- message: 'Should a git repository be initialized?'
55
- }],
56
- decisions
57
- );
98
+ const ids = {
99
+ BASE_DETAILS: BASE_DETAILS_PROMPT_ID,
100
+ GIT_REPOSITORY: GIT_REPOSITORY_PROMPT_ID,
101
+ REPOSITORY_HOST: REPOSITORY_HOST_PROMPT_ID,
102
+ PROJECT_LANGUAGE: PROJECT_LANGUAGE_PROMPT_ID,
103
+ DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID
104
+ };
58
105
 
59
- return gitRepoShouldBeCreated;
106
+ const questionNames = {
107
+ ...questionNames$2,
108
+ ...questionNames$1
109
+ };
110
+
111
+ async function scaffoldLanguage (languagePlugins, options, {prompt}) {
112
+ const {[questionNames$1.PROJECT_LANGUAGE]: chosenLanguage} = await promptForProjectLanguage(languagePlugins, {prompt});
113
+
114
+ const plugin = languagePlugins[chosenLanguage];
115
+
116
+ if (plugin) return plugin.scaffold(options);
117
+
118
+ return undefined;
60
119
  }
61
120
 
62
121
  async function getExistingRemotes(git) {
@@ -107,20 +166,8 @@ async function defineRemoteOrigin(projectRoot, sshUrl) {
107
166
  return {nextSteps: [{summary: 'Set local `master` branch to track upstream `origin/master`'}]};
108
167
  }
109
168
 
110
- async function promptForVcsHostDetails (hosts, decisions) {
111
- const answers = await prompt([{
112
- name: questionNames$1.REPO_HOST,
113
- type: 'list',
114
- message: 'Where will the repository be hosted?',
115
- choices: Object.keys(hosts)
116
- }], decisions);
117
- const host = hosts[answers[questionNames$1.REPO_HOST]];
118
-
119
- return {...answers, ...host};
120
- }
121
-
122
- async function scaffoldVcsHost(hosts, decisions, options) {
123
- const {[questionNames$1.REPO_HOST]: chosenHost} = await promptForVcsHostDetails(hosts, decisions);
169
+ async function scaffoldVcsHost(hosts, options, {prompt}) {
170
+ const {[questionNames$1.REPO_HOST]: chosenHost} = await promptForVcsHostChoice(hosts, {prompt});
124
171
 
125
172
  const lowercasedHosts = Object.fromEntries(
126
173
  Object.entries(hosts).map(([name, details]) => [name.toLowerCase(), details])
@@ -132,8 +179,8 @@ async function scaffoldVcsHost(hosts, decisions, options) {
132
179
  return {vcs: {}};
133
180
  }
134
181
 
135
- async function scaffoldVcs({projectRoot, projectName, decisions, vcsHosts, visibility, description}) {
136
- if (await promptForRepoCreation(decisions)) {
182
+ async function scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt}) {
183
+ if (await promptForRepoCreation({prompt})) {
137
184
  if (await test({projectRoot})) {
138
185
  info('Git repository already exists');
139
186
 
@@ -141,11 +188,7 @@ async function scaffoldVcs({projectRoot, projectName, decisions, vcsHosts, visib
141
188
  }
142
189
 
143
190
  const [{vcs: {host, owner, name, sshUrl}}] = await Promise.all([
144
- scaffoldVcsHost(
145
- vcsHosts,
146
- decisions,
147
- {projectName, projectRoot, description, visibility}
148
- ),
191
+ scaffoldVcsHost(vcsHosts, {projectName, projectRoot, description, visibility}, {prompt}),
149
192
  scaffold$1({projectRoot})
150
193
  ]);
151
194
 
@@ -209,20 +252,11 @@ var licensePlugin = /*#__PURE__*/Object.freeze({
209
252
  test: tester
210
253
  });
211
254
 
212
- async function promptForDependencyUpdaterChoice(updaters, decisions) {
213
- return prompt([{
214
- name: questionNames$1.DEPENDENCY_UPDATER,
215
- type: 'list',
216
- message: 'Which dependency-update service do you want to manage this project?',
217
- choices: [...Object.keys(updaters), 'Other']
218
- }], decisions);
219
- }
220
-
221
- async function scaffoldDependencyUpdater (plugins, decisions, options) {
255
+ async function scaffoldDependencyUpdater (plugins, options, {prompt}) {
222
256
  if (!Object.keys(plugins).length) return undefined;
223
257
 
224
258
  const plugin = plugins[
225
- (await promptForDependencyUpdaterChoice(plugins, decisions))[questionNames$1.DEPENDENCY_UPDATER]
259
+ (await promptForDependencyUpdaterChoice(plugins, {prompt}))[questionNames$1.DEPENDENCY_UPDATER]
226
260
  ];
227
261
 
228
262
  if (plugin) return plugin.scaffold(options);
@@ -230,21 +264,14 @@ async function scaffoldDependencyUpdater (plugins, decisions, options) {
230
264
  return undefined;
231
265
  }
232
266
 
233
- function promptForBaseDetails(projectRoot, decisions) {
234
- return prompt(questionsForBaseDetails(decisions, projectRoot), decisions);
235
- }
236
-
237
267
  var languagePluginsSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
238
268
 
239
269
  var vcsHostPluginsSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin);
240
270
 
241
271
  var dependencyUpdaterPluginsSchema = joi.object().pattern(joi.string(), optionsSchemas.form8ionPlugin).default({});
242
272
 
243
- const decisionsSchema = joi.object();
244
-
245
273
  function validate(options) {
246
274
  return validateOptions(joi.object({
247
- decisions: decisionsSchema,
248
275
  plugins: joi.object({
249
276
  dependencyUpdaters: dependencyUpdaterPluginsSchema,
250
277
  languages: languagePluginsSchema,
@@ -294,9 +321,9 @@ async function lift ({projectRoot, results, enhancers, vcs, dependencies}) {
294
321
  return enhancerResults;
295
322
  }
296
323
 
297
- async function scaffold(options) {
324
+ async function scaffold(options, {prompt}) {
298
325
  const projectRoot = process.cwd();
299
- const {decisions, plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);
326
+ const {plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);
300
327
 
301
328
  const {
302
329
  [questionNames$2.PROJECT_NAME]: projectName,
@@ -305,11 +332,11 @@ async function scaffold(options) {
305
332
  [questionNames$2.DESCRIPTION]: description,
306
333
  [questionNames$2.COPYRIGHT_YEAR]: copyrightYear,
307
334
  [questionNames$2.COPYRIGHT_HOLDER]: copyHolder
308
- } = await promptForBaseDetails(projectRoot, decisions);
335
+ } = await promptForBaseDetails(projectRoot, {prompt});
309
336
  const copyright = {year: copyrightYear, holder: copyHolder};
310
337
 
311
338
  const [vcsResults, contributing, license] = await Promise.all([
312
- scaffoldVcs({projectRoot, projectName, decisions, vcsHosts, visibility, description}),
339
+ scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt}),
313
340
  scaffoldContributing({visibility}),
314
341
  scaffoldLicense({projectRoot, license: chosenLicense, copyright}),
315
342
  scaffold$2({projectName, projectRoot, description}),
@@ -318,14 +345,14 @@ async function scaffold(options) {
318
345
 
319
346
  const dependencyUpdaterResults = vcsResults.vcs && await scaffoldDependencyUpdater(
320
347
  dependencyUpdaters,
321
- decisions,
322
- {projectRoot}
348
+ {projectRoot},
349
+ {prompt}
323
350
  );
324
351
 
325
352
  const language = await scaffoldLanguage(
326
353
  languages,
327
- decisions,
328
- {projectRoot, projectName, vcs: vcsResults.vcs, visibility, license: chosenLicense || 'UNLICENSED', description}
354
+ {projectRoot, projectName, vcs: vcsResults.vcs, visibility, license: chosenLicense || 'UNLICENSED', description},
355
+ {prompt}
329
356
  );
330
357
 
331
358
  const mergedResults = deepmerge.all([
@@ -354,10 +381,7 @@ async function scaffold(options) {
354
381
  reportResults(mergedResults);
355
382
  }
356
383
 
357
- const questionNames = {
358
- ...questionNames$2,
359
- ...questionNames$1
360
- };
384
+ const promptConstants = {ids};
361
385
 
362
- export { lift, questionNames, scaffold };
386
+ export { lift, promptConstants, questionNames, scaffold };
363
387
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/prompts/question-names.js","../src/language/prompt.js","../src/language/scaffolder.js","../src/vcs/prompt.js","../src/vcs/git/remotes.js","../src/vcs/host/prompt.js","../src/vcs/host/scaffolder.js","../src/vcs/scaffolder.js","../src/license/scaffolder.js","../src/license/tester.js","../src/license/lifter.js","../src/dependency-updater/prompt.js","../src/dependency-updater/scaffolder.js","../src/prompts/questions.js","../src/language/schema.js","../src/vcs/host/schema.js","../src/dependency-updater/schema.js","../src/options-schemas.js","../src/options-validator.js","../src/template-path.js","../src/editorconfig/scaffolder.js","../src/contributing/scaffolder.js","../src/lift.js","../src/scaffolder.js","../src/index.js"],"sourcesContent":["export const questionNames = {\n GIT_REPO: 'gitRepo',\n REPO_HOST: 'repoHost',\n REPO_OWNER: 'repoOwner',\n PROJECT_LANGUAGE: 'projectLanguage',\n DEPENDENCY_UPDATER: 'dependencyUpdater'\n};\n","import {prompt} from '@form8ion/overridable-prompts';\n\nimport {questionNames} from '../prompts/question-names.js';\n\nexport default function (languages, decisions) {\n return prompt([{\n name: questionNames.PROJECT_LANGUAGE,\n type: 'list',\n message: 'What type of project is this?',\n choices: [...Object.keys(languages), 'Other']\n }], decisions);\n}\n","import {questionNames} from '../prompts/question-names.js';\nimport promptForLanguageDetails from './prompt.js';\n\nexport default async function (languagePlugins, decisions, options) {\n const {[questionNames.PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, decisions);\n\n const plugin = languagePlugins[chosenLanguage];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import {prompt} from '@form8ion/overridable-prompts';\n\nimport {questionNames} from '../prompts/question-names.js';\n\nexport default async function promptForRepoCreation(decisions) {\n const {[questionNames.GIT_REPO]: gitRepoShouldBeCreated} = await prompt(\n [{\n name: questionNames.GIT_REPO,\n type: 'confirm',\n default: true,\n message: 'Should a git repository be initialized?'\n }],\n decisions\n );\n\n return gitRepoShouldBeCreated;\n}\n","import {simpleGit} from 'simple-git';\nimport hostedGitInfo from 'hosted-git-info';\nimport {warn} from '@travi/cli-messages';\n\nasync function getExistingRemotes(git) {\n try {\n return await git.listRemote();\n } catch (e) {\n if ('fatal: No remote configured to list refs from.\\n' === e.message) {\n return [];\n }\n\n throw e;\n }\n}\n\nexport async function determineExistingVcsDetails({projectRoot}) {\n const git = simpleGit({baseDir: projectRoot});\n const remoteOrigin = await git.remote(['get-url', 'origin']);\n const {user, project, type} = hostedGitInfo.fromUrl(remoteOrigin);\n\n return {vcs: {owner: user, name: project, host: type}};\n}\n\nexport async function defineRemoteOrigin(projectRoot, sshUrl) {\n if (!sshUrl) {\n warn('URL not available to configure remote `origin`');\n\n return {nextSteps: []};\n }\n\n const git = simpleGit({baseDir: projectRoot});\n const existingRemotes = await getExistingRemotes(git);\n\n if (existingRemotes.includes('origin')) {\n warn('The `origin` remote is already defined for this repository');\n\n return {nextSteps: []};\n }\n\n // info('Setting the local `master` branch to track `origin/master`');\n //\n // await gitBranch.setUpstream(\n // await gitBranch.lookup(repository, 'master', gitBranch.BRANCH.LOCAL),\n // 'origin/master'\n // );\n\n await git.addRemote('origin', sshUrl);\n\n return {nextSteps: [{summary: 'Set local `master` branch to track upstream `origin/master`'}]};\n}\n","import {prompt} from '@form8ion/overridable-prompts';\n\nimport {questionNames} from '../../prompts/question-names.js';\n\nexport default async function (hosts, decisions) {\n const answers = await prompt([{\n name: questionNames.REPO_HOST,\n type: 'list',\n message: 'Where will the repository be hosted?',\n choices: Object.keys(hosts)\n }], decisions);\n const host = hosts[answers[questionNames.REPO_HOST]];\n\n return {...answers, ...host};\n}\n","import {questionNames} from '../../prompts/question-names.js';\nimport promptForVcsHostDetails from './prompt.js';\n\nexport default async function scaffoldVcsHost(hosts, decisions, options) {\n const {[questionNames.REPO_HOST]: chosenHost} = await promptForVcsHostDetails(hosts, decisions);\n\n const lowercasedHosts = Object.fromEntries(\n Object.entries(hosts).map(([name, details]) => [name.toLowerCase(), details])\n );\n const host = lowercasedHosts[chosenHost.toLowerCase()];\n\n if (host) return host.scaffold(options);\n\n return {vcs: {}};\n}\n","import {info} from '@travi/cli-messages';\nimport {scaffold as scaffoldGit, test as alreadyVersionedByGit} from '@form8ion/git';\n\nimport repositoryShouldBeCreated from './prompt.js';\nimport {determineExistingVcsDetails, defineRemoteOrigin} from './git/index.js';\nimport {scaffold as scaffoldVcsHost} from './host/index.js';\n\nexport default async function scaffoldVcs({projectRoot, projectName, decisions, vcsHosts, visibility, description}) {\n if (await repositoryShouldBeCreated(decisions)) {\n if (await alreadyVersionedByGit({projectRoot})) {\n info('Git repository already exists');\n\n return {vcs: await determineExistingVcsDetails({projectRoot})};\n }\n\n const [{vcs: {host, owner, name, sshUrl}}] = await Promise.all([\n scaffoldVcsHost(\n vcsHosts,\n decisions,\n {projectName, projectRoot, description, visibility}\n ),\n scaffoldGit({projectRoot})\n ]);\n\n const remoteOriginResults = await defineRemoteOrigin(projectRoot, sshUrl);\n\n return {\n vcs: {host, owner, name},\n nextSteps: [{summary: 'Commit scaffolded files'}, ...remoteOriginResults.nextSteps]\n };\n }\n\n return {};\n}\n","import {promises as fs} from 'fs';\nimport wrap from 'word-wrap';\nimport mustache from 'mustache';\n// eslint-disable-next-line import/extensions\nimport spdxLicenseList from 'spdx-license-list/full.js';\nimport {info} from '@travi/cli-messages';\n\nexport default async function ({projectRoot, license, copyright}) {\n if (license) {\n info('Generating License');\n\n const licenseContent = spdxLicenseList[license].licenseText;\n\n await fs.writeFile(\n `${projectRoot}/LICENSE`,\n `${wrap(\n mustache.render(licenseContent, {year: copyright.year, 'copyright holders': copyright.holder}, {}, ['<', '>']),\n {width: 80, indent: ''}\n )}\\n`\n );\n }\n\n return {};\n}\n","import {fileExists} from '@form8ion/core';\n\nexport default function ({projectRoot}) {\n return fileExists(`${projectRoot}/LICENSE`);\n}\n","function repositoryIsHostedOnGithub(vcs) {\n return vcs && 'github' === vcs.host;\n}\n\nexport default function ({vcs}) {\n return {\n ...repositoryIsHostedOnGithub(vcs) && {\n badges: {\n consumer: {\n license: {\n link: 'LICENSE',\n img: `https://img.shields.io/github/license/${vcs.owner}/${vcs.name}.svg?logo=opensourceinitiative`,\n text: 'license'\n }\n }\n }\n }\n };\n}\n","import {prompt} from '@form8ion/overridable-prompts';\nimport {questionNames} from '../prompts/question-names.js';\n\nexport async function promptForDependencyUpdaterChoice(updaters, decisions) {\n return prompt([{\n name: questionNames.DEPENDENCY_UPDATER,\n type: 'list',\n message: 'Which dependency-update service do you want to manage this project?',\n choices: [...Object.keys(updaters), 'Other']\n }], decisions);\n}\n","import {questionNames} from '../prompts/question-names.js';\nimport {promptForDependencyUpdaterChoice} from './prompt.js';\n\nexport default async function (plugins, decisions, options) {\n if (!Object.keys(plugins).length) return undefined;\n\n const plugin = plugins[\n (await promptForDependencyUpdaterChoice(plugins, decisions))[questionNames.DEPENDENCY_UPDATER]\n ];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import {questionsForBaseDetails} from '@form8ion/core';\nimport {prompt} from '@form8ion/overridable-prompts';\n\nexport function promptForBaseDetails(projectRoot, decisions) {\n return prompt(questionsForBaseDetails(decisions, projectRoot), decisions);\n}\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(/^/, optionsSchemas.form8ionPlugin);\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(joi.string(), optionsSchemas.form8ionPlugin).default({});\n","import joi from 'joi';\n\nexport const decisionsSchema = joi.object();\n","import {validateOptions} from '@form8ion/core';\nimport joi from 'joi';\n\nimport languagePluginsSchema from './language/schema.js';\nimport vcsHostPluginsSchema from './vcs/host/schema.js';\nimport dependencyUpdaterPluginsSchema from './dependency-updater/schema.js';\nimport {decisionsSchema} from './options-schemas.js';\n\nexport function validate(options) {\n return validateOptions(joi.object({\n decisions: decisionsSchema,\n plugins: joi.object({\n dependencyUpdaters: dependencyUpdaterPluginsSchema,\n languages: languagePluginsSchema,\n vcsHosts: vcsHostPluginsSchema\n })\n }), options) || {};\n}\n","import {resolve} from 'path';\nimport filedirname from 'filedirname';\n\nexport default function (fileName) {\n const [, __dirname] = filedirname();\n\n return resolve(__dirname, '..', 'templates', fileName);\n}\n","import {promises as fs} from 'node:fs';\n\nimport determinePathToTemplateFile from '../template-path.js';\n\nexport default function ({projectRoot}) {\n return fs.copyFile(determinePathToTemplateFile('editorconfig.ini'), `${projectRoot}/.editorconfig`);\n}\n","export default function ({visibility}) {\n if ('Public' === visibility) {\n return {\n badges: {\n contribution: {\n PRs: {\n text: 'PRs Welcome',\n link: 'https://makeapullrequest.com',\n img: 'https://img.shields.io/badge/PRs-welcome-brightgreen.svg'\n }\n }\n }\n };\n }\n\n return {};\n}\n","import {applyEnhancers} from '@form8ion/core';\nimport {lift as liftReadme} from '@form8ion/readme';\nimport * as gitPlugin from '@form8ion/git';\n\nimport * as licensePlugin from './license/index.js';\n\nexport default async function ({projectRoot, results, enhancers, vcs, dependencies}) {\n const enhancerResults = await applyEnhancers({\n results,\n enhancers: {...enhancers, gitPlugin, licensePlugin},\n options: {projectRoot, vcs},\n dependencies\n });\n\n await liftReadme({projectRoot, results: enhancerResults});\n\n return enhancerResults;\n}\n","import deepmerge from 'deepmerge';\nimport {execa} from 'execa';\nimport {questionNames as coreQuestionNames} from '@form8ion/core';\nimport {reportResults} from '@form8ion/results-reporter';\nimport {scaffold as scaffoldReadme} from '@form8ion/readme';\nimport {info} from '@travi/cli-messages';\n\nimport {scaffold as scaffoldLanguage} from './language/index.js';\nimport {scaffold as scaffoldVcs} from './vcs/index.js';\nimport {scaffold as scaffoldLicense} from './license/index.js';\nimport scaffoldDependencyUpdater from './dependency-updater/scaffolder.js';\nimport {promptForBaseDetails} from './prompts/questions.js';\nimport {validate} from './options-validator.js';\nimport {scaffold as scaffoldEditorConfig} from './editorconfig/index.js';\nimport {scaffold as scaffoldContributing} from './contributing/index.js';\nimport lift from './lift.js';\n\nexport async function scaffold(options) {\n const projectRoot = process.cwd();\n const {decisions, plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);\n\n const {\n [coreQuestionNames.PROJECT_NAME]: projectName,\n [coreQuestionNames.LICENSE]: chosenLicense,\n [coreQuestionNames.VISIBILITY]: visibility,\n [coreQuestionNames.DESCRIPTION]: description,\n [coreQuestionNames.COPYRIGHT_YEAR]: copyrightYear,\n [coreQuestionNames.COPYRIGHT_HOLDER]: copyHolder\n } = await promptForBaseDetails(projectRoot, decisions);\n const copyright = {year: copyrightYear, holder: copyHolder};\n\n const [vcsResults, contributing, license] = await Promise.all([\n scaffoldVcs({projectRoot, projectName, decisions, vcsHosts, visibility, description}),\n scaffoldContributing({visibility}),\n scaffoldLicense({projectRoot, license: chosenLicense, copyright}),\n scaffoldReadme({projectName, projectRoot, description}),\n scaffoldEditorConfig({projectRoot})\n ]);\n\n const dependencyUpdaterResults = vcsResults.vcs && await scaffoldDependencyUpdater(\n dependencyUpdaters,\n decisions,\n {projectRoot}\n );\n\n const language = await scaffoldLanguage(\n languages,\n decisions,\n {projectRoot, projectName, vcs: vcsResults.vcs, visibility, license: chosenLicense || 'UNLICENSED', description}\n );\n\n const mergedResults = deepmerge.all([\n license,\n language,\n dependencyUpdaterResults,\n contributing,\n vcsResults\n ].filter(Boolean));\n\n await lift({\n projectRoot,\n vcs: vcsResults.vcs,\n results: mergedResults,\n enhancers: {...dependencyUpdaters, ...languages, ...vcsHosts}\n });\n\n if (language && language.verificationCommand) {\n info('Verifying the generated project');\n\n const subprocess = execa(language.verificationCommand, {shell: true});\n subprocess.stdout.pipe(process.stdout);\n await subprocess;\n }\n\n reportResults(mergedResults);\n}\n","import {questionNames as coreQuestionNames} from '@form8ion/core';\nimport {questionNames as projectScaffolderQuestionNames} from './prompts/question-names.js';\n\nexport * from './scaffolder.js';\nexport {default as lift} from './lift.js';\nexport const questionNames = {\n ...coreQuestionNames,\n ...projectScaffolderQuestionNames\n};\n"],"names":["questionNames","repositoryShouldBeCreated","alreadyVersionedByGit","scaffoldGit","fs","liftReadme","coreQuestionNames","scaffoldReadme","projectScaffolderQuestionNames"],"mappings":";;;;;;;;;;;;;;;;;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{"version":3,"file":"index.js","sources":["../src/prompts/questions.js","../src/prompts/question-names.js","../src/vcs/prompt.js","../src/language/prompt.js","../src/vcs/host/prompt.js","../src/dependency-updater/prompt.js","../src/prompts/index.js","../src/language/scaffolder.js","../src/vcs/git/remotes.js","../src/vcs/host/scaffolder.js","../src/vcs/scaffolder.js","../src/license/scaffolder.js","../src/license/tester.js","../src/license/lifter.js","../src/dependency-updater/scaffolder.js","../src/language/schema.js","../src/vcs/host/schema.js","../src/dependency-updater/schema.js","../src/options-validator.js","../src/template-path.js","../src/editorconfig/scaffolder.js","../src/contributing/scaffolder.js","../src/lift.js","../src/scaffolder.js","../src/index.js"],"sourcesContent":["import {questionsForBaseDetails} from '@form8ion/core';\n\nexport const BASE_DETAILS_PROMPT_ID = 'BASE_DETAILS';\n\nexport function promptForBaseDetails(projectRoot, {prompt}) {\n return prompt({\n id: BASE_DETAILS_PROMPT_ID,\n questions: questionsForBaseDetails(projectRoot)\n });\n}\n","export const questionNames = {\n GIT_REPO: 'gitRepo',\n REPO_HOST: 'repoHost',\n REPO_OWNER: 'repoOwner',\n PROJECT_LANGUAGE: 'projectLanguage',\n DEPENDENCY_UPDATER: 'dependencyUpdater'\n};\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const GIT_REPOSITORY_PROMPT_ID = 'GIT_REPOSITORY';\n\nexport default async function promptForRepoCreation({prompt}) {\n const {[questionNames.GIT_REPO]: gitRepoShouldBeCreated} = await prompt({\n id: GIT_REPOSITORY_PROMPT_ID,\n questions: [{\n name: questionNames.GIT_REPO,\n type: 'confirm',\n default: true,\n message: 'Should a git repository be initialized?'\n }]\n });\n\n return gitRepoShouldBeCreated;\n}\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const PROJECT_LANGUAGE_PROMPT_ID = 'PROJECT_LANGUAGE';\n\nexport default function promptForProjectLanguage(languages, {prompt}) {\n return prompt({\n id: PROJECT_LANGUAGE_PROMPT_ID,\n questions: [{\n name: questionNames.PROJECT_LANGUAGE,\n type: 'list',\n message: 'What type of project is this?',\n choices: [...Object.keys(languages), 'Other']\n }]\n });\n}\n","import {questionNames} from '../../prompts/question-names.js';\n\nexport const REPOSITORY_HOST_PROMPT_ID = 'REPOSITORY_HOST';\n\nexport default async function promptForVcsHostChoice(hosts, {prompt}) {\n const answers = await prompt({\n id: REPOSITORY_HOST_PROMPT_ID,\n questions: [{\n name: questionNames.REPO_HOST,\n type: 'list',\n message: 'Where will the repository be hosted?',\n choices: Object.keys(hosts)\n }]\n });\n const host = hosts[answers[questionNames.REPO_HOST]];\n\n return {...answers, ...host};\n}\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';\n\nexport async function promptForDependencyUpdaterChoice(updaters, {prompt}) {\n return prompt({\n id: DEPENDENCY_UPDATER_PROMPT_ID,\n questions: [{\n name: questionNames.DEPENDENCY_UPDATER,\n type: 'list',\n message: 'Which dependency-update service do you want to manage this project?',\n choices: [...Object.keys(updaters), 'Other']\n }]\n });\n}\n","import {questionNames as coreQuestionNames} from '@form8ion/core';\n\nimport {BASE_DETAILS_PROMPT_ID} from './questions.js';\nimport {GIT_REPOSITORY_PROMPT_ID} from '../vcs/prompt.js';\nimport {PROJECT_LANGUAGE_PROMPT_ID} from '../language/prompt.js';\nimport {REPOSITORY_HOST_PROMPT_ID} from '../vcs/host/prompt.js';\nimport {DEPENDENCY_UPDATER_PROMPT_ID} from '../dependency-updater/prompt.js';\nimport {questionNames as projectScaffolderQuestionNames} from './question-names.js';\n\nexport const ids = {\n BASE_DETAILS: BASE_DETAILS_PROMPT_ID,\n GIT_REPOSITORY: GIT_REPOSITORY_PROMPT_ID,\n REPOSITORY_HOST: REPOSITORY_HOST_PROMPT_ID,\n PROJECT_LANGUAGE: PROJECT_LANGUAGE_PROMPT_ID,\n DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID\n};\n\nexport const questionNames = {\n ...coreQuestionNames,\n ...projectScaffolderQuestionNames\n};\n","import {questionNames} from '../prompts/question-names.js';\nimport promptForLanguageDetails from './prompt.js';\n\nexport default async function (languagePlugins, options, {prompt}) {\n const {[questionNames.PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, {prompt});\n\n const plugin = languagePlugins[chosenLanguage];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import {simpleGit} from 'simple-git';\nimport hostedGitInfo from 'hosted-git-info';\nimport {warn} from '@travi/cli-messages';\n\nasync function getExistingRemotes(git) {\n try {\n return await git.listRemote();\n } catch (e) {\n if ('fatal: No remote configured to list refs from.\\n' === e.message) {\n return [];\n }\n\n throw e;\n }\n}\n\nexport async function determineExistingVcsDetails({projectRoot}) {\n const git = simpleGit({baseDir: projectRoot});\n const remoteOrigin = await git.remote(['get-url', 'origin']);\n const {user, project, type} = hostedGitInfo.fromUrl(remoteOrigin);\n\n return {vcs: {owner: user, name: project, host: type}};\n}\n\nexport async function defineRemoteOrigin(projectRoot, sshUrl) {\n if (!sshUrl) {\n warn('URL not available to configure remote `origin`');\n\n return {nextSteps: []};\n }\n\n const git = simpleGit({baseDir: projectRoot});\n const existingRemotes = await getExistingRemotes(git);\n\n if (existingRemotes.includes('origin')) {\n warn('The `origin` remote is already defined for this repository');\n\n return {nextSteps: []};\n }\n\n // info('Setting the local `master` branch to track `origin/master`');\n //\n // await gitBranch.setUpstream(\n // await gitBranch.lookup(repository, 'master', gitBranch.BRANCH.LOCAL),\n // 'origin/master'\n // );\n\n await git.addRemote('origin', sshUrl);\n\n return {nextSteps: [{summary: 'Set local `master` branch to track upstream `origin/master`'}]};\n}\n","import {questionNames} from '../../prompts/question-names.js';\nimport promptForVcsHostDetails from './prompt.js';\n\nexport default async function scaffoldVcsHost(hosts, options, {prompt}) {\n const {[questionNames.REPO_HOST]: chosenHost} = await promptForVcsHostDetails(hosts, {prompt});\n\n const lowercasedHosts = Object.fromEntries(\n Object.entries(hosts).map(([name, details]) => [name.toLowerCase(), details])\n );\n const host = lowercasedHosts[chosenHost.toLowerCase()];\n\n if (host) return host.scaffold(options);\n\n return {vcs: {}};\n}\n","import {info} from '@travi/cli-messages';\nimport {scaffold as scaffoldGit, test as alreadyVersionedByGit} from '@form8ion/git';\n\nimport repositoryShouldBeCreated from './prompt.js';\nimport {determineExistingVcsDetails, defineRemoteOrigin} from './git/index.js';\nimport {scaffold as scaffoldVcsHost} from './host/index.js';\n\nexport default async function scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt}) {\n if (await repositoryShouldBeCreated({prompt})) {\n if (await alreadyVersionedByGit({projectRoot})) {\n info('Git repository already exists');\n\n return {vcs: await determineExistingVcsDetails({projectRoot})};\n }\n\n const [{vcs: {host, owner, name, sshUrl}}] = await Promise.all([\n scaffoldVcsHost(vcsHosts, {projectName, projectRoot, description, visibility}, {prompt}),\n scaffoldGit({projectRoot})\n ]);\n\n const remoteOriginResults = await defineRemoteOrigin(projectRoot, sshUrl);\n\n return {\n vcs: {host, owner, name},\n nextSteps: [{summary: 'Commit scaffolded files'}, ...remoteOriginResults.nextSteps]\n };\n }\n\n return {};\n}\n","import {promises as fs} from 'fs';\nimport wrap from 'word-wrap';\nimport mustache from 'mustache';\n// eslint-disable-next-line import/extensions\nimport spdxLicenseList from 'spdx-license-list/full.js';\nimport {info} from '@travi/cli-messages';\n\nexport default async function ({projectRoot, license, copyright}) {\n if (license) {\n info('Generating License');\n\n const licenseContent = spdxLicenseList[license].licenseText;\n\n await fs.writeFile(\n `${projectRoot}/LICENSE`,\n `${wrap(\n mustache.render(licenseContent, {year: copyright.year, 'copyright holders': copyright.holder}, {}, ['<', '>']),\n {width: 80, indent: ''}\n )}\\n`\n );\n }\n\n return {};\n}\n","import {fileExists} from '@form8ion/core';\n\nexport default function ({projectRoot}) {\n return fileExists(`${projectRoot}/LICENSE`);\n}\n","function repositoryIsHostedOnGithub(vcs) {\n return vcs && 'github' === vcs.host;\n}\n\nexport default function ({vcs}) {\n return {\n ...repositoryIsHostedOnGithub(vcs) && {\n badges: {\n consumer: {\n license: {\n link: 'LICENSE',\n img: `https://img.shields.io/github/license/${vcs.owner}/${vcs.name}.svg?logo=opensourceinitiative`,\n text: 'license'\n }\n }\n }\n }\n };\n}\n","import {questionNames} from '../prompts/question-names.js';\nimport {promptForDependencyUpdaterChoice} from './prompt.js';\n\nexport default async function (plugins, options, {prompt}) {\n if (!Object.keys(plugins).length) return undefined;\n\n const plugin = plugins[\n (await promptForDependencyUpdaterChoice(plugins, {prompt}))[questionNames.DEPENDENCY_UPDATER]\n ];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(/^/, optionsSchemas.form8ionPlugin);\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(joi.string(), optionsSchemas.form8ionPlugin).default({});\n","import {validateOptions} from '@form8ion/core';\nimport joi from 'joi';\n\nimport languagePluginsSchema from './language/schema.js';\nimport vcsHostPluginsSchema from './vcs/host/schema.js';\nimport dependencyUpdaterPluginsSchema from './dependency-updater/schema.js';\n\nexport function validate(options) {\n return validateOptions(joi.object({\n plugins: joi.object({\n dependencyUpdaters: dependencyUpdaterPluginsSchema,\n languages: languagePluginsSchema,\n vcsHosts: vcsHostPluginsSchema\n })\n }), options) || {};\n}\n","import {resolve} from 'path';\nimport filedirname from 'filedirname';\n\nexport default function (fileName) {\n const [, __dirname] = filedirname();\n\n return resolve(__dirname, '..', 'templates', fileName);\n}\n","import {promises as fs} from 'node:fs';\n\nimport determinePathToTemplateFile from '../template-path.js';\n\nexport default function ({projectRoot}) {\n return fs.copyFile(determinePathToTemplateFile('editorconfig.ini'), `${projectRoot}/.editorconfig`);\n}\n","export default function ({visibility}) {\n if ('Public' === visibility) {\n return {\n badges: {\n contribution: {\n PRs: {\n text: 'PRs Welcome',\n link: 'https://makeapullrequest.com',\n img: 'https://img.shields.io/badge/PRs-welcome-brightgreen.svg'\n }\n }\n }\n };\n }\n\n return {};\n}\n","import {applyEnhancers} from '@form8ion/core';\nimport {lift as liftReadme} from '@form8ion/readme';\nimport * as gitPlugin from '@form8ion/git';\n\nimport * as licensePlugin from './license/index.js';\n\nexport default async function ({projectRoot, results, enhancers, vcs, dependencies}) {\n const enhancerResults = await applyEnhancers({\n results,\n enhancers: {...enhancers, gitPlugin, licensePlugin},\n options: {projectRoot, vcs},\n dependencies\n });\n\n await liftReadme({projectRoot, results: enhancerResults});\n\n return enhancerResults;\n}\n","import deepmerge from 'deepmerge';\nimport {execa} from 'execa';\nimport {questionNames as coreQuestionNames} from '@form8ion/core';\nimport {reportResults} from '@form8ion/results-reporter';\nimport {scaffold as scaffoldReadme} from '@form8ion/readme';\nimport {info} from '@travi/cli-messages';\n\nimport {scaffold as scaffoldLanguage} from './language/index.js';\nimport {scaffold as scaffoldVcs} from './vcs/index.js';\nimport {scaffold as scaffoldLicense} from './license/index.js';\nimport scaffoldDependencyUpdater from './dependency-updater/scaffolder.js';\nimport {promptForBaseDetails} from './prompts/questions.js';\nimport {validate} from './options-validator.js';\nimport {scaffold as scaffoldEditorConfig} from './editorconfig/index.js';\nimport {scaffold as scaffoldContributing} from './contributing/index.js';\nimport lift from './lift.js';\n\nexport async function scaffold(options, {prompt}) {\n const projectRoot = process.cwd();\n const {plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);\n\n const {\n [coreQuestionNames.PROJECT_NAME]: projectName,\n [coreQuestionNames.LICENSE]: chosenLicense,\n [coreQuestionNames.VISIBILITY]: visibility,\n [coreQuestionNames.DESCRIPTION]: description,\n [coreQuestionNames.COPYRIGHT_YEAR]: copyrightYear,\n [coreQuestionNames.COPYRIGHT_HOLDER]: copyHolder\n } = await promptForBaseDetails(projectRoot, {prompt});\n const copyright = {year: copyrightYear, holder: copyHolder};\n\n const [vcsResults, contributing, license] = await Promise.all([\n scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt}),\n scaffoldContributing({visibility}),\n scaffoldLicense({projectRoot, license: chosenLicense, copyright}),\n scaffoldReadme({projectName, projectRoot, description}),\n scaffoldEditorConfig({projectRoot})\n ]);\n\n const dependencyUpdaterResults = vcsResults.vcs && await scaffoldDependencyUpdater(\n dependencyUpdaters,\n {projectRoot},\n {prompt}\n );\n\n const language = await scaffoldLanguage(\n languages,\n {projectRoot, projectName, vcs: vcsResults.vcs, visibility, license: chosenLicense || 'UNLICENSED', description},\n {prompt}\n );\n\n const mergedResults = deepmerge.all([\n license,\n language,\n dependencyUpdaterResults,\n contributing,\n vcsResults\n ].filter(Boolean));\n\n await lift({\n projectRoot,\n vcs: vcsResults.vcs,\n results: mergedResults,\n enhancers: {...dependencyUpdaters, ...languages, ...vcsHosts}\n });\n\n if (language && language.verificationCommand) {\n info('Verifying the generated project');\n\n const subprocess = execa(language.verificationCommand, {shell: true});\n subprocess.stdout.pipe(process.stdout);\n await subprocess;\n }\n\n reportResults(mergedResults);\n}\n","import {ids} from './prompts/index.js';\n\nexport * from './scaffolder.js';\nexport {default as lift} from './lift.js';\nexport const promptConstants = {ids};\n\nexport {questionNames} from './prompts/index.js';\n"],"names":["questionNames","coreQuestionNames","projectScaffolderQuestionNames","promptForLanguageDetails","promptForVcsHostDetails","repositoryShouldBeCreated","alreadyVersionedByGit","scaffoldGit","fs","liftReadme","scaffoldReadme"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,MAAM,sBAAsB,GAAG,cAAc;;AAE7C,SAAS,oBAAoB,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE;AAC5D,EAAE,OAAO,MAAM,CAAC;AAChB,IAAI,EAAE,EAAE,sBAAsB;AAC9B,IAAI,SAAS,EAAE,uBAAuB,CAAC,WAAW;AAClD,GAAG,CAAC;AACJ;;ACTO,MAAMA,eAAa,GAAG;AAC7B,E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,EAAE,aAAa;AAC1B,IAAI,SAAS,EAAE,CAAC,GAAG,kBAAkB,EAAE,GAAG,SAAS,EAAE,GAAG,QAAQ;AAChE,GAAG,CAAC;;AAEJ,EAAE,IAAI,QAAQ,IAAI,QAAQ,CAAC,mBAAmB,EAAE;AAChD,IAAI,IAAI,CAAC,iCAAiC,CAAC;;AAE3C,IAAI,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACzE,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AAC1C,IAAI,MAAM,UAAU;AACpB;;AAEA,EAAE,aAAa,CAAC,aAAa,CAAC;AAC9B;;ACvEY,MAAC,eAAe,GAAG,CAAC,GAAG;;;;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@form8ion/project",
3
3
  "description": "opinionated scaffolder for new projects",
4
4
  "license": "MIT",
5
- "version": "22.0.0-beta.2",
5
+ "version": "22.0.0-beta.3",
6
6
  "type": "module",
7
7
  "engines": {
8
8
  "node": "^18.19.0 || ^20.9.0 || >=22.11.0"
@@ -64,7 +64,6 @@
64
64
  "dependencies": {
65
65
  "@form8ion/core": "^4.6.0",
66
66
  "@form8ion/git": "^2.1.1",
67
- "@form8ion/overridable-prompts": "^1.1.0",
68
67
  "@form8ion/readme": "3.1.0",
69
68
  "@form8ion/results-reporter": "^1.1.0",
70
69
  "@hapi/hoek": "^11.0.2",
@@ -1,11 +1,15 @@
1
- import {prompt} from '@form8ion/overridable-prompts';
2
1
  import {questionNames} from '../prompts/question-names.js';
3
2
 
4
- export async function promptForDependencyUpdaterChoice(updaters, decisions) {
5
- return prompt([{
6
- name: questionNames.DEPENDENCY_UPDATER,
7
- type: 'list',
8
- message: 'Which dependency-update service do you want to manage this project?',
9
- choices: [...Object.keys(updaters), 'Other']
10
- }], decisions);
3
+ export const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';
4
+
5
+ export async function promptForDependencyUpdaterChoice(updaters, {prompt}) {
6
+ return prompt({
7
+ id: DEPENDENCY_UPDATER_PROMPT_ID,
8
+ questions: [{
9
+ name: questionNames.DEPENDENCY_UPDATER,
10
+ type: 'list',
11
+ message: 'Which dependency-update service do you want to manage this project?',
12
+ choices: [...Object.keys(updaters), 'Other']
13
+ }]
14
+ });
11
15
  }
@@ -1,30 +1,27 @@
1
- import * as prompts from '@form8ion/overridable-prompts';
2
-
3
- import {afterEach, describe, expect, it, vi} from 'vitest';
1
+ import {describe, expect, it, vi} from 'vitest';
4
2
  import any from '@travi/any';
5
3
  import {when} from 'vitest-when';
6
4
 
7
- import {promptForDependencyUpdaterChoice} from './prompt.js';
5
+ import {DEPENDENCY_UPDATER_PROMPT_ID, promptForDependencyUpdaterChoice} from './prompt.js';
8
6
  import {questionNames} from '../index.js';
9
7
 
10
8
  vi.mock('@form8ion/overridable-prompts');
11
9
 
12
10
  describe('dependency updater prompt', () => {
13
- afterEach(() => {
14
- vi.clearAllMocks();
15
- });
16
-
17
11
  it('should enable choosing the preferred updater', async () => {
12
+ const prompt = vi.fn();
18
13
  const answers = any.simpleObject();
19
14
  const updaters = any.simpleObject();
20
- const decisions = any.simpleObject();
21
- when(prompts.prompt).calledWith([{
22
- name: questionNames.DEPENDENCY_UPDATER,
23
- type: 'list',
24
- message: 'Which dependency-update service do you want to manage this project?',
25
- choices: [...Object.keys(updaters), 'Other']
26
- }], decisions).thenResolve(answers);
15
+ when(prompt).calledWith({
16
+ id: DEPENDENCY_UPDATER_PROMPT_ID,
17
+ questions: [{
18
+ name: questionNames.DEPENDENCY_UPDATER,
19
+ type: 'list',
20
+ message: 'Which dependency-update service do you want to manage this project?',
21
+ choices: [...Object.keys(updaters), 'Other']
22
+ }]
23
+ }).thenResolve(answers);
27
24
 
28
- expect(await promptForDependencyUpdaterChoice(updaters, decisions)).toEqual(answers);
25
+ expect(await promptForDependencyUpdaterChoice(updaters, {prompt})).toEqual(answers);
29
26
  });
30
27
  });
@@ -1,11 +1,11 @@
1
1
  import {questionNames} from '../prompts/question-names.js';
2
2
  import {promptForDependencyUpdaterChoice} from './prompt.js';
3
3
 
4
- export default async function (plugins, decisions, options) {
4
+ export default async function (plugins, options, {prompt}) {
5
5
  if (!Object.keys(plugins).length) return undefined;
6
6
 
7
7
  const plugin = plugins[
8
- (await promptForDependencyUpdaterChoice(plugins, decisions))[questionNames.DEPENDENCY_UPDATER]
8
+ (await promptForDependencyUpdaterChoice(plugins, {prompt}))[questionNames.DEPENDENCY_UPDATER]
9
9
  ];
10
10
 
11
11
  if (plugin) return plugin.scaffold(options);
@@ -1,32 +1,28 @@
1
- import {afterEach, describe, expect, it, vi} from 'vitest';
1
+ import {describe, expect, it, vi} from 'vitest';
2
2
  import any from '@travi/any';
3
3
  import {when} from 'vitest-when';
4
4
 
5
- import * as prompt from './prompt.js';
5
+ import {promptForDependencyUpdaterChoice} from './prompt.js';
6
6
  import scaffoldUpdater from './scaffolder.js';
7
7
  import {questionNames} from '../index.js';
8
- import {promptForDependencyUpdaterChoice} from './prompt.js';
9
8
 
10
9
  vi.mock('./prompt');
11
10
 
12
11
  describe('dependency-updater scaffolder', () => {
13
- afterEach(() => {
14
- vi.clearAllMocks();
15
- });
12
+ const prompt = () => undefined;
16
13
 
17
14
  it('should execute the chosen scaffolder with the appropriate options', async () => {
18
- const decisions = any.simpleObject();
19
15
  const options = any.simpleObject();
20
16
  const chosenUpdater = any.word();
21
17
  const chosenUpdaterScaffolder = vi.fn();
22
18
  const plugins = {...any.simpleObject(), [chosenUpdater]: {scaffold: chosenUpdaterScaffolder}};
23
19
  const scaffolderResult = any.simpleObject();
24
- when(prompt.promptForDependencyUpdaterChoice)
25
- .calledWith(plugins, decisions)
20
+ when(promptForDependencyUpdaterChoice)
21
+ .calledWith(plugins, {prompt})
26
22
  .thenResolve({[questionNames.DEPENDENCY_UPDATER]: chosenUpdater});
27
23
  when(chosenUpdaterScaffolder).calledWith(options).thenResolve(scaffolderResult);
28
24
 
29
- expect(await scaffoldUpdater(plugins, decisions, options)).toEqual(scaffolderResult);
25
+ expect(await scaffoldUpdater(plugins, options, {prompt})).toEqual(scaffolderResult);
30
26
  });
31
27
 
32
28
  it('should not present a prompt if no updaters are registered', async () => {
package/src/index.js CHANGED
@@ -1,9 +1,7 @@
1
- import {questionNames as coreQuestionNames} from '@form8ion/core';
2
- import {questionNames as projectScaffolderQuestionNames} from './prompts/question-names.js';
1
+ import {ids} from './prompts/index.js';
3
2
 
4
3
  export * from './scaffolder.js';
5
4
  export {default as lift} from './lift.js';
6
- export const questionNames = {
7
- ...coreQuestionNames,
8
- ...projectScaffolderQuestionNames
9
- };
5
+ export const promptConstants = {ids};
6
+
7
+ export {questionNames} from './prompts/index.js';