Skip to content

Commit 087ec89

Browse files
committed
Auto merge of #1959 - Turbo87:auto-import, r=Turbo87
Use `ember-auto-import` to import npm modules ... instead of using the complicated `app.import()` API
2 parents c1cbe41 + 31db55c commit 087ec89

File tree

4 files changed

+4048
-495
lines changed

4 files changed

+4048
-495
lines changed

app/routes/crate/version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { observer } from '@ember/object';
22
import Route from '@ember/routing/route';
33
import { inject as service } from '@ember/service';
4-
import semver from 'semver';
4+
import { prerelease } from 'semver';
55

66
import fetch from 'fetch';
77
import ajax from 'ember-fetch/ajax';
@@ -21,7 +21,7 @@ export default Route.extend({
2121
const controller = this.controllerFor(this.routeName);
2222
const maxVersion = crate.get('max_version');
2323

24-
const isUnstableVersion = version => !!semver.prerelease(version);
24+
const isUnstableVersion = version => !!prerelease(version);
2525

2626
const fetchCrateDocumentation = () => {
2727
if (!crate.get('documentation') || crate.get('documentation').substr(0, 16) === 'https://docs.rs/') {

ember-cli-build.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,5 @@ module.exports = function(defaults) {
3636
},
3737
});
3838

39-
// Use `app.import` to add additional libraries to the generated
40-
// output files.
41-
//
42-
// If you need to use different assets in different
43-
// environments, specify an object as the first parameter. That
44-
// object's keys should be the environment name and the values
45-
// should be the asset to use in that environment.
46-
//
47-
// If the library that you are including contains AMD or ES6
48-
// modules that you would like to import into your application
49-
// please specify an object with the list of modules as keys
50-
// along with the exports of each module as its value.
51-
app.import('node_modules/timekeeper/lib/timekeeper.js', {
52-
using: [{ transformation: 'cjs', as: 'timekeeper' }],
53-
});
54-
app.import('node_modules/semver/semver.js', {
55-
using: [{ transformation: 'cjs', as: 'semver' }],
56-
});
57-
5839
return app.toTree();
5940
};

0 commit comments

Comments
 (0)