Skip to content

Commit 38a69fa

Browse files
authored
Update Environment & Dependencies (#45)
* 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
1 parent e52b7c2 commit 38a69fa

28 files changed

+15511
-9510
lines changed

.csslintrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": [ "plugin:@wordpress/eslint-plugin/recommended" ]
2+
"extends": [ "plugin:@wordpress/eslint-plugin/recommended-with-formatting" ]
33
}
File renamed without changes.

.github/workflows/release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ jobs:
8989
run: git status
9090

9191
- name: 🔼 Bump version
92+
run: npm version ${{ github.event.inputs.version }} -m 'Tagging %s' -f
93+
94+
- name: ⚙️ Get new project version
9295
id: version
93-
run: echo "::set-output name=version::$(npm version ${{ github.event.inputs.version }} -m 'Tagging %s' -f)"
96+
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
9497

9598
- name: 🏗 Build Release
9699
run: npx grunt release
@@ -124,3 +127,12 @@ jobs:
124127
asset_path: ./update/${{ steps.package.outputs.slug }}.zip
125128
asset_name: ${{ steps.package.outputs.slug }}-${{ steps.version.outputs.version }}.zip
126129
asset_content_type: application/zip
130+
131+
- name: Deploy to WordPress.org
132+
uses: luehrsenheinrich/action-wordpress-plugin-deploy@develop
133+
env:
134+
SVN_PASSWORD: ${{ secrets.WPM_SVN_PASSWORD }}
135+
SVN_USERNAME: ${{ secrets.WPM_SVN_USERNAME }}
136+
ASSETS_DIR: 'assets'
137+
PLUGIN_DIR: 'trunk'
138+
VERSION: ${{ steps.version.outputs.version }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ update
2121

2222
## JS
2323
build/**/*.min.js
24+
build/**/*.bundle.js

.wp-env.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"plugins": [
3+
"https://downloads.wordpress.org/plugin/wordpress-importer.zip",
4+
"https://downloads.wordpress.org/plugin/query-monitor.zip",
5+
"https://downloads.wordpress.org/plugin/debug-bar.zip",
6+
"./trunk"
7+
],
8+
"mappings": {
9+
"php.ini": "./php.ini"
10+
},
11+
"env": {
12+
"development": {
13+
"config": {
14+
"WP_DEBUG": true,
15+
"WP_ENVIRONMENT_TYPE": "development"
16+
}
17+
}
18+
}
19+
}

CHANGELOG.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,13 @@ Just [file a GitHub issue](https://github.com/luehrsenheinrich/quicklink/issues/
1010

1111
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.
1212

13-
## Helping with the documentation
14-
15-
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.
16-
1713
## Setting up the dev environment
1814

1915
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.
2016

21-
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.
17+
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.
2218

23-
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`.
19+
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`.
2420

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

Gruntfile.js

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const webpackConfig = require('./webpack.config');
2-
const gruntNewerLess = require('grunt-newer-less');
32

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

13-
// LESS / CSS
14-
15-
// Compile Less
16-
// Compile the less files
17-
less: {
18-
development: {
19-
options: {
20-
optimization: 2
21-
},
22-
files: {
23-
"build/admin/admin.css": "build/admin/less/admin.less", // destination file and source file
24-
}
25-
},
26-
},
27-
28-
postcss: {
29-
autoprefix: {
30-
options: {
31-
map: false, // inline sourcemaps
32-
processors: [
33-
require('autoprefixer')(), // add vendor prefixes
34-
]
35-
},
36-
files: {
37-
"build/admin/admin.css": "build/admin/admin.css",
38-
39-
}
40-
},
41-
minify: {
42-
options: {
43-
map: false,
44-
processors: [
45-
require('cssnano')({}),
46-
]
47-
},
48-
files: {
49-
"build/admin/admin.min.css": "build/admin/admin.css",
50-
51-
}
52-
}
53-
},
5412

5513
// JAVASCRIPT
5614
eslint: {
@@ -80,20 +38,6 @@ module.exports = function(grunt) {
8038
livereload: true
8139
},
8240
},
83-
less: {
84-
files: ['build/**/*.less'], // which files to watch
85-
tasks: ['deploy_css'],
86-
options: {
87-
//livereload: true
88-
},
89-
},
90-
css: {
91-
files: ['build/**/*.css', 'build/*.css', ],
92-
tasks: [],
93-
options: {
94-
livereload: true
95-
}
96-
},
9741
php: {
9842
files: ['build/**/*.php'], // which files to watch
9943
tasks: ['deploy_php'],
@@ -123,7 +67,6 @@ module.exports = function(grunt) {
12367
return grunt.template.process(content, {delimiters: 'custom-delimiters'});
12468
},
12569
},
126-
build_css: {expand: true, cwd: 'build', src: ['**/*.min.css'], dest: 'trunk/', filter: 'isFile'},
12770
build_php: {expand: true, cwd: 'build', src: ['**/*.php'], dest: 'trunk/', filter: 'isFile'},
12871
build: {expand: true, cwd: 'build', src: ['**/*.min.js', '**/*.bundle.js', '**/*.min.css', '**/*.txt','**/*.svg','**/*.po','**/*.pot', '**/*.tmpl.html'], dest: 'trunk/', filter: 'isFile'},
12972
build_stream: {expand: true, options: { encoding: null }, cwd: 'build', src: ['**/*.mo', 'img/**/*'], dest: 'trunk/', filter: 'isFile'},
@@ -162,17 +105,10 @@ module.exports = function(grunt) {
162105
{src: ['**'], cwd: 'trunk', expand: true, dest: '<%= pkg.slug %>'}, // includes files in path
163106
]
164107
}
165-
},
166-
167-
newer: {
168-
options: {
169-
override: gruntNewerLess.overrideLess
170-
}
171108
}
172109
});
173110

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

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

184120
// 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.
185-
grunt.registerTask( 'deploy_css', ['handle_css', 'newer:copy:build_css'] );
186121
grunt.registerTask( 'deploy_php', ['handle_php', 'newer:copy:build_php'] );
187122

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

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

194129
// The release task adds a new tag in the release folder.
195130
grunt.registerTask( 'release', ['lint', 'deploy', 'clean:update', 'compress'] );

bin/define-env.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)