Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Laravel Mix with Bud #2643

Merged
merged 52 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cfd458a
init
kellymears Feb 18, 2021
01e6bb1
remove test image
kellymears Feb 18, 2021
1111252
update to latest @roots/sage release
kellymears Feb 28, 2021
db23a80
chore(deps): update acorn + bud
QWp6t Mar 16, 2021
8cda952
chore(deps): update acorn
QWp6t Mar 16, 2021
5cd9640
chore(build): add missing package.json scripts
QWp6t Mar 16, 2021
c775fc8
chore(deps): update bud
QWp6t Mar 16, 2021
8d80360
chore(assets): use Bundle::enqueue()
QWp6t Mar 16, 2021
cb3af73
fix(configs): use Roots\public_path
QWp6t Mar 16, 2021
199317b
chore(admin-assets): customizer should use bundle()
QWp6t Mar 16, 2021
51b9db7
deps(@roots/sage) update to 3.0.98-alpha.0
kellymears Mar 25, 2021
f00c38b
clean(assets.php) remove assets handling scaffold utils
kellymears Mar 25, 2021
5b88592
improve(assets) prefer postcss, demonstrate hmr with simple/useful util
kellymears Mar 25, 2021
7f132cf
mergefix(latest)
kellymears Mar 25, 2021
f3f4c4b
chore(deps): update bud to 3.0.102-alpha.0
QWp6t Apr 2, 2021
5a52fdf
config: update @roots/sage to 3.0.104-alpha.0
kellymears Apr 2, 2021
5d5cf93
mergefix
kellymears Apr 2, 2021
780b2aa
Merge branch 'master' into roots-build-tools
QWp6t Apr 2, 2021
b9c09e7
chore(deps): update bud to 3.0.108-alpha.0
QWp6t Apr 3, 2021
6947e64
deps: update @roots/sage to 3.0.112-alpha.0
kellymears Apr 4, 2021
22d4c4b
mergefix
kellymears Apr 4, 2021
294fb2d
v4.1.0
kellymears May 20, 2021
7a35d2e
build(bud): use bud.config.yml
QWp6t Jun 7, 2021
9a86a2b
build(deps): update bud 4.4.0
QWp6t Jun 7, 2021
6227721
chore(deps): update acorn
QWp6t Jun 7, 2021
e3c7e75
Merge remote-tracking branch 'origin/master' into roots-build-tools
QWp6t Jun 7, 2021
cf0df1b
build(deps): set tailwind as dev-dep
QWp6t Jun 7, 2021
6894af6
ci(node): build on node v14 and v16
QWp6t Jun 7, 2021
bebea02
ci(main): fix yarn build
QWp6t Jun 7, 2021
ee778af
ci(main): use --ci when building to prevent ink errors
QWp6t Jun 7, 2021
d267ec2
Merge branch 'master' into roots-build-tools
QWp6t Jul 4, 2021
8a55e74
update to v4.7.0-9
kellymears Jul 5, 2021
af36dbc
mergefix
kellymears Jul 5, 2021
7226394
chore(deps-dev): Bump @roots/bud to v5.0.0-next.0
QWp6t Oct 16, 2021
aa44e13
fix(ci-main): remove unrecognized flag `--ci`
QWp6t Oct 16, 2021
faf60a5
chore(deps): update composer dependencies
QWp6t Oct 18, 2021
37b6c99
chore(deps-dev): Bump @roots/bud to v5.0.0-next.5
QWp6t Oct 19, 2021
fd5fe97
fix PHP 8 lock
retlehs Oct 22, 2021
1709859
fix(conf-assets): assume `public` dist folder by default
QWp6t Oct 22, 2021
1fce825
chore(config-bud): fix jsdoc
QWp6t Oct 23, 2021
bb121e1
chore(deps-dev): Bump @roots/bud to v5.0.0-next.7
QWp6t Oct 23, 2021
8e85172
fix(cs-css): relax failing stylelint rules
QWp6t Oct 23, 2021
7df7513
fix(scripts-dev): use `bud dev`
QWp6t Oct 24, 2021
7ddc8e2
chore(deps): update roots/acorn to 2.0.0-beta.0
QWp6t Oct 31, 2021
f60773a
chore(deps): Bump roots/acorn to v2.0.0-beta.2
QWp6t Nov 12, 2021
108a054
chore(deps): Bump @roots/bud to v5.0.0-beta.9
QWp6t Nov 12, 2021
8ed677e
chore(deps-dev): Bump @roots/bud to v5.0.0-next.13
QWp6t Nov 17, 2021
001bb1a
chore(deps-dev): Bump @roots/bud to v5.0.0-next.14
QWp6t Nov 18, 2021
86cb1cb
Merge branch 'master' into roots-build-tools
QWp6t Nov 19, 2021
7266d06
Drop Node v14 support
retlehs Nov 19, 2021
e18f21d
chore(deps): Bump roots/acorn to 2.0.0-beta.4
QWp6t Nov 21, 2021
e53a2f4
Tests: Remove unused build artifact
retlehs Nov 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
module.exports = {
root: true,
extends: 'eslint:recommended',
parser: 'babel-eslint',
extends: ['eslint:recommended', 'plugin:react/recommended'],
globals: {
wp: true
wp: true,
},
env: {
node: true,
es6: true,
amd: true,
browser: true,
jquery: true
jquery: true,
},
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
experimentalObjectRestSpread: true,
globalReturn: true,
generators: false,
objectLiteralDuplicateProperties: false
impliedStrict: true,
objectLiteralDuplicateProperties: false,
jsx: true,
},
ecmaVersion: 2017,
sourceType: 'module'
sourceType: 'module',
},
plugins: ['import'],
plugins: ['import', 'react-hooks'],
settings: {
react: {
version: 'detect',
},
'import/core-modules': [],
'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$']
'import/ignore': [
'node_modules',
'\\.(coffee|scss|css|less|hbs|svg|json)$',
],
},
rules: {
'no-console': 0,
Expand All @@ -35,8 +44,8 @@ module.exports = {
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'ignore'
}
]
}
functions: 'ignore',
},
],
},
};
15 changes: 8 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
node: ['12.14.0', '14']
node: ['16']

steps:
- name: Checkout the project
Expand All @@ -35,19 +35,20 @@ jobs:
- uses: actions/cache@v2
with:
path: ${{ steps.yarncache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json') }}
key: ${{ runner.os }}-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.node }}-yarn-

- name: Install dependencies using Yarn
run: yarn install --frozen-lockfile

- name: Execute the Node test scripts
run: yarn test
- name: Lint scripts and styles
run: yarn lint

- name: Verify that assets are built successfully
- name: Build and compile assets
run: |
yarn build:production
cat public/mix-manifest.json
yarn build
cat public/entrypoints.json
cat public/manifest.json

php:
name: PHP ${{ matrix.php }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/node_modules
/vendor
/public
.env
.budfiles
npm-debug.log
yarn-error.log
6 changes: 5 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"bracketSpacing": false,
"jsxBracketSameLine": true,
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
2 changes: 2 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "stylelint-config-standard",
"rules": {
"string-quotes": null,
"selector-class-pattern": null,
"declaration-colon-newline-after": null,
"value-list-comma-newline-after": null,
"no-empty-source": null,
Expand Down
4 changes: 2 additions & 2 deletions app/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

use WP_Customize_Manager;

use function Roots\asset;
use function Roots\bundle;

/**
* Register the `.brand` selector to the blogname.
Expand All @@ -32,5 +32,5 @@
* @return void
*/
add_action('customize_preview_init', function () {
wp_enqueue_script('sage/customizer.js', asset('scripts/customizer.js')->uri(), ['customize-preview'], null, true);
bundle('customizer')->enqueueJs(true, ['customize-preview']);
});
22 changes: 3 additions & 19 deletions app/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,15 @@

namespace App;

use function Roots\asset;
use function Roots\bundle;

/**
* Register the theme assets.
*
* @return void
*/
add_action('wp_enqueue_scripts', function () {
wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), ['jquery'], null, true);
wp_enqueue_script('sage/app.js', asset('scripts/app.js')->uri(), ['sage/vendor.js'], null, true);

wp_add_inline_script('sage/vendor.js', asset('scripts/manifest.js')->contents(), 'before');

if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}

wp_enqueue_style('sage/app.css', asset('styles/app.css')->uri(), false, null);
bundle('app')->enqueue();
}, 100);

/**
Expand All @@ -32,14 +23,7 @@
* @return void
*/
add_action('enqueue_block_editor_assets', function () {
if ($manifest = asset('scripts/manifest.asset.php')->load()) {
wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), ...array_values($manifest));
wp_enqueue_script('sage/editor.js', asset('scripts/editor.js')->uri(), ['sage/vendor.js'], null, true);

wp_add_inline_script('sage/vendor.js', asset('scripts/manifest.js')->contents(), 'before');
}

wp_enqueue_style('sage/editor.css', asset('styles/editor.css')->uri(), false, null);
bundle('editor')->enqueue();
}, 100);

/**
Expand Down
41 changes: 41 additions & 0 deletions bud.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @typedef {import('@roots/bud').Bud} Bud
*
* @param {Bud} config
*/

module.exports = async (config) =>
config
/**
* Application entrypoints
*
* Paths are relative to your resources directory
*/
.entry({
app: ['scripts/app.js', 'styles/app.css'],
editor: ['scripts/editor.js', 'styles/editor.css'],
customizer: 'scripts/customizer.js',
})

/**
* These files should be processed as part of the build
* even if they are not explicitly imported in application assets.
*/
.assets(['assets/images'])

/**
* These files will trigger a full page reload
* when modified.
*/
.watch([
'tailwind.config.js',
'resources/views/*.blade.php',
'app/View/**/*.php',
])

/**
* Target URL to be proxied by the dev server.
*
* This is your local dev server.
*/
.proxy({target: 'http://example.test'});
15 changes: 1 addition & 14 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
|
*/

'debug' => WP_DEBUG,
'debug' => WP_DEBUG && WP_DEBUG_DISPLAY,

/*
|--------------------------------------------------------------------------
Expand All @@ -56,19 +56,6 @@

'timezone' => get_option('timezone_string', 'UTC'),

/*
|--------------------------------------------------------------------------
| Global Helpers
|--------------------------------------------------------------------------
|
| This value enables the usage of various Acorn helpers without the need
| to specify a namespace. This defaults to false as to not pollute the
| global namespace.
|
*/

'globals' => false,

/*
|--------------------------------------------------------------------------
| Application Locale Configuration
Expand Down
5 changes: 2 additions & 3 deletions config/assets.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use function Roots\public_path;

return [

/*
Expand Down Expand Up @@ -36,7 +34,8 @@
'theme' => [
'path' => get_theme_file_path('public'),
'url' => get_theme_file_uri('public'),
'assets' => public_path('mix-manifest.json'),
'assets' => public_path('manifest.json'),
'bundles' => public_path('entrypoints.json'),
]
]
];
1 change: 0 additions & 1 deletion config/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Monolog\Handler\SyslogUdpHandler;

use function Roots\env;
use function Roots\storage_path;

return [

Expand Down
2 changes: 0 additions & 2 deletions config/view.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use function Roots\resource_path;

return [

/*
Expand Down
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3'

services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress

wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- '8000:80'
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
working_dir: /var/www/html
volumes:
- ./:/var/www/html/wp-content/themes/sage

volumes:
db_data:
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<body <?php body_class('no-js'); ?>>
<?php wp_body_open(); ?>
<?php do_action('get_header'); ?>

<div id="app">
<?php echo \Roots\view(\Roots\app('sage.view'), \Roots\app('sage.data'))->render(); ?>
<?php echo view(app('sage.view'), app('sage.data'))->render(); ?>
</div>

<?php do_action('get_footer'); ?>
Expand Down
Loading