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

+54
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

+31
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

+22
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

+11
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

+3
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

+61
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

+53
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

+29
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

+7
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

+20
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+
}

.jscsrc

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"preset": "wordpress",
3+
"fileExtensions": [".js", "jscs"],
4+
5+
"excludeFiles": [
6+
"./gulpfile.js",
7+
"./redux-core/inc/themecheck/js/*.min.js",
8+
"./redux-core/inc/welcome/js/jquery.easing.min.js",
9+
"./redux-core/inc/welcome/js/*.js",
10+
"./redux-core/inc/extensions/**/*.min.js",
11+
"./redux-core/inc/fields/spinner/vendor/*.min.js",
12+
"./redux-core/inc/fields/typography/todo/*.*",
13+
"./redux-core/inc/fields/**/*.min.js",
14+
"./redux-core/assets/js/vendor/**/*.js",
15+
"./redux-core/assets/js/vendor/*.js",
16+
"./redux-core/assets/js/media/*.min.js",
17+
"./redux-core/assets/js/*.js",
18+
"./node_modules/**",
19+
"./redux-templates/**",
20+
"./.*/**"
21+
],
22+
23+
"maxErrors": -1,
24+
"requireSemicolons": true,
25+
"requireParenthesesAroundIIFE": true,
26+
"maximumLineLength": 240,
27+
"validateLineBreaks": null,
28+
"validateIndentation": "\t",
29+
"disallowTrailingComma": true,
30+
"disallowUnusedParams": true,
31+
32+
"disallowSpaceAfterPrefixUnaryOperators": false,
33+
"disallowSpacesInsideParentheses": false,
34+
"disallowSpacesInsideObjectBrackets": null,
35+
"disallowImplicitTypeConversion": ["string"],
36+
"requireCamelCaseOrUpperCaseIdentifiers": false,
37+
"validateQuoteMarks": false,
38+
"safeContextKeyword": "_this",
39+
"jsDoc": {
40+
"checkAnnotations": "closurecompiler",
41+
"checkParamNames": true,
42+
"requireParamTypes": true,
43+
"checkRedundantParams": true,
44+
"checkReturnTypes": true,
45+
"checkRedundantReturns": true,
46+
"requireReturnTypes": true,
47+
"checkTypes": "capitalizedNativeCase",
48+
"checkRedundantAccess": true,
49+
"requireNewlineAfterDescription": true
50+
},
51+
}

.jshintignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
./redux-core/assets/js/*.js
2+
./redux-core/assets/js/media/*.min.js
3+
./redux-core/assets/js/vendor/*.js
4+
./redux-core/assets/js/vendor/**/*.js
5+
./redux-core/assets/js/redux/*.js
6+
./redux-core/inc/fields/**/*.min.js
7+
./redux-core/inc/fields/typography/todo/*.*
8+
./redux-core/inc/fields/spinner/vendor/*.*
9+
./redux-core/inc/extensions/**/*.min.js
10+
./redux-core/inc/welcome/js/*.min.js
11+
./redux-core/inc/welcome/js/jquery.easing.min.js
12+
./redux-core/inc/welcome/js/redux-banner-admin.js
13+
./redux-core/inc/themecheck/js/*.min.js
14+
./redux-templates/**
15+
./node_modules/**
16+
./.config/*.js
17+
./.*/**

.stylelintignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
bin
3+
obj
4+
*.*
5+
!*.scss
6+
*.svg
7+
*.png
8+
redux-core/assets/scss/vendor/*.scss
9+
redux-core/assets/scss/vendor/**/*.scss

0 commit comments

Comments
 (0)