Skip to content
Permalink
Browse files
chore!: Normalize repository, dropping node <10.13 support (#40)
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
  • Loading branch information
sttk and phated committed Jul 24, 2021
1 parent 9351bb3 commit 00f59689d0eb9668d939a85e06428a0906587a6f
Show file tree
Hide file tree
Showing 19 changed files with 344 additions and 229 deletions.
@@ -1,3 +1,6 @@
{
"extends": "gulp"
"extends": "gulp",
"rules": {
"max-statements": 0
}
}

This file was deleted.

@@ -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
@@ -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
@@ -1,31 +1,67 @@
# 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 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

# Test results
test.xunit
@@ -0,0 +1,3 @@
coverage/
.nyc_output/
CHANGELOG.md

This file was deleted.

35 LICENSE
@@ -1,24 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014-2019 Tyler Kellen <tyler@sleekcode.net>, Blaine Bublitz <blaine.bublitz@gmail.com>, and Eric Schoffstall <yo@contra.io>
Copyright (c) 2014-2019, 2021 Tyler Kellen <tyler@sleekcode.net>, Blaine Bublitz <blaine.bublitz@gmail.com>, and Eric Schoffstall <yo@contra.io>

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:
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 above copyright notice and this permission notice shall be
included in all copies or substantial portions of 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.
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.
@@ -6,24 +6,16 @@

# rechoir

[![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]

Prepare a node environment to require files with different extensions.

## What is it?

This module, in conjunction with [interpret]-like objects, can register any filetype the npm ecosystem has a module loader for. This library is a dependency of [Liftoff].
This module, in conjunction with [interpret]-like objects, can register any filetype the npm ecosystem has a module loader for. This library is a dependency of [liftoff].

**Note:** While `rechoir` will automatically load and register transpilers like `coffee-script`, you must provide a local installation. The transpilers are **not** bundled with this module.


## rechoir for enterprise

Available as part of the Tidelift Subscription

The maintainers of rechoir 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-rechoir?utm_source=npm-rechoir&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)


## Usage

```js
@@ -42,13 +34,13 @@ console.log(require('./test/fixtures/test.toml'));

### `prepare(config, filepath, [cwd], [noThrow])`

Look for a module loader associated with the provided file and attempt require it. If necessary, run any setup required to inject it into [require.extensions](http://nodejs.org/api/globals.html#globals_require_extensions).
Look for a module loader associated with the provided file and attempt require it. If necessary, run any setup required to inject it into [require.extensions].

`config` An [interpret]-like configuration object.

`filepath` A file whose type you'd like to register a module loader for.

`cwd` An optional path to start searching for the module required to load the requested file. Defaults to the directory of `filepath`.
`cwd` An optional path to start searching for the module required to load the requested file. Defaults to the directory of `filepath`.

`noThrow` An optional boolean indicating if the method should avoid throwing.

@@ -62,22 +54,20 @@ If a loader is already registered, this will simply return `true`.

MIT

[interpret]: http://github.com/gulpjs/interpret
[Liftoff]: http://github.com/gulpjs/liftoff

[downloads-image]: http://img.shields.io/npm/dm/rechoir.svg
<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/rechoir.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/rechoir
[npm-image]: http://img.shields.io/npm/v/rechoir.svg

[travis-url]: https://travis-ci.org/gulpjs/rechoir
[travis-image]: http://img.shields.io/travis/gulpjs/rechoir.svg?label=travis-ci
[npm-image]: https://img.shields.io/npm/v/rechoir.svg?style=flat-square

[appveyor-url]: https://ci.appveyor.com/project/gulpjs/rechoir
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/rechoir.svg?label=appveyor
[ci-url]: https://github.com/gulpjs/rechoir/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/rechoir/dev?style=flat-square

[coveralls-url]: https://coveralls.io/r/gulpjs/rechoir
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/rechoir/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/rechoir/master.svg
<!-- prettier-ignore-end -->

<!-- prettier-ignore-start -->
[interpret]: https://github.com/gulpjs/interpret
[require.extensions]: https://nodejs.org/api/modules.html#modules_require_extensions
[liftoff]: https://github.com/js-cli/js-liftoff
<!-- prettier-ignore-end -->

This file was deleted.

@@ -4,14 +4,14 @@ var extension = require('./lib/extension');
var normalize = require('./lib/normalize');
var register = require('./lib/register');

exports.prepare = function(extensions, filepath, cwd, nothrow) {
exports.prepare = function (extensions, filepath, cwd, nothrow) {
var config, usedExtension, err, option, attempt, error;
var attempts = [];
var onlyErrors = true;
var exts = extension(filepath);

if (exts) {
exts.some(function(ext) {
exts.some(function (ext) {
usedExtension = ext;
config = normalize(extensions[ext]);
return !!config;
@@ -40,7 +40,7 @@ exports.prepare = function(extensions, filepath, cwd, nothrow) {
for (var i in config) {
option = config[i];
attempt = register(cwd, option.module, option.register);
error = (attempt instanceof Error) ? attempt : null;
error = attempt instanceof Error ? attempt : null;
if (error) {
attempt = null;
}
@@ -55,7 +55,9 @@ exports.prepare = function(extensions, filepath, cwd, nothrow) {
}
}
if (onlyErrors) {
err = new Error('Unable to use specified module loaders for "' + usedExtension + '".');
err = new Error(
'Unable to use specified module loaders for "' + usedExtension + '".'
);
err.failures = attempts;
if (nothrow) {
return err;
@@ -34,7 +34,7 @@ function getPossibleExtensions(longExtension) {
return arr;
}

module.exports = function(input) {
module.exports = function (input) {
var basename = path.basename(input);
var longExtension = getLongExtension(basename);
if (!longExtension) {
@@ -5,7 +5,7 @@ function normalizer(config) {
return config;
}

module.exports = function(config) {
module.exports = function (config) {
if (Array.isArray(config)) {
return config.map(normalizer);
}

0 comments on commit 00f5968

Please sign in to comment.