diff --git a/packages/dnb-design-system-portal/.stylelintignore b/packages/dnb-design-system-portal/.stylelintignore
index 62a85463e19..3b3d2d61a61 100644
--- a/packages/dnb-design-system-portal/.stylelintignore
+++ b/packages/dnb-design-system-portal/.stylelintignore
@@ -1,3 +1,4 @@
*__tests__*
*not_in_use*
PortalStyle.js
+scripts
diff --git a/packages/dnb-design-system-portal/package.json b/packages/dnb-design-system-portal/package.json
index c26516b7735..83950116f92 100644
--- a/packages/dnb-design-system-portal/package.json
+++ b/packages/dnb-design-system-portal/package.json
@@ -18,14 +18,14 @@
"deploy": "yarn deploy-ci",
"deploy-ci": "babel-node ./scripts/deploy.js",
"deploy:fast": "yarn build-portal --prefix-paths && babel-node ./scripts/deploy.js",
- "dev": "nodemon --exec 'gatsby develop' -w 'gatsby-node.js' -w 'gatsby-config.js'",
+ "dev": "nodemon --exec 'gatsby develop' --watch 'gatsby-node.js' --watch 'gatsby-config.js'",
"lint": "eslint --quiet ./src",
"lint-ci": "yarn lint:js && yarn lint:styles",
"lint-staged": "lint-staged",
"lint:js": "yarn lint --fix",
"lint:styles": "stylelint './src/**/*.{js,css}'",
"make-ui-lib-pages": "babel-node ./scripts/uilib/makeDemosFactory.js && yarn prettier:components",
- "make-ui-lib-pages:dev": "nodemon --exec 'yarn make-ui-lib-pages' -e js -w '**/makeDemosFactory.js' -w '**/tasks/*' -w '**/Template.js' -w '**/template.md'",
+ "make-ui-lib-pages:dev": "nodemon --exec 'yarn make-ui-lib-pages' --ext js --watch '**/makeDemosFactory.js' --watch '**/tasks/*' --watch '**/Template.js' --watch '**/template.md'",
"reset": "cd ../../ && yarn reset && cd - && yarn build",
"serve": "live-server public --watch --no-browser --port=8001",
"start": "cross-env DEBUG=gatsby:query-watcher gatsby develop",
diff --git a/packages/dnb-ui-lib/.stylelintignore b/packages/dnb-ui-lib/.stylelintignore
index 8edaa108567..34aa8d6b088 100644
--- a/packages/dnb-ui-lib/.stylelintignore
+++ b/packages/dnb-ui-lib/.stylelintignore
@@ -1,3 +1,4 @@
*__tests__*
*not_in_use*
src/components/slider/Slider.js
+scripts
diff --git a/packages/dnb-ui-lib/assets/icons/add.svg b/packages/dnb-ui-lib/assets/icons/add.svg
index 3033b2e9505..620795ca6c2 100644
--- a/packages/dnb-ui-lib/assets/icons/add.svg
+++ b/packages/dnb-ui-lib/assets/icons/add.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/add_medium.svg b/packages/dnb-ui-lib/assets/icons/add_medium.svg
index 59b26594dc3..ff500e7a9da 100644
--- a/packages/dnb-ui-lib/assets/icons/add_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/add_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/bell_medium.svg b/packages/dnb-ui-lib/assets/icons/bell_medium.svg
index 7fd73f751a4..f7e60d179a6 100644
--- a/packages/dnb-ui-lib/assets/icons/bell_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/bell_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/calendar.svg b/packages/dnb-ui-lib/assets/icons/calendar.svg
index d70940d0776..151c66d87d7 100644
--- a/packages/dnb-ui-lib/assets/icons/calendar.svg
+++ b/packages/dnb-ui-lib/assets/icons/calendar.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/calendar_medium.svg b/packages/dnb-ui-lib/assets/icons/calendar_medium.svg
index 938d7f53713..a50832a9567 100644
--- a/packages/dnb-ui-lib/assets/icons/calendar_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/calendar_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/check.svg b/packages/dnb-ui-lib/assets/icons/check.svg
index 4f0415b3078..a3d587c996e 100644
--- a/packages/dnb-ui-lib/assets/icons/check.svg
+++ b/packages/dnb-ui-lib/assets/icons/check.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/check_medium.svg b/packages/dnb-ui-lib/assets/icons/check_medium.svg
index e58a18d0f62..e73982069c2 100644
--- a/packages/dnb-ui-lib/assets/icons/check_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/check_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/chevron_down.svg b/packages/dnb-ui-lib/assets/icons/chevron_down.svg
index 88a7a9c0c77..52a0777bfc8 100644
--- a/packages/dnb-ui-lib/assets/icons/chevron_down.svg
+++ b/packages/dnb-ui-lib/assets/icons/chevron_down.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/chevron_down_medium.svg b/packages/dnb-ui-lib/assets/icons/chevron_down_medium.svg
index cb4c672a423..db926064444 100644
--- a/packages/dnb-ui-lib/assets/icons/chevron_down_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/chevron_down_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/chevron_left.svg b/packages/dnb-ui-lib/assets/icons/chevron_left.svg
index f165b1fe17d..7b8acee1c07 100644
--- a/packages/dnb-ui-lib/assets/icons/chevron_left.svg
+++ b/packages/dnb-ui-lib/assets/icons/chevron_left.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/chevron_left_medium.svg b/packages/dnb-ui-lib/assets/icons/chevron_left_medium.svg
index 69067ed4fc9..0191018084f 100644
--- a/packages/dnb-ui-lib/assets/icons/chevron_left_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/chevron_left_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/chevron_right.svg b/packages/dnb-ui-lib/assets/icons/chevron_right.svg
index a97f3b5e4d1..7161deb6c61 100644
--- a/packages/dnb-ui-lib/assets/icons/chevron_right.svg
+++ b/packages/dnb-ui-lib/assets/icons/chevron_right.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/chevron_right_medium.svg b/packages/dnb-ui-lib/assets/icons/chevron_right_medium.svg
index 119d2f2abcb..31d042511f5 100644
--- a/packages/dnb-ui-lib/assets/icons/chevron_right_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/chevron_right_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/chevron_up.svg b/packages/dnb-ui-lib/assets/icons/chevron_up.svg
index d8721dd460f..340d18054ae 100644
--- a/packages/dnb-ui-lib/assets/icons/chevron_up.svg
+++ b/packages/dnb-ui-lib/assets/icons/chevron_up.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/chevron_up_medium.svg b/packages/dnb-ui-lib/assets/icons/chevron_up_medium.svg
index c62ef39f9a8..5ca38982ae5 100644
--- a/packages/dnb-ui-lib/assets/icons/chevron_up_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/chevron_up_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/close.svg b/packages/dnb-ui-lib/assets/icons/close.svg
index 0f6f0a50f28..231b91208ab 100644
--- a/packages/dnb-ui-lib/assets/icons/close.svg
+++ b/packages/dnb-ui-lib/assets/icons/close.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/close_medium.svg b/packages/dnb-ui-lib/assets/icons/close_medium.svg
index e561d6f5299..c6f3e002bb4 100644
--- a/packages/dnb-ui-lib/assets/icons/close_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/close_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/exclamation.svg b/packages/dnb-ui-lib/assets/icons/exclamation.svg
index f12ef28706b..6c939f0a37c 100644
--- a/packages/dnb-ui-lib/assets/icons/exclamation.svg
+++ b/packages/dnb-ui-lib/assets/icons/exclamation.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/exclamation_medium.svg b/packages/dnb-ui-lib/assets/icons/exclamation_medium.svg
index 5b3e2667f39..117b98debd3 100644
--- a/packages/dnb-ui-lib/assets/icons/exclamation_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/exclamation_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/fullscreen.svg b/packages/dnb-ui-lib/assets/icons/fullscreen.svg
index c4d1cfd690c..dec68dbea2f 100644
--- a/packages/dnb-ui-lib/assets/icons/fullscreen.svg
+++ b/packages/dnb-ui-lib/assets/icons/fullscreen.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/fullscreen_medium.svg b/packages/dnb-ui-lib/assets/icons/fullscreen_medium.svg
index d1c4f70ce90..699ed01a8c6 100644
--- a/packages/dnb-ui-lib/assets/icons/fullscreen_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/fullscreen_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/hamburger.svg b/packages/dnb-ui-lib/assets/icons/hamburger.svg
index 0c9b8509e47..c1ac3535c94 100644
--- a/packages/dnb-ui-lib/assets/icons/hamburger.svg
+++ b/packages/dnb-ui-lib/assets/icons/hamburger.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/hamburger_medium.svg b/packages/dnb-ui-lib/assets/icons/hamburger_medium.svg
index 11467d0579c..954be0597f7 100644
--- a/packages/dnb-ui-lib/assets/icons/hamburger_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/hamburger_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/logout.svg b/packages/dnb-ui-lib/assets/icons/logout.svg
index 6d432c0a9dc..6c2cc66566b 100644
--- a/packages/dnb-ui-lib/assets/icons/logout.svg
+++ b/packages/dnb-ui-lib/assets/icons/logout.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/logout_medium.svg b/packages/dnb-ui-lib/assets/icons/logout_medium.svg
index 10acdcc6800..4b5e9783dea 100644
--- a/packages/dnb-ui-lib/assets/icons/logout_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/logout_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/more.svg b/packages/dnb-ui-lib/assets/icons/more.svg
index e70c8aef485..055919dc6f7 100644
--- a/packages/dnb-ui-lib/assets/icons/more.svg
+++ b/packages/dnb-ui-lib/assets/icons/more.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/more_medium.svg b/packages/dnb-ui-lib/assets/icons/more_medium.svg
index 2fa19a26d10..3c0bfb27d65 100644
--- a/packages/dnb-ui-lib/assets/icons/more_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/more_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/question.svg b/packages/dnb-ui-lib/assets/icons/question.svg
index e2e080ee975..e5d93869607 100644
--- a/packages/dnb-ui-lib/assets/icons/question.svg
+++ b/packages/dnb-ui-lib/assets/icons/question.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/question_medium.svg b/packages/dnb-ui-lib/assets/icons/question_medium.svg
index c0830de8610..f09a407d99a 100644
--- a/packages/dnb-ui-lib/assets/icons/question_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/question_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/save.svg b/packages/dnb-ui-lib/assets/icons/save.svg
index 06820ca3b39..6a1d52a1694 100644
--- a/packages/dnb-ui-lib/assets/icons/save.svg
+++ b/packages/dnb-ui-lib/assets/icons/save.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/save_medium.svg b/packages/dnb-ui-lib/assets/icons/save_medium.svg
index 912889ff3cb..f2870dabae5 100644
--- a/packages/dnb-ui-lib/assets/icons/save_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/save_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/search.svg b/packages/dnb-ui-lib/assets/icons/search.svg
index 6c372f1670d..04160f3a120 100644
--- a/packages/dnb-ui-lib/assets/icons/search.svg
+++ b/packages/dnb-ui-lib/assets/icons/search.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/search_medium.svg b/packages/dnb-ui-lib/assets/icons/search_medium.svg
index a13074de20b..54763c6f2f7 100644
--- a/packages/dnb-ui-lib/assets/icons/search_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/search_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/subtract.svg b/packages/dnb-ui-lib/assets/icons/subtract.svg
index 758070f3a18..93742790733 100644
--- a/packages/dnb-ui-lib/assets/icons/subtract.svg
+++ b/packages/dnb-ui-lib/assets/icons/subtract.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/subtract_medium.svg b/packages/dnb-ui-lib/assets/icons/subtract_medium.svg
index f7e22b6f9f6..367627e6f62 100644
--- a/packages/dnb-ui-lib/assets/icons/subtract_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/subtract_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/trash.svg b/packages/dnb-ui-lib/assets/icons/trash.svg
index 7de12a3866d..d22604f6dd1 100644
--- a/packages/dnb-ui-lib/assets/icons/trash.svg
+++ b/packages/dnb-ui-lib/assets/icons/trash.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/assets/icons/trash_medium.svg b/packages/dnb-ui-lib/assets/icons/trash_medium.svg
index 4d2ef3b6850..8410db4c3fe 100644
--- a/packages/dnb-ui-lib/assets/icons/trash_medium.svg
+++ b/packages/dnb-ui-lib/assets/icons/trash_medium.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/package-scripts.js b/packages/dnb-ui-lib/package-scripts.js
index ff296c6133d..bd9e86238ac 100644
--- a/packages/dnb-ui-lib/package-scripts.js
+++ b/packages/dnb-ui-lib/package-scripts.js
@@ -29,8 +29,7 @@ module.exports = {
},
figma: {
default: 'yarn figma',
- dev: 'yarn figma:dev',
- update: 'yarn figma:force'
+ dev: 'yarn figma:dev'
},
sb: 'yarn story',
test: {
diff --git a/packages/dnb-ui-lib/package.json b/packages/dnb-ui-lib/package.json
index f84b0dc2458..f6a311ae994 100644
--- a/packages/dnb-ui-lib/package.json
+++ b/packages/dnb-ui-lib/package.json
@@ -22,15 +22,16 @@
"cdn": "live-server --no-browser --cors --port=8081",
"precommit": "yarn lint-staged",
"dev:convertIcons": "nodemon --exec 'babel-node ./scripts/tools/convertIcons' --ignore '/icons/**' --ignore '*.json'",
- "dev:prepareTemplates": "nodemon --exec 'yarn babel-node ./scripts/prepub/tasks/prepareTemplates.js' -e js -w './scripts/prepub/tasks/prepareTemplates.js' -w '**/index_template.js'",
- "dev:styleFactory": "nodemon --exec 'babel-node ./scripts/prepub/tasks/styleFactory.js' -e js -w './scripts/prepub/tasks/styleFactory.js'",
- "dev:themeFactory": "nodemon --exec 'babel-node ./scripts/prepub/tasks/themeFactory.js' -e js -w './scripts/prepub/tasks/themeFactory.js'",
- "figma": "babel-node ./scripts/figma/updateData",
+ "dev:prepareTemplates": "nodemon --exec 'yarn babel-node ./scripts/prepub/tasks/prepareTemplates.js' --ext js --watch './scripts/prepub/tasks/prepareTemplates.js' --watch '**/index_template.js'",
+ "dev:styleFactory": "nodemon --exec 'babel-node ./scripts/prepub/tasks/styleFactory.js' --ext js --watch './scripts/prepub/tasks/styleFactory.js'",
+ "dev:themeFactory": "nodemon --exec 'babel-node ./scripts/prepub/tasks/themeFactory.js' --ext js --watch './scripts/prepub/tasks/themeFactory.js'",
+ "figma": "babel-node ./scripts/figma/updateAll",
"figma-ci-build": "yarn figma",
"figma-ci-commit": "babel-node ./scripts/figma/tasks/commitChanges",
"figma:dev:commit": "nodemon --exec 'babel-node ./scripts/figma/tasks/commitChanges'",
- "figma:dev:icons": "nodemon --exec 'babel-node ./scripts/figma/updateIcons'",
- "figma:force": "yarn figma -u && babel-node ./scripts/tools/convertIcons",
+ "figma:dev:icons": "nodemon --exec 'babel-node ./scripts/figma/updateIcons' --ignore '*.svg' --ignore '*.json'",
+ "figma:refetch": "yarn figma -u",
+ "figma:reset": "babel-node ./scripts/figma/reset && yarn build",
"lint": "eslint --quiet ./src ./scripts ./stories",
"lint-ci": "yarn lint:js && yarn lint:styles",
"lint-staged": "lint-staged -d",
@@ -39,7 +40,7 @@
"publish": "yarn publish-ci --dry-run",
"prepublish-ci": "yarn figma-ci-build && yarn prepublish:local && yarn figma-ci-commit",
"publish-ci": "babel-node ./scripts/release --ci",
- "prepublish:dev": "nodemon --exec 'babel-node ./scripts/prepub/dev.js' -w 'rollup.config.js' -e js,html,json,css,scss -w './src/style/**/*' -w './scripts/**/*' --ignore '*.json'",
+ "prepublish:dev": "nodemon --exec 'babel-node ./scripts/prepub/dev.js' --watch 'rollup.config.js' --ext js,html,json,css,scss --watch './src/style/**/*' --watch './scripts/**/*' --ignore '*.json'",
"publish:disabled": "yarn publish:prerelease && npm publish ./dnb-ui-lib-v*.tgz --preid=ci --npm-tag=ci",
"prepublish:local": "babel-node ./scripts/prepub/runPrepub.js",
"publish:postpack": "yarn pack && nodemon --exec 'babel-node ./scripts/release/postpack.js' ",
@@ -58,7 +59,7 @@
"prettier:other": "prettier --loglevel warn --write '{scripts,src}/**/*.{json,md}' --write '.babelrc' && yarn prettier:package",
"prettier:package": "prettier-package-json --write ./package.json",
"prettier:styles": "prettier --loglevel warn --parser scss --write 'src/**/*.scss'",
- "umd:dev": "nodemon -x 'yarn umd' -e js,html,json,css,scss -w './src/components/**/*' -w './src/patterns/**/*' -w './src/style/**/*' -w './scripts/**/*' --ignore '*.json'"
+ "umd:dev": "nodemon -x 'yarn umd' --ext js,html,json,css,scss --watch './src/components/**/*' --watch './src/patterns/**/*' --watch './src/style/**/*' --watch './scripts/**/*' --ignore '*.json'"
},
"dependencies": {
"classnames": "^2.2.6",
diff --git a/packages/dnb-ui-lib/scripts/figma/FigmaAPI.js b/packages/dnb-ui-lib/scripts/figma/FigmaAPI.js
index 2c3fae0efed..e0d4b807086 100644
--- a/packages/dnb-ui-lib/scripts/figma/FigmaAPI.js
+++ b/packages/dnb-ui-lib/scripts/figma/FigmaAPI.js
@@ -1,5 +1,5 @@
/**
- * Node
+ * The main Figma Task runner
*
*/
@@ -36,16 +36,17 @@ export const fetchFigmaIcons = async (args = {}) => {
}
}
-export const fetchFigmaData = async ({
+export const fetchFigmaAll = async ({
figmaDoc = null,
figmaFile = null,
+ ignoreBranchCheck = null,
...rest
} = {}) => {
try {
// make sure we are on the develop branch
const branchName = await getBranchName({ requiredBranch: 'develop' })
- if (!branchName) {
+ if (ignoreBranchCheck !== true && !branchName) {
log.fail('> Figma: Could not continue, as we require another branch')
return
}
diff --git a/packages/dnb-ui-lib/scripts/figma/helpers/docHelpers.js b/packages/dnb-ui-lib/scripts/figma/helpers/docHelpers.js
index c129abb9c80..d480fe87637 100644
--- a/packages/dnb-ui-lib/scripts/figma/helpers/docHelpers.js
+++ b/packages/dnb-ui-lib/scripts/figma/helpers/docHelpers.js
@@ -1,5 +1,5 @@
/**
- * Node
+ * Figma Task
*
*/
@@ -328,30 +328,38 @@ export const safeFileToDisk = (
{ file = '.tmp/file.json', url },
{ errorExceptionType = ERROR_FATAL }
) =>
- new Promise(resolve => {
+ new Promise(async resolve => {
const localFile = /\//.test(file)
? file
: path.resolve(__dirname, `../.cache/${file}`)
- const stream = fs.createWriteStream(localFile)
- stream.on('error', err => {
- stream.end()
- new ErrorHandler(
- 'Failed on createWriteStream',
- err,
- errorExceptionType
- )
- })
- stream.on('end', (err, content) => {
- stream.end()
- console.log('\n\nerr', err, content)
- new ErrorHandler('Failed on createWriteStream', err)
- })
- stream.on('finish', () => {
- stream.close()
- resolve({ file: localFile })
- })
+ const resetContent = fs.existsSync(localFile)
+ ? await fs.readFile(localFile, 'utf-8')
+ : null
+ const writeStream = fs.createWriteStream(localFile)
+ writeStream
+ .on('error', err => {
+ writeStream.end()
+ new ErrorHandler(
+ 'Failed on createWriteStream',
+ err,
+ errorExceptionType
+ )
+ })
+ .on('finish', async () => {
+ writeStream.close()
+
+ // reset the file, if its empty
+ if (resetContent) {
+ const newContent = await fs.readFile(localFile, 'utf-8')
+ if (String(newContent).trim().length === 0) {
+ await fs.writeFile(localFile, resetContent)
+ }
+ }
+
+ resolve({ localFile })
+ })
https
- .get(url, response => response.pipe(stream))
+ .get(url, response => response.pipe(writeStream))
.on('error', async err => {
try {
await fs.unlink(localFile)
diff --git a/packages/dnb-ui-lib/scripts/figma/index.js b/packages/dnb-ui-lib/scripts/figma/index.js
index 4eb07c7c215..6157f918b1b 100644
--- a/packages/dnb-ui-lib/scripts/figma/index.js
+++ b/packages/dnb-ui-lib/scripts/figma/index.js
@@ -1,11 +1,11 @@
/**
- * Figma API
+ * The main Figma Task runner
*
*/
import {
- fetchFigmaData,
+ fetchFigmaAll,
fetchFigmaStyles,
fetchFigmaIcons
} from './FigmaAPI'
-export { fetchFigmaData, fetchFigmaStyles, fetchFigmaIcons }
+export { fetchFigmaAll, fetchFigmaStyles, fetchFigmaIcons }
diff --git a/packages/dnb-ui-lib/scripts/figma/reset.js b/packages/dnb-ui-lib/scripts/figma/reset.js
new file mode 100644
index 00000000000..64c4350dd3d
--- /dev/null
+++ b/packages/dnb-ui-lib/scripts/figma/reset.js
@@ -0,0 +1,39 @@
+/**
+ * Figma Reset
+ *
+ * Use this to reset and redownload all content and styles
+ *
+ */
+
+import fs from 'fs-extra'
+import path from 'path'
+import { log, ErrorHandler } from '../lib'
+import { fetchFigmaAll } from './index'
+
+export const runFigmaReset = async () => {
+ log.start('Resetting Figma content and styles')
+ try {
+ const versionLockFile = path.resolve(__dirname, './version.lock')
+ if (fs.existsSync(versionLockFile)) {
+ await fs.unlink(versionLockFile)
+ }
+ const iconsLockFile = path.resolve(
+ __dirname,
+ '../../src/icons/icons.lock'
+ )
+ if (fs.existsSync(iconsLockFile)) {
+ await fs.unlink(iconsLockFile)
+ }
+ } catch (e) {
+ log.fail(e)
+ new ErrorHandler(e)
+ }
+}
+
+runFigmaReset().then(() =>
+ fetchFigmaAll({ forceRefetch: true, ignoreBranchCheck: true }).then(
+ () => {
+ log.succeed('Resetting Figma is done')
+ }
+ )
+)
diff --git a/packages/dnb-ui-lib/scripts/figma/tasks/componentsStyleConverter.js b/packages/dnb-ui-lib/scripts/figma/tasks/componentsStyleConverter.js
index c104c313744..b00a16dcb21 100644
--- a/packages/dnb-ui-lib/scripts/figma/tasks/componentsStyleConverter.js
+++ b/packages/dnb-ui-lib/scripts/figma/tasks/componentsStyleConverter.js
@@ -1,5 +1,5 @@
/**
- * Node
+ * Figma Task
*
*/
diff --git a/packages/dnb-ui-lib/scripts/figma/tasks/extractSassVarsToJson.js b/packages/dnb-ui-lib/scripts/figma/tasks/extractSassVarsToJson.js
index 83f07fb9c24..f6e65dcb34c 100644
--- a/packages/dnb-ui-lib/scripts/figma/tasks/extractSassVarsToJson.js
+++ b/packages/dnb-ui-lib/scripts/figma/tasks/extractSassVarsToJson.js
@@ -1,5 +1,5 @@
/**
- * Task
+ * Figma Task
*
*/
diff --git a/packages/dnb-ui-lib/scripts/figma/tasks/extractStylesFromFigmaDoc.js b/packages/dnb-ui-lib/scripts/figma/tasks/extractStylesFromFigmaDoc.js
index e30f1f1f37b..b4b793a66d9 100644
--- a/packages/dnb-ui-lib/scripts/figma/tasks/extractStylesFromFigmaDoc.js
+++ b/packages/dnb-ui-lib/scripts/figma/tasks/extractStylesFromFigmaDoc.js
@@ -1,5 +1,5 @@
/**
- * Task
+ * Figma Task
*
*/
diff --git a/packages/dnb-ui-lib/scripts/figma/tasks/iconsConverter.js b/packages/dnb-ui-lib/scripts/figma/tasks/iconsConverter.js
index ef61ce2925b..441b1b07afe 100644
--- a/packages/dnb-ui-lib/scripts/figma/tasks/iconsConverter.js
+++ b/packages/dnb-ui-lib/scripts/figma/tasks/iconsConverter.js
@@ -1,5 +1,5 @@
/**
- * Node
+ * Figma Task
*
*/
@@ -30,6 +30,7 @@ const iconsDest = path.resolve(__dirname, `../../../assets/icons`)
export const IconsConverter = async ({
figmaDoc = null,
figmaFile = null,
+ forceReconvert = null,
...rest
}) => {
if (!figmaFile) {
@@ -37,7 +38,10 @@ export const IconsConverter = async ({
}
if (figmaDoc === null) {
- figmaDoc = await getFigmaDoc({ figmaFile })
+ figmaDoc = await getFigmaDoc({
+ figmaFile,
+ preventUpdate: forceReconvert
+ })
}
// juce out, if no changes
@@ -73,7 +77,7 @@ export const IconsConverter = async ({
const runFrameIconsFactory = async ({
frameDoc,
figmaFile,
- forceReconvert = null
+ forceRedownload = null
}) => {
if (/#skip/.test(frameDoc.name)) {
return undefined
@@ -145,8 +149,6 @@ const runFrameIconsFactory = async ({
} icons from the "${originalFrameName}" Canvas`
)
- // console.log('\n\niconIdsToFetchFrom', iconIdsToFetchFrom, iconIdsFromDoc)
-
// go and load additional images
const listOfAdditionalIconUrls = Object.entries(
await getFigmaUrlByImageIds({
@@ -175,7 +177,7 @@ const runFrameIconsFactory = async ({
const iconName = prepareIconName(name, iconNameAdditions)
// deifine the filePath
- const filePath = path.resolve(iconsDest, iconName)
+ const file = path.resolve(iconsDest, iconName)
// check if frame content exists in the lock file
const lockFileFrameContent =
@@ -192,22 +194,24 @@ const runFrameIconsFactory = async ({
}
if (
- forceReconvert !== true &&
+ forceRedownload !== true &&
// compare the current id with the one in the lock file
// if the id is the same, and the file exists, this version is not changed
- (lockFileFrameContent && lockFileFrameContent.id === id) &&
+ lockFileFrameContent &&
+ lockFileFrameContent.id === id &&
// and also compare for the frameId, as they may have been upadted
(lockFileFrameContent &&
lockFileFrameContent.slug === md5(figmaFile + frameId)) &&
- fs.existsSync(filePath)
+ fs.existsSync(file)
) {
log.text = `> Figma: File already exists: ${iconName}`
} else {
log.text = `> Figma: Saving file to disk: ${iconName}`
- const { file } = await safeFileToDisk(
+ // console.log('\n\n has url?', file, url)
+ await safeFileToDisk(
{
- file: filePath,
+ file,
url,
id // id is not used for now
},
@@ -216,13 +220,17 @@ const runFrameIconsFactory = async ({
}
)
- await optimizeSVG({ file })
-
ret.timestamp = Date.now()
- log.info(`> Figma: Icon was prepared and saved: ${iconName}`)
+ log.info(
+ `> Figma: Icon was saved: ${iconName} (${ret.timestamp})`
+ )
}
+ await optimizeSVG({ file })
+
+ log.text = `> Figma: Icon was prepared: ${iconName}`
+
return ret
} catch (e) {
log.fail(e)
@@ -266,17 +274,21 @@ const prepareIconName = (name, iconNameAdditions = []) => {
const optimizeSVG = ({ file }) => {
const transformSvg = async content => {
const plugins = [
- {
- removeAttrs: {
- attrs: [
- 'fill' //remove all fills - if the instance has a defined background color, then things are not showing good. Then then have to allow this setting to be there
- // 'svg:fill'
- // 'svg:xmlns',
- // 'svg:width',
- // 'svg:height'
- ]
- }
- },
+ // {
+ // removeAttrs: {
+ // attrs: [
+ // //remove all fills - if the instance has a defined background color,
+ // // then things are not showing good.
+ // // Then then have to allow this setting to be there!
+ // // 'fill'
+ // // 'svg:fill'
+ // // 'svg:xmlns',
+ // // 'svg:width',
+ // // 'svg:height'
+ // ]
+ // }
+ // },
+ // { convertPathData: false }, // if we prefere to not transform any data paths, we have to disable this
{ cleanupIDs: false },
{ removeViewBox: false },
{ removeDimensions: true }
diff --git a/packages/dnb-ui-lib/scripts/figma/tasks/makeStyleFromFigmaDoc.js b/packages/dnb-ui-lib/scripts/figma/tasks/makeStyleFromFigmaDoc.js
index 1941c5e0f9b..db0b83df675 100644
--- a/packages/dnb-ui-lib/scripts/figma/tasks/makeStyleFromFigmaDoc.js
+++ b/packages/dnb-ui-lib/scripts/figma/tasks/makeStyleFromFigmaDoc.js
@@ -1,5 +1,5 @@
/**
- * Task
+ * Figma Task
*
*/
diff --git a/packages/dnb-ui-lib/scripts/figma/tasks/makeStylePrettier.js b/packages/dnb-ui-lib/scripts/figma/tasks/makeStylePrettier.js
index deb0d3124c5..002614055ab 100644
--- a/packages/dnb-ui-lib/scripts/figma/tasks/makeStylePrettier.js
+++ b/packages/dnb-ui-lib/scripts/figma/tasks/makeStylePrettier.js
@@ -1,5 +1,5 @@
/**
- * Task
+ * Figma Task
*
*/
diff --git a/packages/dnb-ui-lib/scripts/figma/updateAll.js b/packages/dnb-ui-lib/scripts/figma/updateAll.js
new file mode 100644
index 00000000000..b24f46602fc
--- /dev/null
+++ b/packages/dnb-ui-lib/scripts/figma/updateAll.js
@@ -0,0 +1,7 @@
+/**
+ * Run only Figma Doc Task
+ *
+ */
+
+import { fetchFigmaAll } from './index'
+fetchFigmaAll({})
diff --git a/packages/dnb-ui-lib/scripts/figma/updateData.js b/packages/dnb-ui-lib/scripts/figma/updateData.js
deleted file mode 100644
index c3da1c3e453..00000000000
--- a/packages/dnb-ui-lib/scripts/figma/updateData.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Node
- *
- */
-
-import { fetchFigmaData } from './index'
-fetchFigmaData({})
diff --git a/packages/dnb-ui-lib/scripts/figma/updateIcons.js b/packages/dnb-ui-lib/scripts/figma/updateIcons.js
index 1754a6edd8d..5a5a225c42e 100644
--- a/packages/dnb-ui-lib/scripts/figma/updateIcons.js
+++ b/packages/dnb-ui-lib/scripts/figma/updateIcons.js
@@ -1,7 +1,7 @@
/**
- * Node
+ * Run only Figma Icons Task
*
*/
import { fetchFigmaIcons } from './index'
-fetchFigmaIcons({ doRefetch: null, forceReconvert: null })
+fetchFigmaIcons({ doRefetch: null, forceReconvert: true })
diff --git a/packages/dnb-ui-lib/scripts/figma/updateStyles.js b/packages/dnb-ui-lib/scripts/figma/updateStyles.js
index e57a188d309..07da53825e3 100644
--- a/packages/dnb-ui-lib/scripts/figma/updateStyles.js
+++ b/packages/dnb-ui-lib/scripts/figma/updateStyles.js
@@ -1,5 +1,5 @@
/**
- * Node
+ * Run only Figma Styles Task
*
*/
diff --git a/packages/dnb-ui-lib/scripts/figma/version.lock b/packages/dnb-ui-lib/scripts/figma/version.lock
index 8f0cdbae26a..1869234a1a4 100644
--- a/packages/dnb-ui-lib/scripts/figma/version.lock
+++ b/packages/dnb-ui-lib/scripts/figma/version.lock
@@ -1 +1 @@
-{"1a3caba565dddc0a936aaddc29a82887":"101586535"}
\ No newline at end of file
+{"1a3caba565dddc0a936aaddc29a82887":"101675458"}
\ No newline at end of file
diff --git a/packages/dnb-ui-lib/scripts/prepub/updateAndPrepub.js b/packages/dnb-ui-lib/scripts/prepub/updateAndPrepub.js
index 74fe9524743..3116d5c2f65 100644
--- a/packages/dnb-ui-lib/scripts/prepub/updateAndPrepub.js
+++ b/packages/dnb-ui-lib/scripts/prepub/updateAndPrepub.js
@@ -4,13 +4,13 @@
*/
import { runPrepublishTasks, log } from './index'
-import { fetchFigmaData } from '../figma'
+import { fetchFigmaAll } from '../figma'
export const run = async () => {
const doRefetch = true
log.start('Starting the prepublish process...')
log.text = '> Figma: Start fetching figma data ...'
- await fetchFigmaData({ doRefetch })
+ await fetchFigmaAll({ doRefetch })
log.text = '> PrePublish: Start prepublishing ...'
await runPrepublishTasks({ preventDelete: false, doRefetch })
}
diff --git a/packages/dnb-ui-lib/server/run.js b/packages/dnb-ui-lib/server/run.js
index 562636c8ea6..a3c138d6028 100644
--- a/packages/dnb-ui-lib/server/run.js
+++ b/packages/dnb-ui-lib/server/run.js
@@ -6,7 +6,7 @@
import express from 'express'
// import fetch from 'node-fetch'
import dotenv from 'dotenv'
-import { fetchFigmaData } from '../scripts/figma'
+import { fetchFigmaAll } from '../scripts/figma'
import { runPrepublishTasks } from '../scripts/prepub'
// import { yalcPublish } from '../scripts/prepub/yalc'
@@ -26,14 +26,14 @@ app.use((req, res, next) => {
})
app.get('/figma/update', async (request, response) => {
- await fetchFigmaData({ doRefetch: true })
+ await fetchFigmaAll({ doRefetch: true })
await runPrepublishTasks({ preventDelete: true })
console.log('> PrePublish: done!')
response.send('{}')
})
app.get('/figma/update/local', async (request, response) => {
- await fetchFigmaData({ doRefetch: true })
+ await fetchFigmaAll({ doRefetch: true })
await runPrepublishTasks({ preventDelete: true })
console.log('> PrePublish: done!')
// await yalcPublish()
diff --git a/packages/dnb-ui-lib/src/components/button/__tests__/__snapshots__/Button.test.js.snap b/packages/dnb-ui-lib/src/components/button/__tests__/__snapshots__/Button.test.js.snap
index ea0044c348e..be3f59da98e 100644
--- a/packages/dnb-ui-lib/src/components/button/__tests__/__snapshots__/Button.test.js.snap
+++ b/packages/dnb-ui-lib/src/components/button/__tests__/__snapshots__/Button.test.js.snap
@@ -79,11 +79,13 @@ exports[`Button component have to match default button snapshot 1`] = `
>
@@ -175,11 +177,13 @@ exports[`Button component have to match href="..." snapshot 1`] = `
>
diff --git a/packages/dnb-ui-lib/src/components/icon-primary/__tests__/__snapshots__/IconPrimary.test.js.snap b/packages/dnb-ui-lib/src/components/icon-primary/__tests__/__snapshots__/IconPrimary.test.js.snap
index 4bded2991df..8f8077de8fe 100644
--- a/packages/dnb-ui-lib/src/components/icon-primary/__tests__/__snapshots__/IconPrimary.test.js.snap
+++ b/packages/dnb-ui-lib/src/components/icon-primary/__tests__/__snapshots__/IconPrimary.test.js.snap
@@ -24,6 +24,7 @@ exports[`IconPrimary component have to match snapshot 1`] = `
width={null}
>
diff --git a/packages/dnb-ui-lib/src/components/modal/__tests__/__snapshots__/Modal.test.js.snap b/packages/dnb-ui-lib/src/components/modal/__tests__/__snapshots__/Modal.test.js.snap
index c1a869cf1c9..235a9184570 100644
--- a/packages/dnb-ui-lib/src/components/modal/__tests__/__snapshots__/Modal.test.js.snap
+++ b/packages/dnb-ui-lib/src/components/modal/__tests__/__snapshots__/Modal.test.js.snap
@@ -140,11 +140,13 @@ exports[`Modal component have to match snapshot 1`] = `
>
@@ -376,11 +378,13 @@ exports[`Modal component have to match snapshot 1`] = `
>
diff --git a/packages/dnb-ui-lib/src/icons/add.js b/packages/dnb-ui-lib/src/icons/add.js
index 388c879e30b..5b92bdd81d4 100644
--- a/packages/dnb-ui-lib/src/icons/add.js
+++ b/packages/dnb-ui-lib/src/icons/add.js
@@ -3,11 +3,12 @@
import React from 'react'
const add = props => (
-