ember-unused-components
Advanced tools
Comparing version
# ember-unused-components CHANGELOG | ||
## On `master`, to release | ||
Nothing new yet | ||
## 1.1.0 (September 10, 2019) | ||
Although, there are no breaking changes this version is released as a new minor version (not a patch version). It introduces a new option (`failOnUnused`) which is switched off by default but in general can be dangerous for some projects. The package files were reduced so it also introduces some danger here. | ||
**FEATURES:** | ||
- ([#31](https://github.com/vastec/ember-unused-components/pull/31)) New option `failOnUnused` which throws and error when unused components were found (useful for CI) | ||
**MAINTENANCE:** | ||
- ([#32](https://github.com/vastec/ember-unused-components/pull/32)) Bump eslint from `6.2.2` to `6.3.0` | ||
- ([#33](https://github.com/vastec/ember-unused-components/pull/33) [#36](https://github.com/vastec/ember-unused-components/pull/36)) Bump eslint-plugin-node from `9.1.0` to `10.0.0` | ||
- ([#34](https://github.com/vastec/ember-unused-components/pull/34)) Improve a hint how to use tests-app in development | ||
- ([#35](https://github.com/vastec/ember-unused-components/pull/34)) Bump eslint-config-prettier from `6.1.0` to `6.2.0` | ||
- ([#38](https://github.com/vastec/ember-unused-components/pull/38)) Specify library files in package.json - npm package size reduced from 2.2MB to 42.1kB (unpacked) | ||
## 1.0.4 (August 27, 2019) | ||
@@ -4,0 +23,0 @@ |
@@ -44,4 +44,8 @@ #!/usr/bin/env node | ||
analyser.logResults(commandOptions.stats, commandOptions.occurrences, config.whitelist); | ||
if (config.failOnUnused && analyser.unusedComponents.length) { | ||
throw new Error(`You have ${analyser.unusedComponents.length} unused components.`); | ||
} | ||
} | ||
main(); |
@@ -51,2 +51,8 @@ 'use strict'; | ||
}) | ||
.option('fail-on-unused', { | ||
alias: 'f', | ||
type: 'boolean', | ||
default: false, | ||
describe: 'throw errors when unused components are found', | ||
}) | ||
.locale('en').argv; | ||
@@ -53,0 +59,0 @@ |
@@ -33,2 +33,3 @@ 'use strict'; | ||
appPath: appPath, | ||
failOnUnused: !!commandOptions.failOnUnused, | ||
ignore: [], | ||
@@ -74,2 +75,3 @@ usePods: | ||
let hasIgnoredFiles = hasConfig && Array.isArray(eucConfig.ignore); | ||
let shouldFailOnUnused = hasConfig && eucConfig.failOnUnused; | ||
@@ -86,2 +88,7 @@ // Set whitelist if available | ||
// Set fail in ci if available | ||
if (shouldFailOnUnused) { | ||
this.config.failOnUnused = eucConfig.failOnUnused; | ||
} | ||
return this.config; | ||
@@ -88,0 +95,0 @@ }, |
{ | ||
"name": "ember-unused-components", | ||
"version": "1.0.4", | ||
"version": "1.1.0-beta.0", | ||
"description": "Search for unused components in your Ember project", | ||
@@ -24,2 +24,6 @@ "keywords": [ | ||
}, | ||
"files": [ | ||
"lib", | ||
"index.js" | ||
], | ||
"dependencies": { | ||
@@ -34,3 +38,3 @@ "colors": "1.3.3", | ||
"eslint-config-prettier": "^6.1.0", | ||
"eslint-plugin-node": "^9.1.0", | ||
"eslint-plugin-node": "^10.0.0", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
@@ -37,0 +41,0 @@ "prettier": "^1.18.2" |
@@ -146,3 +146,4 @@ [](https://badge.fury.io/js/ember-unused-components) | ||
'app/templates/freestyle.hbs' // this is our template with style guides | ||
] | ||
], | ||
failOnUnused: false // optional, default is false, should we throw errors when we find unused components (useful in CI) | ||
}; | ||
@@ -212,2 +213,30 @@ ``` | ||
### Fail on unused | ||
You might want to throw errors when unused components are found. This is especially useful when running in CI. This behavior is turned off by default. | ||
Turn this behavior on in 2 ways: | ||
Setting the `failOnUnused` property of your `.eucrc.js` file to `true`. | ||
```js | ||
module.exports = { | ||
failOnUnused: true | ||
}; | ||
// In practice, it might look something like this: | ||
module.exports = { | ||
failOnUnused: process.env.CI // many CI services like Travis-ci and Circle-ci inject a CI env variable by default. | ||
}; | ||
``` | ||
Passing the `--fail-on-unused` flag to the cli: | ||
```bash | ||
./node_modules/.bin/ember-unused-components --fail-on-unused | ||
``` | ||
The `.eucrc.js` configuration file takes precedence over the cli argument. | ||
Removing components | ||
@@ -214,0 +243,0 @@ ------------------------------------------------------------------------------ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
307
10.43%42833
-97.93%10
-97.62%872
-81.76%2
100%1
Infinity%