Skip to content

Commit 6d0e466

Browse files
SK-2618: Fix build script to correctly include compiled lib output in published package (#130)
* SK-2618: update build command to include ts, common and modules libraries in build
1 parent 76946da commit 6d0e466

File tree

7 files changed

+34
-27
lines changed

7 files changed

+34
-27
lines changed

.github/workflows/internal-release.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,8 @@ jobs:
2323
- uses: actions/setup-node@v1
2424
with:
2525
node-version: 14.21.3
26-
- run: npm install
27-
28-
- name: npm build
29-
run: npm run build
3026

31-
- name: build react-native-sdk
32-
run: |
33-
curl -u ${{ secrets.JFROG_USERNAME }}:${{ secrets.JFROG_PASSWORD }} https://prekarilabs.jfrog.io/prekarilabs/api/npm/auth/ > ~/.npmrc
34-
npm config set registry https://prekarilabs.jfrog.io/prekarilabs/api/npm/npm/
35-
npm config set unsafe-perm true
36-
npm run build
27+
- run: npm install
3728

3829
- name: Get Previous tag
3930
id: previoustag
@@ -54,6 +45,12 @@ jobs:
5445
git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev.$(git rev-parse --short $GITHUB_SHA)"
5546
git push origin -f
5647
57-
- name: publish to jfrog
48+
- name: build react-native-sdk
5849
run: |
59-
npm publish
50+
curl -u ${{ secrets.JFROG_USERNAME }}:${{ secrets.JFROG_PASSWORD }} https://prekarilabs.jfrog.io/prekarilabs/api/npm/auth/ > ~/.npmrc
51+
npm config set registry https://prekarilabs.jfrog.io/prekarilabs/api/npm/npm/
52+
npm config set unsafe-perm true
53+
npm run build
54+
55+
- name: publish to jfrog
56+
run: npm publish

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ jobs:
2020
with:
2121
node-version: 14.21.3
2222
registry-url: 'https://registry.npmjs.org'
23-
- run: npm install
23+
2424

2525
- name: install modules
2626
run: npm install
2727

28-
- name: Build
29-
run: npm run build
30-
3128
- name: Get Previous tag
3229
id: previoustag
3330
uses: WyriHaximus/github-action-get-previous-tag@v1
@@ -47,6 +44,9 @@ jobs:
4744
git commit -m "[AUTOMATED] Public Release - ${{ steps.previoustag.outputs.tag }}"
4845
git push
4946
47+
- name: Build
48+
run: npm run build
49+
5050
- name: publish to npm
5151
run: npm publish
5252
env:

package.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@
44
"description": "Skyflow React Native SDK",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
7-
"types": "lib/typescript/src/index.d.ts",
8-
"exports": {
9-
".": {
10-
"types": "./lib/typescript/src/index.d.ts",
11-
"import": "./lib/module/index.js",
12-
"require": "./lib/commonjs/index.js"
13-
}
14-
},
7+
"types": "lib/typescript/index.d.ts",
158
"react-native": "src/index",
169
"source": "src/index",
1710
"files": [
@@ -36,7 +29,7 @@
3629
"prepare": "bob build",
3730
"example": "yarn --cwd example",
3831
"bootstrap": "yarn example && yarn && yarn example pods",
39-
"build": "bob build && cp -r assets lib/ && cp package.json lib/"
32+
"build": "node scripts/generateSdkDetails.js && bob build && cp -r assets lib/"
4033
},
4134
"keywords": [
4235
"react-native",

scripts/generateSdkDetails.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const fs = require('fs');
2+
const pkg = require('../package.json');
3+
4+
const content = `
5+
export const sdkDetails = {
6+
name: "${pkg.name}",
7+
version: "${pkg.version}",
8+
reactNativeVersion: "${pkg.devDependencies['react-native']}"
9+
};
10+
`;
11+
12+
fs.writeFileSync('src/sdkDetails.ts', content);

src/core-utils/client/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import SkyflowError from '../../utils/skyflow-error';
77
import SKYFLOW_ERROR_CODE from '../../utils/skyflow-error-code';
88
import { getMetaObject } from '../../utils/helpers';
99
import { Platform } from 'react-native';
10-
import sdkDetails from '../../../package.json';
10+
import { sdkDetails } from '../../sdkDetails';
1111

1212
export interface IClientRequest {
1313
body?: any;

src/core/constants/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import maseterCardIcon from '../../../assets/mastercard.png';
1313
import unionPayIcon from '../../../assets/unionpay.png';
1414
import visaCardIcon from '../../../assets/visa.png';
1515
import cartesBancairesIcon from '../../../assets/carter-banceris.png'
16-
import sdkDetails from '../../../package.json';
16+
import { sdkDetails } from '../../sdkDetails';
1717

1818
export const SDK_DETAILS = {
1919
sdkName: 'React Native',

src/sdkDetails.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const sdkDetails = {
2+
name: '',
3+
version: '',
4+
reactNativeVersion: '',
5+
};

0 commit comments

Comments
 (0)