@mono-labs/cli 0.0.177 → 0.0.179

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.177",
3
+ "version": "0.0.179",
4
4
  "description": "A CLI tool for building and deploying projects",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -14,10 +14,6 @@
14
14
  "types": "./src/expo.d.ts",
15
15
  "default": "./src/expo.js"
16
16
  },
17
- "./replaceTokens": {
18
- "types": "./src/replaceTokens.d.ts",
19
- "default": "./src/replaceTokens.js"
20
- },
21
17
  "./tools": {
22
18
  "types": "./src/tools.d.ts",
23
19
  "default": "./src/tools.js"
package/src/expo.js CHANGED
@@ -1,3 +1,26 @@
1
+ export function replaceTokens(str, env) {
2
+ if (typeof str !== 'string') return str;
3
+
4
+ return str.replace(/\$\{([^}]+)\}|\$([A-Z0-9_]+)/g, (m, k1, k2) => {
5
+ const k = k1 || k2;
6
+
7
+ // existing data layer takes priority (guarded in case not defined)
8
+ if (typeof hasData === 'function' && hasData(k)) {
9
+ const val = typeof getData === 'function' ? getData(k) : undefined;
10
+ return val == null ? '' : String(val);
11
+ }
12
+
13
+ // environment variables
14
+ if (env && Object.prototype.hasOwnProperty.call(env, k)) {
15
+ const val = env[k];
16
+ return val == null ? '' : String(val);
17
+ }
18
+
19
+ // fallback
20
+ return '';
21
+ });
22
+ }
23
+
1
24
  function filterEnvByPrefix(env, prefix) {
2
25
  const filtered = {};
3
26
  for (const key in env) {
package/src/expo.ts CHANGED
@@ -1,3 +1,7 @@
1
1
  // Type definitions for mono-labs CLI
2
2
  import type { AppJSONConfig, ExpoConfig } from 'expo/config';
3
3
  export declare function setUpConfig(config: AppJSONConfig): ExpoConfig;
4
+ export declare function replaceTokens(
5
+ input: string,
6
+ tokens: Record<string, string>
7
+ ): string;
@@ -1,36 +0,0 @@
1
- function filterEnvByPrefix(env, prefix) {
2
- const filtered = {};
3
- for (const key in env) {
4
- if (key.startsWith(prefix)) {
5
- filtered[key] = env[key];
6
- }
7
- }
8
- return filtered;
9
- }
10
-
11
- export function setUpConfig(config) {
12
- const { extra = {}, ...other } = config.expo || {};
13
- const router =
14
- extra['router'] ?
15
- { origin: false, ...extra['router'] }
16
- : {
17
- origin: false,
18
- };
19
- const appConfig = {
20
- ...config,
21
-
22
- expo: {
23
- ...other,
24
- extra: {
25
- ...filterEnvByPrefix(process.env, 'NEXT_PUBLIC_'),
26
- eas: {
27
- projectId: process.env.EAS_PROJECT_ID,
28
- },
29
- router,
30
- ...extra,
31
- },
32
- },
33
- };
34
-
35
- return appConfig;
36
- }
@@ -1,4 +0,0 @@
1
- export declare function replaceTokens(
2
- input: string,
3
- tokens: Record<string, string>
4
- ): string;