Skip to content

Commit

Permalink
Move to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 12, 2021
1 parent be263e1 commit f2b3321
Show file tree
Hide file tree
Showing 11 changed files with 363 additions and 392 deletions.
3 changes: 0 additions & 3 deletions .github/funding.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
fail-fast: false
matrix:
node-version:
- 16
- 14
- 12
os:
Expand All @@ -18,7 +19,7 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
7 changes: 2 additions & 5 deletions cpy-error.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
'use strict';
const NestedError = require('nested-error-stacks');
import NestedError from 'nested-error-stacks';

class CpyError extends NestedError {
export default class CpyError extends NestedError {
constructor(message, nested) {
super(message, nested);
Object.assign(this, nested);
this.name = 'CpyError';
}
}

module.exports = CpyError;
29 changes: 13 additions & 16 deletions glob-pattern.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
'use strict';
const glob = require('globby');
const junk = require('junk');
const path = require('path');
const fs = require('fs');
import path from 'node:path';
import fs from 'node:fs';
import glob from 'globby';
import junk from 'junk';

class GlobPattern {
export default class GlobPattern {
/**
* @param {string} pattern
* @param {string} destination
* @param {import('.').Options} options
*/
@param {string} pattern
@param {string} destination
@param {import('.').Options} options
*/
constructor(pattern, destination, options) {
this.path = pattern;
this.originalPath = pattern;
this.destination = destination;
this.options = options;

if (
!glob.hasMagic(pattern) &&
fs.existsSync(pattern) &&
fs.lstatSync(pattern).isDirectory()
!glob.hasMagic(pattern)
&& fs.existsSync(pattern)
&& fs.lstatSync(pattern).isDirectory()
) {
this.path = [pattern, '**'].join('/');
}
Expand Down Expand Up @@ -50,7 +49,7 @@ class GlobPattern {
...this.options,
dot: true,
absolute: true,
onlyFiles: true
onlyFiles: true,
});

if (this.options.ignoreJunk) {
Expand All @@ -60,5 +59,3 @@ class GlobPattern {
return matches;
}
}

module.exports = GlobPattern;
Loading

0 comments on commit f2b3321

Please sign in to comment.