From 7b69c632592dfe3e84332ee27eec28805c23a30e Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 19:09:16 -0700 Subject: [PATCH] chore!: Normalize repository, dropping node <10.13 support (#80) --- .github/workflows/dev.yml | 75 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 16 ++++++++ .gitignore | 50 +++++++++++++++++++---- .prettierignore | 3 ++ .travis.yml | 13 ------ LICENSE | 37 +++++++++-------- README.md | 38 +++++++++--------- appveyor.yml | 28 ------------- package.json | 42 ++++++++++++-------- test/.eslintrc | 6 --- test/.gitkeep | 0 test/index.js | 28 ++++++------- 12 files changed, 211 insertions(+), 125 deletions(-) create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/release.yml create mode 100644 .prettierignore delete mode 100644 .travis.yml delete mode 100644 appveyor.yml delete mode 100644 test/.eslintrc create mode 100644 test/.gitkeep diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..3b07263 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,75 @@ +name: dev +on: + pull_request: + push: + branches: + - master + - main +env: + CI: true + +jobs: + prettier: + name: Format code + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prettier + uses: gulpjs/prettier_action@v3.0 + with: + commit_message: 'chore: Run prettier' + prettier_options: '--write .' + + test: + name: Tests for Node ${{ matrix.node }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node: [10, 12, 14, 16] + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: Clone repository + uses: actions/checkout@v2 + + - name: Set Node.js version + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - run: node --version + - run: npm --version + + - name: Install npm dependencies + run: npm install + + - name: Run lint + run: npm run lint + + - name: Run tests + run: npm test + + - name: Coveralls + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: ${{matrix.os}}-node-${{ matrix.node }} + parallel: true + + coveralls: + needs: test + name: Finish up + + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..87cd13c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,16 @@ +name: release +on: + push: + branches: + - master + - main + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: GoogleCloudPlatform/release-please-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + release-type: node + package-name: release-please-action diff --git a/.gitignore b/.gitignore index d9b74b7..52f7262 100644 --- a/.gitignore +++ b/.gitignore @@ -1,38 +1,72 @@ # Logs logs *.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* # Runtime data pids *.pid *.seed +*.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage -.nyc_output +# nyc test coverage +.nyc_output # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt -# Compiled binary addons (http://nodejs.org/api/addons.html) +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) build/Release -# Dependency directory -# Commenting this out is preferred by some people, see -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- -node_modules +# Dependency directories +node_modules/ +jspm_packages/ -# Users Environment Variables -.lock-wscript +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# next.js build output +.next # Garbage files .DS_Store tmp egcache +# Test results +test.xunit + # Created in fixtures directories by test package-lock.json diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c96ebe0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +coverage/ +.nyc_output/ +CHANGELOG.md diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b505be7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false -language: node_js -node_js: - - '14' - - '12' - - '10' - - '8' - - '6' - - '4' - - '0.12' - - '0.10' -after_script: - - npm run coveralls diff --git a/LICENSE b/LICENSE index 7d7525d..1e90780 100644 --- a/LICENSE +++ b/LICENSE @@ -1,22 +1,21 @@ -Copyright (c) 2014-2018 Tyler Kellen , Blaine Bublitz , and Eric Schoffstall +The MIT License (MIT) -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Copyright (c) 2014-2018, 2022 Tyler Kellen , Blaine Bublitz , and Eric Schoffstall -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index dee4bec..56f53ad 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,12 @@ # interpret -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] A dictionary of file extensions and associated module loaders. ## What is it -This is used by [Liftoff](http://github.com/tkellen/node-liftoff) to automatically require dependencies for configuration files, and by [rechoir](http://github.com/tkellen/node-rechoir) for registering module loaders. - -## interpret for enterprise - -Available as part of the Tidelift Subscription - -The maintainers of interpret and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-interpret?utm_source=npm-interpret&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) +This is used by [Liftoff] to automatically require dependencies for configuration files, and by [rechoir] for registering module loaders. ## API @@ -129,20 +123,24 @@ Consumers should use the exported `extensions` or `jsVariants` object to determi 4. If the value is an array, iterate over it, attempting step #2 or #3 until one of the attempts does not throw. -[require.extensions]: http://nodejs.org/api/globals.html#globals_require_extensions +## License -[downloads-image]: http://img.shields.io/npm/dm/interpret.svg -[npm-url]: https://www.npmjs.com/package/interpret -[npm-image]: http://img.shields.io/npm/v/interpret.svg +MIT -[travis-url]: https://travis-ci.org/gulpjs/interpret -[travis-image]: http://img.shields.io/travis/gulpjs/interpret.svg?label=travis-ci + +[downloads-image]: https://img.shields.io/npm/dm/interpret.svg?style=flat-square +[npm-url]: https://www.npmjs.com/package/interpret +[npm-image]: https://img.shields.io/npm/v/interpret.svg?style=flat-square -[appveyor-url]: https://ci.appveyor.com/project/gulpjs/interpret -[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/interpret.svg?label=appveyor +[ci-url]: https://github.com/gulpjs/interpret/actions?query=workflow:dev +[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/interpret/dev?style=flat-square [coveralls-url]: https://coveralls.io/r/gulpjs/interpret -[coveralls-image]: http://img.shields.io/coveralls/gulpjs/interpret/master.svg - -[gitter-url]: https://gitter.im/gulpjs/gulp -[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/interpret/master.svg?style=flat-square + + + +[Liftoff]: http://github.com/gulpjs/liftoff +[rechoir]: http://github.com/gulpjs/rechoir +[require.extensions]: https://nodejs.org/api/modules.html#requireextensions + diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index aba7249..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -# http://www.appveyor.com/docs/appveyor-yml -# http://www.appveyor.com/docs/lang/nodejs-iojs - -environment: - matrix: - # node.js - - nodejs_version: "0.10" - - nodejs_version: "0.12" - - nodejs_version: "4" - - nodejs_version: "6" - - nodejs_version: "8" - - nodejs_version: "10" - - nodejs_version: "12" - - nodejs_version: "14" - -install: - - ps: Install-Product node $env:nodejs_version - - npm install - -test_script: - - node --version - - npm --version - - cmd: npm test - -build: off - -# build version format -version: "{build}" diff --git a/package.json b/package.json index 12a5387..802c6af 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "interpret", "version": "2.2.0", "description": "A dictionary of file extensions and associated module loaders.", - "author": "Gulp Team (http://gulpjs.com/)", + "author": "Gulp Team (https://gulpjs.com/)", "contributors": [ "Blaine Bublitz ", "Tyler Kellen (http://goingslowly.com/)" @@ -10,7 +10,7 @@ "repository": "gulpjs/interpret", "license": "MIT", "engines": { - "node": ">= 0.10" + "node": ">=10.13.0" }, "main": "index.js", "files": [ @@ -20,23 +20,31 @@ ], "scripts": { "lint": "eslint .", - "pretest": "rm -rf tmp/ && npm run lint", - "test": "mocha --async-only", - "cover": "nyc --reporter=lcov --reporter=text-summary npm test", - "coveralls": "nyc --reporter=text-lcov npm test | coveralls" + "pretest": "npm run lint", + "test": "nyc mocha --async-only" }, - "dependencies": {}, "devDependencies": { - "coveralls": "github:phated/node-coveralls#2.x", - "eslint": "^2.13.0", - "eslint-config-gulp": "^3.0.1", - "expect": "^1.20.2", - "mocha": "^3.5.3", - "nyc": "^10.3.2", - "parse-node-version": "^1.0.0", - "rechoir": "^0.7.0", - "shelljs": "0.7.5", - "trash-cli": "^3.0.0" + "eslint": "^7.0.0", + "eslint-config-gulp": "^5.0.0", + "eslint-plugin-node": "^11.1.0", + "expect": "^27.0.0", + "mocha": "^8.0.0", + "nyc": "^15.0.0", + "parse-node-version": "^2.0.0", + "rechoir": "^0.8.0", + "shelljs": "0.8.5" + }, + "nyc": { + "extension": [ + ".js" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "prettier": { + "singleQuote": true }, "keywords": [ "coffee", diff --git a/test/.eslintrc b/test/.eslintrc deleted file mode 100644 index c8cdccd..0000000 --- a/test/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "gulp/test", - "rules": { - "no-console": 0 - } -} diff --git a/test/.gitkeep b/test/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/index.js b/test/index.js index e6451a1..f56f402 100644 --- a/test/index.js +++ b/test/index.js @@ -48,15 +48,7 @@ function cleanup() { } // These modules need newer node features -var minVersions = { - '@babel/register': { major: 6, minor: 0 }, - coffeescript: { major: 6, minor: 0 }, - esm: { major: 6, minor: 0 }, - json5: { major: 6, minor: 0 }, - sucrase: { major: 8, minor: 0 }, - 'ts-node': { major: 4, minor: 0 }, - 'toml-require': { major: 6, minor: 0 }, -}; +var minVersions = {}; var maxVersions = {}; @@ -134,18 +126,27 @@ describe('interpret.extensions', function() { } } + // Skip any swc test on linux due to https://github.com/swc-project/swc/issues/4107 + if (name === '@swc/register' && process.platform === 'linux') { + this.skip(); + } + this.timeout(0); var expected; process.chdir(path.join(__dirname, fixtureDir)); - shell.exec('trash node_modules', { silent: true }); - shell.exec('trash package-lock.json', { silent: true }); + shell.exec('rm -r node_modules', { silent: true }); + shell.exec('rm package-lock.json', { silent: true }); shell.exec('npm install', { silent: true }); - // TODO: log failures - rechoir.prepare(extensions, fixture); + try { + rechoir.prepare(extensions, fixture); + } catch (err) { + console.error(err.failures); + throw err; + } switch (extension) { case '.ts': @@ -258,5 +259,4 @@ describe('interpret.extensions', function() { expect(require(fixture)).toEqual(expected); done(); }); - });