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

Modernise frontend code #1559

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*!
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/*
* DO NOT EDIT THIS FILE!
*
* It's auto-generated by sonata-project/dev-kit package.
*/

module.exports = {
presets: ['@babel/preset-env'],
};
41 changes: 41 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*!
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/*
* DO NOT EDIT THIS FILE!
*
* It's auto-generated by sonata-project/dev-kit package.
*/

module.exports = {
parser: '@babel/eslint-parser',
extends: ['airbnb-base', 'prettier'],
env: {
browser: true,
jquery: true,
},
plugins: ['header'],
rules: {
'header/header': [
2,
'block',
[
'!',
' * This file is part of the Sonata Project package.',
' *',
' * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>',
' *',
' * For the full copyright and license information, please view the LICENSE',
' * file that was distributed with this source code.',
' ',
],
2,
],
},
};
49 changes: 49 additions & 0 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# DO NOT EDIT THIS FILE!
#
# It's auto-generated by sonata-project/dev-kit package.

name: Frontend

on:
schedule:
- cron: '30 0 * * *'
push:
branches:
- 4.x
pull_request:

permissions:
contents: read

jobs:
webpack-encore:
name: Webpack Encore

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install NPM dependencies
uses: bahmutov/npm-install@v1

- name: Run Eslint
run: npx eslint assets/js

- name: Run Stylelint
run: npx stylelint assets/scss

- name: Run Prettier
run: npx prettier --check assets

- name: Run Webpack Encore
run: npx encore production

- name: Check if the compilation is up to date
run: git diff --no-patch --exit-code src/**/Resources/public
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assets/vendor
27 changes: 27 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/*
* DO NOT EDIT THIS FILE!
*
* It's auto-generated by sonata-project/dev-kit package.
*/

module.exports = {
customSyntax: 'postcss-scss',
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
plugins: ['stylelint-scss', 'stylelint-order'],
rules: {
'at-rule-no-unknown': null,
'scss/at-rule-no-unknown': true,
'order/order': ['custom-properties', 'declarations'],
'order/properties-alphabetical-order': true,
'selector-class-pattern': null,
},
};
6 changes: 6 additions & 0 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ The following code has been removed since it is not used:

* `Sonata\PageBundle\Controller\AjaxController`
* `Sonata\PageBundle\Controller\BlockController`

## Migration to Webpack

Please check the src/Resources/public and the documentation to see the used CSS and JavaScript.

If you are customising (specially removing standard JavaScript or CSS) assets, this will affect you.
13 changes: 0 additions & 13 deletions assets/gulp/config.js

This file was deleted.

7 changes: 0 additions & 7 deletions assets/gulp/index.js

This file was deleted.

33 changes: 0 additions & 33 deletions assets/gulp/tasks/css.js

This file was deleted.

3 changes: 0 additions & 3 deletions assets/gulp/tasks/default.js

This file was deleted.

26 changes: 0 additions & 26 deletions assets/gulp/tasks/js.js

This file was deleted.

7 changes: 0 additions & 7 deletions assets/gulp/tasks/watch.js

This file was deleted.

22 changes: 0 additions & 22 deletions assets/gulp/util/banner.js

This file was deleted.

7 changes: 0 additions & 7 deletions assets/gulp/util/scriptFilter.js

This file was deleted.

18 changes: 18 additions & 0 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*!
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

// Any SCSS/CSS you require will output into a single css file (app.css in this case)
import '../scss/app.scss';

// Only using droppable widget from jQuery UI library
import 'jquery-ui/ui/widgets/droppable';

// SonataPage custom scripts
import './composer';
import './treeview';
Loading