From 728fd4779c03b976b04f75f4c3278f13d4be60cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Sun, 11 Apr 2021 11:15:59 +0200 Subject: [PATCH] Dynamically fetching correct version and generating declarations only for npm lib --- .github/workflows/push-to-npm.yml | 17 +++++++++++++---- front/packages/iframe-api-typings/package.json | 2 +- front/tsconfig.json | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/push-to-npm.yml b/.github/workflows/push-to-npm.yml index 354cb651..798e2530 100644 --- a/.github/workflows/push-to-npm.yml +++ b/.github/workflows/push-to-npm.yml @@ -1,7 +1,5 @@ name: Push @workadventure/iframe-api-typings to NPM on: - # TODO remove action on push - push: ~ release: types: [created] jobs: @@ -14,8 +12,19 @@ jobs: with: node-version: '14.x' registry-url: 'https://registry.npmjs.org' - # TODO: replace version with RELEASE tag - # TODO: enable declaration flag in tsconfig dynamically + + - name: Edit tsconfig.json to add declarations + run: "sed -i 's/\"declaration\": false/\"declaration\": true/g' tsconfig.json" + working-directory: "front" + + - name: Replace version number + run: 'sed -i "s#VERSION_PLACEHOLDER#${GITHUB_REF/refs\/tags\//}#g" package.json' + working-directory: "front/packages/iframe-api-typings" + + - name: Debug package.json + run: cat package.json + working-directory: "front/packages/iframe-api-typings" + - name: Install Protoc uses: arduino/setup-protoc@v1 with: diff --git a/front/packages/iframe-api-typings/package.json b/front/packages/iframe-api-typings/package.json index 61184c4e..fa35851c 100644 --- a/front/packages/iframe-api-typings/package.json +++ b/front/packages/iframe-api-typings/package.json @@ -1,6 +1,6 @@ { "name": "@workadventure/iframe-api-typings", - "version": "1.2.0", + "version": "VERSION_PLACEHOLDER", "description": "Typescript typings for WorkAdventure iFrame API", "main": "iframe_api.js", "types": "iframe_api.d.ts", diff --git a/front/tsconfig.json b/front/tsconfig.json index f6cb384a..b5c8c74d 100644 --- a/front/tsconfig.json +++ b/front/tsconfig.json @@ -5,7 +5,7 @@ "moduleResolution": "node", "module": "CommonJS", "target": "ES2015", - "declaration": true, + "declaration": false, "downlevelIteration": true, "jsx": "react", "allowJs": true,