@form8ion/project 22.0.0-beta.1 → 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 +29 -24
- package/lib/index.js +101 -77
- package/lib/index.js.map +1 -1
- package/package.json +1 -2
- package/src/dependency-updater/prompt.js +12 -8
- package/src/dependency-updater/prompt.test.js +13 -16
- package/src/dependency-updater/scaffolder.js +2 -2
- package/src/dependency-updater/scaffolder.test.js +6 -10
- package/src/index.js +4 -6
- package/src/language/prompt.js +12 -9
- package/src/language/prompt.test.js +13 -16
- package/src/language/scaffolder.js +2 -2
- package/src/language/scaffolder.test.js +3 -3
- package/src/options-validator.js +0 -2
- package/src/options-validator.test.js +1 -5
- package/src/prompts/index.js +21 -0
- package/src/prompts/questions.js +7 -3
- package/src/prompts/questions.test.js +5 -6
- package/src/scaffolder.js +8 -8
- package/src/scaffolder.test.js +20 -27
- package/src/vcs/host/prompt.js +12 -9
- package/src/vcs/host/prompt.test.js +27 -23
- package/src/vcs/host/scaffolder.js +2 -2
- package/src/vcs/host/scaffolder.test.js +5 -5
- package/src/vcs/prompt.js +8 -8
- package/src/vcs/prompt.test.js +12 -11
- package/src/vcs/scaffolder.js +3 -7
- package/src/vcs/scaffolder.test.js +8 -8
- package/src/options-schemas.js +0 -3
- package/src/options-schemas.test.js +0 -20
|
@@ -16,7 +16,7 @@ vi.mock('./prompt.js');
|
|
|
16
16
|
|
|
17
17
|
describe('vcs scaffolder', () => {
|
|
18
18
|
const projectRoot = any.string();
|
|
19
|
-
const
|
|
19
|
+
const prompt = () => undefined;
|
|
20
20
|
|
|
21
21
|
it('should scaffold the repository and vcs host details', async () => {
|
|
22
22
|
const host = any.word();
|
|
@@ -29,14 +29,14 @@ describe('vcs scaffolder', () => {
|
|
|
29
29
|
const vcsHostDetails = {host, owner, name};
|
|
30
30
|
const sshUrl = any.url();
|
|
31
31
|
const remoteOriginNextSteps = any.listOf(any.simpleObject);
|
|
32
|
-
when(promptForRepoCreation).calledWith(
|
|
32
|
+
when(promptForRepoCreation).calledWith({prompt}).thenResolve(true);
|
|
33
33
|
when(alreadyVersionedByGit).calledWith({projectRoot}).thenResolve(false);
|
|
34
34
|
when(scaffoldVcsHost)
|
|
35
|
-
.calledWith(vcsHosts,
|
|
35
|
+
.calledWith(vcsHosts, {projectName, projectRoot, description, visibility}, {prompt})
|
|
36
36
|
.thenResolve({vcs: {...vcsHostDetails, sshUrl, ...any.simpleObject()}});
|
|
37
37
|
when(defineRemoteOrigin).calledWith(projectRoot, sshUrl).thenResolve({nextSteps: remoteOriginNextSteps});
|
|
38
38
|
|
|
39
|
-
expect(await scaffoldVcs({projectRoot, projectName,
|
|
39
|
+
expect(await scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt})).toEqual({
|
|
40
40
|
vcs: vcsHostDetails,
|
|
41
41
|
nextSteps: [{summary: 'Commit scaffolded files'}, ...remoteOriginNextSteps]
|
|
42
42
|
});
|
|
@@ -45,16 +45,16 @@ describe('vcs scaffolder', () => {
|
|
|
45
45
|
|
|
46
46
|
it('should not scaffold a repository or vcs host details when the project is already versioned by git', async () => {
|
|
47
47
|
const existingVcsDetails = any.simpleObject();
|
|
48
|
-
when(promptForRepoCreation).calledWith(
|
|
48
|
+
when(promptForRepoCreation).calledWith({prompt}).thenResolve(true);
|
|
49
49
|
when(alreadyVersionedByGit).calledWith({projectRoot}).thenResolve(true);
|
|
50
50
|
when(determineExistingVcsDetails).calledWith({projectRoot}).thenResolve(existingVcsDetails);
|
|
51
51
|
|
|
52
|
-
expect(await scaffoldVcs({projectRoot,
|
|
52
|
+
expect(await scaffoldVcs({projectRoot}, {prompt})).toEqual({vcs: existingVcsDetails});
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it('should not scaffold a repository or vcs host details when a repository should not be created', async () => {
|
|
56
|
-
when(promptForRepoCreation).calledWith(
|
|
56
|
+
when(promptForRepoCreation).calledWith({prompt}).thenResolve(false);
|
|
57
57
|
|
|
58
|
-
expect(await scaffoldVcs({projectRoot,
|
|
58
|
+
expect(await scaffoldVcs({projectRoot}, {prompt})).toEqual({});
|
|
59
59
|
});
|
|
60
60
|
});
|
package/src/options-schemas.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {validateOptions} from '@form8ion/core';
|
|
2
|
-
|
|
3
|
-
import {describe, expect, it} from 'vitest';
|
|
4
|
-
import any from '@travi/any';
|
|
5
|
-
|
|
6
|
-
import {decisionsSchema} from './options-schemas.js';
|
|
7
|
-
|
|
8
|
-
describe('generic options schemas', () => {
|
|
9
|
-
describe('decisions', () => {
|
|
10
|
-
it('should return the validated options', () => {
|
|
11
|
-
const options = any.simpleObject();
|
|
12
|
-
|
|
13
|
-
expect(validateOptions(decisionsSchema, options)).toEqual(options);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('should require the decisions to be defined as a map', () => {
|
|
17
|
-
expect(() => validateOptions(decisionsSchema, any.word())).toThrowError('must be of type object');
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|