diff --git a/.eslintrc.js b/.eslintrc.js
index 46b3d7146..4efcfb283 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -14,35 +14,35 @@ module.exports = {
browser: true,
},
rules: {
- 'unicorn/prevent-abbreviations': false,
- 'unicorn/prefer-node-append': false,
+ 'unicorn/prevent-abbreviations': 0,
+ 'unicorn/prefer-node-append': 0,
},
overrides: [
{
files: '**/demo/*.js',
rules: {
'unicorn/filename-case': 'off',
- 'import/no-extraneous-dependencies': false
+ 'import/no-extraneous-dependencies': 0
},
},
{
files: ['src/**/*.{story,test}.js'],
rules: {
- 'import/no-extraneous-dependencies': false,
+ 'import/no-extraneous-dependencies': 0,
},
},
{
files: ['php/**/*.story.js'],
rules: {
- 'import/no-extraneous-dependencies': false,
+ 'import/no-extraneous-dependencies': 0,
camelcase: 0,
- 'import/order': false,
+ 'import/order': 0,
},
},
{
files: ['utils/**/*.{js,jsx}'],
rules: {
- 'import/no-extraneous-dependencies': false,
+ 'import/no-extraneous-dependencies': 0,
},
},
],
diff --git a/.gitignore b/.gitignore
index 4f0174c4a..03f7eef0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@ dist
node_modules
vendor
php/packages
+php/dist
+php/images
yarn-error.log
.idea
composer.lock
diff --git a/docs/getting-started.md b/docs/getting-started.md
index a81611c4a..323856a9b 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -183,7 +183,7 @@ yarn render:js
All these commands can be executed at once passing the generated files through prettier:
```bash
-yarn render
+yarn render-php-js
```
The whole process of installing the dependencies, generating the needed files, then linting them and finally launching a storybook instance on port 9002 is done by:
@@ -193,3 +193,21 @@ yarn start:php-ec
```
All output files are stored in `./php/packages/ec` folder.
+
+
+## Deployment of the PHP Twig Storybook
+
+We host the php/js storybook on github: https://ec-europa.github.io/ecl-twig
+To be able to deploy a new version on github there are scripts you can execute:
+
+```bash
+yarn dist:php
+```
+
+It will create the bundle and place it in php/dist
+
+```bash
+yarn deploy:php
+```
+
+It uses the npm package https://www.npmjs.com/package/gh-pages to quickly deploy the php/dist folder on github.
diff --git a/package.json b/package.json
index 7da57d35d..54d2ffff8 100644
--- a/package.json
+++ b/package.json
@@ -3,12 +3,17 @@
"scripts": {
"build:ec": "build-storybook -c ./src/ec/.storybook -o build/ec",
"build:eu": "echo \"Nothing to do...\"",
+ "build-storybook": "build-storybook -c php/.storybook -o php/dist && yarn copy:php && yarn fix-php-dist",
"check:release": "scripts/check-packages.sh",
"check:component": "run-s clean:php \"render:* {1}\" pretty:php \"diff {1}\" --",
"copy:static": "ncp static build",
+ "copy:php": "node_modules/@ecl-twig/php-storybook/resources/get-assets.js",
"clean": "rimraf build dist",
"clean:php": "rimraf build php/packages php/dist",
"dist": "npm-run-all clean build:* copy:static",
+ "dist:php": "npm-run-all clean:php render-php-js build-storybook",
+ "fix-php-dist": "node_modules/@ecl-twig/php-storybook/resources/fix-build.js",
+ "deploy:php": "gh-pages -d php/dist",
"diff": "node_modules/@ecl-twig/php-storybook/scripts/diff.js",
"jest": "jest",
"jest:update": "jest -u",
@@ -65,6 +70,7 @@
"eslint-plugin-react": "7.17.0",
"eslint-plugin-unicorn": "9.1.0",
"file-system": "2.2.2",
+ "gh-pages": "2.1.1",
"html-differ": "1.4.0",
"husky": "2.4.1",
"jest": "24.9.0",
@@ -82,6 +88,7 @@
"prismjs": "1.18.0",
"react": "16.12.0",
"react-dom": "16.12.0",
+ "replace-in-file": "4.2.0",
"rimraf": "2.6.3",
"shellcheck": "0.3.0",
"twing": "2.3.7",
diff --git a/php/php_storybook/resources/fix-build.js b/php/php_storybook/resources/fix-build.js
new file mode 100755
index 000000000..7569c221d
--- /dev/null
+++ b/php/php_storybook/resources/fix-build.js
@@ -0,0 +1,30 @@
+#!/usr/bin/env node
+
+/* eslint-disable no-console, import/no-extraneous-dependencies */
+
+const replace = require('replace-in-file');
+
+const options = {
+ files: 'php/dist/*',
+ from: [
+ /\/icons.svg/g,
+ /\/icons-social.svg/g,
+ /\/logo--en.svg/g,
+ /\/logo--fr.svg/g,
+ /\/logo--mute.svg/g,
+ ],
+ to: [
+ 'icons.svg',
+ 'icons-social.svg',
+ 'logo-en.svg',
+ 'logo--fr.svg',
+ 'logo--mute.svg',
+ ],
+};
+
+replace(options, (error, results) => {
+ if (error) {
+ return console.error('Error occurred:', error);
+ }
+ return console.log('Replacement results:', results);
+});
diff --git a/php/php_storybook/resources/get-assets.js b/php/php_storybook/resources/get-assets.js
new file mode 100755
index 000000000..7e81f79e0
--- /dev/null
+++ b/php/php_storybook/resources/get-assets.js
@@ -0,0 +1,15 @@
+#!/usr/bin/env node
+
+/* eslint-disable import/no-extraneous-dependencies, no-console */
+
+const { ncp } = require('ncp');
+
+const options = {};
+options.dereference = true;
+
+ncp('static/images/', 'php/dist/', options, err => {
+ if (err) {
+ return console.error(err);
+ }
+ return console.log('Assets copied in the php/dist folder');
+});
diff --git a/src/ec/packages/ec-component-icon/__snapshots__/icon.test.js.snap b/src/ec/packages/ec-component-icon/__snapshots__/icon.test.js.snap
index e2b5a00f4..68715c61f 100644
--- a/src/ec/packages/ec-component-icon/__snapshots__/icon.test.js.snap
+++ b/src/ec/packages/ec-component-icon/__snapshots__/icon.test.js.snap
@@ -537,7 +537,7 @@ exports[`EC - Icon UI - icon check renders correctly 1`] = `
focusable="false"
>
`;
@@ -549,7 +549,7 @@ exports[`EC - Icon UI - icon check-filled renders correctly 1`] = `
focusable="false"
>
`;
@@ -561,7 +561,7 @@ exports[`EC - Icon UI - icon close renders correctly 1`] = `
focusable="false"
>
`;
@@ -573,7 +573,7 @@ exports[`EC - Icon UI - icon close-filled renders correctly 1`] = `
focusable="false"
>
`;
@@ -585,7 +585,7 @@ exports[`EC - Icon UI - icon corner-arrow renders correctly 1`] = `
focusable="false"
>
`;
@@ -597,7 +597,7 @@ exports[`EC - Icon UI - icon download renders correctly 1`] = `
focusable="false"
>
`;
@@ -609,7 +609,7 @@ exports[`EC - Icon UI - icon external renders correctly 1`] = `
focusable="false"
>
`;
@@ -621,7 +621,7 @@ exports[`EC - Icon UI - icon fullscreen renders correctly 1`] = `
focusable="false"
>
`;
@@ -633,7 +633,7 @@ exports[`EC - Icon UI - icon minus renders correctly 1`] = `
focusable="false"
>
`;
@@ -645,7 +645,7 @@ exports[`EC - Icon UI - icon plus renders correctly 1`] = `
focusable="false"
>
`;
@@ -657,7 +657,7 @@ exports[`EC - Icon UI - icon rounded-arrow renders correctly 1`] = `
focusable="false"
>
`;
@@ -669,7 +669,7 @@ exports[`EC - Icon UI - icon solid-arrow renders correctly 1`] = `
focusable="false"
>
`;
diff --git a/src/ec/packages/ec-component-icon/demo/data--audio.js b/src/ec/packages/ec-component-icon/demo/data--audio.js
index 602f3c253..4b3a100d9 100644
--- a/src/ec/packages/ec-component-icon/demo/data--audio.js
+++ b/src/ec/packages/ec-component-icon/demo/data--audio.js
@@ -2,6 +2,7 @@ import specs from '@ecl/ec-specs-icon/demo/data--audio';
import adapter from '../adapter';
const data = adapter(specs);
-data.icon.type = 'ui';
+data.icon.type = 'general';
+data.icon.name = 'audio';
export default data;
diff --git a/src/ec/packages/ec-component-icon/demo/data--facebook.js b/src/ec/packages/ec-component-icon/demo/data--facebook.js
index 9802ccf6e..0824ba1ac 100644
--- a/src/ec/packages/ec-component-icon/demo/data--facebook.js
+++ b/src/ec/packages/ec-component-icon/demo/data--facebook.js
@@ -3,5 +3,6 @@ import adapter from '../adapter';
const data = adapter(specs);
data.icon.type = 'branded';
+data.icon.name = 'facebook';
export default data;
diff --git a/src/ec/packages/ec-component-icon/demo/data--success.js b/src/ec/packages/ec-component-icon/demo/data--success.js
index fdfade944..2e2342e9d 100644
--- a/src/ec/packages/ec-component-icon/demo/data--success.js
+++ b/src/ec/packages/ec-component-icon/demo/data--success.js
@@ -3,5 +3,5 @@ import adapter from '../adapter';
const data = adapter(specs);
data.icon.type = 'notifications';
-
+data.icon.name = 'success';
export default data;
diff --git a/yarn.lock b/yarn.lock
index 4cd0f9b21..2c2c38b61 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4280,7 +4280,7 @@ async-limiter@~1.0.0:
resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"
integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==
-async@^2.6.3:
+async@^2.6.1, async@^2.6.3:
version "2.6.3"
resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff"
integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==
@@ -5719,7 +5719,7 @@ commander@2.17.x:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
-commander@^2.11.0, commander@^2.14.1, commander@^2.19.0, commander@^2.20.0, commander@^2.3.0, commander@^2.8.1, commander@^2.9.0, commander@~2.20.3:
+commander@^2.11.0, commander@^2.14.1, commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@^2.3.0, commander@^2.8.1, commander@^2.9.0, commander@~2.20.3:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
@@ -7154,6 +7154,11 @@ elliptic@^6.0.0:
minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.0"
+email-addresses@^3.0.1:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/email-addresses/-/email-addresses-3.1.0.tgz#cabf7e085cbdb63008a70319a74e6136188812fb"
+ integrity sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==
+
emoji-regex@^7.0.1, emoji-regex@^7.0.2:
version "7.0.3"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
@@ -8094,7 +8099,15 @@ filename-reserved-regex@^2.0.0:
resolved "https://registry.yarnpkg.com/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz#abf73dfab735d045440abfea2d91f389ebbfa229"
integrity sha1-q/c9+rc10EVECr/qLZHzieu/oik=
-filenamify@^1.0.1:
+filenamify-url@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/filenamify-url/-/filenamify-url-1.0.0.tgz#b32bd81319ef5863b73078bed50f46a4f7975f50"
+ integrity sha1-syvYExnvWGO3MHi+1Q9GpPeXX1A=
+ dependencies:
+ filenamify "^1.0.0"
+ humanize-url "^1.0.0"
+
+filenamify@^1.0.0, filenamify@^1.0.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/filenamify/-/filenamify-1.2.1.tgz#a9f2ffd11c503bed300015029272378f1f1365a5"
integrity sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=
@@ -8653,6 +8666,20 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"
+gh-pages@2.1.1:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/gh-pages/-/gh-pages-2.1.1.tgz#5be70a92f9cb70404bafabd8bb149c0e9a8c264b"
+ integrity sha512-yNW2SFp9xGRP/8Sk2WXuLI/Gn92oOL4HBgudn6PsqAnuWT90Y1tozJoTfX1WdrDSW5Rb90kLVOf5mm9KJ/2fDw==
+ dependencies:
+ async "^2.6.1"
+ commander "^2.18.0"
+ email-addresses "^3.0.1"
+ filenamify-url "^1.0.0"
+ fs-extra "^7.0.0"
+ globby "^6.1.0"
+ graceful-fs "^4.1.11"
+ rimraf "^2.6.2"
+
gh-release-fetch@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/gh-release-fetch/-/gh-release-fetch-1.0.3.tgz#0740c753ac30100bff8340788e421136b9e62009"
@@ -9481,6 +9508,14 @@ humanize-ms@^1.2.1:
dependencies:
ms "^2.0.0"
+humanize-url@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/humanize-url/-/humanize-url-1.0.1.tgz#f4ab99e0d288174ca4e1e50407c55fbae464efff"
+ integrity sha1-9KuZ4NKIF0yk4eUEB8VfuuRk7/8=
+ dependencies:
+ normalize-url "^1.0.0"
+ strip-url-auth "^1.0.0"
+
husky@2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/husky/-/husky-2.4.1.tgz#dd00f9646f8693b93f7b3a12ba4be00be0eff7ab"
@@ -12562,6 +12597,16 @@ normalize-url@2.0.1:
query-string "^5.0.1"
sort-keys "^2.0.0"
+normalize-url@^1.0.0:
+ version "1.9.1"
+ resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-1.9.1.tgz#2cc0d66b31ea23036458436e3620d85954c66c3c"
+ integrity sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=
+ dependencies:
+ object-assign "^4.0.1"
+ prepend-http "^1.0.0"
+ query-string "^4.1.0"
+ sort-keys "^1.0.0"
+
normalize-url@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559"
@@ -13679,7 +13724,7 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
-prepend-http@^1.0.1:
+prepend-http@^1.0.0, prepend-http@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=
@@ -13972,6 +14017,14 @@ qs@~6.5.2:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
+query-string@^4.1.0:
+ version "4.3.4"
+ resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb"
+ integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s=
+ dependencies:
+ object-assign "^4.1.0"
+ strict-uri-encode "^1.0.0"
+
query-string@^5.0.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb"
@@ -14704,6 +14757,15 @@ replace-ext@0.0.1:
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924"
integrity sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=
+replace-in-file@4.2.0:
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-4.2.0.tgz#be779f4f61a8ee1ab9f917998bd36441673680fe"
+ integrity sha512-9PGYDbU8iQF3W5a0Ariaf4KzYjsZSkonCYiZylwMiYOu0w5Bg9IuT4DqNnibA4zGNVxH//F7Hxh1P25TofAHGw==
+ dependencies:
+ chalk "^2.4.2"
+ glob "^7.1.4"
+ yargs "^13.3.0"
+
replaceall@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/replaceall/-/replaceall-0.1.6.tgz#81d81ac7aeb72d7f5c4942adf2697a3220688d8e"
@@ -15871,6 +15933,11 @@ strip-outer@^1.0.0:
dependencies:
escape-string-regexp "^1.0.2"
+strip-url-auth@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/strip-url-auth/-/strip-url-auth-1.0.1.tgz#22b0fa3a41385b33be3f331551bbb837fa0cd7ae"
+ integrity sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=
+
strong-log-transformer@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/strong-log-transformer/-/strong-log-transformer-2.1.0.tgz#0f5ed78d325e0421ac6f90f7f10e691d6ae3ae10"