Skip to content

Commit ada3c6d

Browse files
authored
fix: make tokens validation less strict (#4)
1 parent c619059 commit ada3c6d

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/withStallion.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,19 @@ export interface StallionPluginProps {
1212
* Main plugin function that applies Stallion configuration to both Android and iOS
1313
*/
1414
export const withStallion: ConfigPlugin<StallionPluginProps> = (config, props) => {
15-
// Validate required props
16-
if (!props.projectId) {
17-
throw new Error('expo-stallion-plugin: projectId is required');
18-
}
19-
if (!props.appToken) {
20-
throw new Error('expo-stallion-plugin: appToken is required');
15+
// If required props are missing, skip plugin gracefully.
16+
// This allows commands like `eas env:pull` to work before
17+
// environment variables have been pulled down.
18+
if (!props.projectId || !props.appToken) {
19+
console.warn(
20+
'expo-stallion-plugin: projectId and appToken are not set — skipping native configuration. ' +
21+
'This is expected during commands like `eas env:pull`. ' +
22+
'Make sure these values are set before running a build.'
23+
);
24+
return config;
2125
}
26+
27+
// Validate prop format (only when values are actually provided)
2228
if (!props.appToken.startsWith('spb_')) {
2329
throw new Error('expo-stallion-plugin: appToken must start with "spb_"');
2430
}

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"target": "ES2020",
44
"module": "commonjs",
55
"lib": ["ES2020"],
6+
"types": ["node"],
67
"declaration": true,
78
"outDir": "./build",
89
"rootDir": "./src",

0 commit comments

Comments
 (0)