Skip to content

Commit c3294f5

Browse files
committed
moving v4 from beta repo
Signed-off-by: Kevin Provance <[email protected]>
1 parent ae94aef commit c3294f5

File tree

919 files changed

+192203
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

919 files changed

+192203
-256
lines changed

.config/externals.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* Utility methods for use when generating build configuration objects.
3+
*/
4+
const { join } = require( 'path' );
5+
6+
/**
7+
* Given a string, returns a new string with dash separators converted to
8+
* camel-case equivalent. This is not as aggressive as `_.camelCase`, which
9+
* which would also upper-case letters following numbers.
10+
*
11+
* @param {string} string Input dash-delimited string.
12+
*
13+
* @return {string} Camel-cased string.
14+
*/
15+
const camelCaseDash = string => string.replace(
16+
/-([a-z])/g,
17+
( match, letter ) => letter.toUpperCase()
18+
);
19+
20+
/**
21+
* Define externals to load components through the wp global.
22+
*/
23+
const externals = [
24+
'api-fetch',
25+
'block-editor',
26+
'blocks',
27+
'components',
28+
'compose',
29+
'data',
30+
'date',
31+
'htmlEntities',
32+
'hooks',
33+
'edit-post',
34+
'element',
35+
'editor',
36+
'i18n',
37+
'plugins',
38+
'viewport',
39+
'ajax',
40+
'codeEditor',
41+
'rich-text',
42+
].reduce( ( externals, name ) => ( {
43+
...externals,
44+
[ `@wordpress/${ name }` ]: `wp.${ camelCaseDash( name ) }`,
45+
} ), {
46+
wp: 'wp',
47+
lodash: 'lodash', // WP loads lodash already.
48+
redux_templates: 'redux-templates', // Our localized JS variable.
49+
fetch: 'fetch', // Used in our debugger sidebar.
50+
'react': 'React',
51+
'react-dom': 'ReactDOM',
52+
} );
53+
54+
module.exports = externals;

.config/phplint.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
error=false
4+
5+
while test $# -gt 0; do
6+
current=$1
7+
shift
8+
9+
if [ ! -d $current ] && [ ! -f $current ] ; then
10+
echo "Invalid directory or file: $current"
11+
error=true
12+
13+
continue
14+
fi
15+
16+
for file in `find $current -type f -name "*.php"` ; do
17+
RESULTS=`php -l $file`
18+
19+
if [ "$RESULTS" != "No syntax errors detected in $file" ] ; then
20+
echo $RESULTS
21+
error=true
22+
fi
23+
done
24+
done
25+
26+
27+
if [ "$error" = true ] ; then
28+
exit 1
29+
else
30+
exit 0
31+
fi

.config/plugins.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const ImageminPlugin = require( 'imagemin-webpack' )
2+
const CreateFileWebpack = require('create-file-webpack')
3+
4+
module.exports = [
5+
new ImageminPlugin( {
6+
bail: false,
7+
cache: true,
8+
imageminOptions: {
9+
plugins: [
10+
[ 'pngquant', { quality: [ 0.5, 0.5 ] } ],
11+
]
12+
}
13+
} ),
14+
new CreateFileWebpack({
15+
// path to folder in which the file will be created
16+
path: './',
17+
// file name
18+
fileName: 'local_developer.txt',
19+
// content of the file
20+
content: ''
21+
})
22+
]

.config/push_to_master.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
cd "$(dirname "$0")"
4+
cd ../build
5+
echo $(pwd)
6+
git clone --depth 1 [email protected]:redux-templates/redux-templates.git --branch master master
7+
mv master/.git redux-templates/
8+
cd redux-templates
9+
git add -A
10+
git commit -m "Release"
11+
git push origin master

.config/readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Cedits
2+
3+
Config based from https://github.com/kadamwhite/wp-block-hmr-demo

.config/webpack.config.dev.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const externals = require( './externals' )
2+
const rules = require( './rules' )
3+
const plugins = require( './plugins' )
4+
const path = require( 'path' )
5+
6+
module.exports = [{
7+
8+
mode: 'development',
9+
10+
devtool: 'cheap-module-source-map',
11+
12+
entry: {
13+
'redux-templates': path.join( __dirname, '../redux-templates/src/index.js' )
14+
},
15+
16+
output: {
17+
path: path.join( __dirname, '../redux-templates/assets/js' ),
18+
filename: '[name].js',
19+
},
20+
21+
// Permit importing @wordpress/* packages.
22+
externals,
23+
24+
resolve: {
25+
alias: {
26+
'~redux-templates': path.resolve( __dirname, '../redux-templates/src/' )
27+
}
28+
},
29+
30+
optimization: {
31+
splitChunks: {
32+
cacheGroups: {
33+
vendor: {
34+
test: /node_modules/,
35+
chunks: "initial",
36+
name: "vendor",
37+
priority: 10,
38+
enforce: true
39+
}
40+
}
41+
},
42+
},
43+
44+
// Clean up build output
45+
stats: {
46+
all: false,
47+
assets: true,
48+
colors: true,
49+
errors: true,
50+
performance: true,
51+
timings: true,
52+
warnings: true,
53+
},
54+
55+
module: {
56+
strictExportPresence: true,
57+
rules,
58+
},
59+
60+
plugins,
61+
}]

.config/webpack.config.prod.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const externals = require( './externals' )
2+
const rules = require( './rules' )
3+
const plugins = require( './plugins' )
4+
const path = require( 'path' )
5+
6+
module.exports = [{
7+
8+
mode: 'production',
9+
10+
devtool: 'hidden-source-map',
11+
12+
entry: {
13+
'redux-templates': path.join( __dirname, '../redux-templates/src/index.js' )
14+
},
15+
16+
output: {
17+
path: path.join( __dirname, '../redux-templates/assets/js' ),
18+
filename: '[name].min.js',
19+
},
20+
21+
// Permit importing @wordpress/* packages.
22+
externals,
23+
24+
resolve: {
25+
alias: {
26+
'~redux-templates': path.resolve( __dirname, '../redux-templates/src/' )
27+
}
28+
},
29+
30+
// Optimize output bundle.
31+
optimization: {
32+
minimize: true,
33+
noEmitOnErrors: true,
34+
splitChunks: {
35+
cacheGroups: {
36+
vendor: {
37+
test: /node_modules/,
38+
chunks: "initial",
39+
name: "vendor",
40+
priority: 10,
41+
enforce: true
42+
}
43+
}
44+
},
45+
},
46+
47+
module: {
48+
strictExportPresence: true,
49+
rules,
50+
},
51+
52+
plugins,
53+
}]

.editorconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
indent_size = 4
16+
17+
[*.yml]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[*.scss]
22+
indent_style = space
23+
indent_size = 4
24+
25+
[*.md]
26+
trim_trailing_whitespace = false
27+
28+
[{*.txt,wp-config-sample.php}]
29+
end_of_line = crlf

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build
2+
redux-templates/assets/js/redux-templates.js
3+
*.min.js
4+
**/tests/
5+
redux-core/assets/js/redux-vendors.js
6+
redux-core/assets/js/vendor/**/*.js
7+
redux-templates/assets/js/vendor.js

.eslintrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"node": true
5+
},
6+
"parser": "babel-eslint",
7+
"rules": {
8+
"quotes": [
9+
2,
10+
"single"
11+
]
12+
},
13+
"plugins": [
14+
"react"
15+
],
16+
"parserOptions": {
17+
"ecmaVersion": 5,
18+
"sourceType": "script"
19+
}
20+
}

0 commit comments

Comments
 (0)