diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index cbb89359..60c6f2a2 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -34,9 +34,8 @@ jobs: matrix: node: - 18.19.0 - - 20.6.1 - - 22.0.0 - - 22 + - 20.9.0 + - 22.11.0 - 23 steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/package-lock.json b/package-lock.json index 12952968..345bfbe5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,6 @@ "jest-when": "3.7.0", "lockfile-lint": "4.14.0", "ls-engines": "0.9.3", - "make-dir": "4.0.0", "mdast-util-from-markdown": "2.0.2", "mdast-util-heading-range": "4.0.0", "mdast-zone": "6.1.0", @@ -63,7 +62,7 @@ "vitest": "3.0.5" }, "engines": { - "node": "^18.19.0 || ^20.6.1 || >=22" + "node": "^18.19.0 || ^20.9.0 || >=22.11.0" }, "funding": { "url": "https://github.com/sponsors/travi" diff --git a/package.json b/package.json index beb809c6..3efeed90 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "version": "0.0.0-semantically-released", "type": "module", "engines": { - "node": "^18.19.0 || ^20.6.1 || >=22" + "node": "^18.19.0 || ^20.9.0 || >=22.11.0" }, "author": "Matt Travi (https://matt.travi.org/)", "contributors": [ @@ -95,7 +95,6 @@ "jest-when": "3.7.0", "lockfile-lint": "4.14.0", "ls-engines": "0.9.3", - "make-dir": "4.0.0", "mdast-util-from-markdown": "2.0.2", "mdast-util-heading-range": "4.0.0", "mdast-zone": "6.1.0", diff --git a/src/lift.js b/src/lift.js index 784987b5..644b8890 100644 --- a/src/lift.js +++ b/src/lift.js @@ -1,4 +1,3 @@ -import deepmerge from 'deepmerge'; import {applyEnhancers} from '@form8ion/core'; import {lift as liftReadme} from '@form8ion/readme'; import * as gitPlugin from '@form8ion/git'; @@ -13,7 +12,7 @@ export default async function ({projectRoot, results, enhancers, vcs, dependenci dependencies }); - await liftReadme({projectRoot, results: deepmerge.all([results, enhancerResults])}); + await liftReadme({projectRoot, results: enhancerResults}); return enhancerResults; } diff --git a/src/lift.test.js b/src/lift.test.js index c50c848e..3ddfb239 100644 --- a/src/lift.test.js +++ b/src/lift.test.js @@ -1,4 +1,3 @@ -import deepmerge from 'deepmerge'; import * as core from '@form8ion/core'; import * as readme from '@form8ion/readme'; import * as gitPlugin from '@form8ion/git'; @@ -26,7 +25,6 @@ describe('lift', () => { const vcs = any.simpleObject(); const results = any.simpleObject(); const enhancerResults = any.simpleObject(); - const mergedResults = any.simpleObject(); when(core.applyEnhancers) .calledWith({ results, @@ -35,9 +33,8 @@ describe('lift', () => { dependencies }) .mockResolvedValue(enhancerResults); - when(deepmerge.all).calledWith([results, enhancerResults]).mockReturnValue(mergedResults); expect(await lift({projectRoot, results, enhancers, vcs, dependencies})).toEqual(enhancerResults); - expect(readme.lift).toHaveBeenCalledWith({projectRoot, results: mergedResults}); + expect(readme.lift).toHaveBeenCalledWith({projectRoot, results: enhancerResults}); }); }); diff --git a/src/scaffolder.js b/src/scaffolder.js index 158c3b84..d62f106f 100644 --- a/src/scaffolder.js +++ b/src/scaffolder.js @@ -63,7 +63,7 @@ export async function scaffold(options) { projectRoot, vcs: vcsResults.vcs, results: mergedResults, - enhancers: {...dependencyUpdaters, ...vcsHosts} + enhancers: {...dependencyUpdaters, ...languages, ...vcsHosts} }); if (language && language.verificationCommand) { diff --git a/src/scaffolder.test.js b/src/scaffolder.test.js index 00b699fa..0e902624 100644 --- a/src/scaffolder.test.js +++ b/src/scaffolder.test.js @@ -133,7 +133,7 @@ describe('project scaffolder', () => { projectRoot: projectPath, vcs, results: mergedResults, - enhancers: {...dependencyUpdaters, ...vcsHosts} + enhancers: {...dependencyUpdaters, ...vcsHosts, ...languages} }); expect(resultsReporter.reportResults).toHaveBeenCalledWith(mergedResults); }); diff --git a/test/integration/features/scaffold/git.feature b/test/integration/features/scaffold/git.feature index d60169c4..41003663 100644 --- a/test/integration/features/scaffold/git.feature +++ b/test/integration/features/scaffold/git.feature @@ -16,8 +16,10 @@ Feature: Git Repository Scenario: to be versioned and hosted Given the project should be versioned in git And the git repository will be hosted + And a language scaffolder is chosen When the project is scaffolded Then the remote origin is defined + And the project repository is hosted on the chosen host Scenario: already versioned Given the project root is already initialized as a git repository diff --git a/test/integration/features/step_definitions/common-steps.js b/test/integration/features/step_definitions/common-steps.js index 2dc6f9b2..01236e90 100644 --- a/test/integration/features/step_definitions/common-steps.js +++ b/test/integration/features/step_definitions/common-steps.js @@ -51,6 +51,9 @@ When(/^the project is scaffolded$/, async function () { this.projectName = 'project-name'; this.projectDescription = any.sentence(); + this.projectHomepage = any.url(); + + this.languageLiftResults = {...any.simpleObject(), homepage: this.projectHomepage}; await scaffold({ plugins: { @@ -66,6 +69,16 @@ When(/^the project is scaffolded$/, async function () { info(`Scaffolding ${chosenLanguage} language details for ${projectName}`); return this.languageScaffolderResults; + }, + test: ({projectRoot}) => { + info(`Determining if project at ${projectRoot} uses the ${chosenLanguage} language`); + + return true; + }, + lift: ({projectRoot}) => { + info(`Applying the ${chosenLanguage} language lifter to the project at ${projectRoot}`); + + return this.languageLiftResults; } } } @@ -73,9 +86,23 @@ When(/^the project is scaffolded$/, async function () { ...vcsHost && 'Other' !== vcsHost && { vcsHosts: { [vcsHost]: { - scaffold: ({projectName, owner}) => ({ - vcs: {sshUrl: this.remoteOriginUrl, name: projectName, owner, host: vcsHost} - }) + scaffold: ({projectName, owner}) => { + this.hostedVcsDetails = {name: projectName, host: vcsHost}; + + return ({ + vcs: {sshUrl: this.remoteOriginUrl, name: projectName, owner, host: vcsHost} + }); + }, + test: ({projectRoot}) => { + info(`Determining if project at ${projectRoot} uses the ${vcsHost} VCS host`); + + return true; + }, + lift: ({results}) => { + this.vcsHostProjectHomepage = results.homepage; + + return results; + } } } } diff --git a/test/integration/features/step_definitions/vcs/git-steps.js b/test/integration/features/step_definitions/vcs/git-steps.js index 6640829f..15da56bf 100644 --- a/test/integration/features/step_definitions/vcs/git-steps.js +++ b/test/integration/features/step_definitions/vcs/git-steps.js @@ -1,7 +1,6 @@ import {promises as fs} from 'node:fs'; import {GitError} from 'simple-git'; -import makeDir from 'make-dir'; import {fileExists} from '@form8ion/core'; import {Before, Given, Then} from '@cucumber/cucumber'; @@ -34,7 +33,7 @@ Given('the project root is already initialized as a git repository', async funct this.existingVcsIgnoredFiles = any.listOf(any.word); this.existingVcsIgnoredDirectories = any.listOf(any.word); - await makeDir(`${process.cwd()}/.git`); + await fs.mkdir(`${process.cwd()}/.git`, {recursive: true}); await fs.writeFile( `${process.cwd()}/.gitignore`, `${this.existingVcsIgnoredDirectories.join('\n')}\n\n${this.existingVcsIgnoredFiles.join('\n')}` diff --git a/test/integration/features/step_definitions/vcs/vcs-host-steps.js b/test/integration/features/step_definitions/vcs/vcs-host-steps.js index 82d5f180..e5e0e4ae 100644 --- a/test/integration/features/step_definitions/vcs/vcs-host-steps.js +++ b/test/integration/features/step_definitions/vcs/vcs-host-steps.js @@ -1,11 +1,15 @@ -import {Given} from '@cucumber/cucumber'; +import {Given, Then} from '@cucumber/cucumber'; import any from '@travi/any'; +import {assert} from 'chai'; import {questionNames} from '../../../../../src/prompts/question-names.js'; Given('the git repository will be hosted', async function () { - this.setAnswerFor(questionNames.REPO_HOST, any.word()); + const vcsHost = any.word(); + + this.setAnswerFor(questionNames.REPO_HOST, vcsHost); this.remoteOriginUrl = any.url(); + this.repoHost = vcsHost; }); Given('the repository is hosted on {string}', async function (host) { @@ -13,3 +17,8 @@ Given('the repository is hosted on {string}', async function (host) { this.vcsOwner = any.word(); this.vcsName = any.word(); }); + +Then('the project repository is hosted on the chosen host', async function () { + assert.deepEqual(this.hostedVcsDetails, {name: this.projectName, host: this.repoHost}); + assert.equal(this.vcsHostProjectHomepage, this.projectHomepage); +});