@form8ion/project 22.0.0-beta.13 → 22.0.0-beta.14
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 +43 -11
- package/lib/index.js +127 -101
- package/lib/index.js.map +1 -1
- package/package.json +9 -9
- package/src/ci-provider/prompt.js +17 -0
- package/src/ci-provider/prompt.test.js +27 -0
- package/src/contributing/scaffolder.js +1 -1
- package/src/dependency-updater/prompt.js +3 -1
- package/src/dependency-updater/prompt.test.js +4 -2
- package/src/dependency-updater/scaffolder.js +4 -2
- package/src/dependency-updater/scaffolder.test.js +11 -4
- package/src/editorconfig/scaffolder.js +1 -1
- package/src/index.js +1 -5
- package/src/language/prompt.js +3 -1
- package/src/language/prompt.test.js +3 -1
- package/src/language/scaffolder.js +4 -2
- package/src/language/scaffolder.test.js +10 -5
- package/src/license/lifter.js +1 -1
- package/src/license/tester.js +1 -1
- package/src/prompts/index.js +7 -8
- package/src/prompts/question-names.js +19 -5
- package/src/scaffolder.js +5 -5
- package/src/scaffolder.test.js +6 -4
- package/src/template-path.js +1 -1
- package/src/vcs/host/prompt.js +4 -2
- package/src/vcs/host/prompt.test.js +6 -4
- package/src/vcs/host/scaffolder.js +3 -1
- package/src/vcs/host/scaffolder.test.js +4 -2
- package/src/vcs/prompt.js +4 -2
- package/src/vcs/prompt.test.js +4 -2
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ a wrapper.
|
|
|
72
72
|
|
|
73
73
|
```javascript
|
|
74
74
|
import {ungroupObject} from '@form8ion/core';
|
|
75
|
-
import {lift,
|
|
75
|
+
import {lift, promptConstants, scaffold} from '@form8ion/project';
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
#### Execute
|
|
@@ -96,16 +96,48 @@ const plugins = {
|
|
|
96
96
|
await scaffold(
|
|
97
97
|
{plugins},
|
|
98
98
|
{
|
|
99
|
-
prompt: () =>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
prompt: async ({id}) => {
|
|
100
|
+
const {questionNames, ids} = promptConstants;
|
|
101
|
+
const {
|
|
102
|
+
BASE_DETAILS: baseDetailsPromptId,
|
|
103
|
+
GIT_REPOSITORY: gitRepositoryPromptId,
|
|
104
|
+
PROJECT_LANGUAGE: projectLanguagePromptId
|
|
105
|
+
} = ids;
|
|
106
|
+
|
|
107
|
+
switch (id) {
|
|
108
|
+
case baseDetailsPromptId: {
|
|
109
|
+
const {
|
|
110
|
+
PROJECT_NAME,
|
|
111
|
+
LICENSE,
|
|
112
|
+
VISIBILITY,
|
|
113
|
+
DESCRIPTION,
|
|
114
|
+
COPYRIGHT_HOLDER,
|
|
115
|
+
COPYRIGHT_YEAR
|
|
116
|
+
} = questionNames[baseDetailsPromptId];
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
[PROJECT_NAME]: 'my-project',
|
|
120
|
+
[LICENSE]: 'MIT',
|
|
121
|
+
[VISIBILITY]: 'Public',
|
|
122
|
+
[DESCRIPTION]: 'My project',
|
|
123
|
+
[COPYRIGHT_HOLDER]: 'John Smith',
|
|
124
|
+
[COPYRIGHT_YEAR]: '2022'
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
case gitRepositoryPromptId: {
|
|
128
|
+
const {GIT_REPO} = questionNames[gitRepositoryPromptId];
|
|
129
|
+
|
|
130
|
+
return {[GIT_REPO]: false};
|
|
131
|
+
}
|
|
132
|
+
case projectLanguagePromptId: {
|
|
133
|
+
const {PROJECT_LANGUAGE} = questionNames[projectLanguagePromptId];
|
|
134
|
+
|
|
135
|
+
return {[PROJECT_LANGUAGE]: 'foo'};
|
|
136
|
+
}
|
|
137
|
+
default:
|
|
138
|
+
throw new Error(`Unknown prompt with ID: ${id}`);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
109
141
|
logger: {
|
|
110
142
|
info: () => undefined,
|
|
111
143
|
success: () => undefined,
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { questionsForBaseDetails, questionNames as questionNames$2, fileExists, optionsSchemas, validateOptions, applyEnhancers } from '@form8ion/core';
|
|
2
1
|
import deepmerge from 'deepmerge';
|
|
3
2
|
import { execa } from 'execa';
|
|
3
|
+
import { questionNames as questionNames$1, fileExists, questionsForBaseDetails, optionsSchemas, validateOptions, applyEnhancers } from '@form8ion/core';
|
|
4
4
|
import { lift as lift$1, scaffold as scaffold$2 } from '@form8ion/readme';
|
|
5
5
|
import * as gitPlugin from '@form8ion/git';
|
|
6
6
|
import { test, scaffold as scaffold$1 } from '@form8ion/git';
|
|
@@ -15,46 +15,35 @@ import { promises as promises$1 } from 'node:fs';
|
|
|
15
15
|
import { resolve } from 'path';
|
|
16
16
|
import filedirname from 'filedirname';
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
const questionNames = {
|
|
19
|
+
BASE_DETAILS: questionNames$1,
|
|
20
|
+
GIT_REPOSITORY: {
|
|
21
|
+
GIT_REPO: 'gitRepo'
|
|
22
|
+
},
|
|
23
|
+
REPOSITORY_HOST: {
|
|
24
|
+
REPO_HOST: 'repoHost',
|
|
25
|
+
REPO_OWNER: 'repoOwner'
|
|
26
|
+
},
|
|
27
|
+
PROJECT_LANGUAGE: {
|
|
28
|
+
PROJECT_LANGUAGE: 'projectLanguage'
|
|
29
|
+
},
|
|
30
|
+
DEPENDENCY_UPDATER: {
|
|
31
|
+
DEPENDENCY_UPDATER: 'dependencyUpdater'
|
|
32
|
+
},
|
|
33
|
+
CI_PROVIDER: {
|
|
34
|
+
CI_PROVIDER: 'ciProvider'
|
|
35
|
+
}
|
|
33
36
|
};
|
|
34
37
|
|
|
35
|
-
const GIT_REPOSITORY_PROMPT_ID = 'GIT_REPOSITORY';
|
|
36
|
-
|
|
37
|
-
async function promptForRepoCreation({prompt}) {
|
|
38
|
-
const {[questionNames$1.GIT_REPO]: gitRepoShouldBeCreated} = await prompt({
|
|
39
|
-
id: GIT_REPOSITORY_PROMPT_ID,
|
|
40
|
-
questions: [{
|
|
41
|
-
name: questionNames$1.GIT_REPO,
|
|
42
|
-
type: 'confirm',
|
|
43
|
-
default: true,
|
|
44
|
-
message: 'Should a git repository be initialized?'
|
|
45
|
-
}]
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return gitRepoShouldBeCreated;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
38
|
const PROJECT_LANGUAGE_PROMPT_ID = 'PROJECT_LANGUAGE';
|
|
52
39
|
|
|
40
|
+
const {PROJECT_LANGUAGE: PROJECT_LANGUAGE$1} = questionNames.PROJECT_LANGUAGE;
|
|
41
|
+
|
|
53
42
|
function promptForProjectLanguage(languages, {prompt}) {
|
|
54
43
|
return prompt({
|
|
55
44
|
id: PROJECT_LANGUAGE_PROMPT_ID,
|
|
56
45
|
questions: [{
|
|
57
|
-
name:
|
|
46
|
+
name: PROJECT_LANGUAGE$1,
|
|
58
47
|
type: 'list',
|
|
59
48
|
message: 'What type of project is this?',
|
|
60
49
|
choices: [...Object.keys(languages), 'Other']
|
|
@@ -62,58 +51,34 @@ function promptForProjectLanguage(languages, {prompt}) {
|
|
|
62
51
|
});
|
|
63
52
|
}
|
|
64
53
|
|
|
65
|
-
const
|
|
54
|
+
const {PROJECT_LANGUAGE} = questionNames.PROJECT_LANGUAGE;
|
|
66
55
|
|
|
67
|
-
async function
|
|
68
|
-
const
|
|
69
|
-
id: REPOSITORY_HOST_PROMPT_ID,
|
|
70
|
-
questions: [{
|
|
71
|
-
name: questionNames$1.REPO_HOST,
|
|
72
|
-
type: 'list',
|
|
73
|
-
message: 'Where will the repository be hosted?',
|
|
74
|
-
choices: Object.keys(hosts)
|
|
75
|
-
}]
|
|
76
|
-
});
|
|
77
|
-
const host = hosts[answers[questionNames$1.REPO_HOST]];
|
|
56
|
+
async function scaffoldLanguage(languagePlugins, options, {prompt}) {
|
|
57
|
+
const {[PROJECT_LANGUAGE]: chosenLanguage} = await promptForProjectLanguage(languagePlugins, {prompt});
|
|
78
58
|
|
|
79
|
-
|
|
80
|
-
}
|
|
59
|
+
const plugin = languagePlugins[chosenLanguage];
|
|
81
60
|
|
|
82
|
-
|
|
61
|
+
if (plugin) return plugin.scaffold(options);
|
|
83
62
|
|
|
84
|
-
|
|
85
|
-
return prompt({
|
|
86
|
-
id: DEPENDENCY_UPDATER_PROMPT_ID,
|
|
87
|
-
questions: [{
|
|
88
|
-
name: questionNames$1.DEPENDENCY_UPDATER,
|
|
89
|
-
type: 'list',
|
|
90
|
-
message: 'Which dependency-update service do you want to manage this project?',
|
|
91
|
-
choices: [...Object.keys(updaters), 'Other']
|
|
92
|
-
}]
|
|
93
|
-
});
|
|
63
|
+
return undefined;
|
|
94
64
|
}
|
|
95
65
|
|
|
96
|
-
const
|
|
97
|
-
BASE_DETAILS: BASE_DETAILS_PROMPT_ID,
|
|
98
|
-
GIT_REPOSITORY: GIT_REPOSITORY_PROMPT_ID,
|
|
99
|
-
REPOSITORY_HOST: REPOSITORY_HOST_PROMPT_ID,
|
|
100
|
-
PROJECT_LANGUAGE: PROJECT_LANGUAGE_PROMPT_ID,
|
|
101
|
-
DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const questionNames = {
|
|
105
|
-
...questionNames$2,
|
|
106
|
-
...questionNames$1
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
async function scaffoldLanguage (languagePlugins, options, {prompt}) {
|
|
110
|
-
const {[questionNames$1.PROJECT_LANGUAGE]: chosenLanguage} = await promptForProjectLanguage(languagePlugins, {prompt});
|
|
66
|
+
const GIT_REPOSITORY_PROMPT_ID = 'GIT_REPOSITORY';
|
|
111
67
|
|
|
112
|
-
|
|
68
|
+
const {GIT_REPO} = questionNames.GIT_REPOSITORY;
|
|
113
69
|
|
|
114
|
-
|
|
70
|
+
async function promptForRepoCreation({prompt}) {
|
|
71
|
+
const {[GIT_REPO]: gitRepoShouldBeCreated} = await prompt({
|
|
72
|
+
id: GIT_REPOSITORY_PROMPT_ID,
|
|
73
|
+
questions: [{
|
|
74
|
+
name: GIT_REPO,
|
|
75
|
+
type: 'confirm',
|
|
76
|
+
default: true,
|
|
77
|
+
message: 'Should a git repository be initialized?'
|
|
78
|
+
}]
|
|
79
|
+
});
|
|
115
80
|
|
|
116
|
-
return
|
|
81
|
+
return gitRepoShouldBeCreated;
|
|
117
82
|
}
|
|
118
83
|
|
|
119
84
|
async function getExistingRemotes(git) {
|
|
@@ -164,8 +129,29 @@ async function defineRemoteOrigin(projectRoot, sshUrl, {logger}) {
|
|
|
164
129
|
return {nextSteps: [{summary: 'Set local `master` branch to track upstream `origin/master`'}]};
|
|
165
130
|
}
|
|
166
131
|
|
|
132
|
+
const REPOSITORY_HOST_PROMPT_ID = 'REPOSITORY_HOST';
|
|
133
|
+
|
|
134
|
+
const {REPO_HOST: REPO_HOST$1} = questionNames.REPOSITORY_HOST;
|
|
135
|
+
|
|
136
|
+
async function promptForVcsHostChoice(hosts, {prompt}) {
|
|
137
|
+
const answers = await prompt({
|
|
138
|
+
id: REPOSITORY_HOST_PROMPT_ID,
|
|
139
|
+
questions: [{
|
|
140
|
+
name: REPO_HOST$1,
|
|
141
|
+
type: 'list',
|
|
142
|
+
message: 'Where will the repository be hosted?',
|
|
143
|
+
choices: Object.keys(hosts)
|
|
144
|
+
}]
|
|
145
|
+
});
|
|
146
|
+
const host = hosts[answers[REPO_HOST$1]];
|
|
147
|
+
|
|
148
|
+
return {...answers, ...host};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const {REPO_HOST} = questionNames.REPOSITORY_HOST;
|
|
152
|
+
|
|
167
153
|
async function scaffoldVcsHost(hosts, options, {prompt}) {
|
|
168
|
-
const {[
|
|
154
|
+
const {[REPO_HOST]: chosenHost} = await promptForVcsHostChoice(hosts, {prompt});
|
|
169
155
|
|
|
170
156
|
const lowercasedHosts = Object.fromEntries(
|
|
171
157
|
Object.entries(hosts).map(([name, details]) => [name.toLowerCase(), details])
|
|
@@ -222,7 +208,7 @@ async function scaffoldLicense({projectRoot, license, copyright}, {logger}) {
|
|
|
222
208
|
return {};
|
|
223
209
|
}
|
|
224
210
|
|
|
225
|
-
function
|
|
211
|
+
function licenseDefined({projectRoot}) {
|
|
226
212
|
return fileExists(`${projectRoot}/LICENSE`);
|
|
227
213
|
}
|
|
228
214
|
|
|
@@ -230,7 +216,7 @@ function repositoryIsHostedOnGithub(vcs) {
|
|
|
230
216
|
return vcs && 'github' === vcs.host;
|
|
231
217
|
}
|
|
232
218
|
|
|
233
|
-
function
|
|
219
|
+
function liftLicense({vcs}) {
|
|
234
220
|
return {
|
|
235
221
|
...repositoryIsHostedOnGithub(vcs) && {
|
|
236
222
|
badges: {
|
|
@@ -248,16 +234,34 @@ function lifter ({vcs}) {
|
|
|
248
234
|
|
|
249
235
|
var licensePlugin = /*#__PURE__*/Object.freeze({
|
|
250
236
|
__proto__: null,
|
|
251
|
-
lift:
|
|
237
|
+
lift: liftLicense,
|
|
252
238
|
scaffold: scaffoldLicense,
|
|
253
|
-
test:
|
|
239
|
+
test: licenseDefined
|
|
254
240
|
});
|
|
255
241
|
|
|
256
|
-
|
|
242
|
+
const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';
|
|
243
|
+
|
|
244
|
+
const {DEPENDENCY_UPDATER: DEPENDENCY_UPDATER$1} = questionNames.DEPENDENCY_UPDATER;
|
|
245
|
+
|
|
246
|
+
async function promptForDependencyUpdaterChoice(updaters, {prompt}) {
|
|
247
|
+
return prompt({
|
|
248
|
+
id: DEPENDENCY_UPDATER_PROMPT_ID,
|
|
249
|
+
questions: [{
|
|
250
|
+
name: DEPENDENCY_UPDATER$1,
|
|
251
|
+
type: 'list',
|
|
252
|
+
message: 'Which dependency-update service do you want to manage this project?',
|
|
253
|
+
choices: [...Object.keys(updaters), 'Other']
|
|
254
|
+
}]
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;
|
|
259
|
+
|
|
260
|
+
async function scaffoldDependencyUpdater(plugins, options, {prompt}) {
|
|
257
261
|
if (!Object.keys(plugins).length) return undefined;
|
|
258
262
|
|
|
259
263
|
const plugin = plugins[
|
|
260
|
-
(await promptForDependencyUpdaterChoice(plugins, {prompt}))[
|
|
264
|
+
(await promptForDependencyUpdaterChoice(plugins, {prompt}))[DEPENDENCY_UPDATER]
|
|
261
265
|
];
|
|
262
266
|
|
|
263
267
|
if (plugin) return plugin.scaffold(options);
|
|
@@ -265,6 +269,15 @@ async function scaffoldDependencyUpdater (plugins, options, {prompt}) {
|
|
|
265
269
|
return undefined;
|
|
266
270
|
}
|
|
267
271
|
|
|
272
|
+
const BASE_DETAILS_PROMPT_ID = 'BASE_DETAILS';
|
|
273
|
+
|
|
274
|
+
function promptForBaseDetails(projectRoot, {prompt}) {
|
|
275
|
+
return prompt({
|
|
276
|
+
id: BASE_DETAILS_PROMPT_ID,
|
|
277
|
+
questions: questionsForBaseDetails(projectRoot)
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
268
281
|
var languagePluginsSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});
|
|
269
282
|
|
|
270
283
|
var vcsHostPluginsSchema = joi.object().pattern(/^/, optionsSchemas.form8ionPlugin);
|
|
@@ -284,21 +297,21 @@ function validate(options) {
|
|
|
284
297
|
}), options) || {};
|
|
285
298
|
}
|
|
286
299
|
|
|
287
|
-
function
|
|
300
|
+
function determinePathToTemplate(fileName) {
|
|
288
301
|
const [, __dirname] = filedirname();
|
|
289
302
|
|
|
290
303
|
return resolve(__dirname, '..', 'templates', fileName);
|
|
291
304
|
}
|
|
292
305
|
|
|
293
|
-
function scaffoldEditorConfig
|
|
294
|
-
return promises$1.copyFile(
|
|
306
|
+
function scaffoldEditorConfig({projectRoot}) {
|
|
307
|
+
return promises$1.copyFile(determinePathToTemplate('editorconfig.ini'), `${projectRoot}/.editorconfig`);
|
|
295
308
|
}
|
|
296
309
|
|
|
297
310
|
function editorconfigInUse({projectRoot}) {
|
|
298
311
|
return fileExists(`${projectRoot}/.editorconfig`);
|
|
299
312
|
}
|
|
300
313
|
|
|
301
|
-
function
|
|
314
|
+
function scaffoldContribution({visibility}) {
|
|
302
315
|
if ('Public' === visibility) {
|
|
303
316
|
return {
|
|
304
317
|
badges: {
|
|
@@ -338,28 +351,28 @@ async function scaffold(options, {prompt, logger}) {
|
|
|
338
351
|
const {plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);
|
|
339
352
|
|
|
340
353
|
const {
|
|
341
|
-
[questionNames$
|
|
342
|
-
[questionNames$
|
|
343
|
-
[questionNames$
|
|
344
|
-
[questionNames$
|
|
345
|
-
[questionNames$
|
|
346
|
-
[questionNames$
|
|
354
|
+
[questionNames$1.PROJECT_NAME]: projectName,
|
|
355
|
+
[questionNames$1.LICENSE]: chosenLicense,
|
|
356
|
+
[questionNames$1.VISIBILITY]: visibility,
|
|
357
|
+
[questionNames$1.DESCRIPTION]: description,
|
|
358
|
+
[questionNames$1.COPYRIGHT_YEAR]: copyrightYear,
|
|
359
|
+
[questionNames$1.COPYRIGHT_HOLDER]: copyHolder
|
|
347
360
|
} = await promptForBaseDetails(projectRoot, {prompt});
|
|
348
361
|
const copyright = {year: copyrightYear, holder: copyHolder};
|
|
349
362
|
|
|
350
363
|
const [vcsResults, contributing, license] = await Promise.all([
|
|
351
364
|
scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt, logger}),
|
|
352
|
-
|
|
365
|
+
scaffoldContribution({visibility}),
|
|
353
366
|
scaffoldLicense({projectRoot, license: chosenLicense, copyright}, {logger}),
|
|
354
367
|
scaffold$2({projectName, projectRoot, description}),
|
|
355
368
|
scaffoldEditorConfig({projectRoot})
|
|
356
369
|
]);
|
|
357
370
|
|
|
358
|
-
const dependencyUpdaterResults = vcsResults.vcs
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
371
|
+
const [dependencyUpdaterResults] = vcsResults.vcs
|
|
372
|
+
? await Promise.all([
|
|
373
|
+
scaffoldDependencyUpdater(dependencyUpdaters, {projectRoot}, {prompt})
|
|
374
|
+
])
|
|
375
|
+
: [];
|
|
363
376
|
|
|
364
377
|
const language = await scaffoldLanguage(
|
|
365
378
|
languages,
|
|
@@ -393,7 +406,20 @@ async function scaffold(options, {prompt, logger}) {
|
|
|
393
406
|
return mergedResults;
|
|
394
407
|
}
|
|
395
408
|
|
|
396
|
-
const
|
|
409
|
+
const CI_PROVIDER_PROMPT_ID = 'CI_PROVIDER';
|
|
410
|
+
|
|
411
|
+
const {CI_PROVIDER} = questionNames.CI_PROVIDER;
|
|
412
|
+
|
|
413
|
+
const ids = {
|
|
414
|
+
BASE_DETAILS: BASE_DETAILS_PROMPT_ID,
|
|
415
|
+
GIT_REPOSITORY: GIT_REPOSITORY_PROMPT_ID,
|
|
416
|
+
REPOSITORY_HOST: REPOSITORY_HOST_PROMPT_ID,
|
|
417
|
+
PROJECT_LANGUAGE: PROJECT_LANGUAGE_PROMPT_ID,
|
|
418
|
+
DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID,
|
|
419
|
+
CI_PROVIDER: CI_PROVIDER_PROMPT_ID
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
const constants = {ids, questionNames};
|
|
397
423
|
|
|
398
|
-
export { lift, promptConstants,
|
|
424
|
+
export { lift, constants as promptConstants, scaffold };
|
|
399
425
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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/ci-provider/schema.js","../src/options-validator.js","../src/template-path.js","../src/editorconfig/scaffolder.js","../src/editorconfig/tester.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 parseGitUrl from 'git-url-parse';\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 {owner, name, host} = parseGitUrl(remoteOrigin.trimEnd());\n\n return {vcs: {owner, name, host: 'github.com' === host ? 'github' : host}};\n}\n\nexport async function defineRemoteOrigin(projectRoot, sshUrl, {logger}) {\n if (!sshUrl) {\n logger.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 logger.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 {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(\n {projectRoot, projectName, vcsHosts, visibility, description},\n {prompt, logger}\n) {\n if (await repositoryShouldBeCreated({prompt})) {\n if (await alreadyVersionedByGit({projectRoot})) {\n logger.info('Git repository already exists');\n\n return 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, {logger});\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';\n\nexport default async function scaffoldLicense({projectRoot, license, copyright}, {logger}) {\n if (license) {\n logger.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 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';\nimport ciProviderPluginsSchema from './ci-provider/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 ciProviders: ciProviderPluginsSchema\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","import {fileExists} from '@form8ion/core';\n\nexport default function editorconfigInUse({projectRoot}) {\n return fileExists(`${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 {scaffold as scaffoldEditorconfig, test as editorconfigInUse} from './editorconfig/index.js';\nimport * as licensePlugin from './license/index.js';\n\nexport default async function lift({projectRoot, results, enhancers, vcs, dependencies}) {\n if (!await editorconfigInUse({projectRoot})) {\n await scaffoldEditorconfig({projectRoot});\n }\n\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 {scaffold as scaffoldReadme} from '@form8ion/readme';\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, logger}) {\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, logger}),\n scaffoldContributing({visibility}),\n scaffoldLicense({projectRoot, license: chosenLicense, copyright}, {logger}),\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 logger.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 return 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","alreadyVersioned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MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC;;AAElD,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,EAAE;;AAEF,EAAE,OAAO,aAAa;AACtB;;ACrEY,MAAC,eAAe,GAAG,CAAC,GAAG;;;;"}
|
|
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/ci-provider/schema.js","../src/options-validator.js","../src/template-path.js","../src/editorconfig/scaffolder.js","../src/editorconfig/tester.js","../src/contributing/scaffolder.js","../src/lift.js","../src/scaffolder.js","../src/ci-provider/prompt.js","../src/prompts/index.js"],"sourcesContent":["import {questionNames as coreQuestionNames} from '@form8ion/core';\n\nexport const questionNames = {\n BASE_DETAILS: coreQuestionNames,\n GIT_REPOSITORY: {\n GIT_REPO: 'gitRepo'\n },\n REPOSITORY_HOST: {\n REPO_HOST: 'repoHost',\n REPO_OWNER: 'repoOwner'\n },\n PROJECT_LANGUAGE: {\n PROJECT_LANGUAGE: 'projectLanguage'\n },\n DEPENDENCY_UPDATER: {\n DEPENDENCY_UPDATER: 'dependencyUpdater'\n },\n CI_PROVIDER: {\n CI_PROVIDER: 'ciProvider'\n }\n};\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const PROJECT_LANGUAGE_PROMPT_ID = 'PROJECT_LANGUAGE';\n\nconst {PROJECT_LANGUAGE} = questionNames.PROJECT_LANGUAGE;\n\nexport default function promptForProjectLanguage(languages, {prompt}) {\n return prompt({\n id: PROJECT_LANGUAGE_PROMPT_ID,\n questions: [{\n name: 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';\nimport promptForLanguageDetails from './prompt.js';\n\nconst {PROJECT_LANGUAGE} = questionNames.PROJECT_LANGUAGE;\n\nexport default async function scaffoldLanguage(languagePlugins, options, {prompt}) {\n const {[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 {questionNames} from '../prompts/question-names.js';\n\nexport const GIT_REPOSITORY_PROMPT_ID = 'GIT_REPOSITORY';\n\nconst {GIT_REPO} = questionNames.GIT_REPOSITORY;\n\nexport default async function promptForRepoCreation({prompt}) {\n const {[GIT_REPO]: gitRepoShouldBeCreated} = await prompt({\n id: GIT_REPOSITORY_PROMPT_ID,\n questions: [{\n name: 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 {simpleGit} from 'simple-git';\nimport parseGitUrl from 'git-url-parse';\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 {owner, name, host} = parseGitUrl(remoteOrigin.trimEnd());\n\n return {vcs: {owner, name, host: 'github.com' === host ? 'github' : host}};\n}\n\nexport async function defineRemoteOrigin(projectRoot, sshUrl, {logger}) {\n if (!sshUrl) {\n logger.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 logger.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';\n\nexport const REPOSITORY_HOST_PROMPT_ID = 'REPOSITORY_HOST';\n\nconst {REPO_HOST} = questionNames.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: 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[REPO_HOST]];\n\n return {...answers, ...host};\n}\n","import {questionNames} from '../../prompts/question-names.js';\nimport promptForVcsHostDetails from './prompt.js';\n\nconst {REPO_HOST} = questionNames.REPOSITORY_HOST;\n\nexport default async function scaffoldVcsHost(hosts, options, {prompt}) {\n const {[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 {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(\n {projectRoot, projectName, vcsHosts, visibility, description},\n {prompt, logger}\n) {\n if (await repositoryShouldBeCreated({prompt})) {\n if (await alreadyVersionedByGit({projectRoot})) {\n logger.info('Git repository already exists');\n\n return 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, {logger});\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';\n\nexport default async function scaffoldLicense({projectRoot, license, copyright}, {logger}) {\n if (license) {\n logger.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 licenseDefined({projectRoot}) {\n return fileExists(`${projectRoot}/LICENSE`);\n}\n","function repositoryIsHostedOnGithub(vcs) {\n return vcs && 'github' === vcs.host;\n}\n\nexport default function liftLicense({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';\n\nexport const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';\n\nconst {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;\n\nexport async function promptForDependencyUpdaterChoice(updaters, {prompt}) {\n return prompt({\n id: DEPENDENCY_UPDATER_PROMPT_ID,\n questions: [{\n name: 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} from '../prompts/question-names.js';\nimport {promptForDependencyUpdaterChoice} from './prompt.js';\n\nconst {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;\n\nexport default async function scaffoldDependencyUpdater(plugins, options, {prompt}) {\n if (!Object.keys(plugins).length) return undefined;\n\n const plugin = plugins[\n (await promptForDependencyUpdaterChoice(plugins, {prompt}))[DEPENDENCY_UPDATER]\n ];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","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","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';\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';\nimport ciProviderPluginsSchema from './ci-provider/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 ciProviders: ciProviderPluginsSchema\n })\n }), options) || {};\n}\n","import {resolve} from 'path';\nimport filedirname from 'filedirname';\n\nexport default function determinePathToTemplate(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 scaffoldEditorConfig({projectRoot}) {\n return fs.copyFile(determinePathToTemplateFile('editorconfig.ini'), `${projectRoot}/.editorconfig`);\n}\n","import {fileExists} from '@form8ion/core';\n\nexport default function editorconfigInUse({projectRoot}) {\n return fileExists(`${projectRoot}/.editorconfig`);\n}\n","export default function scaffoldContribution({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 {scaffold as scaffoldEditorconfig, test as editorconfigInUse} from './editorconfig/index.js';\nimport * as licensePlugin from './license/index.js';\n\nexport default async function lift({projectRoot, results, enhancers, vcs, dependencies}) {\n if (!await editorconfigInUse({projectRoot})) {\n await scaffoldEditorconfig({projectRoot});\n }\n\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 {scaffold as scaffoldReadme} from '@form8ion/readme';\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, logger}) {\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, logger}),\n scaffoldContributing({visibility}),\n scaffoldLicense({projectRoot, license: chosenLicense, copyright}, {logger}),\n scaffoldReadme({projectName, projectRoot, description}),\n scaffoldEditorConfig({projectRoot})\n ]);\n\n const [dependencyUpdaterResults] = vcsResults.vcs\n ? await Promise.all([\n scaffoldDependencyUpdater(dependencyUpdaters, {projectRoot}, {prompt})\n ])\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 logger.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 return mergedResults;\n}\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const CI_PROVIDER_PROMPT_ID = 'CI_PROVIDER';\n\nconst {CI_PROVIDER} = questionNames.CI_PROVIDER;\n\nexport default function promptForCiProvider(providers, {prompt}) {\n return prompt({\n id: CI_PROVIDER_PROMPT_ID,\n questions: [{\n name: CI_PROVIDER,\n type: 'list',\n message: 'Which CI service do you want use with this project?',\n choices: [...Object.keys(providers), 'Other']\n }]\n });\n}\n","import {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 {CI_PROVIDER_PROMPT_ID} from '../ci-provider/prompt.js';\nimport {questionNames} 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 CI_PROVIDER: CI_PROVIDER_PROMPT_ID\n};\n\nexport {questionNames};\n\nexport const constants = {ids, questionNames};\n"],"names":["coreQuestionNames","PROJECT_LANGUAGE","promptForLanguageDetails","REPO_HOST","promptForVcsHostDetails","repositoryShouldBeCreated","alreadyVersionedByGit","scaffoldGit","fs","DEPENDENCY_UPDATER","determinePathToTemplateFile","scaffoldEditorconfig","liftReadme","scaffoldContributing","scaffoldReadme"],"mappings":";;;;;;;;;;;;;;;;;AAEO,MAAM,aAAa,G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AG,EAAE,UAAU,CAAC,GAAG;AACvB,IAAI,OAAO,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,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC;;AAElD,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,EAAE;;AAEF,EAAE,OAAO,aAAa;AACtB;;ACvEO,MAAM,qBAAqB,GAAG,aAAa;;AAElD,MAAM,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,WAAW;;ACIxC,MAAM,GAAG,GAAG;AACnB,EAAE,YAAY,EAAE,sBAAsB;AACtC,EAAE,cAAc,EAAE,wBAAwB;AAC1C,EAAE,eAAe,EAAE,yBAAyB;AAC5C,EAAE,gBAAgB,EAAE,0BAA0B;AAC9C,EAAE,kBAAkB,EAAE,4BAA4B;AAClD,EAAE,WAAW,EAAE;AACf,CAAC;;AAIW,MAAC,SAAS,GAAG,CAAC,GAAG,EAAE,aAAa;;;;"}
|
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.
|
|
5
|
+
"version": "22.0.0-beta.14",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": "^22.21.0 || >=24.12"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"access": "public",
|
|
56
56
|
"provenance": true
|
|
57
57
|
},
|
|
58
|
-
"packageManager": "npm@11.
|
|
58
|
+
"packageManager": "npm@11.13.0+sha512.7119a16a0843580d65160977520e3f5710c974f04afd4fad36d9eb97d917ba716a856c35c78c4be6dc64367eeaccfb957ef5ce997ca31e9330b2e936ba2b1b92",
|
|
59
59
|
"config": {
|
|
60
60
|
"commitizen": {
|
|
61
61
|
"path": "./node_modules/cz-conventional-changelog"
|
|
@@ -78,14 +78,14 @@
|
|
|
78
78
|
"write-yaml": "1.0.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@cucumber/cucumber": "12.
|
|
82
|
-
"@form8ion/commitlint-config": "2.0.
|
|
83
|
-
"@form8ion/eslint-config": "7.0.
|
|
81
|
+
"@cucumber/cucumber": "12.8.2",
|
|
82
|
+
"@form8ion/commitlint-config": "2.0.13",
|
|
83
|
+
"@form8ion/eslint-config": "7.1.0-beta.1",
|
|
84
84
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
85
85
|
"@form8ion/eslint-config-vitest": "1.1.0",
|
|
86
86
|
"@form8ion/remark-lint-preset": "6.0.7",
|
|
87
87
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
88
|
-
"@travi/any": "3.
|
|
88
|
+
"@travi/any": "3.3.0",
|
|
89
89
|
"c8": "11.0.0",
|
|
90
90
|
"chai": "6.2.2",
|
|
91
91
|
"cross-env": "10.1.0",
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"remark-toc": "9.0.0",
|
|
106
106
|
"remark-usage": "11.0.1",
|
|
107
107
|
"rimraf": "6.1.3",
|
|
108
|
-
"rollup": "4.60.
|
|
108
|
+
"rollup": "4.60.2",
|
|
109
109
|
"rollup-plugin-auto-external": "2.0.0",
|
|
110
|
-
"sinon": "21.1.
|
|
110
|
+
"sinon": "21.1.2",
|
|
111
111
|
"testdouble": "3.20.2",
|
|
112
112
|
"unist-util-find": "3.0.0",
|
|
113
|
-
"vitest": "4.1.
|
|
113
|
+
"vitest": "4.1.5",
|
|
114
114
|
"vitest-when": "0.10.0"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {questionNames} from '../prompts/question-names.js';
|
|
2
|
+
|
|
3
|
+
export const CI_PROVIDER_PROMPT_ID = 'CI_PROVIDER';
|
|
4
|
+
|
|
5
|
+
const {CI_PROVIDER} = questionNames.CI_PROVIDER;
|
|
6
|
+
|
|
7
|
+
export default function promptForCiProvider(providers, {prompt}) {
|
|
8
|
+
return prompt({
|
|
9
|
+
id: CI_PROVIDER_PROMPT_ID,
|
|
10
|
+
questions: [{
|
|
11
|
+
name: CI_PROVIDER,
|
|
12
|
+
type: 'list',
|
|
13
|
+
message: 'Which CI service do you want use with this project?',
|
|
14
|
+
choices: [...Object.keys(providers), 'Other']
|
|
15
|
+
}]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {describe, it, expect, vi} from 'vitest';
|
|
2
|
+
import any from '@travi/any';
|
|
3
|
+
import {when} from 'vitest-when';
|
|
4
|
+
|
|
5
|
+
import promptForCiProvider, {CI_PROVIDER_PROMPT_ID} from './prompt.js';
|
|
6
|
+
import {questionNames} from '../prompts/index.js';
|
|
7
|
+
|
|
8
|
+
const {CI_PROVIDER} = questionNames.CI_PROVIDER;
|
|
9
|
+
|
|
10
|
+
describe('ci-provider-prompt', () => {
|
|
11
|
+
it('should prompt for the provider choice', async () => {
|
|
12
|
+
const prompt = vi.fn();
|
|
13
|
+
const answers = any.simpleObject();
|
|
14
|
+
const providers = any.simpleObject();
|
|
15
|
+
when(prompt).calledWith({
|
|
16
|
+
id: CI_PROVIDER_PROMPT_ID,
|
|
17
|
+
questions: [{
|
|
18
|
+
name: CI_PROVIDER,
|
|
19
|
+
type: 'list',
|
|
20
|
+
message: 'Which CI service do you want use with this project?',
|
|
21
|
+
choices: [...Object.keys(providers), 'Other']
|
|
22
|
+
}]
|
|
23
|
+
}).thenResolve(answers);
|
|
24
|
+
|
|
25
|
+
expect(await promptForCiProvider(providers, {prompt})).toEqual(answers);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -2,11 +2,13 @@ import {questionNames} from '../prompts/question-names.js';
|
|
|
2
2
|
|
|
3
3
|
export const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';
|
|
4
4
|
|
|
5
|
+
const {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;
|
|
6
|
+
|
|
5
7
|
export async function promptForDependencyUpdaterChoice(updaters, {prompt}) {
|
|
6
8
|
return prompt({
|
|
7
9
|
id: DEPENDENCY_UPDATER_PROMPT_ID,
|
|
8
10
|
questions: [{
|
|
9
|
-
name:
|
|
11
|
+
name: DEPENDENCY_UPDATER,
|
|
10
12
|
type: 'list',
|
|
11
13
|
message: 'Which dependency-update service do you want to manage this project?',
|
|
12
14
|
choices: [...Object.keys(updaters), 'Other']
|
|
@@ -3,10 +3,12 @@ import any from '@travi/any';
|
|
|
3
3
|
import {when} from 'vitest-when';
|
|
4
4
|
|
|
5
5
|
import {DEPENDENCY_UPDATER_PROMPT_ID, promptForDependencyUpdaterChoice} from './prompt.js';
|
|
6
|
-
import {questionNames} from '../index.js';
|
|
6
|
+
import {questionNames} from '../prompts/index.js';
|
|
7
7
|
|
|
8
8
|
vi.mock('@form8ion/overridable-prompts');
|
|
9
9
|
|
|
10
|
+
const {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;
|
|
11
|
+
|
|
10
12
|
describe('dependency updater prompt', () => {
|
|
11
13
|
it('should enable choosing the preferred updater', async () => {
|
|
12
14
|
const prompt = vi.fn();
|
|
@@ -15,7 +17,7 @@ describe('dependency updater prompt', () => {
|
|
|
15
17
|
when(prompt).calledWith({
|
|
16
18
|
id: DEPENDENCY_UPDATER_PROMPT_ID,
|
|
17
19
|
questions: [{
|
|
18
|
-
name:
|
|
20
|
+
name: DEPENDENCY_UPDATER,
|
|
19
21
|
type: 'list',
|
|
20
22
|
message: 'Which dependency-update service do you want to manage this project?',
|
|
21
23
|
choices: [...Object.keys(updaters), 'Other']
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {questionNames} from '../prompts/question-names.js';
|
|
2
2
|
import {promptForDependencyUpdaterChoice} from './prompt.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;
|
|
5
|
+
|
|
6
|
+
export default async function scaffoldDependencyUpdater(plugins, options, {prompt}) {
|
|
5
7
|
if (!Object.keys(plugins).length) return undefined;
|
|
6
8
|
|
|
7
9
|
const plugin = plugins[
|
|
8
|
-
(await promptForDependencyUpdaterChoice(plugins, {prompt}))[
|
|
10
|
+
(await promptForDependencyUpdaterChoice(plugins, {prompt}))[DEPENDENCY_UPDATER]
|
|
9
11
|
];
|
|
10
12
|
|
|
11
13
|
if (plugin) return plugin.scaffold(options);
|
|
@@ -4,10 +4,12 @@ import {when} from 'vitest-when';
|
|
|
4
4
|
|
|
5
5
|
import {promptForDependencyUpdaterChoice} from './prompt.js';
|
|
6
6
|
import scaffoldUpdater from './scaffolder.js';
|
|
7
|
-
import {questionNames} from '../index.js';
|
|
7
|
+
import {questionNames} from '../prompts/index.js';
|
|
8
8
|
|
|
9
9
|
vi.mock('./prompt.js');
|
|
10
10
|
|
|
11
|
+
const {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;
|
|
12
|
+
|
|
11
13
|
describe('dependency-updater scaffolder', () => {
|
|
12
14
|
const prompt = () => undefined;
|
|
13
15
|
|
|
@@ -19,7 +21,7 @@ describe('dependency-updater scaffolder', () => {
|
|
|
19
21
|
const scaffolderResult = any.simpleObject();
|
|
20
22
|
when(promptForDependencyUpdaterChoice)
|
|
21
23
|
.calledWith(plugins, {prompt})
|
|
22
|
-
.thenResolve({[
|
|
24
|
+
.thenResolve({[DEPENDENCY_UPDATER]: chosenUpdater});
|
|
23
25
|
when(chosenUpdaterScaffolder).calledWith(options).thenResolve(scaffolderResult);
|
|
24
26
|
|
|
25
27
|
expect(await scaffoldUpdater(plugins, options, {prompt})).toEqual(scaffolderResult);
|
|
@@ -31,8 +33,13 @@ describe('dependency-updater scaffolder', () => {
|
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
it('should not result in an error when choosing an updater without a defined scaffolder', async () => {
|
|
34
|
-
|
|
36
|
+
const plugins = any.simpleObject();
|
|
37
|
+
const options = any.simpleObject();
|
|
38
|
+
const context = {prompt: undefined};
|
|
39
|
+
when(promptForDependencyUpdaterChoice)
|
|
40
|
+
.calledWith(plugins, context)
|
|
41
|
+
.thenResolve({[DEPENDENCY_UPDATER]: any.word()});
|
|
35
42
|
|
|
36
|
-
expect(await scaffoldUpdater(
|
|
43
|
+
expect(await scaffoldUpdater(plugins, options, context)).toBe(undefined);
|
|
37
44
|
});
|
|
38
45
|
});
|
|
@@ -2,6 +2,6 @@ import {promises as fs} from 'node:fs';
|
|
|
2
2
|
|
|
3
3
|
import determinePathToTemplateFile from '../template-path.js';
|
|
4
4
|
|
|
5
|
-
export default function ({projectRoot}) {
|
|
5
|
+
export default function scaffoldEditorConfig({projectRoot}) {
|
|
6
6
|
return fs.copyFile(determinePathToTemplateFile('editorconfig.ini'), `${projectRoot}/.editorconfig`);
|
|
7
7
|
}
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {ids} from './prompts/index.js';
|
|
2
|
-
|
|
3
1
|
export * from './scaffolder.js';
|
|
4
2
|
export {default as lift} from './lift.js';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export {questionNames} from './prompts/index.js';
|
|
3
|
+
export {constants as promptConstants} from './prompts/index.js';
|
package/src/language/prompt.js
CHANGED
|
@@ -2,11 +2,13 @@ import {questionNames} from '../prompts/question-names.js';
|
|
|
2
2
|
|
|
3
3
|
export const PROJECT_LANGUAGE_PROMPT_ID = 'PROJECT_LANGUAGE';
|
|
4
4
|
|
|
5
|
+
const {PROJECT_LANGUAGE} = questionNames.PROJECT_LANGUAGE;
|
|
6
|
+
|
|
5
7
|
export default function promptForProjectLanguage(languages, {prompt}) {
|
|
6
8
|
return prompt({
|
|
7
9
|
id: PROJECT_LANGUAGE_PROMPT_ID,
|
|
8
10
|
questions: [{
|
|
9
|
-
name:
|
|
11
|
+
name: PROJECT_LANGUAGE,
|
|
10
12
|
type: 'list',
|
|
11
13
|
message: 'What type of project is this?',
|
|
12
14
|
choices: [...Object.keys(languages), 'Other']
|
|
@@ -7,6 +7,8 @@ import promptForLanguageDetails, {PROJECT_LANGUAGE_PROMPT_ID} from './prompt.js'
|
|
|
7
7
|
|
|
8
8
|
vi.mock('@form8ion/overridable-prompts');
|
|
9
9
|
|
|
10
|
+
const {PROJECT_LANGUAGE} = questionNames.PROJECT_LANGUAGE;
|
|
11
|
+
|
|
10
12
|
describe('language prompt', () => {
|
|
11
13
|
it('should prompt for the language details', async () => {
|
|
12
14
|
const prompt = vi.fn();
|
|
@@ -15,7 +17,7 @@ describe('language prompt', () => {
|
|
|
15
17
|
when(prompt).calledWith({
|
|
16
18
|
id: PROJECT_LANGUAGE_PROMPT_ID,
|
|
17
19
|
questions: [{
|
|
18
|
-
name:
|
|
20
|
+
name: PROJECT_LANGUAGE,
|
|
19
21
|
type: 'list',
|
|
20
22
|
message: 'What type of project is this?',
|
|
21
23
|
choices: [...Object.keys(languages), 'Other']
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {questionNames} from '../prompts/question-names.js';
|
|
2
2
|
import promptForLanguageDetails from './prompt.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const {PROJECT_LANGUAGE} = questionNames.PROJECT_LANGUAGE;
|
|
5
|
+
|
|
6
|
+
export default async function scaffoldLanguage(languagePlugins, options, {prompt}) {
|
|
7
|
+
const {[PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, {prompt});
|
|
6
8
|
|
|
7
9
|
const plugin = languagePlugins[chosenLanguage];
|
|
8
10
|
|
|
@@ -2,12 +2,14 @@ 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
|
|
5
|
+
import promptForProjectLanguage from './prompt.js';
|
|
6
6
|
import {questionNames} from '../prompts/question-names.js';
|
|
7
7
|
import scaffold from './scaffolder.js';
|
|
8
8
|
|
|
9
9
|
vi.mock('./prompt.js');
|
|
10
10
|
|
|
11
|
+
const {PROJECT_LANGUAGE} = questionNames.PROJECT_LANGUAGE;
|
|
12
|
+
|
|
11
13
|
describe('language scaffolder', () => {
|
|
12
14
|
it('should scaffold the chosen language', async () => {
|
|
13
15
|
const options = any.simpleObject();
|
|
@@ -16,17 +18,20 @@ describe('language scaffolder', () => {
|
|
|
16
18
|
const prompt = () => undefined;
|
|
17
19
|
const chosenLanguageScaffolder = vi.fn();
|
|
18
20
|
const plugins = {...any.simpleObject(), [chosenLanguage]: {scaffold: chosenLanguageScaffolder}};
|
|
19
|
-
when(
|
|
21
|
+
when(promptForProjectLanguage)
|
|
20
22
|
.calledWith(plugins, {prompt})
|
|
21
|
-
.thenResolve({[
|
|
23
|
+
.thenResolve({[PROJECT_LANGUAGE]: chosenLanguage});
|
|
22
24
|
when(chosenLanguageScaffolder).calledWith(options).thenResolve(scaffolderResult);
|
|
23
25
|
|
|
24
26
|
expect(await scaffold(plugins, options, {prompt})).toEqual(scaffolderResult);
|
|
25
27
|
});
|
|
26
28
|
|
|
27
29
|
it('should not result in an error when choosing a language without a defined scaffolder', async () => {
|
|
28
|
-
|
|
30
|
+
const plugins = any.simpleObject();
|
|
31
|
+
const options = any.simpleObject();
|
|
32
|
+
const dependencies = {prompt: undefined};
|
|
33
|
+
when(promptForProjectLanguage).calledWith(plugins, dependencies).thenResolve({[PROJECT_LANGUAGE]: any.word()});
|
|
29
34
|
|
|
30
|
-
await scaffold(
|
|
35
|
+
await scaffold(plugins, options, dependencies);
|
|
31
36
|
});
|
|
32
37
|
});
|
package/src/license/lifter.js
CHANGED
package/src/license/tester.js
CHANGED
package/src/prompts/index.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {questionNames as coreQuestionNames} from '@form8ion/core';
|
|
2
|
-
|
|
3
1
|
import {BASE_DETAILS_PROMPT_ID} from './questions.js';
|
|
4
2
|
import {GIT_REPOSITORY_PROMPT_ID} from '../vcs/prompt.js';
|
|
5
3
|
import {PROJECT_LANGUAGE_PROMPT_ID} from '../language/prompt.js';
|
|
6
4
|
import {REPOSITORY_HOST_PROMPT_ID} from '../vcs/host/prompt.js';
|
|
7
5
|
import {DEPENDENCY_UPDATER_PROMPT_ID} from '../dependency-updater/prompt.js';
|
|
8
|
-
import {
|
|
6
|
+
import {CI_PROVIDER_PROMPT_ID} from '../ci-provider/prompt.js';
|
|
7
|
+
import {questionNames} from './question-names.js';
|
|
9
8
|
|
|
10
9
|
export const ids = {
|
|
11
10
|
BASE_DETAILS: BASE_DETAILS_PROMPT_ID,
|
|
12
11
|
GIT_REPOSITORY: GIT_REPOSITORY_PROMPT_ID,
|
|
13
12
|
REPOSITORY_HOST: REPOSITORY_HOST_PROMPT_ID,
|
|
14
13
|
PROJECT_LANGUAGE: PROJECT_LANGUAGE_PROMPT_ID,
|
|
15
|
-
DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID
|
|
14
|
+
DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID,
|
|
15
|
+
CI_PROVIDER: CI_PROVIDER_PROMPT_ID
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
18
|
+
export {questionNames};
|
|
19
|
+
|
|
20
|
+
export const constants = {ids, questionNames};
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import {questionNames as coreQuestionNames} from '@form8ion/core';
|
|
2
|
+
|
|
1
3
|
export const questionNames = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
BASE_DETAILS: coreQuestionNames,
|
|
5
|
+
GIT_REPOSITORY: {
|
|
6
|
+
GIT_REPO: 'gitRepo'
|
|
7
|
+
},
|
|
8
|
+
REPOSITORY_HOST: {
|
|
9
|
+
REPO_HOST: 'repoHost',
|
|
10
|
+
REPO_OWNER: 'repoOwner'
|
|
11
|
+
},
|
|
12
|
+
PROJECT_LANGUAGE: {
|
|
13
|
+
PROJECT_LANGUAGE: 'projectLanguage'
|
|
14
|
+
},
|
|
15
|
+
DEPENDENCY_UPDATER: {
|
|
16
|
+
DEPENDENCY_UPDATER: 'dependencyUpdater'
|
|
17
|
+
},
|
|
18
|
+
CI_PROVIDER: {
|
|
19
|
+
CI_PROVIDER: 'ciProvider'
|
|
20
|
+
}
|
|
7
21
|
};
|
package/src/scaffolder.js
CHANGED
|
@@ -35,11 +35,11 @@ export async function scaffold(options, {prompt, logger}) {
|
|
|
35
35
|
scaffoldEditorConfig({projectRoot})
|
|
36
36
|
]);
|
|
37
37
|
|
|
38
|
-
const dependencyUpdaterResults = vcsResults.vcs
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const [dependencyUpdaterResults] = vcsResults.vcs
|
|
39
|
+
? await Promise.all([
|
|
40
|
+
scaffoldDependencyUpdater(dependencyUpdaters, {projectRoot}, {prompt})
|
|
41
|
+
])
|
|
42
|
+
: [];
|
|
43
43
|
|
|
44
44
|
const language = await scaffoldLanguage(
|
|
45
45
|
languages,
|
package/src/scaffolder.test.js
CHANGED
|
@@ -33,6 +33,8 @@ vi.mock('./editorconfig');
|
|
|
33
33
|
vi.mock('./contributing');
|
|
34
34
|
vi.mock('./lift.js');
|
|
35
35
|
|
|
36
|
+
const {GIT_REPO} = questionNames.GIT_REPOSITORY;
|
|
37
|
+
|
|
36
38
|
describe('project scaffolder', () => {
|
|
37
39
|
const originalProcessCwd = process.cwd;
|
|
38
40
|
const options = any.simpleObject();
|
|
@@ -157,7 +159,7 @@ describe('project scaffolder', () => {
|
|
|
157
159
|
.calledWith(projectPath, {prompt})
|
|
158
160
|
.thenResolve({
|
|
159
161
|
[coreQuestionNames.DESCRIPTION]: description,
|
|
160
|
-
[
|
|
162
|
+
[GIT_REPO]: true,
|
|
161
163
|
[coreQuestionNames.PROJECT_NAME]: projectName,
|
|
162
164
|
[coreQuestionNames.VISIBILITY]: visibility
|
|
163
165
|
});
|
|
@@ -174,7 +176,7 @@ describe('project scaffolder', () => {
|
|
|
174
176
|
|
|
175
177
|
it('should not scaffold the git repo if not requested', async () => {
|
|
176
178
|
when(optionsValidator.validate).calledWith(options).thenReturn({plugins: {}});
|
|
177
|
-
prompts.promptForBaseDetails.mockResolvedValue({[
|
|
179
|
+
prompts.promptForBaseDetails.mockResolvedValue({[GIT_REPO]: false});
|
|
178
180
|
scaffoldReadme.mockResolvedValue();
|
|
179
181
|
scaffoldVcs.mockResolvedValue({});
|
|
180
182
|
|
|
@@ -208,7 +210,7 @@ describe('project scaffolder', () => {
|
|
|
208
210
|
prompts.promptForBaseDetails.mockResolvedValue({
|
|
209
211
|
[coreQuestionNames.PROJECT_NAME]: projectName,
|
|
210
212
|
[coreQuestionNames.VISIBILITY]: visibility,
|
|
211
|
-
[
|
|
213
|
+
[GIT_REPO]: true,
|
|
212
214
|
[coreQuestionNames.LICENSE]: license,
|
|
213
215
|
[coreQuestionNames.DESCRIPTION]: description
|
|
214
216
|
});
|
|
@@ -239,7 +241,7 @@ describe('project scaffolder', () => {
|
|
|
239
241
|
prompts.promptForBaseDetails.mockResolvedValue({
|
|
240
242
|
[coreQuestionNames.PROJECT_NAME]: projectName,
|
|
241
243
|
[coreQuestionNames.VISIBILITY]: visibility,
|
|
242
|
-
[
|
|
244
|
+
[GIT_REPO]: true,
|
|
243
245
|
[coreQuestionNames.LICENSE]: license,
|
|
244
246
|
[coreQuestionNames.DESCRIPTION]: description
|
|
245
247
|
});
|
package/src/template-path.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {resolve} from 'path';
|
|
2
2
|
import filedirname from 'filedirname';
|
|
3
3
|
|
|
4
|
-
export default function (fileName) {
|
|
4
|
+
export default function determinePathToTemplate(fileName) {
|
|
5
5
|
const [, __dirname] = filedirname();
|
|
6
6
|
|
|
7
7
|
return resolve(__dirname, '..', 'templates', fileName);
|
package/src/vcs/host/prompt.js
CHANGED
|
@@ -2,17 +2,19 @@ import {questionNames} from '../../prompts/question-names.js';
|
|
|
2
2
|
|
|
3
3
|
export const REPOSITORY_HOST_PROMPT_ID = 'REPOSITORY_HOST';
|
|
4
4
|
|
|
5
|
+
const {REPO_HOST} = questionNames.REPOSITORY_HOST;
|
|
6
|
+
|
|
5
7
|
export default async function promptForVcsHostChoice(hosts, {prompt}) {
|
|
6
8
|
const answers = await prompt({
|
|
7
9
|
id: REPOSITORY_HOST_PROMPT_ID,
|
|
8
10
|
questions: [{
|
|
9
|
-
name:
|
|
11
|
+
name: REPO_HOST,
|
|
10
12
|
type: 'list',
|
|
11
13
|
message: 'Where will the repository be hosted?',
|
|
12
14
|
choices: Object.keys(hosts)
|
|
13
15
|
}]
|
|
14
16
|
});
|
|
15
|
-
const host = hosts[answers[
|
|
17
|
+
const host = hosts[answers[REPO_HOST]];
|
|
16
18
|
|
|
17
19
|
return {...answers, ...host};
|
|
18
20
|
}
|
|
@@ -8,6 +8,8 @@ import promptForVcsHostDetails, {REPOSITORY_HOST_PROMPT_ID} from './prompt.js';
|
|
|
8
8
|
vi.mock('@form8ion/overridable-prompts');
|
|
9
9
|
vi.mock('../../prompts/conditionals');
|
|
10
10
|
|
|
11
|
+
const {REPO_HOST} = questionNames.REPOSITORY_HOST;
|
|
12
|
+
|
|
11
13
|
describe('vcs host details prompt', () => {
|
|
12
14
|
let prompt;
|
|
13
15
|
const answers = any.simpleObject();
|
|
@@ -20,11 +22,11 @@ describe('vcs host details prompt', () => {
|
|
|
20
22
|
const host = any.string();
|
|
21
23
|
const hostNames = [...any.listOf(any.string), host];
|
|
22
24
|
const hosts = any.objectWithKeys(hostNames, {factory: () => ({})});
|
|
23
|
-
const answersWithHostChoice = {...answers, [
|
|
25
|
+
const answersWithHostChoice = {...answers, [REPO_HOST]: host};
|
|
24
26
|
when(prompt).calledWith({
|
|
25
27
|
id: REPOSITORY_HOST_PROMPT_ID,
|
|
26
28
|
questions: [{
|
|
27
|
-
name:
|
|
29
|
+
name: REPO_HOST,
|
|
28
30
|
type: 'list',
|
|
29
31
|
message: 'Where will the repository be hosted?',
|
|
30
32
|
choices: hostNames
|
|
@@ -35,11 +37,11 @@ describe('vcs host details prompt', () => {
|
|
|
35
37
|
});
|
|
36
38
|
|
|
37
39
|
it('should not throw an error when `Other` is chosen as the host', async () => {
|
|
38
|
-
const answersWithHostChoice = {...answers, [
|
|
40
|
+
const answersWithHostChoice = {...answers, [REPO_HOST]: 'Other'};
|
|
39
41
|
when(prompt).calledWith({
|
|
40
42
|
id: REPOSITORY_HOST_PROMPT_ID,
|
|
41
43
|
questions: [{
|
|
42
|
-
name:
|
|
44
|
+
name: REPO_HOST,
|
|
43
45
|
type: 'list',
|
|
44
46
|
message: 'Where will the repository be hosted?',
|
|
45
47
|
choices: []
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {questionNames} from '../../prompts/question-names.js';
|
|
2
2
|
import promptForVcsHostDetails from './prompt.js';
|
|
3
3
|
|
|
4
|
+
const {REPO_HOST} = questionNames.REPOSITORY_HOST;
|
|
5
|
+
|
|
4
6
|
export default async function scaffoldVcsHost(hosts, options, {prompt}) {
|
|
5
|
-
const {[
|
|
7
|
+
const {[REPO_HOST]: chosenHost} = await promptForVcsHostDetails(hosts, {prompt});
|
|
6
8
|
|
|
7
9
|
const lowercasedHosts = Object.fromEntries(
|
|
8
10
|
Object.entries(hosts).map(([name, details]) => [name.toLowerCase(), details])
|
|
@@ -8,6 +8,8 @@ import scaffoldVcsHost from './scaffolder.js';
|
|
|
8
8
|
|
|
9
9
|
vi.mock('./prompt');
|
|
10
10
|
|
|
11
|
+
const {REPO_HOST, REPO_OWNER} = questionNames.REPOSITORY_HOST;
|
|
12
|
+
|
|
11
13
|
describe('vcs host scaffolder', () => {
|
|
12
14
|
const options = any.simpleObject();
|
|
13
15
|
const prompt = () => undefined;
|
|
@@ -20,7 +22,7 @@ describe('vcs host scaffolder', () => {
|
|
|
20
22
|
const owner = any.word;
|
|
21
23
|
when(promptForVcsHostDetails)
|
|
22
24
|
.calledWith(hostPlugins, {prompt})
|
|
23
|
-
.thenResolve({[
|
|
25
|
+
.thenResolve({[REPO_HOST]: chosenHost, [REPO_OWNER]: owner});
|
|
24
26
|
when(chosenHostScaffolder).calledWith(options).thenResolve(results);
|
|
25
27
|
|
|
26
28
|
expect(await scaffoldVcsHost(hostPlugins, options, {prompt})).toEqual(results);
|
|
@@ -30,7 +32,7 @@ describe('vcs host scaffolder', () => {
|
|
|
30
32
|
const hostPlugins = any.simpleObject();
|
|
31
33
|
when(promptForVcsHostDetails)
|
|
32
34
|
.calledWith(hostPlugins, {prompt})
|
|
33
|
-
.thenResolve({[
|
|
35
|
+
.thenResolve({[REPO_HOST]: any.word()});
|
|
34
36
|
|
|
35
37
|
expect(await scaffoldVcsHost(hostPlugins, options, {prompt})).toEqual({vcs: {}});
|
|
36
38
|
});
|
package/src/vcs/prompt.js
CHANGED
|
@@ -2,11 +2,13 @@ import {questionNames} from '../prompts/question-names.js';
|
|
|
2
2
|
|
|
3
3
|
export const GIT_REPOSITORY_PROMPT_ID = 'GIT_REPOSITORY';
|
|
4
4
|
|
|
5
|
+
const {GIT_REPO} = questionNames.GIT_REPOSITORY;
|
|
6
|
+
|
|
5
7
|
export default async function promptForRepoCreation({prompt}) {
|
|
6
|
-
const {[
|
|
8
|
+
const {[GIT_REPO]: gitRepoShouldBeCreated} = await prompt({
|
|
7
9
|
id: GIT_REPOSITORY_PROMPT_ID,
|
|
8
10
|
questions: [{
|
|
9
|
-
name:
|
|
11
|
+
name: GIT_REPO,
|
|
10
12
|
type: 'confirm',
|
|
11
13
|
default: true,
|
|
12
14
|
message: 'Should a git repository be initialized?'
|
package/src/vcs/prompt.test.js
CHANGED
|
@@ -7,6 +7,8 @@ import promptForRepoCreation, {GIT_REPOSITORY_PROMPT_ID} from './prompt.js';
|
|
|
7
7
|
|
|
8
8
|
vi.mock('@form8ion/overridable-prompts');
|
|
9
9
|
|
|
10
|
+
const {GIT_REPO} = questionNames.GIT_REPOSITORY;
|
|
11
|
+
|
|
10
12
|
describe('git prompt', () => {
|
|
11
13
|
it('should ask whether a repository should be created', async () => {
|
|
12
14
|
const prompt = vi.fn();
|
|
@@ -15,13 +17,13 @@ describe('git prompt', () => {
|
|
|
15
17
|
.calledWith({
|
|
16
18
|
id: GIT_REPOSITORY_PROMPT_ID,
|
|
17
19
|
questions: [{
|
|
18
|
-
name:
|
|
20
|
+
name: GIT_REPO,
|
|
19
21
|
type: 'confirm',
|
|
20
22
|
default: true,
|
|
21
23
|
message: 'Should a git repository be initialized?'
|
|
22
24
|
}]
|
|
23
25
|
})
|
|
24
|
-
.thenResolve({[
|
|
26
|
+
.thenResolve({[GIT_REPO]: repoShouldBeCreated});
|
|
25
27
|
|
|
26
28
|
expect(await promptForRepoCreation({prompt})).toBe(repoShouldBeCreated);
|
|
27
29
|
});
|