Skip to content

Commit 0ab81c2

Browse files
build: Config API url based on env
2 parents 6b6568c + 8b1e77c commit 0ab81c2

File tree

5 files changed

+93
-9
lines changed

5 files changed

+93
-9
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
API_DOMAIN = https://app.sirenapp.io/

package-lock.json

Lines changed: 80 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "test_notification",
3-
"version": "1.0.16",
3+
"version": "1.0.21",
44
"description": "JavaScript middleware designed to streamline interaction for managing and displaying in-app notifications seamlessly",
55
"main": "dist/umd/siren-js-umd-sdk.js",
66
"module": "dist/esm/siren-js-esm-sdk.js",
@@ -36,17 +36,20 @@
3636
"@rollup/plugin-commonjs": "^25.0.7",
3737
"@rollup/plugin-json": "^6.1.0",
3838
"@rollup/plugin-node-resolve": "^15.2.3",
39+
"@rollup/plugin-replace": "^5.0.5",
3940
"@rollup/plugin-terser": "^0.4.4",
4041
"@rollup/plugin-typescript": "^11.1.6",
4142
"@types/jest": "^29.5.12",
4243
"@typescript-eslint/eslint-plugin": "^7.0.2",
4344
"@typescript-eslint/parser": "^7.0.2",
45+
"dotenv": "^16.4.5",
4446
"eslint": "^8.56.0",
4547
"husky": "^9.0.11",
4648
"jest": "^29.7.0",
4749
"jest-environment-jsdom": "^29.7.0",
4850
"rollup": "^4.12.0",
4951
"rollup-plugin-livereload": "^2.0.5",
52+
"rollup-plugin-replace": "^2.2.0",
5053
"rollup-plugin-serve": "^1.1.1",
5154
"ts-jest": "^29.1.2",
5255
"ts-node": "^10.9.2"

rollup.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import typescript from '@rollup/plugin-typescript';
44
import json from '@rollup/plugin-json';
55
import terser from '@rollup/plugin-terser';
66
import babel from '@rollup/plugin-babel';
7+
import dotenv from "dotenv";
8+
import replace from 'rollup-plugin-replace'
79

10+
11+
dotenv.config()
812
export default {
913
input: 'src/Siren.ts',
1014
output: [{
@@ -21,17 +25,16 @@ export default {
2125
}
2226
],
2327
plugins: [
24-
typescript(),
2528
resolve(),
2629
commonjs(),
2730
json(),
2831
typescript({
2932
tsconfig: './tsconfig.json',
30-
declaration: true,
31-
sourceMap: false
3233
}),
3334
babel(),
3435
terser(),
35-
36+
replace({
37+
'process.env.API_DOMAIN': JSON.stringify(process?.env.API_DOMAIN)
38+
})
3639
]
3740
};

src/constants/generic.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// Todo: Update API_DOMAIN before publishing the package.
2-
export const API_DOMAIN = "https://api.stg.sirenapp.io/";
1+
export const API_DOMAIN = process.env.API_DOMAIN;
32

43
export enum HttpMethodOptions {
54
GET = "GET",

0 commit comments

Comments
 (0)