How can I upgrade Webpack Encore bundle? - symfony

I have a Symfony 4.4 project and I need to upgrade from symfony/webpack-encore-pack to symfony/webpack-encore-bundle. I want to do it in the best way, so can you tell me what's the best practice to do this operation (to take care of possibile dependencies and so on)?

Temporarily rename your existing webpack.config.js to webpack.config.bak.js to allow Symfony Flex to copy a fresh config there.
Replace symfony/webpack-encore-pack dependency with symfony/webpack-encore-bundle in your composer.json
Run composer update - it should replace the old package with the new one and Symfony Flex will copy default configuration from the recipe: https://github.com/symfony/recipes/tree/master/symfony/webpack-encore-bundle/1.9
Upgrade your yarn/npm dependencies using yarn upgrade #symfony/webpack-encore or npm upgrade #symfony/webpack-encore.
Update your new webpack.config.js with JS/CSS entries from the back up file. Please note that syntax and option names might have changed - check CHANGELOG.md.
Run npm run dev to see if your assets are still building properly.

Related

How to create production stability drupal 8 project using composer?

I've been getting to drupal and recently found out about composer. I use the following command to create a dev drupal instance:
composer create-project drupal-composer/drupal-project:~8.x-dev <folder-name> --stability dev --no-interaction
I was wondering what the package name is for the stable release of drupal.
Thank you.
You shouldn't need to change anything about your core build, both development and production will be running the current build of drupal/core. But modules like Devel or Stage File Proxy can be added to the require-dev section in your composer.json and installed while doing development and kept out of the build on production.
Hopefully this link will help: https://www.drupal.org/docs/8/update/update-core-via-composer#update-drupal-8-core
The very last part about Production environments says to run composer install --no-dev to remove any dev dependencies from the build.

Upgrade symfony from skeleton to website-skeleton

I've just been experimenting with Symfony 4, and started out with a console app, so ran:
composer create-project symfony/skeleton my-project
I now realise that was a mistake, and instead want the website skeleton
composer create-project symfony/website-skeleton my-project
What's the simplest way to upgrade my existing project to have everything that comes in website-skeleton?
If you've just been experimenting, the simplest way would be to create a new project with symfony/website-skeleton and eventually integrate into it the code you developped and want to keep.
symfony/website-skeleton is not an upgrade, it just installs more dependencies by default for users who don't want to install them manually.
So if you really want to keep the existing project, you could add the missing dependencies yourself with composer.
You can find a list of the dependencies here.

Meteor 1.3 node build: doesn't work anymore with React

With 1.2.*, I used to build my staging/production bundles with meteor build, then moving into ./bundle/programs/server and npm install there.
I do the same thing with 1.3 version but now I have error message on trying to run bundle main file with node:
WARNING: npm peer requirements not installed:
- react#0.14.x not installed.
- react-addons-pure-render-mixin#0.14.x not installed.
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
/var/www/builds/1459320997/bundle/programs/server/node_modules/fibers/future.js:267
throw(ex);
^
Error: Can't find npm module 'react'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?
I use react-meteor-data meteor package.
However, I already have "react": "^0.14.8", and "react-addons-linked-state-mixin": "^0.14.8", in my package.json and of course installed it with npm install ... --save and it is working fine on development environment when I use meteor command.
Any additional actions needed to run it? Did they change how meteor package should be build for production and didn't changed their docs? (because I don't see any changes in docs concerning meteor build so far.
Update: I tried to manually npm install these packages into ./bundle/program/server. Now they consequentially requires packages already listed in my package.json. I suppose Meteor just ignore this file on bundle. Will try to add a bug in their tracker.
I used Meteor 1.2 to build new 1.3 code so it is the issue. It happened because currently I build on the server that had another Meteor version.
I used answer from another Stackoverflow user (Ian) Updating all Meteor packages to latest versions
Easiest way is to delete the contents of .meteor/versions and then save

Composer misses to install certain files (app/console, AutoLoader.php, app_dev.php, etc.)

I am developing a web application with Symfony 2. The code of my own bundle that forms the heart of my application and some configurations files for application-wide settings are controlled by Git (mostly the directories, src/MyCompany/MyBundle, app/Resources/config, etc.) The rest is under control of Composer (the framework, 3rd party bundles, etc.)
Up to now, I ran a ./composer self-update && ./composer.phar update once in a while, pushed or fetched source code from the origin of my repository and everything has been working well.
Today, I started a new fresh working directory and experienced some odd problems.
I performed
git clone <my git repo url> www
cd www
composer.phar install
The composer.json is part of my repository, hence it normally suffices to excute Composer in order to install the framework and all required bundles to get a fully working copy of my web application.
But today, composer.phar install stopped prematurely complainig about missing files. Luckily, I still had my old working directory, so I could copy over the missing files manually, and restart composer.phar. I had to repeat these steps several times until I ended with a fully working application.
The files that were missing are
app/console
AutoLoader.php
app_dev.php
AppCache.php
I thought that these files are part of the Symfony framework and expected them to be installed by Composer. Fot this reason they are not under control of my revision control system.
I found this related question. The answer is very generic und not particularly helpful. All it says is that for example app/console should be included into revision control, because it is not installed by Composer (any longer) and that there is a change in the directory structure due to the transition from Symfony 2 to 3. But I know for sure that app/console was installed by Composer in the past. Hence, something changed.
This leads me to the following questions
Is there any complete, up-to-date and official documentation
what should be included in the repository
what should be in .gitignore
what is managed by Composer?
Is there any documentation how to do the transistion from the old directory structure to the new one in preperation of Symfony 3?
I thought I read all README.md, all release information and everything in "Living on the Edge" of the Symfony site, but somehow I missed this.
The clean way to install Symfony2 from scratch with composer, is to use the following command:
composer create-project symfony/framework-standard-edition my_project_name
This will ensure that all basic structures are created. After that, you can still insert your customisations from the previous project.
Then you can add everything – except app/config/parameters.yml as well as the contents of vendor/, app/cache and app/logs – to your repository.
About transitioning to SF3, I guess there’ll be an upgrade path as soon as SF3 is stable enough to create such a document.
1.1. that depends how you want people to be able to fetch your bundle
1.2. I share with you my own .gitignore: beware I use git for my own use to have a security for my files, not to allow people to get my bundle:
# Cache and logs (Symfony2)
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
# Cache and logs (Symfony3)
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
!var/logs/.gitkeep
# Parameters
/app/config/parameters.yml
/app/config/parameters.ini
# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/
# Assets and user uploads
/web/bundles/
/web/uploads/
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data
/build/
# Composer PHAR
1.3. everything that is in composer.json

Installing phpunit - are the sebastian & symfony directories necessary?

When installing phpunit 4.0 using composer (in PHPStorm) I get ....
/phpunit
/sebastian
/symfony
Does anyone know why I get the 2nd two and if there are necessary in any way.
Thanks
these dependencies are necessary as you can see at the composer file of PHPUnit. Before Composer was around and they shipped the software only via PEAR, you need to install all the dependencies by your own. At the end nothing changed.
In case you are concerned about installing all these dependencies over and over again for every PHP project you need PHPUnit, you can install it globally on you system.
Add composer global require 'phpunit/phpunit=3.7.*' to your composer.json.
Yes, those two directories are necessary for PHPUnit to work.
The dependencies in the vendor folder are managed by composer for you, you don't need to worry here. The reason you have them is because you installed PHPUnit.
When you remove PHPUnit and those dependencies aren't required by any other package, they will be removed again.

Resources