@form8ion/project 22.0.0-beta.1 → 22.0.0-beta.11

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/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "name": "@form8ion/project",
3
3
  "description": "opinionated scaffolder for new projects",
4
4
  "license": "MIT",
5
- "version": "22.0.0-beta.1",
5
+ "version": "22.0.0-beta.11",
6
6
  "type": "module",
7
7
  "engines": {
8
- "node": "^18.19.0 || ^20.9.0 || >=22.11.0"
8
+ "node": "^20.19.0 || >=22.14.0"
9
9
  },
10
10
  "author": "Matt Travi <npm@travi.org> (https://matt.travi.org/)",
11
11
  "contributors": [
@@ -55,7 +55,7 @@
55
55
  "access": "public",
56
56
  "provenance": true
57
57
  },
58
- "packageManager": "npm@11.4.1+sha512.fcee43884166b6f9c5d04535fb95650e9708b6948a1f797eddf40e9778646778a518dfa32651b1c62ff36f4ac42becf177ca46ca27d53f24b539190c8d91802b",
58
+ "packageManager": "npm@11.11.0+sha512.f36811c4aae1fde639527368ae44c571d050006a608d67a191f195a801a52637a312d259186254aa3a3799b05335b7390539cf28656d18f0591a1125ba35f973",
59
59
  "config": {
60
60
  "commitizen": {
61
61
  "path": "./node_modules/cz-conventional-changelog"
@@ -64,55 +64,53 @@
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
- "@form8ion/results-reporter": "^1.1.0",
70
68
  "@hapi/hoek": "^11.0.2",
71
- "@travi/cli-messages": "1.1.1",
72
69
  "deepmerge": "^4.2.2",
73
70
  "execa": "^9.5.1",
74
71
  "filedirname": "^3.0.0",
75
- "hosted-git-info": "^8.0.0",
72
+ "git-url-parse": "^16.1.0",
76
73
  "joi": "^17.1.1",
77
74
  "mustache": "4.2.0",
78
75
  "simple-git": "^3.16.0",
79
- "spdx-license-list": "6.10.0",
76
+ "spdx-license-list": "6.11.0",
80
77
  "word-wrap": "^1.2.3",
81
78
  "write-yaml": "1.0.0"
82
79
  },
83
80
  "devDependencies": {
84
- "@cucumber/cucumber": "11.3.0",
85
- "@form8ion/commitlint-config": "2.0.6",
86
- "@form8ion/eslint-config": "7.0.12",
81
+ "@cucumber/cucumber": "12.7.0",
82
+ "@form8ion/commitlint-config": "2.0.8",
83
+ "@form8ion/eslint-config": "7.0.13",
87
84
  "@form8ion/eslint-config-cucumber": "1.4.1",
88
- "@form8ion/eslint-config-vitest": "1.0.0",
85
+ "@form8ion/eslint-config-vitest": "1.1.0",
89
86
  "@form8ion/remark-lint-preset": "6.0.7",
90
- "@rollup/plugin-node-resolve": "16.0.1",
91
- "@travi/any": "3.1.2",
92
- "c8": "10.1.3",
93
- "chai": "5.2.0",
94
- "cross-env": "7.0.3",
87
+ "@rollup/plugin-node-resolve": "16.0.3",
88
+ "@travi/any": "3.1.3",
89
+ "c8": "11.0.0",
90
+ "chai": "6.2.2",
91
+ "cross-env": "10.1.0",
95
92
  "cz-conventional-changelog": "3.3.0",
93
+ "debug": "4.4.3",
96
94
  "gherkin-lint": "4.2.4",
97
95
  "husky": "9.1.7",
98
- "lockfile-lint": "4.14.1",
99
- "ls-engines": "0.9.3",
100
- "mdast-util-from-markdown": "2.0.2",
96
+ "lockfile-lint": "5.0.0",
97
+ "ls-engines": "0.9.4",
98
+ "mdast-util-from-markdown": "2.0.3",
101
99
  "mdast-util-heading-range": "4.0.0",
102
100
  "mdast-zone": "6.1.0",
103
101
  "mock-fs": "5.5.0",
104
102
  "npm-run-all2": "8.0.4",
105
- "publint": "0.3.12",
103
+ "publint": "0.3.18",
106
104
  "remark-cli": "12.0.1",
107
105
  "remark-toc": "9.0.0",
108
106
  "remark-usage": "11.0.1",
109
- "rimraf": "6.0.1",
110
- "rollup": "4.42.0",
107
+ "rimraf": "6.1.3",
108
+ "rollup": "4.59.0",
111
109
  "rollup-plugin-auto-external": "2.0.0",
112
- "sinon": "20.0.0",
110
+ "sinon": "21.0.2",
113
111
  "testdouble": "3.20.2",
114
112
  "unist-util-find": "3.0.0",
115
- "vitest": "3.2.3",
116
- "vitest-when": "0.6.1"
113
+ "vitest": "4.0.18",
114
+ "vitest-when": "0.10.0"
117
115
  }
118
116
  }
@@ -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
- vi.mock('./prompt');
9
+ vi.mock('./prompt.js');
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';
@@ -1,12 +1,15 @@
1
- import {prompt} from '@form8ion/overridable-prompts';
2
-
3
1
  import {questionNames} from '../prompts/question-names.js';
4
2
 
5
- export default function (languages, decisions) {
6
- return prompt([{
7
- name: questionNames.PROJECT_LANGUAGE,
8
- type: 'list',
9
- message: 'What type of project is this?',
10
- choices: [...Object.keys(languages), 'Other']
11
- }], decisions);
3
+ export const PROJECT_LANGUAGE_PROMPT_ID = 'PROJECT_LANGUAGE';
4
+
5
+ export default function promptForProjectLanguage(languages, {prompt}) {
6
+ return prompt({
7
+ id: PROJECT_LANGUAGE_PROMPT_ID,
8
+ questions: [{
9
+ name: questionNames.PROJECT_LANGUAGE,
10
+ type: 'list',
11
+ message: 'What type of project is this?',
12
+ choices: [...Object.keys(languages), 'Other']
13
+ }]
14
+ });
12
15
  }
@@ -1,30 +1,27 @@
1
- import {prompt} 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
5
  import {questionNames} from '../prompts/question-names.js';
8
- import promptForLanguageDetails from './prompt.js';
6
+ import promptForLanguageDetails, {PROJECT_LANGUAGE_PROMPT_ID} from './prompt.js';
9
7
 
10
8
  vi.mock('@form8ion/overridable-prompts');
11
9
 
12
10
  describe('language prompt', () => {
13
- afterEach(() => {
14
- vi.clearAllMocks();
15
- });
16
-
17
11
  it('should prompt for the language details', async () => {
12
+ const prompt = vi.fn();
18
13
  const answers = any.simpleObject();
19
- const decisions = any.simpleObject();
20
14
  const languages = any.simpleObject();
21
- when(prompt).calledWith([{
22
- name: questionNames.PROJECT_LANGUAGE,
23
- type: 'list',
24
- message: 'What type of project is this?',
25
- choices: [...Object.keys(languages), 'Other']
26
- }], decisions).thenResolve(answers);
15
+ when(prompt).calledWith({
16
+ id: PROJECT_LANGUAGE_PROMPT_ID,
17
+ questions: [{
18
+ name: questionNames.PROJECT_LANGUAGE,
19
+ type: 'list',
20
+ message: 'What type of project is this?',
21
+ choices: [...Object.keys(languages), 'Other']
22
+ }]
23
+ }).thenResolve(answers);
27
24
 
28
- expect(await promptForLanguageDetails(languages, decisions)).toEqual(answers);
25
+ expect(await promptForLanguageDetails(languages, {prompt})).toEqual(answers);
29
26
  });
30
27
  });
@@ -1,8 +1,8 @@
1
1
  import {questionNames} from '../prompts/question-names.js';
2
2
  import promptForLanguageDetails from './prompt.js';
3
3
 
4
- export default async function (languagePlugins, decisions, options) {
5
- const {[questionNames.PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, decisions);
4
+ export default async function (languagePlugins, options, {prompt}) {
5
+ const {[questionNames.PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, {prompt});
6
6
 
7
7
  const plugin = languagePlugins[chosenLanguage];
8
8
 
@@ -13,15 +13,15 @@ describe('language scaffolder', () => {
13
13
  const options = any.simpleObject();
14
14
  const chosenLanguage = any.word();
15
15
  const scaffolderResult = any.simpleObject();
16
- const decisions = any.simpleObject();
16
+ const prompt = () => undefined;
17
17
  const chosenLanguageScaffolder = vi.fn();
18
18
  const plugins = {...any.simpleObject(), [chosenLanguage]: {scaffold: chosenLanguageScaffolder}};
19
19
  when(languagePrompt.default)
20
- .calledWith(plugins, decisions)
20
+ .calledWith(plugins, {prompt})
21
21
  .thenResolve({[questionNames.PROJECT_LANGUAGE]: chosenLanguage});
22
22
  when(chosenLanguageScaffolder).calledWith(options).thenResolve(scaffolderResult);
23
23
 
24
- expect(await scaffold(plugins, decisions, options)).toEqual(scaffolderResult);
24
+ expect(await scaffold(plugins, options, {prompt})).toEqual(scaffolderResult);
25
25
  });
26
26
 
27
27
  it('should not result in an error when choosing a language without a defined scaffolder', async () => {
@@ -3,11 +3,10 @@ import wrap from 'word-wrap';
3
3
  import mustache from 'mustache';
4
4
  // eslint-disable-next-line import/extensions
5
5
  import spdxLicenseList from 'spdx-license-list/full.js';
6
- import {info} from '@travi/cli-messages';
7
6
 
8
- export default async function ({projectRoot, license, copyright}) {
7
+ export default async function scaffoldLicense({projectRoot, license, copyright}, {logger}) {
9
8
  if (license) {
10
- info('Generating License');
9
+ logger.info('Generating License');
11
10
 
12
11
  const licenseContent = spdxLicenseList[license].licenseText;
13
12
 
@@ -3,7 +3,7 @@ import wrap from 'word-wrap';
3
3
  import spdxLicenseListWithContent from 'spdx-license-list/full';
4
4
  import spdxLicenseList from 'spdx-license-list/simple';
5
5
 
6
- import {afterEach, describe, expect, it, vi} from 'vitest';
6
+ import {describe, expect, it, vi} from 'vitest';
7
7
  import any from '@travi/any';
8
8
 
9
9
  import scaffoldLicense from './scaffolder.js';
@@ -16,19 +16,16 @@ describe('license', () => {
16
16
  const copyrightHolders = any.sentence();
17
17
  const copyright = {year, holder: copyrightHolders};
18
18
  const projectRoot = any.string();
19
-
20
- afterEach(() => {
21
- vi.clearAllMocks();
22
- });
19
+ const logger = {info: () => {}};
23
20
 
24
21
  it('should not generate a license file when no license was chosen', async () => {
25
- await scaffoldLicense({});
22
+ await scaffoldLicense({}, {logger});
26
23
 
27
24
  expect(fs.writeFile).not.toHaveBeenCalled();
28
25
  });
29
26
 
30
27
  it('should write the contents for the chosen license to LICENSE', async () => {
31
- expect(await scaffoldLicense({projectRoot, license, copyright, vcs: {}})).toEqual({});
28
+ expect(await scaffoldLicense({projectRoot, license, copyright, vcs: {}}, {logger})).toEqual({});
32
29
 
33
30
  expect(fs.writeFile).toHaveBeenCalledWith(
34
31
  `${projectRoot}/LICENSE`,
@@ -43,7 +40,7 @@ describe('license', () => {
43
40
  });
44
41
 
45
42
  it('should write the common version of the MIT license to LICENSE, when chosen', async () => {
46
- expect(await scaffoldLicense({projectRoot, license: 'MIT', copyright, vcs: {}})).toEqual({});
43
+ expect(await scaffoldLicense({projectRoot, license: 'MIT', copyright, vcs: {}}, {logger})).toEqual({});
47
44
 
48
45
  expect(fs.writeFile).toHaveBeenCalledWith(
49
46
  `${projectRoot}/LICENSE`,
package/src/lift.js CHANGED
@@ -4,7 +4,7 @@ import * as gitPlugin from '@form8ion/git';
4
4
 
5
5
  import * as licensePlugin from './license/index.js';
6
6
 
7
- export default async function ({projectRoot, results, enhancers, vcs, dependencies}) {
7
+ export default async function lift({projectRoot, results, enhancers, vcs, dependencies}) {
8
8
  const enhancerResults = await applyEnhancers({
9
9
  results,
10
10
  enhancers: {...enhancers, gitPlugin, licensePlugin},
@@ -4,11 +4,9 @@ import joi from 'joi';
4
4
  import languagePluginsSchema from './language/schema.js';
5
5
  import vcsHostPluginsSchema from './vcs/host/schema.js';
6
6
  import dependencyUpdaterPluginsSchema from './dependency-updater/schema.js';
7
- import {decisionsSchema} from './options-schemas.js';
8
7
 
9
8
  export function validate(options) {
10
9
  return validateOptions(joi.object({
11
- decisions: decisionsSchema,
12
10
  plugins: joi.object({
13
11
  dependencyUpdaters: dependencyUpdaterPluginsSchema,
14
12
  languages: languagePluginsSchema,
@@ -6,7 +6,6 @@ import any from '@travi/any';
6
6
  import {when} from 'vitest-when';
7
7
 
8
8
  import languagePluginsSchema from './language/schema.js';
9
- import {decisionsSchema} from './options-schemas.js';
10
9
  import vcsHostPluginsSchema from './vcs/host/schema.js';
11
10
  import dependencyUpdaterPluginsSchema from './dependency-updater/schema.js';
12
11
  import {validate} from './options-validator.js';
@@ -39,10 +38,7 @@ describe('options validator', () => {
39
38
  vcsHosts: vcsHostPluginsSchema
40
39
  })
41
40
  .thenReturn(pluginsSchema);
42
- when(joi.object).calledWith({
43
- decisions: decisionsSchema,
44
- plugins: pluginsSchema
45
- }).thenReturn(fullSchema);
41
+ when(joi.object).calledWith({plugins: pluginsSchema}).thenReturn(fullSchema);
46
42
  when(core.validateOptions).calledWith(fullSchema, options).thenReturn(validatedOptions);
47
43
 
48
44
  expect(validate(options)).toEqual(validatedOptions);
@@ -0,0 +1,21 @@
1
+ import {questionNames as coreQuestionNames} from '@form8ion/core';
2
+
3
+ import {BASE_DETAILS_PROMPT_ID} from './questions.js';
4
+ import {GIT_REPOSITORY_PROMPT_ID} from '../vcs/prompt.js';
5
+ import {PROJECT_LANGUAGE_PROMPT_ID} from '../language/prompt.js';
6
+ import {REPOSITORY_HOST_PROMPT_ID} from '../vcs/host/prompt.js';
7
+ import {DEPENDENCY_UPDATER_PROMPT_ID} from '../dependency-updater/prompt.js';
8
+ import {questionNames as projectScaffolderQuestionNames} from './question-names.js';
9
+
10
+ export const ids = {
11
+ BASE_DETAILS: BASE_DETAILS_PROMPT_ID,
12
+ GIT_REPOSITORY: GIT_REPOSITORY_PROMPT_ID,
13
+ REPOSITORY_HOST: REPOSITORY_HOST_PROMPT_ID,
14
+ PROJECT_LANGUAGE: PROJECT_LANGUAGE_PROMPT_ID,
15
+ DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID
16
+ };
17
+
18
+ export const questionNames = {
19
+ ...coreQuestionNames,
20
+ ...projectScaffolderQuestionNames
21
+ };
@@ -1,6 +1,10 @@
1
1
  import {questionsForBaseDetails} from '@form8ion/core';
2
- import {prompt} from '@form8ion/overridable-prompts';
3
2
 
4
- export function promptForBaseDetails(projectRoot, decisions) {
5
- return prompt(questionsForBaseDetails(decisions, projectRoot), decisions);
3
+ export const BASE_DETAILS_PROMPT_ID = 'BASE_DETAILS';
4
+
5
+ export function promptForBaseDetails(projectRoot, {prompt}) {
6
+ return prompt({
7
+ id: BASE_DETAILS_PROMPT_ID,
8
+ questions: questionsForBaseDetails(projectRoot)
9
+ });
6
10
  }
@@ -1,11 +1,10 @@
1
1
  import * as core from '@form8ion/core';
2
- import * as prompts from '@form8ion/overridable-prompts';
3
2
 
4
3
  import {describe, expect, it, vi} from 'vitest';
5
4
  import any from '@travi/any';
6
5
  import {when} from 'vitest-when';
7
6
 
8
- import {promptForBaseDetails} from './questions.js';
7
+ import {promptForBaseDetails, BASE_DETAILS_PROMPT_ID} from './questions.js';
9
8
 
10
9
  vi.mock('@form8ion/core');
11
10
  vi.mock('@form8ion/overridable-prompts');
@@ -13,13 +12,13 @@ vi.mock('@form8ion/overridable-prompts');
13
12
  describe('base details prompt', () => {
14
13
  const projectPath = any.string();
15
14
  const answers = any.simpleObject();
16
- const decisions = any.simpleObject();
17
15
  const questions = any.listOf(any.simpleObject);
16
+ const prompt = vi.fn();
18
17
 
19
18
  it('should prompt for the necessary details', async () => {
20
- when(core.questionsForBaseDetails).calledWith(decisions, projectPath).thenReturn(questions);
21
- when(prompts.prompt).calledWith(questions, decisions).thenResolve(answers);
19
+ when(core.questionsForBaseDetails).calledWith(projectPath).thenReturn(questions);
20
+ when(prompt).calledWith({id: BASE_DETAILS_PROMPT_ID, questions}).thenResolve(answers);
22
21
 
23
- expect(await promptForBaseDetails(projectPath, decisions)).toEqual(answers);
22
+ expect(await promptForBaseDetails(projectPath, {prompt})).toEqual(answers);
24
23
  });
25
24
  });
package/src/scaffolder.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import deepmerge from 'deepmerge';
2
2
  import {execa} from 'execa';
3
3
  import {questionNames as coreQuestionNames} from '@form8ion/core';
4
- import {reportResults} from '@form8ion/results-reporter';
5
4
  import {scaffold as scaffoldReadme} from '@form8ion/readme';
6
- import {info} from '@travi/cli-messages';
7
5
 
8
6
  import {scaffold as scaffoldLanguage} from './language/index.js';
9
7
  import {scaffold as scaffoldVcs} from './vcs/index.js';
@@ -15,9 +13,9 @@ import {scaffold as scaffoldEditorConfig} from './editorconfig/index.js';
15
13
  import {scaffold as scaffoldContributing} from './contributing/index.js';
16
14
  import lift from './lift.js';
17
15
 
18
- export async function scaffold(options) {
16
+ export async function scaffold(options, {prompt, logger}) {
19
17
  const projectRoot = process.cwd();
20
- const {decisions, plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);
18
+ const {plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);
21
19
 
22
20
  const {
23
21
  [coreQuestionNames.PROJECT_NAME]: projectName,
@@ -26,27 +24,27 @@ export async function scaffold(options) {
26
24
  [coreQuestionNames.DESCRIPTION]: description,
27
25
  [coreQuestionNames.COPYRIGHT_YEAR]: copyrightYear,
28
26
  [coreQuestionNames.COPYRIGHT_HOLDER]: copyHolder
29
- } = await promptForBaseDetails(projectRoot, decisions);
27
+ } = await promptForBaseDetails(projectRoot, {prompt});
30
28
  const copyright = {year: copyrightYear, holder: copyHolder};
31
29
 
32
30
  const [vcsResults, contributing, license] = await Promise.all([
33
- scaffoldVcs({projectRoot, projectName, decisions, vcsHosts, visibility, description}),
31
+ scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt, logger}),
34
32
  scaffoldContributing({visibility}),
35
- scaffoldLicense({projectRoot, license: chosenLicense, copyright}),
33
+ scaffoldLicense({projectRoot, license: chosenLicense, copyright}, {logger}),
36
34
  scaffoldReadme({projectName, projectRoot, description}),
37
35
  scaffoldEditorConfig({projectRoot})
38
36
  ]);
39
37
 
40
38
  const dependencyUpdaterResults = vcsResults.vcs && await scaffoldDependencyUpdater(
41
39
  dependencyUpdaters,
42
- decisions,
43
- {projectRoot, vcs: vcsResults.vcs}
40
+ {projectRoot},
41
+ {prompt}
44
42
  );
45
43
 
46
44
  const language = await scaffoldLanguage(
47
45
  languages,
48
- decisions,
49
- {projectRoot, projectName, vcs: vcsResults.vcs, visibility, license: chosenLicense || 'UNLICENSED', description}
46
+ {projectRoot, projectName, vcs: vcsResults.vcs, visibility, license: chosenLicense || 'UNLICENSED', description},
47
+ {prompt}
50
48
  );
51
49
 
52
50
  const mergedResults = deepmerge.all([
@@ -65,12 +63,12 @@ export async function scaffold(options) {
65
63
  });
66
64
 
67
65
  if (language && language.verificationCommand) {
68
- info('Verifying the generated project');
66
+ logger.info('Verifying the generated project');
69
67
 
70
68
  const subprocess = execa(language.verificationCommand, {shell: true});
71
69
  subprocess.stdout.pipe(process.stdout);
72
70
  await subprocess;
73
71
  }
74
72
 
75
- reportResults(mergedResults);
73
+ return mergedResults;
76
74
  }