Skip to content

Commit

Permalink
Update Environment & Dependencies (#45)
Browse files Browse the repository at this point in the history
* Remove old environment files

that are no longer needed

* Add the wp-env config

* update dependencies and scripts

* configure php for wp-env

* Remove CSS/LESS tasks from the runner

as we currently do not have any CSS/LESS in the repo

* Update CONTRIBUTING.md

* Revert to the default port

* Update PHPCS to a recent version

* Delete .csslintrc

* Move the issue template from the root

* Remove CHANGELOG.md as it is unused

* Update depdendencies

* Remove unused depdendencies

* Opt out of prettier

* Adhere to new eslint rules

* Create a non-minified version

as the WordPress plugin repo technically requires this

* Ignore .bundle.js files

* Update readme.txt

* Automatically deploy to WordPress on release

* A bit more stable version handling

* We seem to need webpack as a direct dependency
  • Loading branch information
Luehrsen authored Aug 16, 2021
1 parent e52b7c2 commit 38a69fa
Show file tree
Hide file tree
Showing 28 changed files with 15,511 additions and 9,510 deletions.
2 changes: 0 additions & 2 deletions .csslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": [ "plugin:@wordpress/eslint-plugin/recommended" ]
"extends": [ "plugin:@wordpress/eslint-plugin/recommended-with-formatting" ]
}
File renamed without changes.
14 changes: 13 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ jobs:
run: git status

- name: 🔼 Bump version
run: npm version ${{ github.event.inputs.version }} -m 'Tagging %s' -f

- name: ⚙️ Get new project version
id: version
run: echo "::set-output name=version::$(npm version ${{ github.event.inputs.version }} -m 'Tagging %s' -f)"
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"

- name: 🏗 Build Release
run: npx grunt release
Expand Down Expand Up @@ -124,3 +127,12 @@ jobs:
asset_path: ./update/${{ steps.package.outputs.slug }}.zip
asset_name: ${{ steps.package.outputs.slug }}-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip

- name: Deploy to WordPress.org
uses: luehrsenheinrich/action-wordpress-plugin-deploy@develop
env:
SVN_PASSWORD: ${{ secrets.WPM_SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.WPM_SVN_USERNAME }}
ASSETS_DIR: 'assets'
PLUGIN_DIR: 'trunk'
VERSION: ${{ steps.version.outputs.version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ update

## JS
build/**/*.min.js
build/**/*.bundle.js
19 changes: 19 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"plugins": [
"https://downloads.wordpress.org/plugin/wordpress-importer.zip",
"https://downloads.wordpress.org/plugin/query-monitor.zip",
"https://downloads.wordpress.org/plugin/debug-bar.zip",
"./trunk"
],
"mappings": {
"php.ini": "./php.ini"
},
"env": {
"development": {
"config": {
"WP_DEBUG": true,
"WP_ENVIRONMENT_TYPE": "development"
}
}
}
}
15 changes: 0 additions & 15 deletions CHANGELOG.md

This file was deleted.

8 changes: 2 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@ Just [file a GitHub issue](https://github.com/luehrsenheinrich/quicklink/issues/

If you’re filing a bug, specific steps to reproduce are helpful. Please include the URL of the page that has the bug, along with what you expected to see and what happened instead.

## Helping with the documentation

Every theme is just as good as the documentation. In this repository we offer [collaboration with a wiki](https://github.com/luehrsenheinrich/quicklink/wiki) to create a documentation for this theme.

## Setting up the dev environment

If you want to contribute code to the theme you have to set up the environment locally. Make sure that you have `npm` and `grunt` installed.

The working directory is the `build` directory. If you change something in another location of the git the pull request or commit will be ignored.
The working directory is the `build` directory. If you change something in another location of the git the pull request or commit will be ignored. This repository uses `@wordpress/env` to provide a local development environment. Please refer to the [documentation for wp-env](https://github.com/WordPress/gutenberg/tree/trunk/packages/env) to learn more about that package.

The development server and all dependencies are handled by docker and npm. Make sure you have [docker-compose installed](https://docs.docker.com/compose/install/) and run `npm run setup` in the directory. You spawned WordPress instance will be available under `http://localhost` with the account `wordpress:wordpress`.
The development server and all dependencies are handled by docker and npm. Make sure you have [docker-compose installed](https://docs.docker.com/compose/install/) and run `npm start` in the directory. You spawned WordPress instance will be available under `http://localhost:8888` with the account `admin:password`.

Please be aware, that you should usually not write code directly on the master branch.

Expand Down
69 changes: 2 additions & 67 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const webpackConfig = require('./webpack.config');
const gruntNewerLess = require('grunt-newer-less');

module.exports = function(grunt) {
require('jit-grunt')(grunt);
Expand All @@ -10,47 +9,6 @@ module.exports = function(grunt) {
pkg: grunt.file.readJSON("package.json"),
pkgLck: grunt.file.readJSON("package-lock.json"),

// LESS / CSS

// Compile Less
// Compile the less files
less: {
development: {
options: {
optimization: 2
},
files: {
"build/admin/admin.css": "build/admin/less/admin.less", // destination file and source file
}
},
},

postcss: {
autoprefix: {
options: {
map: false, // inline sourcemaps
processors: [
require('autoprefixer')(), // add vendor prefixes
]
},
files: {
"build/admin/admin.css": "build/admin/admin.css",

}
},
minify: {
options: {
map: false,
processors: [
require('cssnano')({}),
]
},
files: {
"build/admin/admin.min.css": "build/admin/admin.css",

}
}
},

// JAVASCRIPT
eslint: {
Expand Down Expand Up @@ -80,20 +38,6 @@ module.exports = function(grunt) {
livereload: true
},
},
less: {
files: ['build/**/*.less'], // which files to watch
tasks: ['deploy_css'],
options: {
//livereload: true
},
},
css: {
files: ['build/**/*.css', 'build/*.css', ],
tasks: [],
options: {
livereload: true
}
},
php: {
files: ['build/**/*.php'], // which files to watch
tasks: ['deploy_php'],
Expand Down Expand Up @@ -123,7 +67,6 @@ module.exports = function(grunt) {
return grunt.template.process(content, {delimiters: 'custom-delimiters'});
},
},
build_css: {expand: true, cwd: 'build', src: ['**/*.min.css'], dest: 'trunk/', filter: 'isFile'},
build_php: {expand: true, cwd: 'build', src: ['**/*.php'], dest: 'trunk/', filter: 'isFile'},
build: {expand: true, cwd: 'build', src: ['**/*.min.js', '**/*.bundle.js', '**/*.min.css', '**/*.txt','**/*.svg','**/*.po','**/*.pot', '**/*.tmpl.html'], dest: 'trunk/', filter: 'isFile'},
build_stream: {expand: true, options: { encoding: null }, cwd: 'build', src: ['**/*.mo', 'img/**/*'], dest: 'trunk/', filter: 'isFile'},
Expand Down Expand Up @@ -162,17 +105,10 @@ module.exports = function(grunt) {
{src: ['**'], cwd: 'trunk', expand: true, dest: '<%= pkg.slug %>'}, // includes files in path
]
}
},

newer: {
options: {
override: gruntNewerLess.overrideLess
}
}
});

// These tasks are not needed at the moment, as we do not have any css or js files (yet).
grunt.registerTask( 'handle_css', ['less:development', 'newer:postcss:autoprefix', 'postcss:minify'] );
grunt.registerTask( 'handle_js', ['webpack'] );
grunt.registerTask( 'handle_php', [] );

Expand All @@ -182,14 +118,13 @@ module.exports = function(grunt) {
grunt.registerTask( 'lint', ['lint_php', 'lint_js' ] );

// Deployment strategies. The dev-deploy runs with the watcher and performs quicker. The deploy performs a clean of the trunk folder and a clean copy of the needed files.
grunt.registerTask( 'deploy_css', ['handle_css', 'newer:copy:build_css'] );
grunt.registerTask( 'deploy_php', ['handle_php', 'newer:copy:build_php'] );

// A complete deploy done during initial setup
grunt.registerTask( 'deploy', ['handle_php', 'handle_js', 'handle_css', 'clean:build', 'copy:build', 'copy:build_css', 'copy:build_php', 'copy:build_stream'] );
grunt.registerTask( 'deploy', ['handle_php', 'handle_js', 'clean:build', 'copy:build', 'copy:build_php', 'copy:build_stream'] );

// A partial deploy during the watch tasks
grunt.registerTask( 'dev-deploy', ['handle_js', 'handle_css', 'newer:copy:build', 'newer:copy:build_stream'] );
grunt.registerTask( 'dev-deploy', ['handle_js', 'newer:copy:build', 'newer:copy:build_stream'] );

// The release task adds a new tag in the release folder.
grunt.registerTask( 'release', ['lint', 'deploy', 'clean:update', 'compress'] );
Expand Down
15 changes: 0 additions & 15 deletions bin/define-env.sh

This file was deleted.

165 changes: 0 additions & 165 deletions bin/includes.sh

This file was deleted.

Loading

0 comments on commit 38a69fa

Please sign in to comment.