-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Packages: Move data module to the package maintained by Lerna (#6828)
* Packages: Move data module to the package maintained by Lerna * Data: Add a way to override the persistence storage * Data: Enforce JSX pragma for packages * Devtools: Introduce new module with depreacted util * Packages: Update Babel config to use createElement as pragma for JSX * Packages: Remove @next from README files * Packages: Make Babel config less fragile * Data: Add deep-freeze as dev dependency * Data: Update depscription in package.json * Packages: Add enzyme as dev dependency
- Loading branch information
Showing
32 changed files
with
161 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const { isArray, map } = require( 'lodash' ); | ||
const babelPluginTransformReactJSX = require( 'babel-plugin-transform-react-jsx' ); | ||
const babelPresetEnv = require( 'babel-preset-env' ); | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
const babelDefaultConfig = require( '@wordpress/babel-preset-default' ); | ||
|
||
const plugins = map( babelDefaultConfig.plugins, ( plugin ) => { | ||
if ( isArray( plugin ) && plugin[ 0 ] === babelPluginTransformReactJSX ) { | ||
// TODO: It should become the default value when all modules are moved to packages. | ||
return [ babelPluginTransformReactJSX, { pragma: 'createElement' } ]; | ||
} | ||
|
||
return plugin; | ||
} ); | ||
|
||
const babelConfigs = { | ||
main: { | ||
...babelDefaultConfig, | ||
babelrc: false, | ||
plugins, | ||
presets: map( babelDefaultConfig.presets, ( preset ) => { | ||
if ( isArray( preset ) && preset[ 0 ] === babelPresetEnv ) { | ||
return [ babelPresetEnv, Object.assign( | ||
{}, | ||
preset[ 1 ], | ||
{ modules: 'commonjs' } | ||
) ]; | ||
} | ||
return preset; | ||
} ), | ||
}, | ||
module: { | ||
...babelDefaultConfig, | ||
babelrc: false, | ||
plugins, | ||
}, | ||
}; | ||
|
||
function getBabelConfig( environment ) { | ||
return babelConfigs[ environment ]; | ||
} | ||
|
||
module.exports = getBabelConfig; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
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,36 @@ | ||
{ | ||
"name": "@wordpress/data", | ||
"version": "0.0.1", | ||
"description": "Data module for WordPress", | ||
"author": "WordPress", | ||
"license": "GPL-2.0-or-later", | ||
"keywords": [ | ||
"wordpress", | ||
"data", | ||
"redux" | ||
], | ||
"homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/data/README.md", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/WordPress/gutenberg.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WordPress/gutenberg/issues" | ||
}, | ||
"main": "src/index.js", | ||
"dependencies": { | ||
"@wordpress/deprecated": "0.0.1", | ||
"@wordpress/element": "0.0.1", | ||
"@wordpress/is-shallow-equal": "1.0.2", | ||
"equivalent-key-map": "0.2.0", | ||
"lodash": "4.17.5", | ||
"redux": "3.7.2" | ||
}, | ||
"devDependencies": { | ||
"deep-freeze": "0.0.1", | ||
"enzyme": "3.3.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
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 @@ | ||
package-lock=false |
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
Oops, something went wrong.