Commit 40910ba0 authored by Emma's avatar Emma 🏳🌈

Upgrade frontend assets, dev dependencies

parent 982a7c6d
Pipeline #52167093 passed with stages
in 13 minutes and 36 seconds
......@@ -13,11 +13,9 @@ tags
*.bak
*.phar
.DS_Store
/node_modules/
docker-compose.override.yml
# Built assets and uploaded files
/public/build/
/public/js/
/public/media/
/public/submission_images/
......@@ -54,3 +52,10 @@ docker-compose.override.yml
###> symfony/web-server-bundle ###
.web-server-pid
###< symfony/web-server-bundle ###
###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
......@@ -10,7 +10,7 @@ stages:
paths:
- node_modules/
before_script:
- npm install
- yarn
artifacts:
name: "$CI_JOB_NAME"
paths:
......@@ -19,12 +19,12 @@ stages:
build-assets:dev:
<<: *build-assets
script:
- npm run build-dev
- yarn run build-dev
build-assets:prod:
<<: *build-assets
script:
- npm run build-prod
- yarn run build-prod
.php-test: &php-test
stage: test
......
......@@ -19,7 +19,6 @@ body {
display: flex;
flex-direction: column;
min-height: 100%;
margin: 0;
}
a {
......
'use strict';
import $ from 'jquery';
import distanceInWords from 'date-fns/distance_in_words';
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
import isBefore from 'date-fns/is_before';
import { distanceInWords, distanceInWordsToNow, isBefore } from 'date-fns';
import Translator from 'bazinga-translator';
function makeTimesRelative(locale) {
......@@ -33,7 +31,7 @@ function makeTimesRelative(locale) {
function loadLocaleAndMakeTimesRelative(lang) {
lang = lang.toLowerCase().replace('-', '_');
import(`date-fns/locale/${lang}`).then(locale => {
import(`date-fns/locale/${lang}/index.js`).then(locale => {
makeTimesRelative(locale);
}).catch(error => {
if (lang.indexOf('_') !== -1) {
......
......@@ -5,6 +5,7 @@ import $ from 'jquery';
const languageAliases = {
'html': 'xml',
'c': 'cpp',
'js': 'javascript'
};
$(function () {
......@@ -21,15 +22,18 @@ $(function () {
Promise.all([
import('highlight.js/lib/highlight'),
import(`highlight.js/lib/languages/${language}`),
import(`highlight.js/lib/languages/${language}.js`),
import(`highlight.js/styles/${theme}.css`),
]).then(imports => {
const [hljs, definition] = imports;
const [
{ default: hljs },
{ default: definition}
] = imports;
console.log(imports, hljs, definition);
hljs.registerLanguage(language, definition);
hljs.highlightBlock(this);
}).catch(e => {
console && console.log(e);
});
});
});
'use strict';
import '@babel/polyfill';
import 'bazinga-translator';
import { distanceInWords, distanceInWordsToNow, isBefore } from 'date-fns';
import 'jquery';
import 'lodash.debounce';
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ccc10338595928f5a50965915167dfb6",
"content-hash": "526f2c3236fea37660a83d8a5bf236eb",
"packages": [
{
"name": "composer/ca-bundle",
......@@ -6950,6 +6950,60 @@
],
"time": "2019-01-16T20:31:39+00:00"
},
{
"name": "symfony/webpack-encore-bundle",
"version": "v1.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/webpack-encore-bundle.git",
"reference": "e23e9d32abd7fb62b84ad0ff62b235b517c61bc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/e23e9d32abd7fb62b84ad0ff62b235b517c61bc4",
"reference": "e23e9d32abd7fb62b84ad0ff62b235b517c61bc4",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/asset": "^3.4 || ^4.0",
"symfony/config": "^3.4 || ^4.0",
"symfony/contracts": "^1.0",
"symfony/dependency-injection": "^3.4 || ^4.0",
"symfony/http-kernel": "^3.4 || ^4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"symfony/framework-bundle": "^3.4 || ^4.0",
"symfony/phpunit-bridge": "^3.4 || ^4.1",
"symfony/twig-bundle": "^3.4 || ^4.0",
"twig/twig": "^1.35 || ^2.0"
},
"type": "symfony-bundle",
"extra": {
"thanks": {
"name": "symfony/webpack-encore",
"url": "https://github.com/symfony/webpack-encore"
}
},
"autoload": {
"psr-4": {
"Symfony\\WebpackEncoreBundle\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Integration with your Symfony app & Webpack Encore!",
"time": "2019-03-04T15:09:28+00:00"
},
{
"name": "twig/extensions",
"version": "v1.5.4",
......
......@@ -23,4 +23,5 @@ return [
Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true],
EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
......@@ -15,7 +15,6 @@ framework:
php_errors:
log: true
assets:
json_manifest_path: "%kernel.project_dir%/public/build/manifest.json"
packages:
# package for assets that don't go through webpack's cache-busting
static_asset:
......
webpack_encore:
# The path where Encore is building the assets.
# This should match Encore.setOutputPath() in webpack.config.js.
output_path: '%kernel.project_dir%/public/build'
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: '%kernel.debug%'
......@@ -28,9 +28,8 @@ services:
- ./.git:/app/.git:ro
- ./:/app
assets:
image: node:10-alpine
command: ["sh", "-c", "npm install && npm run watch"]
build: docker/node
command: ["sh", "-c", "yarn && yarn run watch"]
volumes:
- ./.git:/app/.git:ro
- ./:/app:rw
working_dir: /app
FROM node:10-alpine
RUN set -ex && \
apk --no-cache add git
WORKDIR /app
This diff is collapsed.
{
"private": true,
"devDependencies": {
"@symfony/webpack-encore": "^0.17.0",
"babel-eslint": "^8.2.3",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-es2015": "^6.24.1",
"eslint": "^4.19.1",
"font-blast": "^0.6.1",
"fontello-cli": "^0.4.0",
"less": "^2.7.3",
"@symfony/webpack-encore": "^0.24.0",
"fontello-cli": "git+https://git@gitlab.com/postmill/fontello-cli.git",
"less": "^3.9.0",
"less-loader": "^4.1.0",
"natives": "^1.1.6",
"webpack": "^3.11.0",
"webpack-merge": "^4.1.2"
"webpack-merge": "^4.2.1"
},
"dependencies": {
"babel-polyfill": "^6.26.0",
"@babel/polyfill": "^7.2.5",
"bazinga-translator": "^2.6.6",
"date-fns": "^1.29.0",
"highlight.js": "^9.12.0",
"date-fns": "^1.30.1",
"highlight.js": "^9.15.6",
"jquery": "^3.3.1",
"lodash.debounce": "^4.0.8",
"normalize.css": "^6.0.0",
"normalize.css": "^8.0.1",
"select2": "^4.0.5",
"typeface-roboto": "0.0.54",
"typeface-roboto-mono": "0.0.54"
},
"scripts": {
"build-dev": "node_modules/.bin/encore dev",
"build-prod": "node_modules/.bin/encore production",
"build-dev": "encore dev",
"build-prod": "encore production",
"lint": "npm run lint:js",
"lint:js": "node_modules/.bin/eslint assets/js webpack.config.js",
"watch": "node_modules/.bin/encore dev --watch"
"lint:js": "eslint assets/js webpack.config.js",
"watch": "encore dev --watch"
}
}
......@@ -404,6 +404,9 @@
"symfony/polyfill-intl-icu": {
"version": "v1.6.0"
},
"symfony/polyfill-intl-idn": {
"version": "v1.10.0"
},
"symfony/polyfill-mbstring": {
"version": "v1.6.0"
},
......@@ -533,6 +536,23 @@
"ref": "c72d107d077f1654428edaed69415d0228c1aefe"
}
},
"symfony/webpack-encore-bundle": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "1b88cff897d383c45522a457ea9daba85a9b9ab2"
},
"files": [
"assets/css/app.css",
"assets/js/app.js",
"config/packages/assets.yaml",
"config/packages/webpack_encore.yaml",
"package.json",
"webpack.config.js"
]
},
"symfony/yaml": {
"version": "v4.0.3"
},
......
......@@ -67,9 +67,7 @@
<script src="{{ path('fos_js_routing_js', {callback: 'fos.Router.setData'}) }}"></script>
{% endif %}
<script src="{{ preload(asset('build/manifest.js')) }}"></script>
<script src="{{ preload(asset('build/vendor.js')) }}"></script>
<script src="{{ preload(asset('build/main.js')) }}"></script>
{{ encore_entry_script_tags('main') }}
{% if app.environment != 'dev' or app.request.query.has('static_assets') %}
<script src="{{ preload(asset('js/translations/config.js', 'static_asset')) }}"></script>
......
......@@ -4,29 +4,18 @@ const Encore = require('@symfony/webpack-encore');
const merge = require('webpack-merge');
Encore
.setOutputPath('public/build/')
.setPublicPath('/build')
.addEntry('main', './assets/js/main.js')
.addStyleEntry('core', './assets/css/core.less')
.addStyleEntry('postmill', './assets/css/postmill.css')
.addStyleEntry('postmill-night', './assets/css/postmill-night.css')
.cleanupOutputBeforeBuild()
.enableLessLoader()
.enableSingleRuntimeChunk()
.enableSourceMaps(!Encore.isProduction())
.addStyleEntry('postmill', './assets/less/postmill.css')
.addStyleEntry('postmill-night', './assets/less/postmill-night.css')
.addStyleEntry('core', './assets/less/core.less')
.createSharedEntry('vendor', [
'babel-polyfill',
'bazinga-translator',
'date-fns/distance_in_words',
'date-fns/distance_in_words_to_now',
'date-fns/is_before',
'jquery',
'lodash.debounce',
])
.addEntry('main', './assets/js/main.js')
.configureBabel(babelConfig => {
babelConfig.presets.push(['es2015', { modules: false }]);
babelConfig.plugins = ['syntax-dynamic-import'];
})
.enableVersioning();
.enableVersioning()
.setOutputPath('public/build/')
.setPublicPath('/build')
.createSharedEntry('vendor', './assets/js/vendor.js');
module.exports = merge(Encore.getWebpackConfig(), {
externals: {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment