From be83575925b6d756ee46eb1719ca8d374203997a Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 15:48:38 -0700 Subject: [PATCH 1/8] chore!: Normalize repository, dropping node <10.13 support --- .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 | 43 ++++++++++++-------- test/.eslintrc | 6 --- test/.gitkeep | 0 test/index.js | 11 +---- 12 files changed, 199 insertions(+), 121 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..e7042ad 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,32 @@ ], "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", + "trash-cli": "^4.0.0" + }, + "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..23bd858 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 = {}; @@ -258,5 +250,4 @@ describe('interpret.extensions', function() { expect(require(fixture)).toEqual(expected); done(); }); - }); From 806da86edf1c3101120d97371a89743e38ac937c Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 18:06:00 -0700 Subject: [PATCH 2/8] debugging --- test/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/index.js b/test/index.js index 23bd858..415beaa 100644 --- a/test/index.js +++ b/test/index.js @@ -135,6 +135,7 @@ describe('interpret.extensions', function() { shell.exec('trash node_modules', { silent: true }); shell.exec('trash package-lock.json', { silent: true }); shell.exec('npm install', { silent: true }); + shell.exec('npm ls'); // TODO: log failures rechoir.prepare(extensions, fixture); From 6d3fe77d6d93111f02d725abb42753519d12b53b Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 18:10:52 -0700 Subject: [PATCH 3/8] more debugging --- test/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index 415beaa..89272ba 100644 --- a/test/index.js +++ b/test/index.js @@ -138,7 +138,12 @@ describe('interpret.extensions', function() { shell.exec('npm ls'); // TODO: log failures - rechoir.prepare(extensions, fixture); + try { + rechoir.prepare(extensions, fixture); + } catch (err) { + console.log(err.attempts); + throw err; + } switch (extension) { case '.ts': From 9cf57f6df1c2ecb6ccf853d5fe70a4df28a4c333 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 18:18:19 -0700 Subject: [PATCH 4/8] wrong prop --- test/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.js b/test/index.js index 89272ba..351cf86 100644 --- a/test/index.js +++ b/test/index.js @@ -141,7 +141,7 @@ describe('interpret.extensions', function() { try { rechoir.prepare(extensions, fixture); } catch (err) { - console.log(err.attempts); + console.log(err.failures); throw err; } From 24ec272474ec8270441d655acba06bc0fed74c09 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 18:44:16 -0700 Subject: [PATCH 5/8] shelljs rm? --- package.json | 3 +-- test/index.js | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e7042ad..802c6af 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,7 @@ "nyc": "^15.0.0", "parse-node-version": "^2.0.0", "rechoir": "^0.8.0", - "shelljs": "0.8.5", - "trash-cli": "^4.0.0" + "shelljs": "0.8.5" }, "nyc": { "extension": [ diff --git a/test/index.js b/test/index.js index 351cf86..37729a7 100644 --- a/test/index.js +++ b/test/index.js @@ -132,10 +132,9 @@ describe('interpret.extensions', function() { 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 }); - shell.exec('npm ls'); // TODO: log failures try { From e059aba3f2143f6a84afbfe12fa9b1a44d4971e5 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 18:49:43 -0700 Subject: [PATCH 6/8] more changes --- test/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/index.js b/test/index.js index 37729a7..1ae71f8 100644 --- a/test/index.js +++ b/test/index.js @@ -126,6 +126,11 @@ describe('interpret.extensions', function() { } } + // Any swc test after the first will fail on linux due to https://github.com/swc-project/swc/issues/4107 + if (process.platform === 'linux' && extension === '.tsx' && name === '@swc/register') { + this.skip(); + } + this.timeout(0); var expected; @@ -136,11 +141,10 @@ describe('interpret.extensions', function() { shell.exec('rm package-lock.json', { silent: true }); shell.exec('npm install', { silent: true }); - // TODO: log failures try { rechoir.prepare(extensions, fixture); } catch (err) { - console.log(err.failures); + console.error(err.failures); throw err; } From 9dfda271242ee0437aa65ec40f853824ac9ba3ff Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 18:54:42 -0700 Subject: [PATCH 7/8] refactor workaround --- test/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/index.js b/test/index.js index 1ae71f8..a761ce6 100644 --- a/test/index.js +++ b/test/index.js @@ -52,6 +52,8 @@ var minVersions = {}; var maxVersions = {}; +var swcTested = false; + describe('interpret.extensions', function() { beforeEach(cleanup); @@ -127,8 +129,12 @@ describe('interpret.extensions', function() { } // Any swc test after the first will fail on linux due to https://github.com/swc-project/swc/issues/4107 - if (process.platform === 'linux' && extension === '.tsx' && name === '@swc/register') { - this.skip(); + if (name === '@swc/register') { + if (process.platform === 'linux' && swcTested) { + this.skip(); + } else { + swcTested = true; + } } this.timeout(0); From 42c773e620eeee47123427df264b1f5d87ef7ed0 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 6 Apr 2022 18:59:38 -0700 Subject: [PATCH 8/8] we test it on other platforms so skip it on linux --- test/index.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/test/index.js b/test/index.js index a761ce6..f56f402 100644 --- a/test/index.js +++ b/test/index.js @@ -52,8 +52,6 @@ var minVersions = {}; var maxVersions = {}; -var swcTested = false; - describe('interpret.extensions', function() { beforeEach(cleanup); @@ -128,13 +126,9 @@ describe('interpret.extensions', function() { } } - // Any swc test after the first will fail on linux due to https://github.com/swc-project/swc/issues/4107 - if (name === '@swc/register') { - if (process.platform === 'linux' && swcTested) { - this.skip(); - } else { - swcTested = true; - } + // 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);