Skip to content

Commit

Permalink
upgrade the build process
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidsector9 committed Aug 8, 2023
1 parent 02ab3e6 commit 1694ff0
Show file tree
Hide file tree
Showing 26 changed files with 32,912 additions and 14,817 deletions.
21 changes: 0 additions & 21 deletions .eslintrc.js

This file was deleted.

8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [ "plugin:@wordpress/eslint-plugin/recommended" ],
"globals": {
"jQuery": "readonly",
"tinyMCE": "readonly",
"insecureContentAdmin": "readonly"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/build-release-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
- name: Setup node version and npm cache
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
node-version-file: '.nvmrc'

- name: Install Node dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install node v12
- name: install node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
Expand All @@ -32,7 +32,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: npm install
- run: npm ci
- run: npm run build

cypress:
Expand All @@ -48,7 +48,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: install node v12
- name: install node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
Expand All @@ -67,7 +67,7 @@ jobs:
path: |
dist
languages
- run: npm install
- run: npm ci
if: ${{ steps.cache-node.outputs.cache-hit != 'true' }}
- run: npm run build
if: ${{ steps.cache-build.outputs.cache-hit != 'true' }}
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install node v12
- name: install node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
Expand All @@ -28,13 +28,9 @@ jobs:
~/.cache
~/.npm
- name: npm install
run: npm install
run: npm ci
- name: eslint
uses: icrawl/action-eslint@v1
with:
custom-glob: src/js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run lint:js
phpcs:
name: phpcs
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
npm-debug.log
dist/
build/

# Mac OSX
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
16
40 changes: 0 additions & 40 deletions babel.config.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/js/gutenberg.js

This file was deleted.

22 changes: 11 additions & 11 deletions includes/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ function load_translations() {
* Enqueue editor-only JavaScript/CSS
*/
function block_editor_scripts() {
$asset_file = INSECURE_CONTENT_PATH . 'dist/js/gutenberg.asset.php';
$asset_file = INSECURE_CONTENT_PATH . 'build/gutenberg.asset.php';
if ( file_exists( $asset_file ) ) {
$asset = require_once $asset_file;
wp_enqueue_script(
'insecure-content-gutenberg',
INSECURE_CONTENT_URL . 'dist/js/gutenberg.js',
INSECURE_CONTENT_URL . 'build/gutenberg.js',
$asset['dependencies'],
$asset['version'],
true
);
wp_enqueue_style(
'insecure-content-gutenberg',
INSECURE_CONTENT_URL . 'dist/css/editor-style.css',
INSECURE_CONTENT_URL . 'build/gutenberg.css',
false,
$asset['version'],
'all'
Expand All @@ -62,12 +62,12 @@ function enqueue_scripts( $hook = '' ) {
return;
}

$asset_file = INSECURE_CONTENT_PATH . 'dist/js/classic-editor.asset.php';
$asset_file = INSECURE_CONTENT_PATH . 'build/classic-editor.asset.php';
if ( file_exists( $asset_file ) ) {
$asset = require_once $asset_file;
wp_enqueue_script(
'insecure-content-admin',
INSECURE_CONTENT_URL . 'dist/js/classic-editor.js',
INSECURE_CONTENT_URL . 'build/classic-editor.js',
$asset['dependencies'],
$asset['version'],
true
Expand All @@ -83,7 +83,7 @@ function enqueue_scripts( $hook = '' ) {

wp_enqueue_style(
'insecure-content-admin',
INSECURE_CONTENT_URL . 'dist/css/admin-style.css',
INSECURE_CONTENT_URL . 'build/classic-editor.css',
false,
$asset['version'],
);
Expand All @@ -94,20 +94,20 @@ function enqueue_scripts( $hook = '' ) {
* Enqueue admin-only JavaScript/CSS
*/
function admin_scripts() {
$asset_file = INSECURE_CONTENT_PATH . 'dist/js/admin.asset.php';
$asset_file = INSECURE_CONTENT_PATH . 'build/admin.asset.php';
if ( file_exists( $asset_file ) ) {
$asset = require_once $asset_file;
wp_enqueue_script(
'insecure-content-admin',
INSECURE_CONTENT_URL . 'dist/js/admin.js',
INSECURE_CONTENT_URL . 'build/admin.js',
$asset['dependencies'],
$asset['version'],
true
);

wp_enqueue_style(
'insecure-content-admin',
INSECURE_CONTENT_URL . 'dist/css/admin-style.css',
INSECURE_CONTENT_URL . 'build/classic-editor.css',
false,
$asset['version'],
);
Expand All @@ -120,7 +120,7 @@ function admin_scripts() {
* @return void
*/
function compile_script_notice() {
$asset_file = INSECURE_CONTENT_PATH . 'dist/js/gutenberg.asset.php';
$asset_file = INSECURE_CONTENT_PATH . 'build/gutenberg.asset.php';

if ( file_exists( $asset_file ) ) {
return;
Expand All @@ -142,7 +142,7 @@ function compile_script_notice() {
*/
function mce_css( $mce_css = '' ) {

$url = INSECURE_CONTENT_URL . 'dist/css/editor-style.css';
$url = INSECURE_CONTENT_URL . 'build/gutenberg.css';
if ( empty( $mce_css ) ) {
return $url;
}
Expand Down
Loading

0 comments on commit 1694ff0

Please sign in to comment.