-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CHORE] add package flag infra, strip flag infra (#6737)
* [CHORE] add package flag infra convert to flag infra dont ship flag code to production * kickstart cause npm registry blinked * fix detect * cleanup reduce * even simpler * invoke cnary test * match new pattern * use EMBER_ENV and this._findApp * _findHost not _findApp * cleanup uniqueAdd
- Loading branch information
Showing
22 changed files
with
201 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
module.exports = { name: require('./package').name }; | ||
module.exports = { | ||
name: require('./package').name, | ||
treeFor() { | ||
// Nested addons don't call isEnabled automatically, | ||
// So this ensures that we return empty trees whenever | ||
// we are not enabled. | ||
if (this.isEnabled()) { | ||
return this._super.treeFor.call(this, ...arguments); | ||
} | ||
}, | ||
isEnabled() { | ||
if (this.__isEnabled !== undefined) { | ||
return this.__isEnabled; | ||
} | ||
const env = process.env.EMBER_ENV; | ||
|
||
this.__isEnabled = env !== 'production'; | ||
|
||
return this.__isEnabled; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default { | ||
HAS_EMBER_DATA_PACKAGE: 'ember-data', | ||
HAS_STORE_PACKAGE: '@ember-data/store', | ||
HAS_MODEL_PACKAGE: '@ember-data/model', | ||
HAS_RECORD_DATA_PACKAGE: '@ember-data/record-data', | ||
HAS_ADAPTER_PACKAGE: '@ember-data/adapter', | ||
HAS_SERIALIZER_PACKAGE: '@ember-data/serializer', | ||
HAS_DEBUG_PACKAGE: '@ember-data/debug', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
@module @ember-data/private-build-infra | ||
*/ | ||
|
||
import { has } from 'require'; | ||
import AVAILABLE_PACKAGES from './available-packages'; | ||
|
||
function flagState(flag: keyof typeof AVAILABLE_PACKAGES): boolean { | ||
const packageName = AVAILABLE_PACKAGES[flag]; | ||
return has(packageName) || false; | ||
} | ||
|
||
export const HAS_EMBER_DATA_PACKAGE = flagState('HAS_EMBER_DATA_PACKAGE'); | ||
export const HAS_STORE_PACKAGE = flagState('HAS_STORE_PACKAGE'); | ||
export const HAS_MODEL_PACKAGE = flagState('HAS_MODEL_PACKAGE'); | ||
export const HAS_ADAPTER_PACKAGE = flagState('HAS_ADAPTER_PACKAGE'); | ||
export const HAS_SERIALIZER_PACKAGE = flagState('HAS_SERIALIZER_PACKAGE'); | ||
export const HAS_DEBUG_PACKAGE = flagState('HAS_DEBUG_PACKAGE'); | ||
export const HAS_RECORD_DATA_PACKAGE = flagState('HAS_RECORD_DATA_PACKAGE'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
name: require('./package').name, | ||
treeFor() { | ||
// Nested addons don't call isEnabled automatically, | ||
// So this ensures that we return empty trees whenever | ||
// we are not enabled. | ||
if (this.isEnabled()) { | ||
return this._super.treeFor.call(this, ...arguments); | ||
} | ||
}, | ||
isEnabled() { | ||
if (this.__isEnabled !== undefined) { | ||
return this.__isEnabled; | ||
} | ||
const env = process.env.EMBER_ENV; | ||
|
||
this.__isEnabled = env !== 'production'; | ||
|
||
return this.__isEnabled; | ||
}, | ||
}; |
105 changes: 0 additions & 105 deletions
105
packages/private-build-infra/node-tests/unit/babel-plugin-remove-imports-test.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.