Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
ember-cli-version-checker
Advanced tools
Determine if your addon is being used by a minimum version of Ember CLI.
The ember-cli-version-checker package is a utility for checking the versions of npm and bower dependencies in Ember CLI projects. It helps ensure compatibility and manage dependencies effectively.
Check Dependency Version
This feature allows you to check if a specific dependency version is less than a given version. In this example, it checks if the 'ember-source' version is less than '3.0.0'.
const VersionChecker = require('ember-cli-version-checker');
let checker = new VersionChecker(this);
let dep = checker.for('ember-source', 'npm');
if (dep.lt('3.0.0')) {
console.log('ember-source version is less than 3.0.0');
}
Check Multiple Dependencies
This feature allows you to check multiple dependencies at once. In this example, it checks if both 'ember-source' and 'jquery' versions are less than '3.0.0'.
const VersionChecker = require('ember-cli-version-checker');
let checker = new VersionChecker(this);
let emberDep = checker.for('ember-source', 'npm');
let jqueryDep = checker.for('jquery', 'bower');
if (emberDep.lt('3.0.0') && jqueryDep.lt('3.0.0')) {
console.log('Both ember-source and jquery versions are less than 3.0.0');
}
Check Dependency Range
This feature allows you to check if a dependency version falls within a specified range. In this example, it checks if the 'ember-source' version is between '2.0.0' and '3.0.0'.
const VersionChecker = require('ember-cli-version-checker');
let checker = new VersionChecker(this);
let dep = checker.for('ember-source', 'npm');
if (dep.satisfies('>=2.0.0 <3.0.0')) {
console.log('ember-source version is between 2.0.0 and 3.0.0');
}
The 'semver' package is a widely-used utility for parsing, validating, and comparing semantic versioning (semver) strings. It provides similar functionality for version checking but is not specific to Ember CLI projects. It is more general-purpose and can be used in any JavaScript project.
The 'npm-check' package is a tool for checking for outdated, incorrect, and unused dependencies in npm projects. While it provides some overlapping functionality with ember-cli-version-checker, it is more focused on overall dependency management and maintenance rather than specific version checks within Ember CLI projects.
The 'yarn' package manager includes built-in functionality for checking and managing dependency versions. It provides a more comprehensive solution for dependency management, including version checks, but is not specific to Ember CLI projects. It is an alternative to npm with additional features for dependency resolution and management.
Makes determining if a compatible version of a given NPM or Bower package that is present.
Throws an error with the given message if a minimum version isn't met.
var VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: 'awesome-addon',
init: function() {
var checker = new VersionChecker(this);
checker.for('ember-cli', 'npm').assertAbove('2.0.0');
}
};
You can also provide a specific message as the third argument to assertAbove
if you'd like to customize the output.
var VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: 'awesome-addon',
init: function() {
var checker = new VersionChecker(this);
checker.for('ember-cli', 'npm').assertAbove('2.0.0', 'To use awesome-addon you must have ember-cli 2.0.0');
}
};
Returns true
if the packages version is above the specified comparison range.
var VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: 'awesome-addon',
init: function() {
var checker = new VersionChecker(this);
var dep = checker.for('ember-cli', 'npm');
if (dep.isAbove('2.0.0')) {
/* deal with 2.0.0 stuff */
} else {
/* provide backwards compat */
};
}
};
You want to provide two different sets of templates, based on the currently running Ember version.
var path = require('path');
var VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: 'awesome-addon',
treeForAddonTemplates: function(tree) {
var checker = new VersionChecker(this);
var dep = checker.for('ember', 'bower');
var baseTemplatesPath = path.join(this.root, 'addon/templates');
if (dep.satisfies('>= 1.13.0') {
return this.treeGenerator(path.join(baseTemplatesPath, 'current'));
} else {
return this.treeGenerator(path.join(baseTemplatesPath, 'legacy'));
}
}
};
FAQs
Determine if your addon is being used by a minimum version of Ember CLI.
The npm package ember-cli-version-checker receives a total of 718,716 weekly downloads. As such, ember-cli-version-checker popularity was classified as popular.
We found that ember-cli-version-checker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.