@form8ion/project 22.0.0-beta.10 → 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/README.md +7 -1
- package/lib/index.js +16 -14
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/license/scaffolder.js +2 -3
- package/src/license/scaffolder.test.js +5 -8
- package/src/lift.js +1 -1
- package/src/scaffolder.js +4 -5
- package/src/scaffolder.test.js +5 -4
- package/src/vcs/git/remotes.js +3 -4
- package/src/vcs/git/remotes.test.js +6 -5
- package/src/vcs/scaffolder.js +6 -4
- package/src/vcs/scaffolder.test.js +4 -3
package/README.md
CHANGED
|
@@ -105,7 +105,13 @@ await scaffold(
|
|
|
105
105
|
[questionNames.COPYRIGHT_HOLDER]: 'John Smith',
|
|
106
106
|
[questionNames.COPYRIGHT_YEAR]: '2022',
|
|
107
107
|
[questionNames.PROJECT_LANGUAGE]: 'foo'
|
|
108
|
-
})
|
|
108
|
+
}),
|
|
109
|
+
logger: {
|
|
110
|
+
info: () => undefined,
|
|
111
|
+
success: () => undefined,
|
|
112
|
+
warn: () => undefined,
|
|
113
|
+
error: () => undefined
|
|
114
|
+
}
|
|
109
115
|
}
|
|
110
116
|
);
|
|
111
117
|
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import { questionsForBaseDetails, questionNames as questionNames$2, fileExists,
|
|
|
2
2
|
import deepmerge from 'deepmerge';
|
|
3
3
|
import { execa } from 'execa';
|
|
4
4
|
import { lift as lift$1, scaffold as scaffold$2 } from '@form8ion/readme';
|
|
5
|
-
import { warn, info } from '@travi/cli-messages';
|
|
6
5
|
import * as gitPlugin from '@form8ion/git';
|
|
7
6
|
import { test, scaffold as scaffold$1 } from '@form8ion/git';
|
|
8
7
|
import { simpleGit } from 'simple-git';
|
|
@@ -137,9 +136,9 @@ async function determineExistingVcsDetails({projectRoot}) {
|
|
|
137
136
|
return {vcs: {owner, name, host: 'github.com' === host ? 'github' : host}};
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
async function defineRemoteOrigin(projectRoot, sshUrl) {
|
|
139
|
+
async function defineRemoteOrigin(projectRoot, sshUrl, {logger}) {
|
|
141
140
|
if (!sshUrl) {
|
|
142
|
-
warn('URL not available to configure remote `origin`');
|
|
141
|
+
logger.warn('URL not available to configure remote `origin`');
|
|
143
142
|
|
|
144
143
|
return {nextSteps: []};
|
|
145
144
|
}
|
|
@@ -148,7 +147,7 @@ async function defineRemoteOrigin(projectRoot, sshUrl) {
|
|
|
148
147
|
const existingRemotes = await getExistingRemotes(git);
|
|
149
148
|
|
|
150
149
|
if (existingRemotes.includes('origin')) {
|
|
151
|
-
warn('The `origin` remote is already defined for this repository');
|
|
150
|
+
logger.warn('The `origin` remote is already defined for this repository');
|
|
152
151
|
|
|
153
152
|
return {nextSteps: []};
|
|
154
153
|
}
|
|
@@ -178,10 +177,13 @@ async function scaffoldVcsHost(hosts, options, {prompt}) {
|
|
|
178
177
|
return {vcs: {}};
|
|
179
178
|
}
|
|
180
179
|
|
|
181
|
-
async function scaffoldVcs(
|
|
180
|
+
async function scaffoldVcs(
|
|
181
|
+
{projectRoot, projectName, vcsHosts, visibility, description},
|
|
182
|
+
{prompt, logger}
|
|
183
|
+
) {
|
|
182
184
|
if (await promptForRepoCreation({prompt})) {
|
|
183
185
|
if (await test({projectRoot})) {
|
|
184
|
-
info('Git repository already exists');
|
|
186
|
+
logger.info('Git repository already exists');
|
|
185
187
|
|
|
186
188
|
return determineExistingVcsDetails({projectRoot});
|
|
187
189
|
}
|
|
@@ -191,7 +193,7 @@ async function scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, desc
|
|
|
191
193
|
scaffold$1({projectRoot})
|
|
192
194
|
]);
|
|
193
195
|
|
|
194
|
-
const remoteOriginResults = await defineRemoteOrigin(projectRoot, sshUrl);
|
|
196
|
+
const remoteOriginResults = await defineRemoteOrigin(projectRoot, sshUrl, {logger});
|
|
195
197
|
|
|
196
198
|
return {
|
|
197
199
|
vcs: {host, owner, name},
|
|
@@ -202,9 +204,9 @@ async function scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, desc
|
|
|
202
204
|
return {};
|
|
203
205
|
}
|
|
204
206
|
|
|
205
|
-
async function scaffoldLicense
|
|
207
|
+
async function scaffoldLicense({projectRoot, license, copyright}, {logger}) {
|
|
206
208
|
if (license) {
|
|
207
|
-
info('Generating License');
|
|
209
|
+
logger.info('Generating License');
|
|
208
210
|
|
|
209
211
|
const licenseContent = spdxLicenseList[license].licenseText;
|
|
210
212
|
|
|
@@ -307,7 +309,7 @@ function scaffoldContributing ({visibility}) {
|
|
|
307
309
|
return {};
|
|
308
310
|
}
|
|
309
311
|
|
|
310
|
-
async function lift
|
|
312
|
+
async function lift({projectRoot, results, enhancers, vcs, dependencies}) {
|
|
311
313
|
const enhancerResults = await applyEnhancers({
|
|
312
314
|
results,
|
|
313
315
|
enhancers: {...enhancers, gitPlugin, licensePlugin},
|
|
@@ -320,7 +322,7 @@ async function lift ({projectRoot, results, enhancers, vcs, dependencies}) {
|
|
|
320
322
|
return enhancerResults;
|
|
321
323
|
}
|
|
322
324
|
|
|
323
|
-
async function scaffold(options, {prompt}) {
|
|
325
|
+
async function scaffold(options, {prompt, logger}) {
|
|
324
326
|
const projectRoot = process.cwd();
|
|
325
327
|
const {plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);
|
|
326
328
|
|
|
@@ -335,9 +337,9 @@ async function scaffold(options, {prompt}) {
|
|
|
335
337
|
const copyright = {year: copyrightYear, holder: copyHolder};
|
|
336
338
|
|
|
337
339
|
const [vcsResults, contributing, license] = await Promise.all([
|
|
338
|
-
scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt}),
|
|
340
|
+
scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt, logger}),
|
|
339
341
|
scaffoldContributing({visibility}),
|
|
340
|
-
scaffoldLicense({projectRoot, license: chosenLicense, copyright}),
|
|
342
|
+
scaffoldLicense({projectRoot, license: chosenLicense, copyright}, {logger}),
|
|
341
343
|
scaffold$2({projectName, projectRoot, description}),
|
|
342
344
|
scaffoldEditorConfig({projectRoot})
|
|
343
345
|
]);
|
|
@@ -370,7 +372,7 @@ async function scaffold(options, {prompt}) {
|
|
|
370
372
|
});
|
|
371
373
|
|
|
372
374
|
if (language && language.verificationCommand) {
|
|
373
|
-
info('Verifying the generated project');
|
|
375
|
+
logger.info('Verifying the generated project');
|
|
374
376
|
|
|
375
377
|
const subprocess = execa(language.verificationCommand, {shell: true});
|
|
376
378
|
subprocess.stdout.pipe(process.stdout);
|
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/options-validator.js","../src/template-path.js","../src/editorconfig/scaffolder.js","../src/contributing/scaffolder.js","../src/lift.js","../src/scaffolder.js","../src/index.js"],"sourcesContent":["import {questionsForBaseDetails} from '@form8ion/core';\n\nexport const BASE_DETAILS_PROMPT_ID = 'BASE_DETAILS';\n\nexport function promptForBaseDetails(projectRoot, {prompt}) {\n return prompt({\n id: BASE_DETAILS_PROMPT_ID,\n questions: questionsForBaseDetails(projectRoot)\n });\n}\n","export const questionNames = {\n GIT_REPO: 'gitRepo',\n REPO_HOST: 'repoHost',\n REPO_OWNER: 'repoOwner',\n PROJECT_LANGUAGE: 'projectLanguage',\n DEPENDENCY_UPDATER: 'dependencyUpdater'\n};\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const GIT_REPOSITORY_PROMPT_ID = 'GIT_REPOSITORY';\n\nexport default async function promptForRepoCreation({prompt}) {\n const {[questionNames.GIT_REPO]: gitRepoShouldBeCreated} = await prompt({\n id: GIT_REPOSITORY_PROMPT_ID,\n questions: [{\n name: questionNames.GIT_REPO,\n type: 'confirm',\n default: true,\n message: 'Should a git repository be initialized?'\n }]\n });\n\n return gitRepoShouldBeCreated;\n}\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const PROJECT_LANGUAGE_PROMPT_ID = 'PROJECT_LANGUAGE';\n\nexport default function promptForProjectLanguage(languages, {prompt}) {\n return prompt({\n id: PROJECT_LANGUAGE_PROMPT_ID,\n questions: [{\n name: questionNames.PROJECT_LANGUAGE,\n type: 'list',\n message: 'What type of project is this?',\n choices: [...Object.keys(languages), 'Other']\n }]\n });\n}\n","import {questionNames} from '../../prompts/question-names.js';\n\nexport const REPOSITORY_HOST_PROMPT_ID = 'REPOSITORY_HOST';\n\nexport default async function promptForVcsHostChoice(hosts, {prompt}) {\n const answers = await prompt({\n id: REPOSITORY_HOST_PROMPT_ID,\n questions: [{\n name: questionNames.REPO_HOST,\n type: 'list',\n message: 'Where will the repository be hosted?',\n choices: Object.keys(hosts)\n }]\n });\n const host = hosts[answers[questionNames.REPO_HOST]];\n\n return {...answers, ...host};\n}\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';\n\nexport async function promptForDependencyUpdaterChoice(updaters, {prompt}) {\n return prompt({\n id: DEPENDENCY_UPDATER_PROMPT_ID,\n questions: [{\n name: questionNames.DEPENDENCY_UPDATER,\n type: 'list',\n message: 'Which dependency-update service do you want to manage this project?',\n choices: [...Object.keys(updaters), 'Other']\n }]\n });\n}\n","import {questionNames as coreQuestionNames} from '@form8ion/core';\n\nimport {BASE_DETAILS_PROMPT_ID} from './questions.js';\nimport {GIT_REPOSITORY_PROMPT_ID} from '../vcs/prompt.js';\nimport {PROJECT_LANGUAGE_PROMPT_ID} from '../language/prompt.js';\nimport {REPOSITORY_HOST_PROMPT_ID} from '../vcs/host/prompt.js';\nimport {DEPENDENCY_UPDATER_PROMPT_ID} from '../dependency-updater/prompt.js';\nimport {questionNames as projectScaffolderQuestionNames} from './question-names.js';\n\nexport const ids = {\n BASE_DETAILS: BASE_DETAILS_PROMPT_ID,\n GIT_REPOSITORY: GIT_REPOSITORY_PROMPT_ID,\n REPOSITORY_HOST: REPOSITORY_HOST_PROMPT_ID,\n PROJECT_LANGUAGE: PROJECT_LANGUAGE_PROMPT_ID,\n DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID\n};\n\nexport const questionNames = {\n ...coreQuestionNames,\n ...projectScaffolderQuestionNames\n};\n","import {questionNames} from '../prompts/question-names.js';\nimport promptForLanguageDetails from './prompt.js';\n\nexport default async function (languagePlugins, options, {prompt}) {\n const {[questionNames.PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, {prompt});\n\n const plugin = languagePlugins[chosenLanguage];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import {simpleGit} from 'simple-git';\nimport parseGitUrl from 'git-url-parse';\nimport {warn} from '@travi/cli-messages';\n\nasync function getExistingRemotes(git) {\n try {\n return await git.listRemote();\n } catch (e) {\n if ('fatal: No remote configured to list refs from.\\n' === e.message) {\n return [];\n }\n\n throw e;\n }\n}\n\nexport async function determineExistingVcsDetails({projectRoot}) {\n const git = simpleGit({baseDir: projectRoot});\n const remoteOrigin = await git.remote(['get-url', 'origin']);\n const {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) {\n if (!sshUrl) {\n warn('URL not available to configure remote `origin`');\n\n return {nextSteps: []};\n }\n\n const git = simpleGit({baseDir: projectRoot});\n const existingRemotes = await getExistingRemotes(git);\n\n if (existingRemotes.includes('origin')) {\n warn('The `origin` remote is already defined for this repository');\n\n return {nextSteps: []};\n }\n\n // info('Setting the local `master` branch to track `origin/master`');\n //\n // await gitBranch.setUpstream(\n // await gitBranch.lookup(repository, 'master', gitBranch.BRANCH.LOCAL),\n // 'origin/master'\n // );\n\n await git.addRemote('origin', sshUrl);\n\n return {nextSteps: [{summary: 'Set local `master` branch to track upstream `origin/master`'}]};\n}\n","import {questionNames} from '../../prompts/question-names.js';\nimport promptForVcsHostDetails from './prompt.js';\n\nexport default async function scaffoldVcsHost(hosts, options, {prompt}) {\n const {[questionNames.REPO_HOST]: chosenHost} = await promptForVcsHostDetails(hosts, {prompt});\n\n const lowercasedHosts = Object.fromEntries(\n Object.entries(hosts).map(([name, details]) => [name.toLowerCase(), details])\n );\n const host = lowercasedHosts[chosenHost.toLowerCase()];\n\n if (host) return host.scaffold(options);\n\n return {vcs: {}};\n}\n","import {info} from '@travi/cli-messages';\nimport {scaffold as scaffoldGit, test as alreadyVersionedByGit} from '@form8ion/git';\n\nimport repositoryShouldBeCreated from './prompt.js';\nimport {determineExistingVcsDetails, defineRemoteOrigin} from './git/index.js';\nimport {scaffold as scaffoldVcsHost} from './host/index.js';\n\nexport default async function scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt}) {\n if (await repositoryShouldBeCreated({prompt})) {\n if (await alreadyVersionedByGit({projectRoot})) {\n info('Git repository already exists');\n\n return determineExistingVcsDetails({projectRoot});\n }\n\n const [{vcs: {host, owner, name, sshUrl}}] = await Promise.all([\n scaffoldVcsHost(vcsHosts, {projectName, projectRoot, description, visibility}, {prompt}),\n scaffoldGit({projectRoot})\n ]);\n\n const remoteOriginResults = await defineRemoteOrigin(projectRoot, sshUrl);\n\n return {\n vcs: {host, owner, name},\n nextSteps: [{summary: 'Commit scaffolded files'}, ...remoteOriginResults.nextSteps]\n };\n }\n\n return {};\n}\n","import {promises as fs} from 'fs';\nimport wrap from 'word-wrap';\nimport mustache from 'mustache';\n// eslint-disable-next-line import/extensions\nimport spdxLicenseList from 'spdx-license-list/full.js';\nimport {info} from '@travi/cli-messages';\n\nexport default async function ({projectRoot, license, copyright}) {\n if (license) {\n info('Generating License');\n\n const licenseContent = spdxLicenseList[license].licenseText;\n\n await fs.writeFile(\n `${projectRoot}/LICENSE`,\n `${wrap(\n mustache.render(licenseContent, {year: copyright.year, 'copyright holders': copyright.holder}, {}, ['<', '>']),\n {width: 80, indent: ''}\n )}\\n`\n );\n }\n\n return {};\n}\n","import {fileExists} from '@form8ion/core';\n\nexport default function ({projectRoot}) {\n return fileExists(`${projectRoot}/LICENSE`);\n}\n","function repositoryIsHostedOnGithub(vcs) {\n return vcs && 'github' === vcs.host;\n}\n\nexport default function ({vcs}) {\n return {\n ...repositoryIsHostedOnGithub(vcs) && {\n badges: {\n consumer: {\n license: {\n link: 'LICENSE',\n img: `https://img.shields.io/github/license/${vcs.owner}/${vcs.name}.svg?logo=opensourceinitiative`,\n text: 'license'\n }\n }\n }\n }\n };\n}\n","import {questionNames} from '../prompts/question-names.js';\nimport {promptForDependencyUpdaterChoice} from './prompt.js';\n\nexport default async function (plugins, options, {prompt}) {\n if (!Object.keys(plugins).length) return undefined;\n\n const plugin = plugins[\n (await promptForDependencyUpdaterChoice(plugins, {prompt}))[questionNames.DEPENDENCY_UPDATER]\n ];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(/^/, optionsSchemas.form8ionPlugin).default({});\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(/^/, optionsSchemas.form8ionPlugin);\n","import joi from 'joi';\nimport {optionsSchemas} from '@form8ion/core';\n\nexport default joi.object().pattern(joi.string(), optionsSchemas.form8ionPlugin).default({});\n","import {validateOptions} from '@form8ion/core';\nimport joi from 'joi';\n\nimport languagePluginsSchema from './language/schema.js';\nimport vcsHostPluginsSchema from './vcs/host/schema.js';\nimport dependencyUpdaterPluginsSchema from './dependency-updater/schema.js';\n\nexport function validate(options) {\n return validateOptions(joi.object({\n plugins: joi.object({\n dependencyUpdaters: dependencyUpdaterPluginsSchema,\n languages: languagePluginsSchema,\n vcsHosts: vcsHostPluginsSchema\n })\n }), options) || {};\n}\n","import {resolve} from 'path';\nimport filedirname from 'filedirname';\n\nexport default function (fileName) {\n const [, __dirname] = filedirname();\n\n return resolve(__dirname, '..', 'templates', fileName);\n}\n","import {promises as fs} from 'node:fs';\n\nimport determinePathToTemplateFile from '../template-path.js';\n\nexport default function ({projectRoot}) {\n return fs.copyFile(determinePathToTemplateFile('editorconfig.ini'), `${projectRoot}/.editorconfig`);\n}\n","export default function ({visibility}) {\n if ('Public' === visibility) {\n return {\n badges: {\n contribution: {\n PRs: {\n text: 'PRs Welcome',\n link: 'https://makeapullrequest.com',\n img: 'https://img.shields.io/badge/PRs-welcome-brightgreen.svg'\n }\n }\n }\n };\n }\n\n return {};\n}\n","import {applyEnhancers} from '@form8ion/core';\nimport {lift as liftReadme} from '@form8ion/readme';\nimport * as gitPlugin from '@form8ion/git';\n\nimport * as licensePlugin from './license/index.js';\n\nexport default async function ({projectRoot, results, enhancers, vcs, dependencies}) {\n const enhancerResults = await applyEnhancers({\n results,\n enhancers: {...enhancers, gitPlugin, licensePlugin},\n options: {projectRoot, vcs},\n dependencies\n });\n\n await liftReadme({projectRoot, results: enhancerResults});\n\n return enhancerResults;\n}\n","import deepmerge from 'deepmerge';\nimport {execa} from 'execa';\nimport {questionNames as coreQuestionNames} from '@form8ion/core';\nimport {scaffold as scaffoldReadme} from '@form8ion/readme';\nimport {info} from '@travi/cli-messages';\n\nimport {scaffold as scaffoldLanguage} from './language/index.js';\nimport {scaffold as scaffoldVcs} from './vcs/index.js';\nimport {scaffold as scaffoldLicense} from './license/index.js';\nimport scaffoldDependencyUpdater from './dependency-updater/scaffolder.js';\nimport {promptForBaseDetails} from './prompts/questions.js';\nimport {validate} from './options-validator.js';\nimport {scaffold as scaffoldEditorConfig} from './editorconfig/index.js';\nimport {scaffold as scaffoldContributing} from './contributing/index.js';\nimport lift from './lift.js';\n\nexport async function scaffold(options, {prompt}) {\n const projectRoot = process.cwd();\n const {plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);\n\n const {\n [coreQuestionNames.PROJECT_NAME]: projectName,\n [coreQuestionNames.LICENSE]: chosenLicense,\n [coreQuestionNames.VISIBILITY]: visibility,\n [coreQuestionNames.DESCRIPTION]: description,\n [coreQuestionNames.COPYRIGHT_YEAR]: copyrightYear,\n [coreQuestionNames.COPYRIGHT_HOLDER]: copyHolder\n } = await promptForBaseDetails(projectRoot, {prompt});\n const copyright = {year: copyrightYear, holder: copyHolder};\n\n const [vcsResults, contributing, license] = await Promise.all([\n scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt}),\n scaffoldContributing({visibility}),\n scaffoldLicense({projectRoot, license: chosenLicense, copyright}),\n scaffoldReadme({projectName, projectRoot, description}),\n scaffoldEditorConfig({projectRoot})\n ]);\n\n const dependencyUpdaterResults = vcsResults.vcs && await scaffoldDependencyUpdater(\n dependencyUpdaters,\n {projectRoot},\n {prompt}\n );\n\n const language = await scaffoldLanguage(\n languages,\n {projectRoot, projectName, vcs: vcsResults.vcs, visibility, license: chosenLicense || 'UNLICENSED', description},\n {prompt}\n );\n\n const mergedResults = deepmerge.all([\n license,\n language,\n dependencyUpdaterResults,\n contributing,\n vcsResults\n ].filter(Boolean));\n\n await lift({\n projectRoot,\n vcs: vcsResults.vcs,\n results: mergedResults,\n enhancers: {...dependencyUpdaters, ...languages, ...vcsHosts}\n });\n\n if (language && language.verificationCommand) {\n info('Verifying the generated project');\n\n const subprocess = execa(language.verificationCommand, {shell: true});\n subprocess.stdout.pipe(process.stdout);\n await subprocess;\n }\n\n 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","alreadyVersionedByGit","scaffoldGit","fs","liftReadme","scaffoldReadme"],"mappings":";;;;;;;;;;;;;;;;;;AAEO,MAAM,sBAAsB,GAAG,cAAc;;AAE7C,SAAS,oBAAoB,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE;AAC5D,EAAE,OAAO,MAAM,CAAC;AAChB,IAAI,EAAE,EAAE,sBAAsB;AAC9B,IAAI,SAAS,EAAE,uBAAuB,CAAC,WAAW;AAClD,GAAG,CAAC;AACJ;;ACTO,MAAMA,eAAa,GAAG;AAC7B,EAAE,QAAQ,EAAE,SAAS;AACrB,EAAE,SAAS,EAAE,UAAU;AACvB,EAAE,UAAU,EAAE,WAAW;AACzB,EAAE,gBAAgB,EAAE,iBAAiB;AACrC,EAAE,kBAAkB,EAAE;AACtB,CAAC;;ACJM,MAAM,wBAAwB,GAAG,gBAAgB;;AAEzC,eAAe,qBAAqB,CAAC,CAAC,MAAM,CAAC,EAAE;AAC9D,EAAE,MAAM,CAAC,CAACA,eAAa,CAAC,QAAQ,GAAG,sBAAsB,CAAC,GAAG,MAAM,MAAM,CAAC;AAC1E,IAAI,EAAE,EAAE,wBAAwB;AAChC,IAAI,SAAS,EAAE,CAAC;AAChB,MAAM,IAAI,EAAEA,eAAa,CAAC,QAAQ;AAClC,MAAM,IAAI,EAAE,SAAS;AACrB,MAAM,OAAO,EAAE,IAAI;AACnB,MAAM,OAAO,EAAE;AACf,KAAK;AACL,GAAG,CAAC;;AAEJ,EAAE,OAAO,sBAAsB;AAC/B;;ACdO,MAAM,0BAA0B,GAAG,kBAAkB;;AAE7C,SAAS,wBAAwB,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE;AACtE,EAAE,OAAO,MAAM,CAAC;AAChB,IAAI,EAAE,EAAE,0BAA0B;AAClC,IAAI,SAAS,EAAE,CAAC;AAChB,MAAM,IAAI,EAAEA,eAAa,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C,WAAW,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,IAAI,YAAY,EAAE,WAAW,CAAC;AACpH,IAAI,CAAC,MAAM;AACX,GAAG;;AAEH,EAAE,MAAM,aAAa,GAAG,SAAS,CAAC,GAAG,CAAC;AACtC,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,wBAAwB;AAC5B,IAAI,YAAY;AAChB,IAAI;AACJ,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;;AAEpB,EAAE,MAAM,IAAI,CAAC;AACb,IAAI,WAAW;AACf,IAAI,GAAG,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,IAAI,CAAC,iCAAiC,CAAC;;AAE3C,IAAI,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACzE,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AAC1C,IAAI,MAAM,UAAU;AACpB,EAAE;;AAEF,EAAE,OAAO,aAAa;AACtB;;ACtEY,MAAC,eAAe,GAAG,CAAC,GAAG;;;;"}
|
|
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/options-validator.js","../src/template-path.js","../src/editorconfig/scaffolder.js","../src/contributing/scaffolder.js","../src/lift.js","../src/scaffolder.js","../src/index.js"],"sourcesContent":["import {questionsForBaseDetails} from '@form8ion/core';\n\nexport const BASE_DETAILS_PROMPT_ID = 'BASE_DETAILS';\n\nexport function promptForBaseDetails(projectRoot, {prompt}) {\n return prompt({\n id: BASE_DETAILS_PROMPT_ID,\n questions: questionsForBaseDetails(projectRoot)\n });\n}\n","export const questionNames = {\n GIT_REPO: 'gitRepo',\n REPO_HOST: 'repoHost',\n REPO_OWNER: 'repoOwner',\n PROJECT_LANGUAGE: 'projectLanguage',\n DEPENDENCY_UPDATER: 'dependencyUpdater'\n};\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const GIT_REPOSITORY_PROMPT_ID = 'GIT_REPOSITORY';\n\nexport default async function promptForRepoCreation({prompt}) {\n const {[questionNames.GIT_REPO]: gitRepoShouldBeCreated} = await prompt({\n id: GIT_REPOSITORY_PROMPT_ID,\n questions: [{\n name: questionNames.GIT_REPO,\n type: 'confirm',\n default: true,\n message: 'Should a git repository be initialized?'\n }]\n });\n\n return gitRepoShouldBeCreated;\n}\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const PROJECT_LANGUAGE_PROMPT_ID = 'PROJECT_LANGUAGE';\n\nexport default function promptForProjectLanguage(languages, {prompt}) {\n return prompt({\n id: PROJECT_LANGUAGE_PROMPT_ID,\n questions: [{\n name: questionNames.PROJECT_LANGUAGE,\n type: 'list',\n message: 'What type of project is this?',\n choices: [...Object.keys(languages), 'Other']\n }]\n });\n}\n","import {questionNames} from '../../prompts/question-names.js';\n\nexport const REPOSITORY_HOST_PROMPT_ID = 'REPOSITORY_HOST';\n\nexport default async function promptForVcsHostChoice(hosts, {prompt}) {\n const answers = await prompt({\n id: REPOSITORY_HOST_PROMPT_ID,\n questions: [{\n name: questionNames.REPO_HOST,\n type: 'list',\n message: 'Where will the repository be hosted?',\n choices: Object.keys(hosts)\n }]\n });\n const host = hosts[answers[questionNames.REPO_HOST]];\n\n return {...answers, ...host};\n}\n","import {questionNames} from '../prompts/question-names.js';\n\nexport const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';\n\nexport async function promptForDependencyUpdaterChoice(updaters, {prompt}) {\n return prompt({\n id: DEPENDENCY_UPDATER_PROMPT_ID,\n questions: [{\n name: questionNames.DEPENDENCY_UPDATER,\n type: 'list',\n message: 'Which dependency-update service do you want to manage this project?',\n choices: [...Object.keys(updaters), 'Other']\n }]\n });\n}\n","import {questionNames as coreQuestionNames} from '@form8ion/core';\n\nimport {BASE_DETAILS_PROMPT_ID} from './questions.js';\nimport {GIT_REPOSITORY_PROMPT_ID} from '../vcs/prompt.js';\nimport {PROJECT_LANGUAGE_PROMPT_ID} from '../language/prompt.js';\nimport {REPOSITORY_HOST_PROMPT_ID} from '../vcs/host/prompt.js';\nimport {DEPENDENCY_UPDATER_PROMPT_ID} from '../dependency-updater/prompt.js';\nimport {questionNames as projectScaffolderQuestionNames} from './question-names.js';\n\nexport const ids = {\n BASE_DETAILS: BASE_DETAILS_PROMPT_ID,\n GIT_REPOSITORY: GIT_REPOSITORY_PROMPT_ID,\n REPOSITORY_HOST: REPOSITORY_HOST_PROMPT_ID,\n PROJECT_LANGUAGE: PROJECT_LANGUAGE_PROMPT_ID,\n DEPENDENCY_UPDATER: DEPENDENCY_UPDATER_PROMPT_ID\n};\n\nexport const questionNames = {\n ...coreQuestionNames,\n ...projectScaffolderQuestionNames\n};\n","import {questionNames} from '../prompts/question-names.js';\nimport promptForLanguageDetails from './prompt.js';\n\nexport default async function (languagePlugins, options, {prompt}) {\n const {[questionNames.PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, {prompt});\n\n const plugin = languagePlugins[chosenLanguage];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import {simpleGit} from 'simple-git';\nimport 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 {validateOptions} from '@form8ion/core';\nimport joi from 'joi';\n\nimport languagePluginsSchema from './language/schema.js';\nimport vcsHostPluginsSchema from './vcs/host/schema.js';\nimport dependencyUpdaterPluginsSchema from './dependency-updater/schema.js';\n\nexport function validate(options) {\n return validateOptions(joi.object({\n plugins: joi.object({\n dependencyUpdaters: dependencyUpdaterPluginsSchema,\n languages: languagePluginsSchema,\n vcsHosts: vcsHostPluginsSchema\n })\n }), options) || {};\n}\n","import {resolve} from 'path';\nimport filedirname from 'filedirname';\n\nexport default function (fileName) {\n const [, __dirname] = filedirname();\n\n return resolve(__dirname, '..', 'templates', fileName);\n}\n","import {promises as fs} from 'node:fs';\n\nimport determinePathToTemplateFile from '../template-path.js';\n\nexport default function ({projectRoot}) {\n return fs.copyFile(determinePathToTemplateFile('editorconfig.ini'), `${projectRoot}/.editorconfig`);\n}\n","export default function ({visibility}) {\n if ('Public' === visibility) {\n return {\n badges: {\n contribution: {\n PRs: {\n text: 'PRs Welcome',\n link: 'https://makeapullrequest.com',\n img: 'https://img.shields.io/badge/PRs-welcome-brightgreen.svg'\n }\n }\n }\n };\n }\n\n return {};\n}\n","import {applyEnhancers} from '@form8ion/core';\nimport {lift as liftReadme} from '@form8ion/readme';\nimport * as gitPlugin from '@form8ion/git';\n\nimport * as licensePlugin from './license/index.js';\n\nexport default async function lift({projectRoot, results, enhancers, vcs, dependencies}) {\n const enhancerResults = await applyEnhancers({\n results,\n enhancers: {...enhancers, gitPlugin, licensePlugin},\n options: {projectRoot, vcs},\n dependencies\n });\n\n await liftReadme({projectRoot, results: enhancerResults});\n\n return enhancerResults;\n}\n","import deepmerge from 'deepmerge';\nimport {execa} from 'execa';\nimport {questionNames as coreQuestionNames} from '@form8ion/core';\nimport {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","alreadyVersionedByGit","scaffoldGit","fs","liftReadme","scaffoldReadme"],"mappings":";;;;;;;;;;;;;;;;;AAEO,MAAM,sBAAsB,GAAG,cAAc;;AAE7C,SAAS,oBAAoB,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE;AAC5D,EAAE,OAAO,MAAM,CAAC;AAChB,IAAI,EAAE,EAAE,sBAAsB;AAC9B,IAAI,SAAS,EAAE,uBAAuB,CAAC,WAAW;AAClD,GAAG,CAAC;AACJ;;ACTO,MAAMA,eAAa,GAAG;AAC7B,EAAE,QAAQ,EAAE,SAAS;AACrB,EAAE,SAAS,EAAE,UAAU;AACvB,EAAE,UAAU,EAAE,WAAW;AACzB,EAAE,gBAAgB,EAAE,iBAAiB;AACrC,EAAE,kBAAkB,EAAE;AACtB,CAAC;;ACJM,MAAM,wBAAwB,GAAG,gBAAgB;;AAEzC,eAAe,qBAAqB,CAAC,CAAC,MAAM,CAAC,EAAE;AAC9D,EAAE,MAAM,CAAC,CAACA,eAAa,CAAC,QAAQ,GAAG,sBAAsB,C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,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;;ACrEY,MAAC,eAAe,GAAG,CAAC,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@form8ion/project",
|
|
3
3
|
"description": "opinionated scaffolder for new projects",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "22.0.0-beta.
|
|
5
|
+
"version": "22.0.0-beta.11",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": "^20.19.0 || >=22.14.0"
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
"@form8ion/git": "^2.1.1",
|
|
67
67
|
"@form8ion/readme": "3.1.0",
|
|
68
68
|
"@hapi/hoek": "^11.0.2",
|
|
69
|
-
"@travi/cli-messages": "1.1.3",
|
|
70
69
|
"deepmerge": "^4.2.2",
|
|
71
70
|
"execa": "^9.5.1",
|
|
72
71
|
"filedirname": "^3.0.0",
|
|
@@ -79,7 +78,7 @@
|
|
|
79
78
|
"write-yaml": "1.0.0"
|
|
80
79
|
},
|
|
81
80
|
"devDependencies": {
|
|
82
|
-
"@cucumber/cucumber": "12.
|
|
81
|
+
"@cucumber/cucumber": "12.7.0",
|
|
83
82
|
"@form8ion/commitlint-config": "2.0.8",
|
|
84
83
|
"@form8ion/eslint-config": "7.0.13",
|
|
85
84
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
@@ -91,6 +90,7 @@
|
|
|
91
90
|
"chai": "6.2.2",
|
|
92
91
|
"cross-env": "10.1.0",
|
|
93
92
|
"cz-conventional-changelog": "3.3.0",
|
|
93
|
+
"debug": "4.4.3",
|
|
94
94
|
"gherkin-lint": "4.2.4",
|
|
95
95
|
"husky": "9.1.7",
|
|
96
96
|
"lockfile-lint": "5.0.0",
|
|
@@ -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 {
|
|
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},
|
package/src/scaffolder.js
CHANGED
|
@@ -2,7 +2,6 @@ import deepmerge from 'deepmerge';
|
|
|
2
2
|
import {execa} from 'execa';
|
|
3
3
|
import {questionNames as coreQuestionNames} from '@form8ion/core';
|
|
4
4
|
import {scaffold as scaffoldReadme} from '@form8ion/readme';
|
|
5
|
-
import {info} from '@travi/cli-messages';
|
|
6
5
|
|
|
7
6
|
import {scaffold as scaffoldLanguage} from './language/index.js';
|
|
8
7
|
import {scaffold as scaffoldVcs} from './vcs/index.js';
|
|
@@ -14,7 +13,7 @@ import {scaffold as scaffoldEditorConfig} from './editorconfig/index.js';
|
|
|
14
13
|
import {scaffold as scaffoldContributing} from './contributing/index.js';
|
|
15
14
|
import lift from './lift.js';
|
|
16
15
|
|
|
17
|
-
export async function scaffold(options, {prompt}) {
|
|
16
|
+
export async function scaffold(options, {prompt, logger}) {
|
|
18
17
|
const projectRoot = process.cwd();
|
|
19
18
|
const {plugins: {dependencyUpdaters, languages, vcsHosts = {}}} = validate(options);
|
|
20
19
|
|
|
@@ -29,9 +28,9 @@ export async function scaffold(options, {prompt}) {
|
|
|
29
28
|
const copyright = {year: copyrightYear, holder: copyHolder};
|
|
30
29
|
|
|
31
30
|
const [vcsResults, contributing, license] = await Promise.all([
|
|
32
|
-
scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt}),
|
|
31
|
+
scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt, logger}),
|
|
33
32
|
scaffoldContributing({visibility}),
|
|
34
|
-
scaffoldLicense({projectRoot, license: chosenLicense, copyright}),
|
|
33
|
+
scaffoldLicense({projectRoot, license: chosenLicense, copyright}, {logger}),
|
|
35
34
|
scaffoldReadme({projectName, projectRoot, description}),
|
|
36
35
|
scaffoldEditorConfig({projectRoot})
|
|
37
36
|
]);
|
|
@@ -64,7 +63,7 @@ export async function scaffold(options, {prompt}) {
|
|
|
64
63
|
});
|
|
65
64
|
|
|
66
65
|
if (language && language.verificationCommand) {
|
|
67
|
-
info('Verifying the generated project');
|
|
66
|
+
logger.info('Verifying the generated project');
|
|
68
67
|
|
|
69
68
|
const subprocess = execa(language.verificationCommand, {shell: true});
|
|
70
69
|
subprocess.stdout.pipe(process.stdout);
|
package/src/scaffolder.test.js
CHANGED
|
@@ -52,6 +52,7 @@ describe('project scaffolder', () => {
|
|
|
52
52
|
const visibility = any.word();
|
|
53
53
|
const vcsIgnore = any.simpleObject();
|
|
54
54
|
const prompt = () => undefined;
|
|
55
|
+
const logger = {info: () => {}};
|
|
55
56
|
|
|
56
57
|
beforeEach(() => {
|
|
57
58
|
process.cwd = vi.fn();
|
|
@@ -106,10 +107,10 @@ describe('project scaffolder', () => {
|
|
|
106
107
|
[coreQuestionNames.VISIBILITY]: visibility
|
|
107
108
|
});
|
|
108
109
|
when(scaffoldVcs)
|
|
109
|
-
.calledWith({projectRoot: projectPath, projectName, vcsHosts, visibility, description}, {prompt})
|
|
110
|
+
.calledWith({projectRoot: projectPath, projectName, vcsHosts, visibility, description}, {prompt, logger})
|
|
110
111
|
.thenResolve(vcsResults);
|
|
111
112
|
when(licenseScaffolder.default)
|
|
112
|
-
.calledWith({projectRoot: projectPath, license, copyright})
|
|
113
|
+
.calledWith({projectRoot: projectPath, license, copyright}, {logger})
|
|
113
114
|
.thenResolve(licenseResults);
|
|
114
115
|
scaffoldLanguage.mockResolvedValue(languageResults);
|
|
115
116
|
when(dependencyUpdaterScaffolder.default)
|
|
@@ -117,7 +118,7 @@ describe('project scaffolder', () => {
|
|
|
117
118
|
.thenResolve(dependencyUpdaterResults);
|
|
118
119
|
when(scaffoldContributing).calledWith({visibility}).thenReturn(contributingResults);
|
|
119
120
|
|
|
120
|
-
expect(await scaffold(options, {prompt})).toEqual(mergedResults);
|
|
121
|
+
expect(await scaffold(options, {prompt, logger})).toEqual(mergedResults);
|
|
121
122
|
|
|
122
123
|
expect(scaffoldReadme).toHaveBeenCalledWith({projectName, projectRoot: projectPath, description});
|
|
123
124
|
expect(scaffoldEditorconfig).toHaveBeenCalledWith({projectRoot: projectPath});
|
|
@@ -224,7 +225,7 @@ describe('project scaffolder', () => {
|
|
|
224
225
|
licenseScaffolder.default.mockResolvedValue({});
|
|
225
226
|
scaffoldContributing.mockResolvedValue({});
|
|
226
227
|
|
|
227
|
-
await scaffold(options, {prompt});
|
|
228
|
+
await scaffold(options, {prompt, logger});
|
|
228
229
|
|
|
229
230
|
expect(scaffoldReadme).toHaveBeenCalledWith({projectName, projectRoot: projectPath, description});
|
|
230
231
|
expect(execaPipe).toHaveBeenCalledWith(process.stdout);
|
package/src/vcs/git/remotes.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {simpleGit} from 'simple-git';
|
|
2
2
|
import parseGitUrl from 'git-url-parse';
|
|
3
|
-
import {warn} from '@travi/cli-messages';
|
|
4
3
|
|
|
5
4
|
async function getExistingRemotes(git) {
|
|
6
5
|
try {
|
|
@@ -22,9 +21,9 @@ export async function determineExistingVcsDetails({projectRoot}) {
|
|
|
22
21
|
return {vcs: {owner, name, host: 'github.com' === host ? 'github' : host}};
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
export async function defineRemoteOrigin(projectRoot, sshUrl) {
|
|
24
|
+
export async function defineRemoteOrigin(projectRoot, sshUrl, {logger}) {
|
|
26
25
|
if (!sshUrl) {
|
|
27
|
-
warn('URL not available to configure remote `origin`');
|
|
26
|
+
logger.warn('URL not available to configure remote `origin`');
|
|
28
27
|
|
|
29
28
|
return {nextSteps: []};
|
|
30
29
|
}
|
|
@@ -33,7 +32,7 @@ export async function defineRemoteOrigin(projectRoot, sshUrl) {
|
|
|
33
32
|
const existingRemotes = await getExistingRemotes(git);
|
|
34
33
|
|
|
35
34
|
if (existingRemotes.includes('origin')) {
|
|
36
|
-
warn('The `origin` remote is already defined for this repository');
|
|
35
|
+
logger.warn('The `origin` remote is already defined for this repository');
|
|
37
36
|
|
|
38
37
|
return {nextSteps: []};
|
|
39
38
|
}
|
|
@@ -53,6 +53,7 @@ describe('Git remote', () => {
|
|
|
53
53
|
|
|
54
54
|
describe('define', () => {
|
|
55
55
|
const sshUrl = any.url();
|
|
56
|
+
const logger = {warn: () => {}};
|
|
56
57
|
|
|
57
58
|
it('should define the remote origin', async () => {
|
|
58
59
|
const listRemote = vi.fn();
|
|
@@ -60,7 +61,7 @@ describe('Git remote', () => {
|
|
|
60
61
|
when(simpleGit).calledWith({baseDir: projectRoot}).thenReturn({listRemote, addRemote});
|
|
61
62
|
when(listRemote).calledWith().thenResolve(any.listOf(any.word));
|
|
62
63
|
|
|
63
|
-
const {nextSteps} = await defineRemoteOrigin(projectRoot, sshUrl);
|
|
64
|
+
const {nextSteps} = await defineRemoteOrigin(projectRoot, sshUrl, {logger});
|
|
64
65
|
|
|
65
66
|
expect(addRemote).toHaveBeenCalledWith('origin', sshUrl);
|
|
66
67
|
expect(nextSteps).toEqual([{summary: 'Set local `master` branch to track upstream `origin/master`'}]);
|
|
@@ -72,7 +73,7 @@ describe('Git remote', () => {
|
|
|
72
73
|
when(simpleGit).calledWith({baseDir: projectRoot}).thenReturn({listRemote, addRemote});
|
|
73
74
|
when(listRemote).calledWith().thenThrow(new Error('fatal: No remote configured to list refs from.\n'));
|
|
74
75
|
|
|
75
|
-
const {nextSteps} = await defineRemoteOrigin(projectRoot, sshUrl);
|
|
76
|
+
const {nextSteps} = await defineRemoteOrigin(projectRoot, sshUrl, {logger});
|
|
76
77
|
|
|
77
78
|
expect(nextSteps).toEqual([{summary: 'Set local `master` branch to track upstream `origin/master`'}]);
|
|
78
79
|
});
|
|
@@ -83,7 +84,7 @@ describe('Git remote', () => {
|
|
|
83
84
|
when(simpleGit).calledWith({baseDir: projectRoot}).thenReturn({listRemote});
|
|
84
85
|
when(listRemote).calledWith().thenThrow(error);
|
|
85
86
|
|
|
86
|
-
await expect(defineRemoteOrigin(projectRoot, sshUrl)).rejects.toThrow(error);
|
|
87
|
+
await expect(defineRemoteOrigin(projectRoot, sshUrl, {logger})).rejects.toThrow(error);
|
|
87
88
|
});
|
|
88
89
|
|
|
89
90
|
it('should return no next-steps when the remote origin is already defined', async () => {
|
|
@@ -91,13 +92,13 @@ describe('Git remote', () => {
|
|
|
91
92
|
when(simpleGit).calledWith({baseDir: projectRoot}).thenReturn({listRemote});
|
|
92
93
|
when(listRemote).calledWith().thenResolve([...any.listOf(any.word), 'origin', ...any.listOf(any.word)]);
|
|
93
94
|
|
|
94
|
-
const {nextSteps} = await defineRemoteOrigin(projectRoot, sshUrl);
|
|
95
|
+
const {nextSteps} = await defineRemoteOrigin(projectRoot, sshUrl, {logger});
|
|
95
96
|
|
|
96
97
|
expect(nextSteps).toEqual([]);
|
|
97
98
|
});
|
|
98
99
|
|
|
99
100
|
it('should return no next-steps when no `sshUrl` is provided', async () => {
|
|
100
|
-
const {nextSteps} = await defineRemoteOrigin(projectRoot);
|
|
101
|
+
const {nextSteps} = await defineRemoteOrigin(projectRoot, undefined, {logger});
|
|
101
102
|
|
|
102
103
|
expect(nextSteps).toEqual([]);
|
|
103
104
|
});
|
package/src/vcs/scaffolder.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {info} from '@travi/cli-messages';
|
|
2
1
|
import {scaffold as scaffoldGit, test as alreadyVersionedByGit} from '@form8ion/git';
|
|
3
2
|
|
|
4
3
|
import repositoryShouldBeCreated from './prompt.js';
|
|
5
4
|
import {determineExistingVcsDetails, defineRemoteOrigin} from './git/index.js';
|
|
6
5
|
import {scaffold as scaffoldVcsHost} from './host/index.js';
|
|
7
6
|
|
|
8
|
-
export default async function scaffoldVcs(
|
|
7
|
+
export default async function scaffoldVcs(
|
|
8
|
+
{projectRoot, projectName, vcsHosts, visibility, description},
|
|
9
|
+
{prompt, logger}
|
|
10
|
+
) {
|
|
9
11
|
if (await repositoryShouldBeCreated({prompt})) {
|
|
10
12
|
if (await alreadyVersionedByGit({projectRoot})) {
|
|
11
|
-
info('Git repository already exists');
|
|
13
|
+
logger.info('Git repository already exists');
|
|
12
14
|
|
|
13
15
|
return determineExistingVcsDetails({projectRoot});
|
|
14
16
|
}
|
|
@@ -18,7 +20,7 @@ export default async function scaffoldVcs({projectRoot, projectName, vcsHosts, v
|
|
|
18
20
|
scaffoldGit({projectRoot})
|
|
19
21
|
]);
|
|
20
22
|
|
|
21
|
-
const remoteOriginResults = await defineRemoteOrigin(projectRoot, sshUrl);
|
|
23
|
+
const remoteOriginResults = await defineRemoteOrigin(projectRoot, sshUrl, {logger});
|
|
22
24
|
|
|
23
25
|
return {
|
|
24
26
|
vcs: {host, owner, name},
|
|
@@ -17,6 +17,7 @@ vi.mock('./prompt.js');
|
|
|
17
17
|
describe('vcs scaffolder', () => {
|
|
18
18
|
const projectRoot = any.string();
|
|
19
19
|
const prompt = () => undefined;
|
|
20
|
+
const logger = {info: () => {}};
|
|
20
21
|
|
|
21
22
|
it('should scaffold the repository and vcs host details', async () => {
|
|
22
23
|
const host = any.word();
|
|
@@ -34,9 +35,9 @@ describe('vcs scaffolder', () => {
|
|
|
34
35
|
when(scaffoldVcsHost)
|
|
35
36
|
.calledWith(vcsHosts, {projectName, projectRoot, description, visibility}, {prompt})
|
|
36
37
|
.thenResolve({vcs: {...vcsHostDetails, sshUrl, ...any.simpleObject()}});
|
|
37
|
-
when(defineRemoteOrigin).calledWith(projectRoot, sshUrl).thenResolve({nextSteps: remoteOriginNextSteps});
|
|
38
|
+
when(defineRemoteOrigin).calledWith(projectRoot, sshUrl, {logger}).thenResolve({nextSteps: remoteOriginNextSteps});
|
|
38
39
|
|
|
39
|
-
expect(await scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt})).toEqual({
|
|
40
|
+
expect(await scaffoldVcs({projectRoot, projectName, vcsHosts, visibility, description}, {prompt, logger})).toEqual({
|
|
40
41
|
vcs: vcsHostDetails,
|
|
41
42
|
nextSteps: [{summary: 'Commit scaffolded files'}, ...remoteOriginNextSteps]
|
|
42
43
|
});
|
|
@@ -49,7 +50,7 @@ describe('vcs scaffolder', () => {
|
|
|
49
50
|
when(alreadyVersionedByGit).calledWith({projectRoot}).thenResolve(true);
|
|
50
51
|
when(determineExistingVcsDetails).calledWith({projectRoot}).thenResolve(existingVcsDetails);
|
|
51
52
|
|
|
52
|
-
expect(await scaffoldVcs({projectRoot}, {prompt})).toEqual(existingVcsDetails);
|
|
53
|
+
expect(await scaffoldVcs({projectRoot}, {prompt, logger})).toEqual(existingVcsDetails);
|
|
53
54
|
});
|
|
54
55
|
|
|
55
56
|
it('should not scaffold a repository or vcs host details when a repository should not be created', async () => {
|