Skip to content

Commit

Permalink
chore: add script to check endpoints before build
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei0x309 committed Sep 20, 2024
1 parent 5d81f19 commit 0c1cdb9
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 18 deletions.
4 changes: 2 additions & 2 deletions apps/yup-live-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "gf.info.yup"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 56
versionName "1.4.4"
versionCode 57
versionName "1.4.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
3 changes: 2 additions & 1 deletion apps/yup-live-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"lint": "eslint --ext .ts,.vue --ignore-path .gitignore --fix src&&prettier . -w -u",
"build": "vue-tsc --noEmit && vite build",
"android": "ionic cap run android -l --external --host=4875.flashsoft.eu --port=4875 --livereload-url=https://4875.flashsoft.eu",
"android-build": "yarn build && ionic capacitor sync android --prod --no-build",
"check-endpoints": "bun run ./scripts/check-build-endpoints.ts",
"android-build": "yarn check-endpoints && yarn build && ionic capacitor sync android --prod --no-build",
"android-open": "ionic capacitor open android",
"android-res": "cordova-res android --skip-config --copy",
"android-ver": "deno run -A ./scripts/update-version.ts",
Expand Down
28 changes: 28 additions & 0 deletions apps/yup-live-mobile/scripts/check-build-endpoints.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { API_BASE as API_BASE_AUTH } from 'shared/src/utils/auth'
import { API_BASE as API_BASE_WEB3_POSTING } from 'shared/src/utils/requests/web3-posting'
import { API_BASE as API_BASE_THREADS } from 'shared/src/utils/requests/threads'
import { API_BASE as API_BASE_TEAM } from 'shared/src/utils/requests/team'
import { API_BASE as API_BASE_FARCASTER } from 'shared/src/utils/requests/farcaster'
import { API_BASE as API_BASE_ACCOUNTS } from 'shared/src/utils/requests/accounts'


const ENDPOINTS = [
API_BASE_AUTH,
API_BASE_WEB3_POSTING,
API_BASE_THREADS,
API_BASE_TEAM,
API_BASE_FARCASTER,
API_BASE_ACCOUNTS,
]

const checkEndpointsForProd = () => {
for (const endpoint of ENDPOINTS) {
if (endpoint.includes('dev.') || endpoint.includes('fstun.')) {
console.error('Endpoint should not contain dev. or fstun. in production:', endpoint)
process.exit(1)
}
}
console.log('All endpoints are correct for production')
}

checkEndpointsForProd()
4 changes: 2 additions & 2 deletions packages/shared/src/utils/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { IMainStore } from '../types/store'

const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');
export const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// export const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');


// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/utils/requests/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type { TPlatform } from '../../types/web3-posting'
import { fetchWAuth } from '../auth'
import { fetchWeb3Profile } from './web3Profiles'

const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');
export const API_BASE = import.meta.env.VITE_YUP_API_BASE;
//export const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');


export const getActionUsage = async (userId: string) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/utils/requests/farcaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { wait } from '../time'
import { walletDisconnect } from '../login-signup'
import { TChannel } from 'shared/src/types/web3-posting';

// const API_BASE = import.meta.env.VITE_YUP_API_BASE;
const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');
export const API_BASE = import.meta.env.VITE_YUP_API_BASE;
//export const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');


export const EIP_712_FARCASTER_DOMAIN = {
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/src/utils/requests/team.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { fetchWAuth } from '../auth'
import type { IMainStore } from '../../types/store'

const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// const API_BASE = (import.meta.env.VITE_YUP_API_BASE).replace('api.', 'dev.api.')
// const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');
export const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// export const API_BASE = (import.meta.env.VITE_YUP_API_BASE).replace('api.', 'dev.api.')
// export const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');


type T_FAIL = {
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/utils/requests/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { Ref } from 'vue';
import type { IMainStore } from '../../types/store'
import { fetchWAuth } from '../auth'

const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');
export const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// export const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');

const deviceID = 'android-k3wpbt5bk5c0000'

Expand Down
7 changes: 3 additions & 4 deletions packages/shared/src/utils/requests/web3-posting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { fetchWAuth } from '../auth';
import type { IMainStore } from '../../types/store';
import type { Ref } from 'vue';

const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.', 'dev.api.');
// const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'localhost:4001').replace('https', 'http');
// const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');
export const API_BASE = import.meta.env.VITE_YUP_API_BASE;
// export const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.', 'dev.api.');
// export const API_BASE = import.meta.env.VITE_YUP_API_BASE.replace('api.yup.io', 'fstun.flashsoft.eu');

export const PLATFORMS: TPlatform[] = ["farcaster", "twitter", "lens", "bsky", "threads"];

Expand Down

0 comments on commit 0c1cdb9

Please sign in to comment.