diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..831e5f4 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,41 @@ +name: Node.js CI + +on: + push: + branches: + - main + pull_request: + +jobs: + + test: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [ 16, 14, 12, 10 ] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run tests-only + + lint: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [ 16 ] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run lint diff --git a/README.md b/README.md index db31644..a890bff 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![NPM Version](https://img.shields.io/npm/v/create-pkg.svg)](https://npmjs.org/package/create-pkg) [![NPM Downloads](https://img.shields.io/npm/dm/create-pkg.svg)](https://npmjs.org/package/create-pkg) -[![test](https://github.com/pkgjs/create/workflows/Test/badge.svg)](https://github.com/pkgjs/create/actions?query=workflow%3ATest) +[![test](https://github.com/pkgjs/create/workflows/Node.js%20CI/badge.svg)](https://github.com/pkgjs/create/actions?query=workflow%3A%22Node.js+CI%22) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard) ## Usage diff --git a/package.json b/package.json index 0758fff..caf595e 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,10 @@ "create-package": "bin/create-package" }, "scripts": { - "test": "standard && mocha --timeout=60000", + "lint": "standard", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "mocha --timeout=60000", "test:debug": "mocha --inspect --inspect-brk --timeout=0", "release": "npm t && standard-version && npm publish", "postpublish": "git push origin && git push origin --tags" @@ -33,6 +36,7 @@ "create-git": "^1.0.0-2", "create-package-json": "^1.0.0-2", "loggerr": "^3.0.0-3", + "object.fromentries": "^2.0.3", "opta": "0.0.6", "semver": "^7.3.2" }, diff --git a/test/index.js b/test/index.js index a160941..558561a 100644 --- a/test/index.js +++ b/test/index.js @@ -3,6 +3,7 @@ const { suite, test, before } = require('mocha') const pkg = require('../package.json') const fixtures = require('fs-test-fixtures') const createPackage = require('..') +const fromEntries = require('object.fromentries') const barePrompt = { promptor: () => async (prompts) => { @@ -17,7 +18,8 @@ const barePrompt = { } return [p.name, ret] })) - return Object.fromEntries(out) + + return fromEntries(out) } } @@ -33,7 +35,8 @@ suite(pkg.name, () => { cwd: fix.TMP, push: false, silent: true, - githubRepo: '__tmp' + githubRepo: '__tmp', + author: 'Unit test' }, barePrompt) }) })