Skip to content

Commit

Permalink
Merge e0f797f into 726101d
Browse files Browse the repository at this point in the history
  • Loading branch information
ravichdev committed Mar 16, 2021
2 parents 726101d + e0f797f commit b9502c7
Show file tree
Hide file tree
Showing 846 changed files with 17,391 additions and 1,226 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Expand Up @@ -2,6 +2,7 @@
**/bin/**
**/node_modules/**
**/vendor/**
**/assets/js/*.js
**/plugin/assets/js/*.js
**/theme/assets/js/*.js
build/*
built/*
2 changes: 1 addition & 1 deletion .eslintrc.json
Expand Up @@ -8,7 +8,7 @@
"**/__tests__/**/*.js",
"**/test/*.js",
"**/?(*.)test.js",
"tests/js/**/*.js"
"**/tests/js/**/*.js"
],
"extends": [
"plugin:jest/all"
Expand Down
14 changes: 10 additions & 4 deletions .gitignore
Expand Up @@ -4,13 +4,19 @@
.idea
composer.lock
material-design.zip
material-design-google.zip
yarn.lock
assets/css/*
!assets/css/src/
assets/js/*
plugin/assets/css/*
!plugin/assets/css/src/
plugin/assets/js/*
theme/assets/css/*
!theme/assets/css/src/
theme/assets/js/*
bin/local-dev/mysql/
bin/local-dev/wordpress/html/
build/
node_modules/
tests/coverage
vendor/
plugin/tests/coverage
plugin/composer*
theme/composer*
5 changes: 3 additions & 2 deletions .stylelintignore
@@ -1,7 +1,8 @@
/assets/css/*.css
/theme/assets/css/*.css
/plugin/assets/css/*.css
/bin
/build
/node_modules
/tests
/vendor
/assets/css/src/mixins.css
/plugin/assets/css/src/mixins.css
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -60,6 +60,7 @@ install:
- export DEV_LIB_PATH=vendor/xwp/wp-dev-lib/scripts
- export DIFF_HEAD=HEAD
- export DEFAULT_BASE_BRANCH=main
- export PROJECT_TYPE=plugin
- source "$DEV_LIB_PATH/travis.install.sh"

before_script:
Expand Down Expand Up @@ -100,7 +101,7 @@ jobs:
- docker-compose exec mysql bash -c "chown -R mysql:mysql /var/lib/mysql"
- npm run wp -- wp core install --title=WordPress --admin_user=admin --admin_password=password --admin_email=admin@example.com --skip-email --url=http://localhost:8088
- npm run wp -- wp plugin activate material-design
- sudo chown -R travis:travis tests node_modules # ensure coverage folder can be created
- sudo chown -R travis:travis plugin/tests node_modules # ensure coverage folder can be created
- npm run test:e2e:coveralls

- name: E2E tests with Docker (7.3, WordPress 5.2)
Expand All @@ -120,7 +121,7 @@ jobs:
- docker-compose exec mysql bash -c "chown -R mysql:mysql /var/lib/mysql"
- npm run wp -- wp core install --title=WordPress --admin_user=admin --admin_password=password --admin_email=admin@example.com --skip-email --url=http://localhost:8088
- npm run wp -- wp plugin activate material-design
- sudo chown -R travis:travis tests node_modules
- sudo chown -R travis:travis plugin/tests node_modules
- npm run test:e2e

- name: JS unit tests (7.4, WordPress latest, with code coverage)
Expand Down
116 changes: 92 additions & 24 deletions Gruntfile.js
Expand Up @@ -23,18 +23,23 @@ module.exports = function( grunt ) {
grunt.initConfig( {
// Build a deploy-able plugin.
copy: {
build: {
plugin: {
src: [
'**',
'!.*',
'!.*/**',
'!**/._.DS_Store',
'!**/.DS_Store',
'!assets/css/src/**',
'!assets/js/.gitignore',
'!assets/src/**',
'!assets/images/png/**',
'!assets/images/jpg/**',
'plugin/**',
'!plugin/.*',
'!plugin/.*/**',
'!plugin/**/._.DS_Store',
'!plugin/**/.DS_Store',
'!plugin/assets/css/src/**',
'!plugin/assets/js/.gitignore',
'!plugin/assets/src/**',
'!plugin/assets/images/png/**',
'!plugin/assets/images/jpg/**',
'!plugin/tests/**',
'!plugin/composer*',
'!plugin/readme.md',
'!plugin/vendor/**',
'!plugin/phpunit.xml',
'!bin/**',
'!build/**',
'!built/**',
Expand All @@ -56,9 +61,60 @@ module.exports = function( grunt ) {
'!postcss.config.js',
'!readme.md',
'!renovate.json',
'!tests/**',
'!vendor/**',
'!webpack.config.js',
'!webpack/**',
],
dest: 'build',
expand: true,
dot: true,
},
theme: {
src: [
'theme/**',
'!theme/.*',
'!theme/.*/**',
'!theme/**/._.DS_Store',
'!theme/**/.DS_Store',
'!theme/assets/css/src/**',
'!theme/assets/css/*.map',
'!theme/assets/js/.gitignore',
'!theme/assets/js/*.php',
'!theme/assets/js/*.map',
'!theme/assets/src/**',
'!theme/tests/**',
'!theme/wp-assets/**',
'!theme/composer*',
'!theme/readme.md',
'!theme/vendor/**',
'!theme/phpunit.xml',
'!bin/**',
'!build/**',
'!built/**',
'!code_of_conduct.md',
'!CONTRIBUTING.md',
'!contributing/**',
'!composer.json',
'!composer.lock',
'!contributing.md',
'!docker-compose.yml',
'!docker-compose-plugin-dev.yml',
'!material-design-google.zip',
'!Gruntfile.js',
'!jest.config.js',
'!node_modules/**',
'!npm-debug.log',
'!package.json',
'!package-lock.json',
'!phpcs.xml',
'!phpcs.xml.dist',
'!phpunit.xml',
'!postcss.config.js',
'!README.md',
'!renovate.json',
'!vendor/**',
'!webpack.config.js',
'!webpack/**',
],
dest: 'build',
expand: true,
Expand All @@ -70,12 +126,18 @@ module.exports = function( grunt ) {
clean: {
compiled: {
src: [
'assets/js/*.js',
'assets/js/*.js.map',
'assets/js/*.asset.php',
'assets/css/*.css',
'!assets/css/src/*',
'assets/css/*.css.map',
'plugin/assets/js/*.js',
'plugin/assets/js/*.js.map',
'plugin/assets/js/*.asset.php',
'plugin/assets/css/*.css',
'!plugin/assets/css/src/*',
'plugin/assets/css/*.css.map',
'theme/assets/js/*.js',
'theme/assets/js/*.js.map',
'theme/assets/js/*.asset.php',
'theme/assets/css/*.css',
'!theme/assets/css/src/*',
'theme/assets/css/*.css.map',
],
},
build: {
Expand All @@ -92,8 +154,11 @@ module.exports = function( grunt ) {
readme: {
command: './vendor/xwp/wp-dev-lib/scripts/generate-markdown-readme', // Generate the readme.md.
},
create_build_zip: {
command: 'if [ ! -e build ]; then echo "Run grunt build first."; exit 1; fi; if [ -e material-design.zip ]; then rm material-design.zip; fi; mv build material-design; zip -r ./material-design.zip material-design; mv material-design build; echo; echo "ZIP of build: $(pwd)/material-design.zip"',
create_plugin_zip: {
command: 'if [ ! -e build ]; then echo "Run grunt build first."; exit 1; fi; if [ -e material-design.zip ]; then rm material-design.zip; fi; mv build/plugin ./material-design; zip -r ./material-design.zip ./material-design; mv ./material-design build/plugin; echo; echo "ZIP of build: $(pwd)/material-design.zip"',
},
create_theme_zip: {
command: 'if [ ! -e build ]; then echo "Run grunt build first."; exit 1; fi; if [ -e material-design-google.zip ]; then rm material-design-google.zip; fi; mv build/theme ./material-design-google; zip -r ./material-design-google.zip ./material-design-google; mv ./material-design-google build/theme; echo; echo "ZIP of build: $(pwd)/material-design-google.zip"',
},
},

Expand All @@ -102,7 +167,7 @@ module.exports = function( grunt ) {
deploy: {
options: {
plugin_slug: 'material-design',
build_dir: 'build',
build_dir: 'build/plugin',
assets_dir: 'wp-assets',
},
},
Expand All @@ -117,8 +182,8 @@ module.exports = function( grunt ) {

// Register custom tasks.
grunt.registerTask( 'icon_mapping', 'Turn codepoints into JSON', () => {
const filePath = 'assets/fonts/icons.json';
const iconFile = grunt.file.read( 'assets/fonts/icons.codepoints' );
const filePath = 'plugin/assets/fonts/icons.json';
const iconFile = grunt.file.read( 'plugin/assets/fonts/icons.codepoints' );
const iconItems = iconFile.split( /\r?\n/g );
const icons = {
icons: {},
Expand All @@ -145,7 +210,10 @@ module.exports = function( grunt ) {

grunt.registerTask( 'build', [ 'readme', 'copy', 'icon_mapping' ] );

grunt.registerTask( 'create-build-zip', [ 'shell:create_build_zip' ] );
grunt.registerTask( 'create-build-zip', [
'shell:create_plugin_zip',
'shell:create_theme_zip',
] );

grunt.registerTask( 'deploy', [ 'build', 'wp_deploy', 'clean' ] );
};
10 changes: 6 additions & 4 deletions composer.json
Expand Up @@ -29,11 +29,13 @@
"composer install --no-dev --prefer-dist --optimize-autoloader --no-scripts"
],
"format": [
"phpcbf ."
"phpcbf ./plugin",
"phpcbf ./theme --standard=phpcs-theme.xml"
],
"lint": [
"@composer validate --strict",
"phpcs ."
"phpcs ./plugin",
"phpcs ./theme --standard=phpcs-theme.xml"
],
"post-install-cmd": [
"@setup"
Expand All @@ -53,13 +55,13 @@
"phpunit"
],
"test-coverage": [
"phpunit --coverage-html tests/coverage/html"
"phpunit --coverage-html plugin/tests/coverage/html"
]
},
"extra": {
"installer-name": "material-design",
"copy-file": {
"tests/wp-tests-config.php": "vendor/xwp/wordpress-tests/phpunit/wp-tests-config.php"
"plugin/tests/wp-tests-config.php": "vendor/xwp/wordpress-tests/phpunit/wp-tests-config.php"
}
}
}
13 changes: 11 additions & 2 deletions docker-compose.yml
Expand Up @@ -42,7 +42,15 @@ services:
- 8088:80
volumes:
- ./bin/local-dev/wordpress/html:/var/www/html
- .:/var/www/html/wp-content/plugins/material-design
- ./plugin:/var/www/html/wp-content/plugins/material-design
- ./theme:/var/www/html/wp-content/themes/material-design-google
# Mount composer files and the vendor folder to both the plugin and theme folders.
- ./vendor:/var/www/html/wp-content/plugins/material-design/vendor
- ./composer.json:/var/www/html/wp-content/plugins/material-design/composer.json
- ./composer.lock:/var/www/html/wp-content/plugins/material-design/composer.lock
- ./vendor:/var/www/html/wp-content/themes/material-design-google/vendor
- ./composer.json:/var/www/html/wp-content/themes/material-design-google/composer.json
- ./composer.lock:/var/www/html/wp-content/themes/material-design-google/composer.lock
restart: always
environment:
WORDPRESS_DEBUG: 1
Expand All @@ -54,7 +62,8 @@ services:
user: xfs
volumes:
- ./bin/local-dev/wordpress/html:/var/www/html
- .:/var/www/html/wp-content/plugins/material-design
- ./plugin:/var/www/html/wp-content/plugins/material-design
- ./theme:/var/www/html/wp-content/themes/material-design-google
depends_on:
- mysql
- wordpress
Expand Down
13 changes: 7 additions & 6 deletions jest.config.js
Expand Up @@ -18,18 +18,19 @@ module.exports = {
verbose: true,
testMatch: [ '**/?(*.)+(spec|test).[jt]s?(x)' ],
preset: '@wordpress/jest-preset-default',
collectCoverageFrom: [ 'assets/src/**/*.js' ],
collectCoverageFrom: [ 'plugin/assets/src/**/*.js' ],
testPathIgnorePatterns: [
'/node_modules/',
'/vendor/',
'/bin/',
'/tests/e2e/',
'/plugin/tests/e2e/',
],
moduleNameMapper: {
'^!!json-loader!(.*).ijmap$': '<rootDir>/tests/mocks/ijmap.js',
'^!!json-loader!(.*).ijmap$': '<rootDir>/plugin/tests/mocks/ijmap.js',
'@wordpress/block-editor':
'<rootDir>/tests/mocks/@wordpress/block-editor.js',
'@wordpress/rich-text': '<rootDir>/tests/mocks/@wordpress/rich-text.js',
'icon-picker*': '<rootDir>/tests/mocks/icon-picker.js',
'<rootDir>/plugin/tests/mocks/@wordpress/block-editor.js',
'@wordpress/rich-text':
'<rootDir>/plugin/tests/mocks/@wordpress/rich-text.js',
'icon-picker*': '<rootDir>/plugin/tests/mocks/icon-picker.js',
},
};

0 comments on commit b9502c7

Please sign in to comment.