@form8ion/project 22.0.0-beta.12 → 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 +139 -102
- 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/ci-provider/schema.js +4 -0
- package/src/ci-provider/schema.test.js +43 -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/index.js +1 -0
- package/src/editorconfig/scaffolder.js +1 -1
- package/src/editorconfig/tester.js +5 -0
- package/src/editorconfig/tester.test.js +25 -0
- 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/lift.js +5 -0
- package/src/lift.test.js +23 -11
- package/src/options-validator.js +3 -1
- package/src/options-validator.test.js +3 -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
|
@@ -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
|
});
|