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 RequireJS with Webpack Encore #285

Merged
merged 20 commits into from
Nov 15, 2019
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"ignore": [
"csbillcore/js/lib/**/*.js",
"csbillcore/js/app.js",
"**/router.js",
"**/router.js"
],
"plugins": [
"@babel/plugin-syntax-dynamic-import"
]
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/web/bundles/**
router.min.js
37 changes: 37 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"parser": "babel-eslint",
"parserOptions": {
"parser": "babel-eslint",
"sourceType": "module"
},
"root": true,
"env": {
"browser": true,
"node": true
},
"plugins": [
"backbone",
"jquery",
"lodash"
],
"extends": [
"eslint:recommended",
"plugin:lodash/recommended",
"plugin:backbone/recommended"
],
"rules": {
"no-else-return": "error",
"no-extra-bind": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-return": "error",
"radix": "error",
"yoda": ["error", "always"],
"no-shadow": "error",
"no-use-before-define": "error",
"quotes": ["error", "single"],
"lodash/import-scope": [2, "member"]
}
}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
web/assets/*
web/bundles/*
web/static
web/bundles
web/css/*
web/js/*
web/fonts/*
Expand Down
14 changes: 2 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ addons:

before_install:
- composer self-update
- composer global require "fxp/composer-asset-plugin"
- mysql -e 'create database solidinvoice_test;'

install:
- composer install -n
- rm bin/r.js && composer install -n --no-scripts # Hack to get npm-assets working after first composer install
- sed -i 's/base_url:\ null/base_url:\ http:\/\/127.0.0.1:9001/g' app/config/parameters.yml

before_script:
Expand Down Expand Up @@ -83,21 +81,13 @@ jobs:
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
- sudo apt-get update -qq
- sudo apt-get install -y -qq yarn=0.24.6-1
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout $(git describe --abbrev=0 --tags)) && source ~/.nvm/nvm.sh && nvm install 8.0
- composer global require "fxp/composer-asset-plugin"
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout $(git describe --abbrev=0 --tags)) && source ~/.nvm/nvm.sh && nvm install 12.0
install:
- composer install -n
- sed -i 's/base_url:\ null/base_url:\ http:\/\/127.0.0.1:9001/g' app/config/parameters.yml
- sed -i 's/database_name:\ solidinvoice/database_name:\ solidinvoice_test/g' app/config/parameters.yml
- yarn
- php bin/console assets:install -n
- rm bin/r.js
- composer install -n --no-scripts
- node_modules/.bin/gulp
- php bin/console fos:js-routing:dump --callback=define -n
- php bin/console bazinga:js-translation:dump --merge-domains -n
- php bin/console oro:requirejs:build -n
- node_modules/.bin/gulp assets
- yarn run dev
before_script:
- php ./bin/console server:start 9001 -n
- sleep 3 # Give php server some time to start
Expand Down
249 changes: 0 additions & 249 deletions Gulpfile.js

This file was deleted.

10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,20 @@ When composer is finished downloading, you can install the required dependencies
$ php composer.phar install
```

After all the dependencies has been installed, the next step is to install all the web assets

```bash
$ php bin/console assets:install --symlink web
```

The final step is to install the Node packages, and compile all the assets

```bash
$ npm install
$ ./node_modules/.bin/gulp
$ npm run dev
```

Now you should have a fully working copy of SolidInvoice.

If you want to run SolidInvoice in production mode, some additional steps is required:

```bash
$ php bin/console fos:js-routing:dump --callback=define
$ php bin/console bazinga:js-translation:dump --merge-domains
$ npm run build
```

Features
Expand Down
2 changes: 1 addition & 1 deletion app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public function registerBundles()
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Symfony\WebpackEncoreBundle\WebpackEncoreBundle(),

new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Oro\Bundle\RequireJSBundle\OroRequireJSBundle(),
new Payum\Bundle\PayumBundle\PayumBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Sylius\Bundle\FlowBundle\SyliusFlowBundle(),
Expand Down