From 8d47585bf998a86b402284fe3a5220b9701016c5 Mon Sep 17 00:00:00 2001 From: CICD Date: Fri, 21 Feb 2020 17:07:40 +0000 Subject: [PATCH 01/50] Release 1.0.8 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1858a71..044a800 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "figma-react", - "version": "1.0.7", + "version": "1.0.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 51a3b1c..ebfca8e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "figma-react", "description": "This is a tool to help you export Figma project into React mockups", - "version": "1.0.7", + "version": "1.0.8", "private": false, "author": "Maxim Karpov ", "repository": { From e1644f005ecedd2a59f2301b33f3f9284ef487b2 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:02:13 +0100 Subject: [PATCH 02/50] test cicd --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ad4d160..d5c4462 100644 --- a/README.md +++ b/README.md @@ -98,3 +98,4 @@ figmaReact.runFigmaReact(options).catch(err => { `npm link` This repository uses Git Flow + From 495c6221625399cbffc75a9e9d11da2d9c306d73 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:04:53 +0100 Subject: [PATCH 03/50] test cicd --- .github/workflows/npm_master_release_patch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index e523199..1edd99d 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -24,5 +24,5 @@ jobs: - run: git config --global user.name "CICD" - run: npm run release:patch env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} NODE_AUTH_TOKEN: ${{secrets.npm_token}} From 3cabb9656d92e6925cc9de202d9bd5e30917c3e7 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:05:11 +0100 Subject: [PATCH 04/50] test cicd --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d5c4462..c884d24 100644 --- a/README.md +++ b/README.md @@ -99,3 +99,4 @@ figmaReact.runFigmaReact(options).catch(err => { This repository uses Git Flow + From 332d95135a3aa86fdae7a6e9317a0f9f04383e3d Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:17:01 +0100 Subject: [PATCH 05/50] test cicd --- .github/workflows/npm_master_release_patch.yml | 1 + package.json | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index 1edd99d..b3a8d83 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -25,4 +25,5 @@ jobs: - run: npm run release:patch env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN_CICD: ${{secrets.GITHUB_TOKEN_CICD}} NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/package.json b/package.json index ebfca8e..5aa93b0 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,10 @@ "format": "prettier --write \"**/*.js\"", "lint": "eslint \"**/*.js\"", "is-master": "git-branch-is master", - "release:current-branch": "release-it", - "release:current-branch:patch": "release-it patch -n", - "release:current-branch:minor": "release-it minor -n", - "release:current-branch:major": "release-it major -n", + "release:current-branch": "GITHUB_TOKEN=$GITHUB_TOKEN_CICD release-it", + "release:current-branch:patch": "GITHUB_TOKEN=$GITHUB_TOKEN_CICD release-it patch -n", + "release:current-branch:minor": "GITHUB_TOKEN=$GITHUB_TOKEN_CICD release-it minor -n", + "release:current-branch:major": "GITHUB_TOKEN=$GITHUB_TOKEN_CICD release-it major -n", "release": "run-s is-master lint release:current-branch", "release:patch": "run-s is-master lint release:current-branch:patch", "release:minor": "run-s is-master lint release:current-branch:minor", @@ -38,10 +38,14 @@ }, "release-it": { "git": { - "tagName": "v${version}" + "tagName": "v${version}", + "push": false }, "github": { "release": true + }, + "hooks": { + "after:git:release": "git push origin HEAD" } }, "dependencies": { From 9c1c68123217de6e6d49706cdbfbb21259d3cec3 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:17:14 +0100 Subject: [PATCH 06/50] test cicd --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c884d24..d5c4462 100644 --- a/README.md +++ b/README.md @@ -99,4 +99,3 @@ figmaReact.runFigmaReact(options).catch(err => { This repository uses Git Flow - From 4f6a4cc5f987c68ed51c5021dc75983d8504d1f1 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:26:44 +0100 Subject: [PATCH 07/50] test cicd --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5aa93b0..476758e 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,10 @@ "format": "prettier --write \"**/*.js\"", "lint": "eslint \"**/*.js\"", "is-master": "git-branch-is master", - "release:current-branch": "GITHUB_TOKEN=$GITHUB_TOKEN_CICD release-it", - "release:current-branch:patch": "GITHUB_TOKEN=$GITHUB_TOKEN_CICD release-it patch -n", - "release:current-branch:minor": "GITHUB_TOKEN=$GITHUB_TOKEN_CICD release-it minor -n", - "release:current-branch:major": "GITHUB_TOKEN=$GITHUB_TOKEN_CICD release-it major -n", + "release:current-branch": "export GITHUB_TOKEN=$GITHUB_TOKEN_CICD && release-it", + "release:current-branch:patch": "export GITHUB_TOKEN=$GITHUB_TOKEN_CICD && release-it patch -n", + "release:current-branch:minor": "export GITHUB_TOKEN=$GITHUB_TOKEN_CICD && release-it minor -n", + "release:current-branch:major": "export GITHUB_TOKEN=$GITHUB_TOKEN_CICD && release-it major -n", "release": "run-s is-master lint release:current-branch", "release:patch": "run-s is-master lint release:current-branch:patch", "release:minor": "run-s is-master lint release:current-branch:minor", @@ -45,7 +45,7 @@ "release": true }, "hooks": { - "after:git:release": "git push origin HEAD" + "after:git:release": "git push origin HEAD --force" } }, "dependencies": { From 4fa8fbd86ae503fb1951c3015f8611de945c56c4 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:27:07 +0100 Subject: [PATCH 08/50] test cicd --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d5c4462..ad4d160 100644 --- a/README.md +++ b/README.md @@ -98,4 +98,3 @@ figmaReact.runFigmaReact(options).catch(err => { `npm link` This repository uses Git Flow - From 542d12e5e1e3fe86bdb54bdf76ff66f2664f7330 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:31:13 +0100 Subject: [PATCH 09/50] rollback cicd test --- .github/workflows/npm_master_release_patch.yml | 3 +-- package.json | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index b3a8d83..e523199 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -24,6 +24,5 @@ jobs: - run: git config --global user.name "CICD" - run: npm run release:patch env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - GITHUB_TOKEN_CICD: ${{secrets.GITHUB_TOKEN_CICD}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/package.json b/package.json index 476758e..230d033 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,10 @@ "format": "prettier --write \"**/*.js\"", "lint": "eslint \"**/*.js\"", "is-master": "git-branch-is master", - "release:current-branch": "export GITHUB_TOKEN=$GITHUB_TOKEN_CICD && release-it", - "release:current-branch:patch": "export GITHUB_TOKEN=$GITHUB_TOKEN_CICD && release-it patch -n", - "release:current-branch:minor": "export GITHUB_TOKEN=$GITHUB_TOKEN_CICD && release-it minor -n", - "release:current-branch:major": "export GITHUB_TOKEN=$GITHUB_TOKEN_CICD && release-it major -n", + "release:current-branch": "release-it", + "release:current-branch:patch": "release-it patch -n", + "release:current-branch:minor": "release-it minor -n", + "release:current-branch:major": "release-it major -n", "release": "run-s is-master lint release:current-branch", "release:patch": "run-s is-master lint release:current-branch:patch", "release:minor": "run-s is-master lint release:current-branch:minor", From 6ff993103d72fc2d7f9e23c90707bb2a24cd07a0 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 19:32:35 +0100 Subject: [PATCH 10/50] rollback cicd --- package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index 230d033..ebfca8e 100644 --- a/package.json +++ b/package.json @@ -38,14 +38,10 @@ }, "release-it": { "git": { - "tagName": "v${version}", - "push": false + "tagName": "v${version}" }, "github": { "release": true - }, - "hooks": { - "after:git:release": "git push origin HEAD --force" } }, "dependencies": { From a27eaf46208aa7143f566832a59ab51d66535864 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 21:52:30 +0100 Subject: [PATCH 11/50] test --- .github/workflows/npm_master_release_patch.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index e523199..ce0b70a 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -22,7 +22,19 @@ jobs: NODE_ENV: development - run: git config --global user.email "makame@mail.ru" - run: git config --global user.name "CICD" + - name: Temporarily disable "include administrators" branch protection + uses: benjefferies/branch-protection-bot@master + if: always() + with: + access-token: ${{ secrets.GITHUB_TOKEN_CICD }} - run: npm run release:patch env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} NODE_AUTH_TOKEN: ${{secrets.npm_token}} + - name: Enable "include administrators" branch protection + uses: benjefferies/branch-protection-bot@master + if: always() # Force to always run this step to ensure "include administrators" is always turned back on + with: + access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + owner: benjefferies + repo: branch-protection-bot From f883a62fa69250ec12e20b3f17bd9a1431e09bfc Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 21:55:45 +0100 Subject: [PATCH 12/50] test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ad4d160..d5c4462 100644 --- a/README.md +++ b/README.md @@ -98,3 +98,4 @@ figmaReact.runFigmaReact(options).catch(err => { `npm link` This repository uses Git Flow + From a1764acb93319a9eb913cbd374a8dd4f1f0ebd3a Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 22:24:18 +0100 Subject: [PATCH 13/50] fix --- .github/workflows/npm_master_release_patch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index ce0b70a..6a5557f 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -23,7 +23,7 @@ jobs: - run: git config --global user.email "makame@mail.ru" - run: git config --global user.name "CICD" - name: Temporarily disable "include administrators" branch protection - uses: benjefferies/branch-protection-bot@master + uses: makamekm/branch-protection-bot@master if: always() with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} @@ -32,7 +32,7 @@ jobs: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} NODE_AUTH_TOKEN: ${{secrets.npm_token}} - name: Enable "include administrators" branch protection - uses: benjefferies/branch-protection-bot@master + uses: makamekm/branch-protection-bot@master if: always() # Force to always run this step to ensure "include administrators" is always turned back on with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} From 0b3c1d3225bf1a8badebf394241b027817c8345f Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 22:25:59 +0100 Subject: [PATCH 14/50] fixes --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d5c4462..ad4d160 100644 --- a/README.md +++ b/README.md @@ -98,4 +98,3 @@ figmaReact.runFigmaReact(options).catch(err => { `npm link` This repository uses Git Flow - From 659ff8fc4145d7a4171f0a3fe4be73fac4468ddc Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 22:36:55 +0100 Subject: [PATCH 15/50] test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ad4d160..d5c4462 100644 --- a/README.md +++ b/README.md @@ -98,3 +98,4 @@ figmaReact.runFigmaReact(options).catch(err => { `npm link` This repository uses Git Flow + From ffd21c9981029895c48df3a5694ce1b21284c991 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 22:40:29 +0100 Subject: [PATCH 16/50] fix --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index d5c4462..ad4d160 100644 --- a/README.md +++ b/README.md @@ -98,4 +98,3 @@ figmaReact.runFigmaReact(options).catch(err => { `npm link` This repository uses Git Flow - From 969dc91e5832f99c19dd90e735d66f1a8b9ae6f6 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 23:04:46 +0100 Subject: [PATCH 17/50] fixes --- .github/workflows/npm_master_release_patch.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index 6a5557f..62bd824 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -33,8 +33,6 @@ jobs: NODE_AUTH_TOKEN: ${{secrets.npm_token}} - name: Enable "include administrators" branch protection uses: makamekm/branch-protection-bot@master - if: always() # Force to always run this step to ensure "include administrators" is always turned back on + if: always() with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} - owner: benjefferies - repo: branch-protection-bot From 9a960d5155aeb9e32269544ed71e3c251b544ed1 Mon Sep 17 00:00:00 2001 From: Makame Date: Fri, 21 Feb 2020 23:06:31 +0100 Subject: [PATCH 18/50] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ad4d160..d5c4462 100644 --- a/README.md +++ b/README.md @@ -98,3 +98,4 @@ figmaReact.runFigmaReact(options).catch(err => { `npm link` This repository uses Git Flow + From 31e3dfc7c3a925852a9e84af413628b2a16604a5 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 23:36:58 +0100 Subject: [PATCH 19/50] fixes --- .github/workflows/npm_master_release_patch.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index 62bd824..66ef42f 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -27,6 +27,7 @@ jobs: if: always() with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + enforce_admins: false - run: npm run release:patch env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} @@ -36,3 +37,4 @@ jobs: if: always() with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + enforce_admins: true From be1956c0693038a311122b2f99025d217e303980 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 23:37:08 +0100 Subject: [PATCH 20/50] fixes --- .github/workflows/npm_master_release_patch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index 66ef42f..0589a44 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -37,4 +37,4 @@ jobs: if: always() with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} - enforce_admins: true + enforce_admins: false From f0bc696622458f045887693d168f2e7a9a04e693 Mon Sep 17 00:00:00 2001 From: makame Date: Fri, 21 Feb 2020 23:38:38 +0100 Subject: [PATCH 21/50] fix --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d5c4462..c884d24 100644 --- a/README.md +++ b/README.md @@ -99,3 +99,4 @@ figmaReact.runFigmaReact(options).catch(err => { This repository uses Git Flow + From e42ec41817fbc9bffd98aa61ab065d353b227627 Mon Sep 17 00:00:00 2001 From: CICD Date: Fri, 21 Feb 2020 23:19:53 +0000 Subject: [PATCH 22/50] Release 1.0.9 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 044a800..ea95065 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "figma-react", - "version": "1.0.8", + "version": "1.0.9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ebfca8e..169a7b9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "figma-react", "description": "This is a tool to help you export Figma project into React mockups", - "version": "1.0.8", + "version": "1.0.9", "private": false, "author": "Maxim Karpov ", "repository": { From e655c54cf2de8004bab74835dfb13d6dd0509899 Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 00:21:05 +0100 Subject: [PATCH 23/50] test --- .github/workflows/npm_master_release_patch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index 0589a44..66ef42f 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -37,4 +37,4 @@ jobs: if: always() with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} - enforce_admins: false + enforce_admins: true From 22cff6c00f0f7edc8147755cf59906d9f18a5137 Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 00:22:09 +0100 Subject: [PATCH 24/50] test --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c884d24..d5c4462 100644 --- a/README.md +++ b/README.md @@ -99,4 +99,3 @@ figmaReact.runFigmaReact(options).catch(err => { This repository uses Git Flow - From 0a76a9c1b010ca0b1dceefa5c0d9baa8f85bfc17 Mon Sep 17 00:00:00 2001 From: CICD Date: Fri, 21 Feb 2020 23:24:33 +0000 Subject: [PATCH 25/50] Release 1.0.10 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea95065..032b124 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "figma-react", - "version": "1.0.9", + "version": "1.0.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 169a7b9..e824aa1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "figma-react", "description": "This is a tool to help you export Figma project into React mockups", - "version": "1.0.9", + "version": "1.0.10", "private": false, "author": "Maxim Karpov ", "repository": { From d53f98daf7699ace7fd697547f955105ca7f8bfb Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 00:46:16 +0100 Subject: [PATCH 26/50] add protection --- .github/workflows/npm_release_major.yml | 12 ++++++++++++ .github/workflows/npm_release_minor.yml | 12 ++++++++++++ .github/workflows/npm_release_patch.yml | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/.github/workflows/npm_release_major.yml b/.github/workflows/npm_release_major.yml index a2905ce..1b5143f 100644 --- a/.github/workflows/npm_release_major.yml +++ b/.github/workflows/npm_release_major.yml @@ -24,7 +24,19 @@ jobs: - run: git fetch origin - run: git checkout -b master origin/master - run: git merge release/major + - name: Temporarily disable "include administrators" branch protection + uses: makamekm/branch-protection-bot@master + if: always() + with: + access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + enforce_admins: false - run: npm run release:major env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} NODE_AUTH_TOKEN: ${{secrets.npm_token}} + - name: Enable "include administrators" branch protection + uses: makamekm/branch-protection-bot@master + if: always() + with: + access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + enforce_admins: true diff --git a/.github/workflows/npm_release_minor.yml b/.github/workflows/npm_release_minor.yml index d17d907..0ba6192 100644 --- a/.github/workflows/npm_release_minor.yml +++ b/.github/workflows/npm_release_minor.yml @@ -24,7 +24,19 @@ jobs: - run: git fetch origin - run: git checkout -b master origin/master - run: git merge release/minor + - name: Temporarily disable "include administrators" branch protection + uses: makamekm/branch-protection-bot@master + if: always() + with: + access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + enforce_admins: false - run: npm run release:minor env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} NODE_AUTH_TOKEN: ${{secrets.npm_token}} + - name: Enable "include administrators" branch protection + uses: makamekm/branch-protection-bot@master + if: always() + with: + access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + enforce_admins: true diff --git a/.github/workflows/npm_release_patch.yml b/.github/workflows/npm_release_patch.yml index 96baccb..3388be0 100644 --- a/.github/workflows/npm_release_patch.yml +++ b/.github/workflows/npm_release_patch.yml @@ -24,7 +24,19 @@ jobs: - run: git fetch origin - run: git checkout -b master origin/master - run: git merge release/patch + - name: Temporarily disable "include administrators" branch protection + uses: makamekm/branch-protection-bot@master + if: always() + with: + access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + enforce_admins: false - run: npm run release:patch env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} NODE_AUTH_TOKEN: ${{secrets.npm_token}} + - name: Enable "include administrators" branch protection + uses: makamekm/branch-protection-bot@master + if: always() + with: + access-token: ${{ secrets.GITHUB_TOKEN_CICD }} + enforce_admins: true From 8db4a7fe8ec574cae59d273b20cc605a3963f2fb Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 01:24:08 +0100 Subject: [PATCH 27/50] test --- .github/workflows/npm_develop.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/npm_develop.yml diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml new file mode 100644 index 0000000..1c4c366 --- /dev/null +++ b/.github/workflows/npm_develop.yml @@ -0,0 +1,31 @@ +name: Node.js Develop Test + +on: + push: + branches: + - develop + +jobs: + publish_patch: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm install + env: + NODE_ENV: development + - run: npm run lint + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + - name: send custom message + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + The ${{ github.event_name }} event triggered final step. + echo This event is a pull request that had an assignee removed. From 8d3df008ae9f2b2082bf6fb3094e7f5e948a06f0 Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 01:29:31 +0100 Subject: [PATCH 28/50] fixes --- .github/workflows/npm_develop.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index 1c4c366..90e8c5a 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -19,8 +19,7 @@ jobs: NODE_ENV: development - run: npm run lint env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN_CICD}} - NODE_AUTH_TOKEN: ${{secrets.npm_token}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: send custom message uses: appleboy/telegram-action@master with: From 86ce20dfe495b5655e53341b341ab66663005462 Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 01:40:04 +0100 Subject: [PATCH 29/50] fixes --- .github/workflows/npm_develop.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index 90e8c5a..3c4fc16 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -20,11 +20,24 @@ jobs: - run: npm run lint env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: send custom message + - name: send a success message uses: appleboy/telegram-action@master with: to: ${{ secrets.TELEGRAM_TO }} token: ${{ secrets.TELEGRAM_TOKEN }} message: | - The ${{ github.event_name }} event triggered final step. - echo This event is a pull request that had an assignee removed. + Figma React - ${{ github.ref }} + SUCCESSFULLY + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} + - name: send a success message + uses: appleboy/telegram-action@master + if: failure() + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + FAILED + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} From d149865ee81234f203637bb117b4b7c8caf4d03c Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 01:46:22 +0100 Subject: [PATCH 30/50] Telegram --- .github/workflows/npm_develop.yml | 6 +++--- .../workflows/npm_master_release_patch.yml | 21 +++++++++++++++++++ .github/workflows/npm_release_major.yml | 21 +++++++++++++++++++ .github/workflows/npm_release_minor.yml | 21 +++++++++++++++++++ .github/workflows/npm_release_patch.yml | 21 +++++++++++++++++++ 5 files changed, 87 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index 3c4fc16..1bacd7e 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -27,10 +27,10 @@ jobs: token: ${{ secrets.TELEGRAM_TOKEN }} message: | Figma React - ${{ github.ref }} - SUCCESSFULLY + SUCCESSFULLY - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - - name: send a success message + - name: send a fail message uses: appleboy/telegram-action@master if: failure() with: @@ -38,6 +38,6 @@ jobs: token: ${{ secrets.TELEGRAM_TOKEN }} message: | Figma React - ${{ github.ref }} - FAILED + FAILED - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/npm_master_release_patch.yml b/.github/workflows/npm_master_release_patch.yml index 66ef42f..fd2cde1 100644 --- a/.github/workflows/npm_master_release_patch.yml +++ b/.github/workflows/npm_master_release_patch.yml @@ -38,3 +38,24 @@ jobs: with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} enforce_admins: true + - name: send a success message + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + SUCCESSFULLY - publish + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} + - name: send a fail message + uses: appleboy/telegram-action@master + if: failure() + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + FAILED - publish + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/npm_release_major.yml b/.github/workflows/npm_release_major.yml index 1b5143f..f303eac 100644 --- a/.github/workflows/npm_release_major.yml +++ b/.github/workflows/npm_release_major.yml @@ -40,3 +40,24 @@ jobs: with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} enforce_admins: true + - name: send a success message + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + SUCCESSFULLY - publish + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} + - name: send a fail message + uses: appleboy/telegram-action@master + if: failure() + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + FAILED - publish + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/npm_release_minor.yml b/.github/workflows/npm_release_minor.yml index 0ba6192..4e8e9c9 100644 --- a/.github/workflows/npm_release_minor.yml +++ b/.github/workflows/npm_release_minor.yml @@ -40,3 +40,24 @@ jobs: with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} enforce_admins: true + - name: send a success message + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + SUCCESSFULLY - publish + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} + - name: send a fail message + uses: appleboy/telegram-action@master + if: failure() + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + FAILED - publish + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/npm_release_patch.yml b/.github/workflows/npm_release_patch.yml index 3388be0..6a457f1 100644 --- a/.github/workflows/npm_release_patch.yml +++ b/.github/workflows/npm_release_patch.yml @@ -40,3 +40,24 @@ jobs: with: access-token: ${{ secrets.GITHUB_TOKEN_CICD }} enforce_admins: true + - name: send a success message + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + SUCCESSFULLY - publish + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} + - name: send a fail message + uses: appleboy/telegram-action@master + if: failure() + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + Figma React - ${{ github.ref }} + FAILED - publish + Triggered by ${{ github.event_name }} event + https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} From e6a6c253695bdb85bfed0575549038d1a30a981a Mon Sep 17 00:00:00 2001 From: Makame Date: Sat, 22 Feb 2020 02:00:08 +0100 Subject: [PATCH 31/50] Create npm_all.yml --- .github/workflows/npm_all.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/npm_all.yml diff --git a/.github/workflows/npm_all.yml b/.github/workflows/npm_all.yml new file mode 100644 index 0000000..7fc3e5d --- /dev/null +++ b/.github/workflows/npm_all.yml @@ -0,0 +1,21 @@ +name: Node.js Linting + +on: + push: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm install + env: + NODE_ENV: development + - run: npm run lint + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From 103b333596f3ab1e1d87b4553081f62835ef347a Mon Sep 17 00:00:00 2001 From: Makame Date: Sat, 22 Feb 2020 02:00:41 +0100 Subject: [PATCH 32/50] Update npm_develop.yml --- .github/workflows/npm_develop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index 1bacd7e..faa40fd 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -6,7 +6,7 @@ on: - develop jobs: - publish_patch: + test_develop: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From d7768efb28a001f8ea558219183e6a1a1681fa7b Mon Sep 17 00:00:00 2001 From: Makame Date: Sat, 22 Feb 2020 02:01:07 +0100 Subject: [PATCH 33/50] Update npm_release_major.yml --- .github/workflows/npm_release_major.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_release_major.yml b/.github/workflows/npm_release_major.yml index f303eac..d07b2f1 100644 --- a/.github/workflows/npm_release_major.yml +++ b/.github/workflows/npm_release_major.yml @@ -6,7 +6,7 @@ on: - release/major jobs: - publish_patch: + publish_major: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From b3aad01cf95f30c64570e0c2c90d56b22b131c19 Mon Sep 17 00:00:00 2001 From: Makame Date: Sat, 22 Feb 2020 02:01:27 +0100 Subject: [PATCH 34/50] Update npm_release_minor.yml --- .github/workflows/npm_release_minor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_release_minor.yml b/.github/workflows/npm_release_minor.yml index 4e8e9c9..c80057e 100644 --- a/.github/workflows/npm_release_minor.yml +++ b/.github/workflows/npm_release_minor.yml @@ -6,7 +6,7 @@ on: - release/minor jobs: - publish_patch: + publish_minor: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 7a0c80df3f42888d7656d51a5a76cd264467058f Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 02:19:41 +0100 Subject: [PATCH 35/50] optimize package json release script --- package.json | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e824aa1..8a8d8dc 100644 --- a/package.json +++ b/package.json @@ -21,14 +21,9 @@ "format": "prettier --write \"**/*.js\"", "lint": "eslint \"**/*.js\"", "is-master": "git-branch-is master", - "release:current-branch": "release-it", - "release:current-branch:patch": "release-it patch -n", - "release:current-branch:minor": "release-it minor -n", - "release:current-branch:major": "release-it major -n", - "release": "run-s is-master lint release:current-branch", - "release:patch": "run-s is-master lint release:current-branch:patch", - "release:minor": "run-s is-master lint release:current-branch:minor", - "release:major": "run-s is-master lint release:current-branch:major" + "release:patch": "run-s is-master lint \"release-it patch -n\"", + "release:minor": "run-s is-master lint \"release-it minor -n\"", + "release:major": "run-s is-master lint \"release-it major -n\"" }, "bin": { "figma-react": "./cli.js" From 81ccd1403c4ea846332cff63140eaeaba05e48dd Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 13:51:58 +0100 Subject: [PATCH 36/50] add additional actions --- .github/workflows/auto_rebase.yml | 24 ++++++++++++++++++++++++ .github/workflows/auto_revert.yml | 19 +++++++++++++++++++ .github/workflows/auto_wip.yml | 12 ++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 .github/workflows/auto_rebase.yml create mode 100644 .github/workflows/auto_revert.yml create mode 100644 .github/workflows/auto_wip.yml diff --git a/.github/workflows/auto_rebase.yml b/.github/workflows/auto_rebase.yml new file mode 100644 index 0000000..2bdd6b4 --- /dev/null +++ b/.github/workflows/auto_rebase.yml @@ -0,0 +1,24 @@ +on: + issue_comment: + types: [created] +name: Automatic Rebase +jobs: + rebase: + name: Rebase + if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + fetch-depth: 0 + - name: Automatic Rebase + uses: cirrus-actions/rebase@1.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # https://github.community/t5/GitHub-Actions/Workflow-is-failing-if-no-job-can-be-ran-due-to-condition/m-p/38186#M3250 + always_job: + name: Always run job + runs-on: ubuntu-latest + steps: + - name: Always run + run: echo "This job is used to prevent the workflow to fail when all other jobs are skipped." \ No newline at end of file diff --git a/.github/workflows/auto_revert.yml b/.github/workflows/auto_revert.yml new file mode 100644 index 0000000..17cf848 --- /dev/null +++ b/.github/workflows/auto_revert.yml @@ -0,0 +1,19 @@ +name: Automatic Revert + +on: + issue_comment: + types: [created] + +jobs: + revert-commit: + + runs-on: ubuntu-latest + + if: contains(github.event.comment.body, '/revert') + + steps: + - uses: actions/checkout@v1 + - name: Automatic Revert + uses: srt32/revert@v0.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/auto_wip.yml b/.github/workflows/auto_wip.yml new file mode 100644 index 0000000..b365b6f --- /dev/null +++ b/.github/workflows/auto_wip.yml @@ -0,0 +1,12 @@ +name: WIP +on: + pull_request: + types: [ opened, synchronize, reopened, edited ] + +jobs: + wip: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: wip/action@v1.0.0 \ No newline at end of file From 3c3db8a2d4f223eca0a4a211b03e4b004aa42cb4 Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:03:47 +0100 Subject: [PATCH 37/50] test --- .github/workflows/auto_wip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto_wip.yml b/.github/workflows/auto_wip.yml index b365b6f..559330e 100644 --- a/.github/workflows/auto_wip.yml +++ b/.github/workflows/auto_wip.yml @@ -9,4 +9,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: wip/action@v1.0.0 \ No newline at end of file + - uses: wip/action@v1.0.0 From 3f6b4b2765380e6f2e7ea53df28f938d1699f03c Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:11:41 +0100 Subject: [PATCH 38/50] add commit message --- .github/workflows/npm_develop.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index faa40fd..5b1f780 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -20,6 +20,14 @@ jobs: - run: npm run lint env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name : GITHUB CONTEXT + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: get commit message + run: echo ::set-env name=commitmsg::$(git log --format=%B -n 1 ${{ github.event.after }}) + - name: show commit message + run : echo $commitmsg - name: send a success message uses: appleboy/telegram-action@master with: @@ -30,6 +38,7 @@ jobs: SUCCESSFULLY - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} + {{ commitmsg }} - name: send a fail message uses: appleboy/telegram-action@master if: failure() @@ -41,3 +50,4 @@ jobs: FAILED - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} + {{ commitmsg }} From 08aa8c032851c61298c4a97392e95460926c5814 Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:15:12 +0100 Subject: [PATCH 39/50] add a commit message to Telegram --- .github/workflows/npm_develop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index 5b1f780..a3e8f47 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -38,7 +38,7 @@ jobs: SUCCESSFULLY - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - {{ commitmsg }} + ${{ commitmsg }} - name: send a fail message uses: appleboy/telegram-action@master if: failure() @@ -50,4 +50,4 @@ jobs: FAILED - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - {{ commitmsg }} + ${{ commitmsg }} From ac9da0cf311a92785a0cc54bb7d7212643a8ee8e Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:17:19 +0100 Subject: [PATCH 40/50] fix pipeline --- .github/workflows/npm_develop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index a3e8f47..ab7d985 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -38,7 +38,7 @@ jobs: SUCCESSFULLY - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - ${{ commitmsg }} + {{ $commitmsg }} - name: send a fail message uses: appleboy/telegram-action@master if: failure() @@ -50,4 +50,4 @@ jobs: FAILED - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - ${{ commitmsg }} + {{ $commitmsg }} From 01eebfaeb3e46afaa906329afa80aa1fe1d75233 Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:19:11 +0100 Subject: [PATCH 41/50] test fix --- .github/workflows/npm_develop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index ab7d985..2cf60f6 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -38,7 +38,7 @@ jobs: SUCCESSFULLY - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - {{ $commitmsg }} + ${{ $commitmsg }} - name: send a fail message uses: appleboy/telegram-action@master if: failure() @@ -50,4 +50,4 @@ jobs: FAILED - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - {{ $commitmsg }} + ${{ $commitmsg }} From 33ce10585c67390ff8839e1454d319eaf02c1a25 Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:23:28 +0100 Subject: [PATCH 42/50] fixes --- .github/workflows/npm_develop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index 2cf60f6..42fcbb3 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -38,7 +38,7 @@ jobs: SUCCESSFULLY - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - ${{ $commitmsg }} + $commitmsg - name: send a fail message uses: appleboy/telegram-action@master if: failure() @@ -50,4 +50,4 @@ jobs: FAILED - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - ${{ $commitmsg }} + $commitmsg From d5e1e3671aa9a3aac0da3f9f028879135a65f70f Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:37:42 +0100 Subject: [PATCH 43/50] fix commit message --- .github/workflows/npm_develop.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/npm_develop.yml b/.github/workflows/npm_develop.yml index 42fcbb3..2fd09e9 100644 --- a/.github/workflows/npm_develop.yml +++ b/.github/workflows/npm_develop.yml @@ -25,9 +25,10 @@ jobs: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - name: get commit message - run: echo ::set-env name=commitmsg::$(git log --format=%B -n 1 ${{ github.event.after }}) + id: get_commitmsg + run: echo ::set-output name=commitmsg::$(git log --format=%B -n 1 ${{ github.event.after }}) - name: show commit message - run : echo $commitmsg + run : echo ${{ steps.get_commitmsg.outputs.commitmsg }} - name: send a success message uses: appleboy/telegram-action@master with: @@ -38,7 +39,8 @@ jobs: SUCCESSFULLY - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - $commitmsg + --- + ${{ steps.get_commitmsg.outputs.commitmsg }} - name: send a fail message uses: appleboy/telegram-action@master if: failure() @@ -50,4 +52,5 @@ jobs: FAILED - test Triggered by ${{ github.event_name }} event https://github.com/makamekm/figma-react/actions/runs/${{ github.run_id }} - $commitmsg + --- + ${{ steps.get_commitmsg.outputs.commitmsg }} From b9dcc4772c3cb47f8b085bfddc090a6b96b0747b Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:44:44 +0100 Subject: [PATCH 44/50] add release notifyer --- .github/workflows/npm_notify_release.yml | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/npm_notify_release.yml diff --git a/.github/workflows/npm_notify_release.yml b/.github/workflows/npm_notify_release.yml new file mode 100644 index 0000000..d08a23a --- /dev/null +++ b/.github/workflows/npm_notify_release.yml @@ -0,0 +1,28 @@ +name: Node.js Public Release Notes + +on: + release: + +jobs: + test_develop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Extract tag name + id: tag + uses: actions/github-script@0.2.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + return context.payload.ref.replace(/\/refs\/tags\//, ''); + - name: send a release notes + uses: appleboy/telegram-action@master + with: + to: ${{ secrets.TELEGRAM_PUBLIC_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + message: | + New version of Figma React ${{ steps.tag.outputs.result }} has been released + https://github.com/makamekm/figma-react/releases/tag/${{ steps.tag.outputs.result }} + https://www.npmjs.com/package/figma-react From 636e869a63df7148f41d424896b82a35a7691b6d Mon Sep 17 00:00:00 2001 From: makame Date: Sat, 22 Feb 2020 14:45:01 +0100 Subject: [PATCH 45/50] fixes --- .github/workflows/npm_notify_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_notify_release.yml b/.github/workflows/npm_notify_release.yml index d08a23a..fc63a79 100644 --- a/.github/workflows/npm_notify_release.yml +++ b/.github/workflows/npm_notify_release.yml @@ -17,7 +17,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | return context.payload.ref.replace(/\/refs\/tags\//, ''); - - name: send a release notes + - name: send release notes uses: appleboy/telegram-action@master with: to: ${{ secrets.TELEGRAM_PUBLIC_TO }} From 7deed78009d111cfdfa26b115b1117b6d038f4fd Mon Sep 17 00:00:00 2001 From: makame Date: Sun, 23 Feb 2020 13:42:52 +0100 Subject: [PATCH 46/50] fix vector, image, bottom position --- api.js | 7 +++++ content.plugins.js | 30 ++++++++++++++++--- index.js | 9 +++--- lib.js | 12 ++++---- style.plugins.js | 75 ++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 115 insertions(+), 18 deletions(-) diff --git a/api.js b/api.js index 7fffdff..1107e42 100644 --- a/api.js +++ b/api.js @@ -7,6 +7,7 @@ module.exports = { loadURLImages, loadImages, loadNodes, + loadURLPNGImages, getHeaders }; @@ -36,6 +37,12 @@ async function loadURLImages(vectorList, fileKey, headers) { return await data.json(); } +async function loadURLPNGImages(fileKey, headers) { + data = await fetch(`${baseUrl}/v1/files/${fileKey}/images`, { headers }); + const json = await data.json(); + return json.meta.images; +} + async function loadImages(imageJSON) { const images = imageJSON.images || {}; if (images) { diff --git a/content.plugins.js b/content.plugins.js index c6be36b..7620934 100644 --- a/content.plugins.js +++ b/content.plugins.js @@ -23,12 +23,12 @@ function applyStyles(state) { // TODO: use import from './${getComponentName(node.name, options)}' async function setComponentFromCache(state, shared) { const { node, content, classNames } = state; - const { component, imgMap, componentMap, componentDescriptionMap, localComponentMap, options, additionalStyles, genClassName } = shared; + const { component, imgMap, pngImages, componentMap, componentDescriptionMap, localComponentMap, options, additionalStyles, genClassName } = shared; if (node.id !== component.id && node.name.charAt(0) === '#') { const name = getComponentName(node.name, options); emptyChildren(state); content.push(`<${name} {...props} nodeId='${node.id}' />`); - if (!componentMap[name]) await createComponent(node, imgMap, componentMap, componentDescriptionMap, options); + if (!componentMap[name]) await createComponent(node, imgMap, pngImages, componentMap, componentDescriptionMap, options); localComponentMap[name] = componentMap[name]; const currentClass = genClassName(); @@ -47,11 +47,33 @@ async function setComponentFromCache(state, shared) { } } -function renderVector(state, { imgMap }) { +function renderVector(state, { imgMap, genClassName, additionalStyles }) { const { node, content } = state; if (node.type === 'VECTOR') { emptyChildren(state); - content.push(`
`); + + const currentClass = genClassName(); + + const cHorizontal = node.constraints && node.constraints.horizontal; + const cVertical = node.constraints && node.constraints.vertical; + + const scaleHorizontal = cHorizontal === 'LEFT_RIGHT' || cHorizontal === 'SCALE'; + const scaleVertical = cVertical === 'TOP_BOTTOM' || cVertical === 'SCALE'; + + let additionalSvgStyles = `\n.${currentClass} > :global(svg) {\n`; + if (scaleHorizontal) additionalSvgStyles += `left: 0;\nwidth: 100%;\n`; + if (scaleVertical) additionalSvgStyles += `top: 0;\nheight: 100%;\n`; + if (scaleHorizontal && scaleVertical) { + additionalSvgStyles += `transform: unset;\n`; + } else if (scaleHorizontal && !scaleVertical) { + additionalSvgStyles += `transform: translateY(-50%);\n`; + } else if (!scaleHorizontal && scaleVertical) { + additionalSvgStyles += `transform: translateX(-50%);\n`; + } + additionalSvgStyles += `}\n`; + additionalStyles.push(additionalSvgStyles); + + content.push(`
`); } } diff --git a/index.js b/index.js index 5d07875..98a7cda 100755 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ require('dotenv').config(); const { preprocessCanvasComponents, createComponents, generateComponent } = require('./lib'); -const { loadCanvas, loadNodes, loadImages, loadURLImages, getHeaders } = require('./api'); +const { loadCanvas, loadNodes, loadImages, loadURLImages, loadURLPNGImages, getHeaders } = require('./api'); const presets = require('./presets'); function getConfig(options = {}) { @@ -62,13 +62,14 @@ async function runFigmaReact(options = {}) { // Load all images used in the document from Figma const imageJSON = await loadURLImages(vectorList, fileKey, headers); const images = await loadImages(imageJSON, fileKey, headers); + const pngImages = await loadURLPNGImages(fileKey, headers); // Debug - // const fs = require('fs'); - // fs.writeFileSync('./temp.json', JSON.stringify(canvas, null, 4)); + const fs = require('fs'); + fs.writeFileSync('./temp.json', JSON.stringify(canvas, null, 4)); // Create components - await createComponents(canvas, images, componentMap, componentDescriptionMap, options); + await createComponents(canvas, images, pngImages, componentMap, componentDescriptionMap, options); // Generate components for (const key in componentMap) { diff --git a/lib.js b/lib.js index 9f4c2c3..932cf5c 100644 --- a/lib.js +++ b/lib.js @@ -17,8 +17,9 @@ input:focus { outline: none; } .vector :global(svg) { - width: 100%; - height: 100%; + left: 50%; + top: 50%; + transform: translateX(-50%) translateY(-50%); position: absolute; }`; @@ -588,7 +589,7 @@ function getDescriptionStyles({ componentDescriptionMap, options }, node) { return description.substring(description.indexOf(delimiter) + delimiter.length).replace(/\\n/g, `\n`); } -async function createComponent(component, imgMap, componentMap, componentDescriptionMap, options = {}) { +async function createComponent(component, imgMap, pngImages, componentMap, componentDescriptionMap, options = {}) { const name = getComponentName(component.name, options); const fileName = getFileName(name); const instance = getComponentInstance(component, options); @@ -643,6 +644,7 @@ async function createComponent(component, imgMap, componentMap, componentDescrip printStyle, additionalStyles, imgMap, + pngImages, componentMap, componentDescriptionMap, localComponentMap, @@ -696,12 +698,12 @@ async function createComponent(component, imgMap, componentMap, componentDescrip componentMap[name] = { instance, name, doc, fileName, localComponentMap }; } -async function createComponents(canvas, images, componentMap, componentDescriptionMap, options = {}) { +async function createComponents(canvas, images, pngImages, componentMap, componentDescriptionMap, options = {}) { for (let i = 0; i < canvas.children.length; i++) { const child = canvas.children[i]; if (child.name.charAt(0) === '#' && child.visible !== false) { const child = canvas.children[i]; - await createComponent(child, images, componentMap, componentDescriptionMap, options); + await createComponent(child, images, pngImages, componentMap, componentDescriptionMap, options); } } } diff --git a/style.plugins.js b/style.plugins.js index a01cdb4..0a1f42c 100644 --- a/style.plugins.js +++ b/style.plugins.js @@ -116,6 +116,7 @@ function setVerticalAlign({ node, middleStyle, outerStyle, bounds }) { outerStyle.left = 0; outerStyle.alignItems = 'stretch'; if (bounds != null) { + middleStyle.position = 'relative'; middleStyle.marginTop = bounds.top; middleStyle.marginBottom = bounds.bottom; } @@ -131,6 +132,7 @@ function setVerticalAlign({ node, middleStyle, outerStyle, bounds }) { outerStyle.left = 0; outerStyle.alignItems = 'center'; if (bounds != null) { + middleStyle.position = 'relative'; middleStyle.marginTop = bounds.top - bounds.bottom; } } else if (cVertical === 'SCALE') { @@ -144,14 +146,28 @@ function setVerticalAlign({ node, middleStyle, outerStyle, bounds }) { outerStyle.left = 0; outerStyle.alignItems = 'stretch'; if (bounds != null) { + middleStyle.position = 'relative'; const parentHeight = bounds.top + bounds.height + bounds.bottom; middleStyle.height = `${(bounds.height * 100) / parentHeight}%`; middleStyle.top = `${(bounds.top * 100) / parentHeight}%`; } + } else if (cVertical === 'BOTTOM') { + outerStyle.width = '100%'; + outerStyle.pointerEvents = 'none'; + outerStyle.position = 'absolute'; + outerStyle.height = '100%'; + outerStyle.bottom = 0; + outerStyle.left = 0; + outerStyle.alignItems = 'flex-end'; + if (bounds != null) { + middleStyle.position = 'relative'; + middleStyle.marginBottom = bounds.bottom; + } } else { if (bounds != null) { outerStyle.position = 'relative'; outerStyle.display = 'flex'; + middleStyle.position = 'relative'; middleStyle.marginTop = bounds.top; middleStyle.marginBottom = bounds.bottom; middleStyle.minHeight = middleStyle.height; @@ -191,7 +207,7 @@ function setHorizontalLayout({ node, middleStyle, innerStyle, parent, classNames } } -function setFrameStyles({ node, middleStyle }) { +function setFrameStyles({ node, middleStyle }, { pngImages }) { if (['FRAME', 'RECTANGLE', 'INSTANCE', 'COMPONENT'].indexOf(node.type) >= 0) { if (['FRAME', 'COMPONENT', 'INSTANCE'].indexOf(node.type) >= 0) { middleStyle.backgroundColor = colorString(node.backgroundColor); @@ -203,8 +219,17 @@ function setFrameStyles({ node, middleStyle }) { middleStyle.backgroundColor = colorString(lastFill.color); middleStyle.opacity = lastFill.opacity; } else if (lastFill.type === 'IMAGE') { - middleStyle.backgroundImage = imageURL(lastFill.imageRef); + middleStyle.backgroundImage = `url(${pngImages[lastFill.imageRef]})`; middleStyle.backgroundSize = backgroundSize(lastFill.scaleMode); + // middleStyle.transform = `matrix(${[ + // lastFill.imageTransform[0][0], + // lastFill.imageTransform[1][0], + // lastFill.imageTransform[0][1], + // lastFill.imageTransform[1][1], + // lastFill.imageTransform[0][2], + // lastFill.imageTransform[1][2] + // ].join(',')})`; + // console.log(middleStyle.transform); } else if (lastFill.type === 'GRADIENT_LINEAR') { middleStyle.background = paintToLinearGradient(lastFill); } else if (lastFill.type === 'GRADIENT_RADIAL') { @@ -259,9 +284,39 @@ function setTextRenderer({ node, props, middleStyle, content }, { printStyle }) middleStyle.display = 'flex'; middleStyle.maxWidth = '-webkit-fill-available'; + middleStyle.alignContent = 'flex-start'; + + if (fontStyle.textAlignHorizontal === 'CENTER') { + middleStyle.justifyContent = 'center'; + } else if (fontStyle.textAlignHorizontal === 'LEFT') { + middleStyle.justifyContent = 'flex-start'; + } else if (fontStyle.textAlignHorizontal === 'RIGHT') { + middleStyle.justifyContent = 'flex-end'; + } + + if (fontStyle.textAlignVertical === 'CENTER') { + middleStyle.verticalAlign = 'middle'; + middleStyle.alignItems = 'center'; + middleStyle.alignContent = 'center'; + } else if (fontStyle.textAlignVertical === 'TOP') { + middleStyle.verticalAlign = 'top'; + middleStyle.alignItems = 'flex-start'; + middleStyle.alignContent = 'flex-start'; + } else if (fontStyle.textAlignVertical === 'BOTTOM') { + middleStyle.verticalAlign = 'bottom'; + middleStyle.alignItems = 'flex-end'; + middleStyle.alignContent = 'flex-end'; + } if (Object.keys(props).includes('input')) { - content.push(``); + const inputId = printStyle({ + flex: 1 + }); + content.push( + `` + ); } else { let para = ''; const styleCache = {}; @@ -274,7 +329,9 @@ function setTextRenderer({ node, props, middleStyle, content }, { printStyle }) const commitParagraph = key => { if (para !== '') { - if (styleCache[currStyle] == null) styleCache[currStyle] = {}; + if (styleCache[currStyle] == null) { + styleCache[currStyle] = {}; + } if (node.styleOverrideTable[currStyle] && node.styleOverrideTable[currStyle].fills) { const lastFill = getPaint(node.styleOverrideTable[currStyle].fills); @@ -319,7 +376,15 @@ function setTextRenderer({ node, props, middleStyle, content }, { printStyle }) if (node.characters[i] === '\n') { commitParagraph(i); - content.push(`
`); + + const id = printStyle({ + flex: 1, + content: '""', + minWidth: '-webkit-fill-available' + }); + + content.push(`
`); + middleStyle.flexWrap = 'wrap'; continue; } From 5c8df1f891f576332ace9b4a70ba294c7439a4f6 Mon Sep 17 00:00:00 2001 From: makame Date: Sun, 23 Feb 2020 13:46:24 +0100 Subject: [PATCH 47/50] fix lint --- content.plugins.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/content.plugins.js b/content.plugins.js index 7620934..e6dd782 100644 --- a/content.plugins.js +++ b/content.plugins.js @@ -23,7 +23,17 @@ function applyStyles(state) { // TODO: use import from './${getComponentName(node.name, options)}' async function setComponentFromCache(state, shared) { const { node, content, classNames } = state; - const { component, imgMap, pngImages, componentMap, componentDescriptionMap, localComponentMap, options, additionalStyles, genClassName } = shared; + const { + component, + imgMap, + pngImages, + componentMap, + componentDescriptionMap, + localComponentMap, + options, + additionalStyles, + genClassName + } = shared; if (node.id !== component.id && node.name.charAt(0) === '#') { const name = getComponentName(node.name, options); emptyChildren(state); From a5be7fe892faa1a887a3519370cd3e43548d75cb Mon Sep 17 00:00:00 2001 From: makame Date: Sun, 23 Feb 2020 16:01:14 +0100 Subject: [PATCH 48/50] add image processing --- lib.js | 7 -- package-lock.json | 310 ++++++++++++++++++++++++++++++++++++++++++---- package.json | 3 +- style.plugins.js | 43 ++++--- 4 files changed, 309 insertions(+), 54 deletions(-) diff --git a/lib.js b/lib.js index 932cf5c..ab99de4 100644 --- a/lib.js +++ b/lib.js @@ -30,7 +30,6 @@ module.exports = { dropShadow, innerShadow, imageURL, - backgroundSize, nodeSort, getPaint, paintToLinearGradient, @@ -86,12 +85,6 @@ function imageURL(hash) { )})`; } -function backgroundSize(scaleMode) { - if (scaleMode === 'FILL') { - return 'cover'; - } -} - function nodeSort(a, b) { if (a.absoluteBoundingBox.y < b.absoluteBoundingBox.y) return -1; else if (a.absoluteBoundingBox.y === b.absoluteBoundingBox.y) return 0; diff --git a/package-lock.json b/package-lock.json index 032b124..ff05e23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -373,7 +373,6 @@ "version": "6.11.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", - "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -455,6 +454,19 @@ "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, "astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -473,8 +485,7 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "atob-lite": { "version": "2.0.0", @@ -482,6 +493,16 @@ "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=", "dev": true }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" + }, "babel-eslint": { "version": "10.0.3", "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.3.tgz", @@ -502,6 +523,14 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, "before-after-hook": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", @@ -617,6 +646,11 @@ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, "chalk": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", @@ -706,7 +740,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -737,6 +770,11 @@ "xdg-basedir": "^4.0.0" } }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, "cosmiconfig": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", @@ -776,6 +814,14 @@ "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -848,8 +894,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "deprecated-obj": { "version": "1.0.1", @@ -917,6 +962,15 @@ "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "dev": true }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -1219,6 +1273,11 @@ "strip-eof": "^1.0.0" } }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, "external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", @@ -1230,11 +1289,15 @@ "tmp": "^0.0.33" } }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, "fast-deep-equal": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", - "dev": true + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" }, "fast-diff": { "version": "1.2.0", @@ -1259,8 +1322,7 @@ "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "fast-levenshtein": { "version": "2.0.6", @@ -1340,6 +1402,11 @@ "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "dev": true }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, "form-data": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", @@ -1384,6 +1451,14 @@ "pump": "^3.0.0" } }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "git-branch-is": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/git-branch-is/-/git-branch-is-3.1.0.tgz", @@ -1494,6 +1569,20 @@ "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", "dev": true }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1533,6 +1622,16 @@ "integrity": "sha512-Z2EICWNJou7Tr9Bd2M2UqDJq3A9F2ePG9w3lIpjoyuSyXFP9QbniJVu3XQYytuw5ebmG7dXSXO9PgAjJG8DDKA==", "dev": true }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -1548,6 +1647,11 @@ "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", "dev": true }, + "image-size": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.6.3.tgz", + "integrity": "sha512-47xSUiQioGaB96nqtp5/q55m0aBQSQdyIloMOc/x+QVTDZLNmXE892IIDrJ0hM1A5vcNUDD5tDffkSP5lCaIIA==" + }, "import-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz", @@ -1883,8 +1987,7 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "is-yarn-global": { "version": "0.3.0", @@ -1904,6 +2007,11 @@ "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==", "dev": true }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1920,6 +2028,11 @@ "esprima": "^4.0.0" } }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -1938,11 +2051,15 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -1950,6 +2067,22 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, "keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -2158,14 +2291,12 @@ "mime-db": { "version": "1.43.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", - "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==", - "dev": true + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" }, "mime-types": { "version": "2.1.26", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", - "dev": true, "requires": { "mime-db": "1.43.0" } @@ -2347,6 +2478,11 @@ "path-key": "^2.0.0" } }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, "object-inspect": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", @@ -2587,6 +2723,11 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, "picomatch": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz", @@ -2643,6 +2784,11 @@ "integrity": "sha512-Fx65lf9/YDn3hUX08XUc0J8rSux36rEsyiv21ZGUC1mOyeM3lTRpZLcrm8aAolzS4itwVfm7TAPyxC2E5zd6xg==", "dev": true }, + "psl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", + "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" + }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -2656,8 +2802,7 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "pupa": { "version": "2.0.1", @@ -2668,6 +2813,11 @@ "escape-goat": "^2.0.0" } }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -2778,6 +2928,55 @@ "yargs-parser": "17.0.0" } }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } + } + }, + "request-image-size": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/request-image-size/-/request-image-size-2.1.0.tgz", + "integrity": "sha512-R9ZZeR3VqmWDmiLifrnQkZINX9e5vPe503qwdoJVvFiFB27WosF1nxEfHGSCFy49vW+Go30t4aB1Wa3dx28zaA==", + "requires": { + "image-size": "^0.6.1", + "request": "^2.54.0", + "standard-http-error": "^2.0.1" + } + }, "resolve": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", @@ -2857,11 +3056,15 @@ "tslib": "^1.9.0" } }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "semver": { "version": "7.1.3", @@ -3017,6 +3220,35 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "standard-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/standard-error/-/standard-error-1.1.0.tgz", + "integrity": "sha1-I+UWj6HAggGJ5YEnAaeQWFENDTQ=" + }, + "standard-http-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/standard-http-error/-/standard-http-error-2.0.1.tgz", + "integrity": "sha1-+K6RcuPO+cs40ucIShkl9Xp8NL0=", + "requires": { + "standard-error": ">= 1.1.0 < 2" + } + }, "string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", @@ -3198,12 +3430,34 @@ "is-number": "^7.0.0" } }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, "tslib": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.0.tgz", "integrity": "sha512-BmndXUtiTn/VDDrJzQE7Mm22Ix3PxgLltW9bSNLoeCY31gnG2OPx0QqJnuc9oMIKioYrz487i6K9o4Pdn0j+Kg==", "dev": true }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -3271,7 +3525,6 @@ "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, "requires": { "punycode": "^2.1.0" } @@ -3294,8 +3547,7 @@ "uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, "v8-compile-cache": { "version": "2.1.0", @@ -3313,6 +3565,16 @@ "spdx-expression-parse": "^3.0.0" } }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, "wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", diff --git a/package.json b/package.json index 8a8d8dc..bca73a7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "dependencies": { "dotenv": "^8.2.0", "node-fetch": "^2.6.0", - "prettier": "^1.19.1" + "prettier": "^1.19.1", + "request-image-size": "^2.1.0" }, "devDependencies": { "babel-eslint": "^10.0.3", diff --git a/style.plugins.js b/style.plugins.js index 0a1f42c..bf87ff7 100644 --- a/style.plugins.js +++ b/style.plugins.js @@ -1,14 +1,5 @@ -const { - colorString, - dropShadow, - innerShadow, - imageURL, - backgroundSize, - getPaint, - paintToLinearGradient, - paintToRadialGradient, - applyFontStyle -} = require('./lib'); +const requestImageSize = require('request-image-size'); +const { colorString, dropShadow, innerShadow, getPaint, paintToLinearGradient, paintToRadialGradient, applyFontStyle } = require('./lib'); const stylePlugins = [ setMiddleOrder, @@ -207,7 +198,8 @@ function setHorizontalLayout({ node, middleStyle, innerStyle, parent, classNames } } -function setFrameStyles({ node, middleStyle }, { pngImages }) { +async function setFrameStyles(state, { pngImages }) { + const { node, middleStyle } = state; if (['FRAME', 'RECTANGLE', 'INSTANCE', 'COMPONENT'].indexOf(node.type) >= 0) { if (['FRAME', 'COMPONENT', 'INSTANCE'].indexOf(node.type) >= 0) { middleStyle.backgroundColor = colorString(node.backgroundColor); @@ -219,17 +211,24 @@ function setFrameStyles({ node, middleStyle }, { pngImages }) { middleStyle.backgroundColor = colorString(lastFill.color); middleStyle.opacity = lastFill.opacity; } else if (lastFill.type === 'IMAGE') { + const imageSize = await requestImageSize(pngImages[lastFill.imageRef]); middleStyle.backgroundImage = `url(${pngImages[lastFill.imageRef]})`; - middleStyle.backgroundSize = backgroundSize(lastFill.scaleMode); - // middleStyle.transform = `matrix(${[ - // lastFill.imageTransform[0][0], - // lastFill.imageTransform[1][0], - // lastFill.imageTransform[0][1], - // lastFill.imageTransform[1][1], - // lastFill.imageTransform[0][2], - // lastFill.imageTransform[1][2] - // ].join(',')})`; - // console.log(middleStyle.transform); + middleStyle.backgroundPosition = 'center center'; + middleStyle.backgroundRepeat = 'no-repeat'; + if (lastFill.scaleMode === 'FILL') { + middleStyle.backgroundSize = 'cover'; + } else if (lastFill.scaleMode === 'FIT') { + middleStyle.backgroundSize = 'contain'; + } else if (lastFill.scaleMode === 'TILE') { + middleStyle.backgroundPosition = 'left top'; + middleStyle.backgroundRepeat = 'repeat'; + middleStyle.backgroundSize = `${lastFill.scalingFactor * imageSize.width}px ${lastFill.scalingFactor * imageSize.height}px`; + } else if (lastFill.scaleMode === 'STRETCH') { + middleStyle.backgroundRepeat = 'no-repeat'; + middleStyle.backgroundSize = `${imageSize.width}px ${imageSize.height}px`; + middleStyle.backgroundPosition = `-${imageSize.width * lastFill.imageTransform[0][2]}px -${imageSize.height * + lastFill.imageTransform[1][2]}px`; + } } else if (lastFill.type === 'GRADIENT_LINEAR') { middleStyle.background = paintToLinearGradient(lastFill); } else if (lastFill.type === 'GRADIENT_RADIAL') { From ec2d7ea2fc0f2138678540e93dba2aaae97cec9d Mon Sep 17 00:00:00 2001 From: makame Date: Sun, 23 Feb 2020 16:44:43 +0100 Subject: [PATCH 49/50] add inline images --- README.md | 1 + content.plugins.js | 14 ++------------ index.js | 16 +++++++++++++--- lib.js | 15 ++++++--------- presets.js | 2 ++ style.plugins.js | 14 +++++++++++--- 6 files changed, 35 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index d5c4462..7ceb42b 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ figmaReact.runFigmaReact(options).catch(err => { - decorator // default 'observer' - classAfterFix // default 'Generated' - fileAfterFix // default '.generated' +- useBase64Images // default false - typeFactory // default ({ props: componentProps }) => `string` - prettierOptions // default ``` diff --git a/content.plugins.js b/content.plugins.js index e6dd782..caa555c 100644 --- a/content.plugins.js +++ b/content.plugins.js @@ -23,22 +23,12 @@ function applyStyles(state) { // TODO: use import from './${getComponentName(node.name, options)}' async function setComponentFromCache(state, shared) { const { node, content, classNames } = state; - const { - component, - imgMap, - pngImages, - componentMap, - componentDescriptionMap, - localComponentMap, - options, - additionalStyles, - genClassName - } = shared; + const { component, componentMap, localComponentMap, options, additionalStyles, genClassName } = shared; if (node.id !== component.id && node.name.charAt(0) === '#') { const name = getComponentName(node.name, options); emptyChildren(state); content.push(`<${name} {...props} nodeId='${node.id}' />`); - if (!componentMap[name]) await createComponent(node, imgMap, pngImages, componentMap, componentDescriptionMap, options); + if (!componentMap[name]) await createComponent(node, shared); localComponentMap[name] = componentMap[name]; const currentClass = genClassName(); diff --git a/index.js b/index.js index 98a7cda..496864e 100755 --- a/index.js +++ b/index.js @@ -43,7 +43,9 @@ async function runFigmaReact(options = {}) { componentDescriptionMap, vectorMap, vectorList, - options + options, + fileKey, + headers }; // Load the document from Figma @@ -61,7 +63,7 @@ async function runFigmaReact(options = {}) { // Load all images used in the document from Figma const imageJSON = await loadURLImages(vectorList, fileKey, headers); - const images = await loadImages(imageJSON, fileKey, headers); + const imgMap = await loadImages(imageJSON, fileKey, headers); const pngImages = await loadURLPNGImages(fileKey, headers); // Debug @@ -69,7 +71,15 @@ async function runFigmaReact(options = {}) { fs.writeFileSync('./temp.json', JSON.stringify(canvas, null, 4)); // Create components - await createComponents(canvas, images, pngImages, componentMap, componentDescriptionMap, options); + await createComponents(canvas, { + fileKey, + headers, + imgMap, + pngImages, + componentMap, + componentDescriptionMap, + options + }); // Generate components for (const key in componentMap) { diff --git a/lib.js b/lib.js index ab99de4..3fd7563 100644 --- a/lib.js +++ b/lib.js @@ -582,7 +582,8 @@ function getDescriptionStyles({ componentDescriptionMap, options }, node) { return description.substring(description.indexOf(delimiter) + delimiter.length).replace(/\\n/g, `\n`); } -async function createComponent(component, imgMap, pngImages, componentMap, componentDescriptionMap, options = {}) { +async function createComponent(component, parentShared) { + const { componentMap, options } = parentShared; const name = getComponentName(component.name, options); const fileName = getFileName(name); const instance = getComponentInstance(component, options); @@ -625,6 +626,7 @@ async function createComponent(component, imgMap, pngImages, componentMap, compo const path = `src/design-system/${fileName}.tsx`; const shared = { + ...parentShared, name, fileName, path, @@ -636,14 +638,9 @@ async function createComponent(component, imgMap, pngImages, componentMap, compo genClassName, printStyle, additionalStyles, - imgMap, - pngImages, - componentMap, - componentDescriptionMap, localComponentMap, stylePlugins: options.stylePlugins, - contentPlugins: options.contentPlugins, - options + contentPlugins: options.contentPlugins }; print(`return (<>`); @@ -691,12 +688,12 @@ async function createComponent(component, imgMap, pngImages, componentMap, compo componentMap[name] = { instance, name, doc, fileName, localComponentMap }; } -async function createComponents(canvas, images, pngImages, componentMap, componentDescriptionMap, options = {}) { +async function createComponents(canvas, shared) { for (let i = 0; i < canvas.children.length; i++) { const child = canvas.children[i]; if (child.name.charAt(0) === '#' && child.visible !== false) { const child = canvas.children[i]; - await createComponent(child, images, pngImages, componentMap, componentDescriptionMap, options); + await createComponent(child, shared); } } } diff --git a/presets.js b/presets.js index 6b02c88..14b6a34 100644 --- a/presets.js +++ b/presets.js @@ -19,6 +19,7 @@ module.exports = { typeFactory: typeFactoryDefault, classAfterFix: 'Generated', fileAfterFix: '.generated', + useBase64Images: false, prettierOptions: { parser: 'typescript', semi: true, @@ -44,6 +45,7 @@ module.exports = { typeFactory: typeFactoryDefault, classAfterFix: 'Generated', fileAfterFix: '.generated', + useBase64Images: false, prettierOptions: { parser: 'typescript', semi: true, diff --git a/style.plugins.js b/style.plugins.js index bf87ff7..9a330b8 100644 --- a/style.plugins.js +++ b/style.plugins.js @@ -1,4 +1,5 @@ const requestImageSize = require('request-image-size'); +const fetch = require('node-fetch'); const { colorString, dropShadow, innerShadow, getPaint, paintToLinearGradient, paintToRadialGradient, applyFontStyle } = require('./lib'); const stylePlugins = [ @@ -198,8 +199,8 @@ function setHorizontalLayout({ node, middleStyle, innerStyle, parent, classNames } } -async function setFrameStyles(state, { pngImages }) { - const { node, middleStyle } = state; +async function setFrameStyles(state, { pngImages, headers, options }) { + const { node, middleStyle, props } = state; if (['FRAME', 'RECTANGLE', 'INSTANCE', 'COMPONENT'].indexOf(node.type) >= 0) { if (['FRAME', 'COMPONENT', 'INSTANCE'].indexOf(node.type) >= 0) { middleStyle.backgroundColor = colorString(node.backgroundColor); @@ -212,7 +213,14 @@ async function setFrameStyles(state, { pngImages }) { middleStyle.opacity = lastFill.opacity; } else if (lastFill.type === 'IMAGE') { const imageSize = await requestImageSize(pngImages[lastFill.imageRef]); - middleStyle.backgroundImage = `url(${pngImages[lastFill.imageRef]})`; + if (options.useBase64Images || Object.keys(props).includes('useBase64')) { + const imageRequest = await fetch(pngImages[lastFill.imageRef], { headers }); + const imageBuffer = await imageRequest.buffer(); + const imageDataURL = `data:${imageRequest.headers.get('content-type')};base64,${imageBuffer.toString('base64')}`; + middleStyle.backgroundImage = `url(${imageDataURL})`; + } else { + middleStyle.backgroundImage = `url(${pngImages[lastFill.imageRef]})`; + } middleStyle.backgroundPosition = 'center center'; middleStyle.backgroundRepeat = 'no-repeat'; if (lastFill.scaleMode === 'FILL') { From 6a105d49cedda47b1416c93f67c398536f4081b8 Mon Sep 17 00:00:00 2001 From: makame Date: Sun, 23 Feb 2020 16:48:56 +0100 Subject: [PATCH 50/50] add input height 100% --- style.plugins.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/style.plugins.js b/style.plugins.js index 9a330b8..521e79a 100644 --- a/style.plugins.js +++ b/style.plugins.js @@ -317,7 +317,8 @@ function setTextRenderer({ node, props, middleStyle, content }, { printStyle }) if (Object.keys(props).includes('input')) { const inputId = printStyle({ - flex: 1 + flex: 1, + height: '100%' }); content.push( `