From 8034e17215423587b518fad1d772567ea6e59f07 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 19 Mar 2019 15:59:02 +0000 Subject: [PATCH 1/4] chore(na): change default cache directory --- README.md | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4486868..aced90b 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ module.exports = { | :-------------------: | :----------------------------------------------: | :---------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **`cacheContext`** | `{String}` | `undefined` | Allows you to override the default cache context in order to generate the cache relatively to a path. By default it will use absolute paths | | **`cacheKey`** | `{Function(options, request) -> {String}}` | `undefined` | Allows you to override default cache key generator | -| **`cacheDirectory`** | `{String}` | `path.resolve('.cache-loader')` | Provide a cache directory where cache items should be stored (used for default read/write implementation) | +| **`cacheDirectory`** | `{String}` | `path.resolve('./node_modules/.cache/.cache-loader')` | Provide a cache directory where cache items should be stored (used for default read/write implementation) | | **`cacheIdentifier`** | `{String}` | `cache-loader:{version} {process.env.NODE_ENV}` | Provide an invalidation identifier which is used to generate the hashes. You can use it for extra dependencies of loaders (used for default read/write implementation) | | **`write`** | `{Function(cacheKey, data, callback) -> {void}}` | `undefined` | Allows you to override default write cache data to file (e.g. Redis, memcached) | | **`read`** | `{Function(cacheKey, callback) -> {void}}` | `undefined` | Allows you to override default read cache data from file | diff --git a/src/index.js b/src/index.js index 8de46e9..45809d6 100644 --- a/src/index.js +++ b/src/index.js @@ -19,7 +19,7 @@ const schema = require('./options.json'); const defaults = { cacheContext: '', - cacheDirectory: path.resolve('.cache-loader'), + cacheDirectory: path.resolve('./node_modules/.cache/.cache-loader'), cacheIdentifier: `cache-loader:${pkg.version} ${env}`, cacheKey, read, From 99ce2e65baf881b197ad38950e55f41f37e97cbc Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 22 Mar 2019 03:26:56 +0000 Subject: [PATCH 2/4] chore(na): remove error changes --- README.md | 2 +- src/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aced90b..4486868 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ module.exports = { | :-------------------: | :----------------------------------------------: | :---------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **`cacheContext`** | `{String}` | `undefined` | Allows you to override the default cache context in order to generate the cache relatively to a path. By default it will use absolute paths | | **`cacheKey`** | `{Function(options, request) -> {String}}` | `undefined` | Allows you to override default cache key generator | -| **`cacheDirectory`** | `{String}` | `path.resolve('./node_modules/.cache/.cache-loader')` | Provide a cache directory where cache items should be stored (used for default read/write implementation) | +| **`cacheDirectory`** | `{String}` | `path.resolve('.cache-loader')` | Provide a cache directory where cache items should be stored (used for default read/write implementation) | | **`cacheIdentifier`** | `{String}` | `cache-loader:{version} {process.env.NODE_ENV}` | Provide an invalidation identifier which is used to generate the hashes. You can use it for extra dependencies of loaders (used for default read/write implementation) | | **`write`** | `{Function(cacheKey, data, callback) -> {void}}` | `undefined` | Allows you to override default write cache data to file (e.g. Redis, memcached) | | **`read`** | `{Function(cacheKey, callback) -> {void}}` | `undefined` | Allows you to override default read cache data from file | diff --git a/src/index.js b/src/index.js index 45809d6..8de46e9 100644 --- a/src/index.js +++ b/src/index.js @@ -19,7 +19,7 @@ const schema = require('./options.json'); const defaults = { cacheContext: '', - cacheDirectory: path.resolve('./node_modules/.cache/.cache-loader'), + cacheDirectory: path.resolve('.cache-loader'), cacheIdentifier: `cache-loader:${pkg.version} ${env}`, cacheKey, read, From d82e70e74ea15168d3119f8e4495696982eec82a Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 25 Jun 2019 20:57:13 +0100 Subject: [PATCH 3/4] chore(na): add scripts for linting and linting fix --- .eslintignore | 3 ++- .prettierignore | 3 ++- package.json | 7 +++++-- scripts/lint-fix.js | 12 ++++++++++++ scripts/lint.js | 12 ++++++++++++ 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 scripts/lint-fix.js create mode 100644 scripts/lint.js diff --git a/.eslintignore b/.eslintignore index c52afd1..19eb815 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ /coverage /dist /node_modules -/test/fixtures \ No newline at end of file +/test/fixtures +/scripts diff --git a/.prettierignore b/.prettierignore index f8f1e31..40815f6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,4 +2,5 @@ /dist /node_modules /test/fixtures -CHANGELOG.md \ No newline at end of file +CHANGELOG.md +/scripts diff --git a/package.json b/package.json index 2964939..ed8a930 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,12 @@ "build": "cross-env NODE_ENV=production babel src -d dist --ignore \"src/**/*.test.js\" --copy-files", "clean": "del-cli dist", "commitlint": "commitlint --from=master", - "lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different", + "lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --check", "lint:js": "eslint --cache src test", - "lint": "npm-run-all -l -p \"lint:**\"", + "lint": "node scripts/lint", + "lint-fix:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --write", + "lint-fix:js": "eslint --fix --cache src test", + "lint-fix": "node scripts/lint-fix", "prepare": "npm run build", "release": "standard-version", "security": "npm audit", diff --git a/scripts/lint-fix.js b/scripts/lint-fix.js new file mode 100644 index 0000000..b8e377d --- /dev/null +++ b/scripts/lint-fix.js @@ -0,0 +1,12 @@ +const runAll = require('npm-run-all'); + +runAll( + ["lint-fix:*"], + { + parallel: true, + printLabel: true, + stdout: process.stdout + }) + .catch(() => { + console.log('\x1b[31m%s\x1b[0m', `There was errors when running the lint-fix task.`); + }); diff --git a/scripts/lint.js b/scripts/lint.js new file mode 100644 index 0000000..c320376 --- /dev/null +++ b/scripts/lint.js @@ -0,0 +1,12 @@ +const runAll = require('npm-run-all'); + +runAll( + ["lint:*"], + { + parallel: true, + printLabel: true, + stdout: process.stdout + }) + .catch(() => { + console.log('\x1b[31m%s\x1b[0m', `There was errors when running the lint task. Please execute 'npm run lint-fix'.`); + }); From de69669f97435b47f34bc43dc3e1a8172ec026e9 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 25 Jun 2019 21:13:50 +0100 Subject: [PATCH 4/4] chore(na): change order in prettier ignore file --- .prettierignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index 40815f6..9ef946c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,5 +2,5 @@ /dist /node_modules /test/fixtures -CHANGELOG.md /scripts +CHANGELOG.md