@form8ion/project 22.0.0-beta.2 → 22.0.0-beta.20
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 +70 -26
- package/lib/index.js +205 -104
- package/lib/index.js.map +1 -1
- package/package.json +27 -29
- package/src/ci-provider/index.js +1 -0
- package/src/ci-provider/prompt.js +17 -0
- package/src/ci-provider/prompt.test.js +27 -0
- package/src/ci-provider/scaffolder.js +27 -0
- package/src/ci-provider/scaffolder.test.js +68 -0
- package/src/ci-provider/schema.js +4 -0
- package/src/ci-provider/schema.test.js +43 -0
- package/src/contributing/scaffolder.js +2 -2
- package/src/contributing/scaffolder.test.js +14 -2
- package/src/dependency-updater/prompt.js +14 -8
- package/src/dependency-updater/prompt.test.js +16 -17
- package/src/dependency-updater/scaffolder.js +4 -2
- package/src/dependency-updater/scaffolder.test.js +18 -15
- 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 -7
- package/src/language/prompt.js +14 -9
- package/src/language/prompt.test.js +15 -16
- package/src/language/scaffolder.js +4 -2
- package/src/language/scaffolder.test.js +13 -8
- package/src/license/lifter.js +1 -1
- package/src/license/scaffolder.js +2 -3
- package/src/license/scaffolder.test.js +5 -8
- package/src/license/tester.js +1 -1
- package/src/lift.js +6 -1
- package/src/lift.test.js +24 -12
- package/src/options-validator.js +3 -3
- package/src/options-validator.test.js +4 -6
- package/src/prompts/index.js +20 -0
- package/src/prompts/question-names.js +19 -5
- package/src/prompts/questions.js +7 -3
- package/src/prompts/questions.test.js +5 -6
- package/src/scaffolder.js +18 -17
- package/src/scaffolder.test.js +39 -31
- package/src/template-path.js +1 -1
- package/src/vcs/git/remotes.js +6 -7
- package/src/vcs/git/remotes.test.js +21 -16
- package/src/vcs/host/prompt.js +15 -10
- package/src/vcs/host/prompt.test.js +31 -25
- package/src/vcs/host/scaffolder.js +4 -2
- package/src/vcs/host/scaffolder.test.js +9 -7
- package/src/vcs/prompt.js +11 -9
- package/src/vcs/prompt.test.js +15 -12
- package/src/vcs/scaffolder.js +9 -11
- package/src/vcs/scaffolder.test.js +10 -9
- package/src/options-schemas.js +0 -3
- package/src/options-schemas.test.js +0 -20
- package/src/prompts/conditionals.js +0 -13
- package/src/prompts/conditionals.test.js +0 -51
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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/options-schemas.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":["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 {prompt} from '@form8ion/overridable-prompts';\n\nimport {questionNames} from '../prompts/question-names.js';\n\nexport default function (languages, decisions) {\n return prompt([{\n name: questionNames.PROJECT_LANGUAGE,\n type: 'list',\n message: 'What type of project is this?',\n choices: [...Object.keys(languages), 'Other']\n }], decisions);\n}\n","import {questionNames} from '../prompts/question-names.js';\nimport promptForLanguageDetails from './prompt.js';\n\nexport default async function (languagePlugins, decisions, options) {\n const {[questionNames.PROJECT_LANGUAGE]: chosenLanguage} = await promptForLanguageDetails(languagePlugins, decisions);\n\n const plugin = languagePlugins[chosenLanguage];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import {prompt} from '@form8ion/overridable-prompts';\n\nimport {questionNames} from '../prompts/question-names.js';\n\nexport default async function promptForRepoCreation(decisions) {\n const {[questionNames.GIT_REPO]: gitRepoShouldBeCreated} = await prompt(\n [{\n name: questionNames.GIT_REPO,\n type: 'confirm',\n default: true,\n message: 'Should a git repository be initialized?'\n }],\n decisions\n );\n\n return gitRepoShouldBeCreated;\n}\n","import {simpleGit} from 'simple-git';\nimport hostedGitInfo from 'hosted-git-info';\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 {user, project, type} = hostedGitInfo.fromUrl(remoteOrigin);\n\n return {vcs: {owner: user, name: project, host: type}};\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 {prompt} from '@form8ion/overridable-prompts';\n\nimport {questionNames} from '../../prompts/question-names.js';\n\nexport default async function (hosts, decisions) {\n const answers = await prompt([{\n name: questionNames.REPO_HOST,\n type: 'list',\n message: 'Where will the repository be hosted?',\n choices: Object.keys(hosts)\n }], decisions);\n const host = hosts[answers[questionNames.REPO_HOST]];\n\n return {...answers, ...host};\n}\n","import {questionNames} from '../../prompts/question-names.js';\nimport promptForVcsHostDetails from './prompt.js';\n\nexport default async function scaffoldVcsHost(hosts, decisions, options) {\n const {[questionNames.REPO_HOST]: chosenHost} = await promptForVcsHostDetails(hosts, decisions);\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, decisions, vcsHosts, visibility, description}) {\n if (await repositoryShouldBeCreated(decisions)) {\n if (await alreadyVersionedByGit({projectRoot})) {\n info('Git repository already exists');\n\n return {vcs: await determineExistingVcsDetails({projectRoot})};\n }\n\n const [{vcs: {host, owner, name, sshUrl}}] = await Promise.all([\n scaffoldVcsHost(\n vcsHosts,\n decisions,\n {projectName, projectRoot, description, visibility}\n ),\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 {prompt} from '@form8ion/overridable-prompts';\nimport {questionNames} from '../prompts/question-names.js';\n\nexport async function promptForDependencyUpdaterChoice(updaters, decisions) {\n return prompt([{\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 }], decisions);\n}\n","import {questionNames} from '../prompts/question-names.js';\nimport {promptForDependencyUpdaterChoice} from './prompt.js';\n\nexport default async function (plugins, decisions, options) {\n if (!Object.keys(plugins).length) return undefined;\n\n const plugin = plugins[\n (await promptForDependencyUpdaterChoice(plugins, decisions))[questionNames.DEPENDENCY_UPDATER]\n ];\n\n if (plugin) return plugin.scaffold(options);\n\n return undefined;\n}\n","import {questionsForBaseDetails} from '@form8ion/core';\nimport {prompt} from '@form8ion/overridable-prompts';\n\nexport function promptForBaseDetails(projectRoot, decisions) {\n return prompt(questionsForBaseDetails(decisions, projectRoot), decisions);\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';\n\nexport const decisionsSchema = joi.object();\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 {decisionsSchema} from './options-schemas.js';\n\nexport function validate(options) {\n return validateOptions(joi.object({\n decisions: decisionsSchema,\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 {reportResults} from '@form8ion/results-reporter';\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) {\n const projectRoot = process.cwd();\n const {decisions, 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, decisions);\n const copyright = {year: copyrightYear, holder: copyHolder};\n\n const [vcsResults, contributing, license] = await Promise.all([\n scaffoldVcs({projectRoot, projectName, decisions, vcsHosts, visibility, description}),\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 decisions,\n {projectRoot}\n );\n\n const language = await scaffoldLanguage(\n languages,\n decisions,\n {projectRoot, projectName, vcs: vcsResults.vcs, visibility, license: chosenLicense || 'UNLICENSED', description}\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 reportResults(mergedResults);\n}\n","import {questionNames as coreQuestionNames} from '@form8ion/core';\nimport {questionNames as projectScaffolderQuestionNames} from './prompts/question-names.js';\n\nexport * from './scaffolder.js';\nexport {default as lift} from './lift.js';\nexport const questionNames = {\n ...coreQuestionNames,\n ...projectScaffolderQuestionNames\n};\n"],"names":["questionNames","repositoryShouldBeCreated","alreadyVersionedByGit","scaffoldGit","fs","liftReadme","coreQuestionNames","scaffoldReadme","projectScaffolderQuestionNames"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAO,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;;ACFc,iCAAQ,EAAE,SAAS,EAAE,SAAS,EAAE;AAC/C,EAAE,OAAO,MAAM,CAAC,CAAC;AACjB,IAAI,IAAI,EAAEA,eAAa,CAAC,gBAAgB;AACxC,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,+BAA+B;AAC5C,IAAI,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO;AAChD,GAAG,CAAC,EAAE,SAAS,CAAC;AAChB;;ACRe,+BAAc,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE;AACpE,EAAE,MAAM,CAAC,CAACA,eAAa,CAAC,gBAAgB,GAAG,cAAc,CAAC,GAAG,MAAM,wBAAwB,CAAC,eAAe,EAAE,SAAS,CAAC;;AAEvH,EAAE,MAAM,MAAM,GAAG,eAAe,CAAC,cAAc,CAAC;;AAEhD,EAAE,IAAI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;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;;AAEA,EAAE,aAAa,CAAC,aAAa,CAAC;AAC9B;;ACtEY,MAAC,aAAa,GAAG;AAC7B,EAAE,GAAGD,eAAiB;AACtB,EAAE,GAAGE;AACL;;;;"}
|
|
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/ci-provider/prompt.js","../src/ci-provider/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/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}};\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 {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 {questionNames} from '../prompts/question-names.js';\nimport promptForCiProvider from './prompt.js';\n\nconst {CI_PROVIDER} = questionNames.CI_PROVIDER;\n\nexport default async function scaffoldCiProvider(plugins, options, {prompt}) {\n if (!Object.keys(plugins).length) return undefined;\n\n const {projectRoot} = options;\n\n const qualifiedPlugins = Object.fromEntries(\n (await Promise.all(\n Object.entries(plugins).map(async ([name, plugin]) => [\n name,\n plugin,\n plugin.qualify ? await plugin.qualify({projectRoot}) : true\n ])\n )).filter(([, , qualified]) => qualified).map(([name, plugin]) => [name, plugin])\n );\n\n const chosen = (await promptForCiProvider(qualifiedPlugins, {prompt}))[CI_PROVIDER];\n const plugin = qualifiedPlugins[chosen];\n\n if (plugin) return plugin.scaffold(options);\n\n return {};\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 (['OSS', 'ISS'].includes(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 {scaffold as scaffoldCiProvider} from './ci-provider/index.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, dependencies) {\n const projectRoot = process.cwd();\n const {plugins: {dependencyUpdaters, ciProviders, languages, vcsHosts = {}}} = validate(options);\n const {prompt, logger} = dependencies;\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 scaffoldCiProvider(ciProviders, {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 }, dependencies);\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 {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","CI_PROVIDER","determinePathToTemplateFile","scaffoldEditorconfig","liftReadme","scaffoldContributing","scaffoldReadme"],"mappings":";;;;;;;;;;;;;;;;;AAEO,MAAM,aAAa,GAAG;AAC7B,EAAE,YAAY,EAAEA,eAAiB;AACjC,EAAE,cAAc,EAAE;AAClB,IAAI,QAAQ,EAAE;AACd,GAAG;AACH,EAAE,eAAe,EAAE;AACnB,IAAI,SAAS,EAAE,UAAU;AACzB,IAAI,UAAU,EAAE;AAChB,GAAG;AACH,EAAE,gBAAgB,EAAE;AACpB,IAAI,gBAAgB,EAAE;AACtB,GAAG;AACH,EAAE,kBAAkB,EAAE;AACtB,IAAI,kBAAkB,EAAE;AACxB,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,WAAW,EAAE;AACjB;AACA,CAAC;;AClBM,MAAM,0BAA0B,GAAG,kBAAkB;;AAE5D,MAAM,mBAACC,kBAAgB,CAAC,GAAG,aAAa,CAAC,gBAAgB;;AAE1C,SAAS,wBAAwB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B,IAAI,SAAS,EAAE,CAAC,GAAG,kBAAkB,EAAE,GAAG,SAAS,EAAE,GAAG,QAAQ;AAChE,GAAG,EAAE,YAAY,CAAC;;AAElB,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;;ACpEO,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,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.
|
|
5
|
+
"version": "22.0.0-beta.20",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^
|
|
8
|
+
"node": "^22.21.0 || >=24.12"
|
|
9
9
|
},
|
|
10
10
|
"author": "Matt Travi <npm@travi.org> (https://matt.travi.org/)",
|
|
11
11
|
"contributors": [
|
|
@@ -55,64 +55,62 @@
|
|
|
55
55
|
"access": "public",
|
|
56
56
|
"provenance": true
|
|
57
57
|
},
|
|
58
|
-
"packageManager": "npm@11.
|
|
58
|
+
"packageManager": "npm@11.17.0+sha512.3eeaf18997b11070d313849268b23766b9db0068997dec9471073170fe43fa17f2b4d0337bf0f52330ee2274e7f5754b21b01052742e48f5c9c74d8b1e32ef43",
|
|
59
59
|
"config": {
|
|
60
60
|
"commitizen": {
|
|
61
61
|
"path": "./node_modules/cz-conventional-changelog"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@form8ion/core": "^
|
|
65
|
+
"@form8ion/core": "^5.0.0-beta.6",
|
|
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
|
-
"
|
|
76
|
-
"joi": "^
|
|
72
|
+
"git-url-parse": "^16.1.0",
|
|
73
|
+
"joi": "^18.0.0",
|
|
77
74
|
"mustache": "4.2.0",
|
|
78
75
|
"simple-git": "^3.16.0",
|
|
79
|
-
"spdx-license-list": "6.
|
|
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": "
|
|
85
|
-
"@form8ion/commitlint-config": "2.0.
|
|
86
|
-
"@form8ion/eslint-config": "7.0.
|
|
81
|
+
"@cucumber/cucumber": "12.9.0",
|
|
82
|
+
"@form8ion/commitlint-config": "2.0.16",
|
|
83
|
+
"@form8ion/eslint-config": "7.1.0-beta.1",
|
|
87
84
|
"@form8ion/eslint-config-cucumber": "1.4.1",
|
|
88
|
-
"@form8ion/eslint-config-vitest": "1.
|
|
85
|
+
"@form8ion/eslint-config-vitest": "1.1.0",
|
|
89
86
|
"@form8ion/remark-lint-preset": "6.0.7",
|
|
90
|
-
"@rollup/plugin-node-resolve": "16.0.
|
|
91
|
-
"@travi/any": "3.
|
|
92
|
-
"c8": "
|
|
93
|
-
"chai": "
|
|
94
|
-
"cross-env": "
|
|
87
|
+
"@rollup/plugin-node-resolve": "16.0.3",
|
|
88
|
+
"@travi/any": "3.3.0",
|
|
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": "
|
|
99
|
-
"ls-engines": "0.
|
|
100
|
-
"mdast-util-from-markdown": "2.0.
|
|
96
|
+
"lockfile-lint": "5.0.0",
|
|
97
|
+
"ls-engines": "0.10.0",
|
|
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
|
-
"npm-run-all2": "
|
|
105
|
-
"publint": "0.3.
|
|
102
|
+
"npm-run-all2": "9.0.2",
|
|
103
|
+
"publint": "0.3.21",
|
|
106
104
|
"remark-cli": "12.0.1",
|
|
107
105
|
"remark-toc": "9.0.0",
|
|
108
106
|
"remark-usage": "11.0.1",
|
|
109
|
-
"rimraf": "6.
|
|
110
|
-
"rollup": "4.
|
|
107
|
+
"rimraf": "6.1.3",
|
|
108
|
+
"rollup": "4.62.0",
|
|
111
109
|
"rollup-plugin-auto-external": "2.0.0",
|
|
112
|
-
"sinon": "
|
|
110
|
+
"sinon": "22.0.0",
|
|
113
111
|
"testdouble": "3.20.2",
|
|
114
112
|
"unist-util-find": "3.0.0",
|
|
115
|
-
"vitest": "
|
|
116
|
-
"vitest-when": "0.
|
|
113
|
+
"vitest": "4.1.8",
|
|
114
|
+
"vitest-when": "0.10.0"
|
|
117
115
|
}
|
|
118
116
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default as scaffold} from './scaffolder.js';
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {questionNames} from '../prompts/question-names.js';
|
|
2
|
+
import promptForCiProvider from './prompt.js';
|
|
3
|
+
|
|
4
|
+
const {CI_PROVIDER} = questionNames.CI_PROVIDER;
|
|
5
|
+
|
|
6
|
+
export default async function scaffoldCiProvider(plugins, options, {prompt}) {
|
|
7
|
+
if (!Object.keys(plugins).length) return undefined;
|
|
8
|
+
|
|
9
|
+
const {projectRoot} = options;
|
|
10
|
+
|
|
11
|
+
const qualifiedPlugins = Object.fromEntries(
|
|
12
|
+
(await Promise.all(
|
|
13
|
+
Object.entries(plugins).map(async ([name, plugin]) => [
|
|
14
|
+
name,
|
|
15
|
+
plugin,
|
|
16
|
+
plugin.qualify ? await plugin.qualify({projectRoot}) : true
|
|
17
|
+
])
|
|
18
|
+
)).filter(([, , qualified]) => qualified).map(([name, plugin]) => [name, plugin])
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const chosen = (await promptForCiProvider(qualifiedPlugins, {prompt}))[CI_PROVIDER];
|
|
22
|
+
const plugin = qualifiedPlugins[chosen];
|
|
23
|
+
|
|
24
|
+
if (plugin) return plugin.scaffold(options);
|
|
25
|
+
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {describe, expect, it, vi} from 'vitest';
|
|
2
|
+
import any from '@travi/any';
|
|
3
|
+
import {when} from 'vitest-when';
|
|
4
|
+
|
|
5
|
+
import promptForCiProvider from './prompt.js';
|
|
6
|
+
import scaffoldCiProvider from './scaffolder.js';
|
|
7
|
+
import {questionNames} from '../prompts/index.js';
|
|
8
|
+
|
|
9
|
+
vi.mock('./prompt.js');
|
|
10
|
+
|
|
11
|
+
const {CI_PROVIDER} = questionNames.CI_PROVIDER;
|
|
12
|
+
|
|
13
|
+
describe('ci-provider scaffolder', () => {
|
|
14
|
+
const prompt = () => undefined;
|
|
15
|
+
const projectRoot = any.string();
|
|
16
|
+
const options = {projectRoot};
|
|
17
|
+
|
|
18
|
+
it('should qualify each plugin and prompt only with those that qualify', async () => {
|
|
19
|
+
const qualifiedProviderName = any.word();
|
|
20
|
+
const unqualifiedProviderName = any.word();
|
|
21
|
+
const qualifiedScaffolder = vi.fn();
|
|
22
|
+
const qualifiedPlugin = {qualify: vi.fn(), scaffold: qualifiedScaffolder};
|
|
23
|
+
const unqualifiedPlugin = {qualify: vi.fn(), scaffold: vi.fn()};
|
|
24
|
+
const scaffolderResult = any.simpleObject();
|
|
25
|
+
when(qualifiedPlugin.qualify).calledWith({projectRoot}).thenResolve(true);
|
|
26
|
+
when(unqualifiedPlugin.qualify).calledWith({projectRoot}).thenResolve(false);
|
|
27
|
+
when(promptForCiProvider)
|
|
28
|
+
.calledWith({[qualifiedProviderName]: qualifiedPlugin}, {prompt})
|
|
29
|
+
.thenResolve({[CI_PROVIDER]: qualifiedProviderName});
|
|
30
|
+
when(qualifiedScaffolder).calledWith(options).thenResolve(scaffolderResult);
|
|
31
|
+
|
|
32
|
+
expect(await scaffoldCiProvider(
|
|
33
|
+
{[qualifiedProviderName]: qualifiedPlugin, [unqualifiedProviderName]: unqualifiedPlugin},
|
|
34
|
+
options,
|
|
35
|
+
{prompt}
|
|
36
|
+
)).toEqual(scaffolderResult);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should treat a plugin without a qualify method as always qualifying', async () => {
|
|
40
|
+
const providerName = any.word();
|
|
41
|
+
const pluginScaffolder = vi.fn();
|
|
42
|
+
const plugin = {scaffold: pluginScaffolder};
|
|
43
|
+
const scaffolderResult = any.simpleObject();
|
|
44
|
+
when(promptForCiProvider)
|
|
45
|
+
.calledWith({[providerName]: plugin}, {prompt})
|
|
46
|
+
.thenResolve({[CI_PROVIDER]: providerName});
|
|
47
|
+
when(pluginScaffolder).calledWith(options).thenResolve(scaffolderResult);
|
|
48
|
+
|
|
49
|
+
expect(await scaffoldCiProvider({[providerName]: plugin}, options, {prompt})).toEqual(scaffolderResult);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should not present a prompt when no plugins are registered', async () => {
|
|
53
|
+
expect(await scaffoldCiProvider({}, options, {prompt})).toBe(undefined);
|
|
54
|
+
expect(promptForCiProvider).not.toHaveBeenCalled();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should return undefined when Other is chosen', async () => {
|
|
58
|
+
const providerName = any.word();
|
|
59
|
+
const plugin = {qualify: vi.fn(), scaffold: vi.fn()};
|
|
60
|
+
when(plugin.qualify).calledWith({projectRoot}).thenResolve(true);
|
|
61
|
+
when(promptForCiProvider)
|
|
62
|
+
.calledWith({[providerName]: plugin}, {prompt})
|
|
63
|
+
.thenResolve({[CI_PROVIDER]: 'Other'});
|
|
64
|
+
|
|
65
|
+
expect(await scaffoldCiProvider({[providerName]: plugin}, options, {prompt})).toEqual({});
|
|
66
|
+
expect(plugin.scaffold).not.toHaveBeenCalled();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {validateOptions} from '@form8ion/core';
|
|
2
|
+
|
|
3
|
+
import {describe, expect, it} from 'vitest';
|
|
4
|
+
import any from '@travi/any';
|
|
5
|
+
|
|
6
|
+
import ciProviderPluginsSchema from './schema.js';
|
|
7
|
+
|
|
8
|
+
describe('ci-provider plugins schema', () => {
|
|
9
|
+
const key = any.word();
|
|
10
|
+
|
|
11
|
+
it('should return the validated options', () => {
|
|
12
|
+
const options = any.objectWithKeys(
|
|
13
|
+
any.listOf(any.string),
|
|
14
|
+
{factory: () => ({scaffold: foo => foo})}
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
expect(validateOptions(ciProviderPluginsSchema, options)).toEqual(options);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should require options to be provided as an object', () => {
|
|
21
|
+
expect(() => validateOptions(ciProviderPluginsSchema, {[key]: []}))
|
|
22
|
+
.toThrowError(`"${key}" must be of type object`);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should require a `scaffold` property to be included', () => {
|
|
26
|
+
expect(() => validateOptions(ciProviderPluginsSchema, {[key]: {}}))
|
|
27
|
+
.toThrowError(`"${key}.scaffold" is required`);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should require `scaffold` to be a function', () => {
|
|
31
|
+
expect(() => validateOptions(ciProviderPluginsSchema, {[key]: {scaffold: any.word()}}))
|
|
32
|
+
.toThrowError(`"${key}.scaffold" must be of type function`);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should require the scaffolder to accept a single argument', () => {
|
|
36
|
+
expect(() => validateOptions(ciProviderPluginsSchema, {[key]: {scaffold: () => undefined}}))
|
|
37
|
+
.toThrowError(`"${key}.scaffold" must have an arity greater or equal to 1`);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should default to an empty map when no updaters are provided', () => {
|
|
41
|
+
expect(validateOptions(ciProviderPluginsSchema)).toEqual({});
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -4,8 +4,20 @@ import any from '@travi/any';
|
|
|
4
4
|
import scaffoldContributing from './scaffolder.js';
|
|
5
5
|
|
|
6
6
|
describe('contributing scaffolder', () => {
|
|
7
|
-
it('should return the PRs-welcome badge for
|
|
8
|
-
const {badges} = scaffoldContributing({visibility: '
|
|
7
|
+
it('should return the PRs-welcome badge for open-source projects', () => {
|
|
8
|
+
const {badges} = scaffoldContributing({visibility: 'OSS'});
|
|
9
|
+
|
|
10
|
+
expect(badges.contribution).toEqual({
|
|
11
|
+
PRs: {
|
|
12
|
+
text: 'PRs Welcome',
|
|
13
|
+
link: 'https://makeapullrequest.com',
|
|
14
|
+
img: 'https://img.shields.io/badge/PRs-welcome-brightgreen.svg'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should return the PRs-welcome badge for inner-source projects', () => {
|
|
20
|
+
const {badges} = scaffoldContributing({visibility: 'ISS'});
|
|
9
21
|
|
|
10
22
|
expect(badges.contribution).toEqual({
|
|
11
23
|
PRs: {
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {prompt} from '@form8ion/overridable-prompts';
|
|
2
1
|
import {questionNames} from '../prompts/question-names.js';
|
|
3
2
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export const DEPENDENCY_UPDATER_PROMPT_ID = 'DEPENDENCY_UPDATER';
|
|
4
|
+
|
|
5
|
+
const {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;
|
|
6
|
+
|
|
7
|
+
export async function promptForDependencyUpdaterChoice(updaters, {prompt}) {
|
|
8
|
+
return prompt({
|
|
9
|
+
id: DEPENDENCY_UPDATER_PROMPT_ID,
|
|
10
|
+
questions: [{
|
|
11
|
+
name: DEPENDENCY_UPDATER,
|
|
12
|
+
type: 'list',
|
|
13
|
+
message: 'Which dependency-update service do you want to manage this project?',
|
|
14
|
+
choices: [...Object.keys(updaters), 'Other']
|
|
15
|
+
}]
|
|
16
|
+
});
|
|
11
17
|
}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import
|
|
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';
|
|
8
|
-
import {questionNames} from '../index.js';
|
|
5
|
+
import {DEPENDENCY_UPDATER_PROMPT_ID, promptForDependencyUpdaterChoice} from './prompt.js';
|
|
6
|
+
import {questionNames} from '../prompts/index.js';
|
|
9
7
|
|
|
10
8
|
vi.mock('@form8ion/overridable-prompts');
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
afterEach(() => {
|
|
14
|
-
vi.clearAllMocks();
|
|
15
|
-
});
|
|
10
|
+
const {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;
|
|
16
11
|
|
|
12
|
+
describe('dependency updater prompt', () => {
|
|
17
13
|
it('should enable choosing the preferred updater', async () => {
|
|
14
|
+
const prompt = vi.fn();
|
|
18
15
|
const answers = any.simpleObject();
|
|
19
16
|
const updaters = any.simpleObject();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
when(prompt).calledWith({
|
|
18
|
+
id: DEPENDENCY_UPDATER_PROMPT_ID,
|
|
19
|
+
questions: [{
|
|
20
|
+
name: DEPENDENCY_UPDATER,
|
|
21
|
+
type: 'list',
|
|
22
|
+
message: 'Which dependency-update service do you want to manage this project?',
|
|
23
|
+
choices: [...Object.keys(updaters), 'Other']
|
|
24
|
+
}]
|
|
25
|
+
}).thenResolve(answers);
|
|
27
26
|
|
|
28
|
-
expect(await promptForDependencyUpdaterChoice(updaters,
|
|
27
|
+
expect(await promptForDependencyUpdaterChoice(updaters, {prompt})).toEqual(answers);
|
|
29
28
|
});
|
|
30
29
|
});
|
|
@@ -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,
|
|
10
|
+
(await promptForDependencyUpdaterChoice(plugins, {prompt}))[DEPENDENCY_UPDATER]
|
|
9
11
|
];
|
|
10
12
|
|
|
11
13
|
if (plugin) return plugin.scaffold(options);
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import {
|
|
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';
|
|
6
|
-
import scaffoldUpdater from './scaffolder.js';
|
|
7
|
-
import {questionNames} from '../index.js';
|
|
8
5
|
import {promptForDependencyUpdaterChoice} from './prompt.js';
|
|
6
|
+
import scaffoldUpdater from './scaffolder.js';
|
|
7
|
+
import {questionNames} from '../prompts/index.js';
|
|
8
|
+
|
|
9
|
+
vi.mock('./prompt.js');
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
const {DEPENDENCY_UPDATER} = questionNames.DEPENDENCY_UPDATER;
|
|
11
12
|
|
|
12
13
|
describe('dependency-updater scaffolder', () => {
|
|
13
|
-
|
|
14
|
-
vi.clearAllMocks();
|
|
15
|
-
});
|
|
14
|
+
const prompt = () => undefined;
|
|
16
15
|
|
|
17
16
|
it('should execute the chosen scaffolder with the appropriate options', async () => {
|
|
18
|
-
const decisions = any.simpleObject();
|
|
19
17
|
const options = any.simpleObject();
|
|
20
18
|
const chosenUpdater = any.word();
|
|
21
19
|
const chosenUpdaterScaffolder = vi.fn();
|
|
22
20
|
const plugins = {...any.simpleObject(), [chosenUpdater]: {scaffold: chosenUpdaterScaffolder}};
|
|
23
21
|
const scaffolderResult = any.simpleObject();
|
|
24
|
-
when(
|
|
25
|
-
.calledWith(plugins,
|
|
26
|
-
.thenResolve({[
|
|
22
|
+
when(promptForDependencyUpdaterChoice)
|
|
23
|
+
.calledWith(plugins, {prompt})
|
|
24
|
+
.thenResolve({[DEPENDENCY_UPDATER]: chosenUpdater});
|
|
27
25
|
when(chosenUpdaterScaffolder).calledWith(options).thenResolve(scaffolderResult);
|
|
28
26
|
|
|
29
|
-
expect(await scaffoldUpdater(plugins,
|
|
27
|
+
expect(await scaffoldUpdater(plugins, options, {prompt})).toEqual(scaffolderResult);
|
|
30
28
|
});
|
|
31
29
|
|
|
32
30
|
it('should not present a prompt if no updaters are registered', async () => {
|
|
@@ -35,8 +33,13 @@ describe('dependency-updater scaffolder', () => {
|
|
|
35
33
|
});
|
|
36
34
|
|
|
37
35
|
it('should not result in an error when choosing an updater without a defined scaffolder', async () => {
|
|
38
|
-
|
|
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()});
|
|
39
42
|
|
|
40
|
-
expect(await scaffoldUpdater(
|
|
43
|
+
expect(await scaffoldUpdater(plugins, options, context)).toBe(undefined);
|
|
41
44
|
});
|
|
42
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
|
}
|