From 42baafb7264be99df1862ae851ed361ec69ecfc0 Mon Sep 17 00:00:00 2001 From: Sergii Golyshev Date: Tue, 5 Dec 2023 16:30:35 +0200 Subject: [PATCH 1/3] PF-132: Adjust validation of tokensTheme in CLI --- src/utils/figma-tokens-data-loader.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/figma-tokens-data-loader.ts b/src/utils/figma-tokens-data-loader.ts index 566cfc2..f85ff3c 100644 --- a/src/utils/figma-tokens-data-loader.ts +++ b/src/utils/figma-tokens-data-loader.ts @@ -165,9 +165,10 @@ export class FigmaTokensDataLoader { 'Unable to load mapping file: `mapping`.`tokenSets` must be an Array with at least one entry' ) } - if (map.tokensTheme && (typeof map.tokensTheme !== 'string' || (map.tokensTheme as string).length === 0)) { + + if (map.tokensTheme && ((typeof map.tokensTheme !== 'string' && !Array.isArray(map.tokensTheme)) || map.tokensTheme.length === 0)) { throw new Error( - 'Unable to load mapping file: `mapping`.`tokensTheme` must be a non-empty string' + 'Unable to load mapping file: `mapping`.`tokensTheme` must be a non-empty string or non-empty array of strings' ) } if (!map.supernovaBrand || typeof map.supernovaBrand !== 'string' || map.supernovaBrand.length === 0) { From d262479d5707d919e1d2b33f2d9d683e1fae834a Mon Sep 17 00:00:00 2001 From: Sergii Golyshev Date: Tue, 5 Dec 2023 16:32:41 +0200 Subject: [PATCH 2/3] Bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8162ee7..521067b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@supernovaio/cli", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@supernovaio/cli", - "version": "1.0.2", + "version": "1.0.3", "bundleDependencies": [ "@supernova-studio/pulsar-core", "@supernova-studio/simple-parse-github-url" diff --git a/package.json b/package.json index eded9a8..737d7bc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@supernovaio/cli", "description": "Supernova.io Command Line Interface", - "version": "1.0.2", + "version": "1.0.3", "author": "Supernova.io", "homepage": "https://supernova.io/", "keywords": [ From 84192bfea0cbfc08240148bc271db2dd371c4e2e Mon Sep 17 00:00:00 2001 From: Sergii Golyshev Date: Tue, 5 Dec 2023 17:04:31 +0200 Subject: [PATCH 3/3] CI: Publish package --- .github/workflows/deploy.yml | 63 ++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 10 ++++-- 2 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..a99a32d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,63 @@ +name: Deploy to PROD + +on: + push: + branches: [main] + # pull_request: + # branches: + # - "main" + # workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 15 + env: + TEST_API_URL: https://api.supernova.io/api/v2 + TEST_API_KEY: ${{ secrets.SN_API_KEY_PROD }} + TEST_ENVIRONMENT: production + TEST_DOC_ENVIRONMENT: Live + TEST_DESIGN_SYSTEM_ID: 105994 + TEST_SYNC_DESIGN_SYSTEM_ID: 105994 + TEST_BRAND_ID: 69a8187b-f3d3-4b0f-a892-90afe6a92dcc + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: lts/Hydrogen + + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Build local exporter + run: cd ${{ github.workspace }}/test-resources/exporter && npm i && npm run build && cd ${{ github.workspace }} + + - name: Authenticate with private NPM package + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN_READ }}" > ~/.npmrc + + - name: Install dependencies + run: npm i + + - name: Build + run: npm run build + + - name: Test + run: npm run test + + - name: Authenticate with private NPM package for publish + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN_WRITE }}" > ~/.npmrc + + - name: Publish to NPM + run: npm run publish-package diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5ed17c..17ea1ea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,10 +3,14 @@ name: Install CLI @PROD on: # push: # branches: [ main ] - pull_request: - branches: - - "main" + # pull_request: + # branches: + # - "main" workflow_dispatch: + workflow_run: + workflows: ["Deploy to PROD"] + types: + - completed jobs: build: