Skip to content

Commit

Permalink
Disable compat adapter for ember-inflector >= 4.0.0 (since it is not …
Browse files Browse the repository at this point in the history
…needed) (#948)

* [Bugfix release] EmberENV.EXTEND_PROTOTYPES is not always present

Newer versions of ember and embroider are not currently compatible, as EmberENV.EXTEND_PROTOTYPES is no longer present.
Luckily, the offending code in embroider is the ember-inflector compact-adapter and as of [email protected] is no longer needed.

To support both pre and post [email protected] we conditionally execute the compatibility code when safe & required

* This folder should never be committed
  • Loading branch information
stefanpenner committed Aug 27, 2021
1 parent a99af05 commit 9ee717f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ typings/

# Intermediate Broccoli output
tmp/

# scenario tester debugging output
tests/scenarios/output/
5 changes: 5 additions & 0 deletions packages/compat/src/compat-adapters/ember-inflector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Node } from 'broccoli-node-api';
import { readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
import { removeSync } from 'fs-extra';
import semver from 'semver';

const makeConfigurable = `
if (EmberENV.EXTEND_PROTOTYPES === true || EmberENV.EXTEND_PROTOTYPES.String) {
Expand All @@ -29,4 +30,8 @@ export default class extends V1Addon {
writeFileSync(join(outputDir, 'make-configurable.js'), makeConfigurable);
});
}

static shouldApplyAdapter(addonInstance: any) {
return semver.lt(addonInstance.pkg.version, '4.0.0');
}
}

0 comments on commit 9ee717f

Please sign in to comment.