@mono-labs/cli 0.0.61 → 0.0.63
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/lib/app.js +18 -15
- package/lib/commands/build/index.js +4 -4
- package/lib/commands/build-process/runners/runBackground.js +11 -5
- package/lib/commands/dev/dev-editor.js +233 -220
- package/lib/commands/submit/index.js +18 -18
- package/lib/commands/update/index.js +32 -32
- package/package.json +4 -4
package/lib/app.js
CHANGED
|
@@ -1,47 +1,50 @@
|
|
|
1
|
-
import { Command } from 'commander'
|
|
1
|
+
import { Command } from 'commander';
|
|
2
2
|
|
|
3
|
-
import { STAGING_URL } from './config.js'
|
|
3
|
+
import { STAGING_URL } from './config.js';
|
|
4
4
|
|
|
5
5
|
import fs from 'node:fs';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { dirname, join } from 'node:path';
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
10
|
const __dirname = dirname(__filename);
|
|
12
11
|
|
|
13
|
-
const pkgPath = join(__dirname, '../', 'package.json');
|
|
12
|
+
const pkgPath = join(__dirname, '../', 'package.json');
|
|
14
13
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
15
14
|
|
|
16
|
-
const version = pkg.version || '0.0.1'
|
|
17
|
-
export const program = new Command()
|
|
15
|
+
const version = pkg.version || '0.0.1';
|
|
16
|
+
export const program = new Command();
|
|
18
17
|
|
|
19
18
|
const getBinFromPackageJSON = () => {
|
|
20
19
|
const keyList = Object.keys(pkg.bin);
|
|
21
|
-
if(keyList.length === 0) {
|
|
20
|
+
if (keyList.length === 0) {
|
|
22
21
|
throw new Error('No bin field found in package.json');
|
|
23
22
|
}
|
|
24
23
|
return keyList[0];
|
|
25
|
-
}
|
|
26
|
-
|
|
24
|
+
};
|
|
27
25
|
|
|
28
26
|
const programName = getBinFromPackageJSON();
|
|
29
27
|
console.log('description', pkg.description);
|
|
30
28
|
|
|
31
|
-
program
|
|
29
|
+
program
|
|
30
|
+
.name(programName)
|
|
31
|
+
.description(pkg.description || '')
|
|
32
|
+
.version(version);
|
|
32
33
|
const EXPO_PUBLIC_API_URL =
|
|
33
|
-
(process.env.EXPO_PUBLIC_API_URL &&
|
|
34
|
+
(process.env.EXPO_PUBLIC_API_URL &&
|
|
35
|
+
process.env.EXPO_PUBLIC_API_URL.length > 0) ||
|
|
36
|
+
STAGING_URL;
|
|
34
37
|
|
|
35
38
|
export const generateEnvValues = (
|
|
36
39
|
forceProd = false,
|
|
37
40
|
ngrokUrl = 'localhost:3000',
|
|
38
|
-
useAtlas = false
|
|
41
|
+
useAtlas = false
|
|
39
42
|
) => {
|
|
40
43
|
return {
|
|
41
44
|
...process.env,
|
|
42
45
|
EXPO_PUBLIC_API_URL,
|
|
43
|
-
|
|
46
|
+
NEXT_FORCE_PROD: forceProd,
|
|
44
47
|
EXPO_PRIVATE_API_URL: ngrokUrl,
|
|
45
48
|
EXPO_UNSTABLE_ATLAS: useAtlas,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -42,13 +42,13 @@ program
|
|
|
42
42
|
console.log(`Building ${platform} with profile ${'`'}${profile}${'`'}`);
|
|
43
43
|
console.log('\n\n\n');
|
|
44
44
|
|
|
45
|
-
const
|
|
46
|
-
console.log('
|
|
45
|
+
const NEXT_FORCE_PROD = str.force || isDev ? 'false' : 'true';
|
|
46
|
+
console.log('NEXT_FORCE_PROD', NEXT_FORCE_PROD);
|
|
47
47
|
|
|
48
|
-
let envObj = generateEnvValues(
|
|
48
|
+
let envObj = generateEnvValues(NEXT_FORCE_PROD, '', false);
|
|
49
49
|
if (!isDev) {
|
|
50
50
|
envObj.EXPO_PUBLIC_API_URL = `${STAGING_URL}`;
|
|
51
|
-
envObj.
|
|
51
|
+
envObj.NEXT_FORCE_PROD = 'true';
|
|
52
52
|
} else {
|
|
53
53
|
const publicUrl = process.env.EXPO_PUBLIC_API_URL || `${STAGING_URL}`;
|
|
54
54
|
envObj.EXPO_PUBLIC_API_URL = publicUrl;
|
|
@@ -2,6 +2,15 @@ import { spawn } from 'child_process';
|
|
|
2
2
|
import { getData, replaceTokens } from '../dataLayer.js';
|
|
3
3
|
import { registerBackground } from './processManager.js';
|
|
4
4
|
|
|
5
|
+
function createdExpandedEnv(envObj) {
|
|
6
|
+
const expandedEnv = {};
|
|
7
|
+
for (const k of Object.keys(envObj)) {
|
|
8
|
+
const v = envObj[k];
|
|
9
|
+
expandedEnv[k] = typeof v === 'string' ? replaceTokens(v) : v;
|
|
10
|
+
}
|
|
11
|
+
return expandedEnv;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
export function runBackground(
|
|
6
15
|
cmd,
|
|
7
16
|
envObj = {},
|
|
@@ -11,11 +20,8 @@ export function runBackground(
|
|
|
11
20
|
const isWin = process.platform === 'win32';
|
|
12
21
|
|
|
13
22
|
// Replace ${field} tokens in env values using dataLayer
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const v = envObj[k];
|
|
17
|
-
expandedEnv[k] = typeof v === 'string' ? replaceTokens(v) : v;
|
|
18
|
-
}
|
|
23
|
+
console.log('envObj:', envObj);
|
|
24
|
+
const expandedEnv = createdExpandedEnv(envObj);
|
|
19
25
|
|
|
20
26
|
// Replace in command string
|
|
21
27
|
const outCmd = replaceTokens(cmd);
|
|
@@ -1,263 +1,276 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import 'dotenv/config';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import treeKill from 'tree-kill';
|
|
1
5
|
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import
|
|
5
|
-
import treeKill from 'tree-kill'
|
|
6
|
+
import { generateEnvValues } from '../../app.js';
|
|
7
|
+
import { STAGING_URL } from '../../config.js';
|
|
8
|
+
import { getNgrokUrl } from './ngrok.js';
|
|
6
9
|
|
|
7
|
-
import { generateEnvValues } from '../../app.js'
|
|
8
|
-
import { STAGING_URL } from '../../config.js'
|
|
9
|
-
import { getNgrokUrl } from './ngrok.js'
|
|
10
|
-
|
|
11
|
-
// EXPO_FORCE_PROD = true;
|
|
12
10
|
// EXPO_UNSTABLE_ATLAS = false;
|
|
13
11
|
|
|
14
12
|
// Import the runDevCommand function
|
|
15
13
|
const colors = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
14
|
+
red: '\x1b[31m',
|
|
15
|
+
green: '\x1b[32m',
|
|
16
|
+
yellow: '\x1b[33m',
|
|
17
|
+
white: '\x1b[37m',
|
|
18
|
+
blue: '\x1b[34m',
|
|
19
|
+
magenta: '\x1b[35m',
|
|
20
|
+
cyan: '\x1b[36m',
|
|
21
|
+
reset: '\x1b[0m',
|
|
22
|
+
};
|
|
25
23
|
|
|
26
24
|
function getContinuedServices() {
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const continuedServices = Object.keys(devServices).filter(
|
|
26
|
+
(key) => devServices[key].continue
|
|
27
|
+
);
|
|
28
|
+
return continuedServices;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function getPrepServices() {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const continuedServices = Object.keys(devServices).filter(
|
|
33
|
+
(key) => !devServices[key].continue
|
|
34
|
+
);
|
|
35
|
+
return continuedServices;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
const devServicesRoot = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
39
|
+
docker: {
|
|
40
|
+
command: 'docker compose up -d',
|
|
41
|
+
key: '?',
|
|
42
|
+
icon: '🐳',
|
|
43
|
+
stdio: 'ignore',
|
|
44
|
+
},
|
|
45
|
+
backend: {
|
|
46
|
+
command: 'yarn backend server',
|
|
47
|
+
key: 'b',
|
|
48
|
+
color: colors.yellow,
|
|
49
|
+
continue: true,
|
|
50
|
+
icon: '🦾',
|
|
51
|
+
},
|
|
52
|
+
// app: {
|
|
53
|
+
// command: 'yarn workspace app expo start -c --tunnel --dev-client',
|
|
54
|
+
// key: 'a',
|
|
55
|
+
// color: colors.white,
|
|
56
|
+
// continue: true,
|
|
57
|
+
// icon: '📱',
|
|
58
|
+
// stdio: ['inherit', 'inherit', 'inherit'],
|
|
59
|
+
// },
|
|
60
|
+
dynamo: {
|
|
61
|
+
command:
|
|
62
|
+
'yarn backend dynamodb-admin -p 8082 --dynamo-endpoint=http://localhost:8000',
|
|
63
|
+
key: 'd',
|
|
64
|
+
continue: true,
|
|
65
|
+
icon: '📦',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
65
68
|
|
|
66
|
-
const devServices = {}
|
|
69
|
+
const devServices = {};
|
|
67
70
|
Object.keys(devServicesRoot).forEach((key) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
})
|
|
74
|
-
const childProcesses = {}
|
|
75
|
-
let allowRestart = true
|
|
71
|
+
const service = devServicesRoot[key];
|
|
72
|
+
devServices[key] = {
|
|
73
|
+
...service,
|
|
74
|
+
name: key,
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
const childProcesses = {};
|
|
78
|
+
let allowRestart = true;
|
|
76
79
|
|
|
77
|
-
const totalRetries = 5
|
|
80
|
+
const totalRetries = 5;
|
|
78
81
|
|
|
79
82
|
function startService(key, forceProd, ngrokUrl, stage, envObj) {
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
const { command, stdio } = devServices[key];
|
|
84
|
+
const isContinued = devServices[key].continue;
|
|
82
85
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
const child = spawn(command, {
|
|
87
|
+
stdio: stdio ? stdio : ['ignore', 'pipe', 'pipe'],
|
|
88
|
+
shell: true,
|
|
89
|
+
env: {
|
|
90
|
+
...envObj,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
90
93
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
childProcesses[key] = child;
|
|
95
|
+
childManager(child, devServices[key], false, () => {
|
|
96
|
+
if (isContinued && allowRestart && key !== 'backend') {
|
|
97
|
+
setTimeout(
|
|
98
|
+
() => startService(key, forceProd, ngrokUrl, stage, envObj),
|
|
99
|
+
2000
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
const write = (color, message) => {
|
|
100
|
-
|
|
101
|
-
}
|
|
106
|
+
process.stdout.write(`${color}${message}${colors.reset}\n`);
|
|
107
|
+
};
|
|
102
108
|
|
|
103
|
-
const serviceSigInt = {}
|
|
109
|
+
const serviceSigInt = {};
|
|
104
110
|
|
|
105
|
-
function childManager(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
function childManager(
|
|
112
|
+
child,
|
|
113
|
+
service,
|
|
114
|
+
nowrite = false,
|
|
115
|
+
restartCallback = undefined
|
|
116
|
+
) {
|
|
117
|
+
const color = service.color || undefined;
|
|
118
|
+
const writeToBox = (data) => {
|
|
119
|
+
if (color) write(color, data.toString());
|
|
120
|
+
};
|
|
110
121
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
if (!nowrite) {
|
|
123
|
+
child.stdout?.on('data', writeToBox);
|
|
124
|
+
child.stderr?.on('data', writeToBox);
|
|
125
|
+
}
|
|
115
126
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
child.on('sigint', (code) => {
|
|
128
|
+
console.log('sigint');
|
|
129
|
+
console.log(
|
|
130
|
+
`\n${service.icon || '🔚'} ${service.name || 'Service'} exited with code ${code}`
|
|
131
|
+
);
|
|
132
|
+
if (restartCallback) restartCallback();
|
|
133
|
+
});
|
|
121
134
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
135
|
+
child.on('exit', (code) => {
|
|
136
|
+
if (!serviceSigInt[service.name] && restartCallback) {
|
|
137
|
+
console.log(
|
|
138
|
+
`\n${service.icon || '🔚'} ${service.name || 'Service'} exited with code ${code}\n`
|
|
139
|
+
);
|
|
140
|
+
restartCallback();
|
|
141
|
+
}
|
|
142
|
+
});
|
|
130
143
|
}
|
|
131
144
|
|
|
132
145
|
export async function dev(_forceProd, useAtlas, argServices, stage) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
const forceProd = stage === true ? true : _forceProd;
|
|
147
|
+
let acceptedServices = argServices || undefined;
|
|
148
|
+
if (acceptedServices === undefined && !stage) {
|
|
149
|
+
const { acceptedServices: services } = await inquirer.prompt([
|
|
150
|
+
{
|
|
151
|
+
type: 'checkbox',
|
|
152
|
+
name: 'acceptedServices',
|
|
153
|
+
message: 'Select services to run:',
|
|
154
|
+
choices: Object.keys(devServices).map((key) => ({
|
|
155
|
+
name: key,
|
|
156
|
+
value: key,
|
|
157
|
+
})),
|
|
158
|
+
default: Object.keys(devServices).map((key) => key),
|
|
159
|
+
},
|
|
160
|
+
]);
|
|
148
161
|
|
|
149
|
-
|
|
150
|
-
|
|
162
|
+
acceptedServices = services;
|
|
163
|
+
}
|
|
151
164
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
let ngrokUrl = '';
|
|
166
|
+
if (!forceProd && !stage) {
|
|
167
|
+
let envObj = generateEnvValues(forceProd);
|
|
168
|
+
getPrepServices().forEach((key) => {
|
|
169
|
+
const { command, stdio } = devServices[key];
|
|
170
|
+
if (acceptedServices.includes(key)) {
|
|
171
|
+
console.log(`Running command for service ${key}: ${command}`);
|
|
172
|
+
const child = spawn(command, {
|
|
173
|
+
stdio: ['pipe', 'inherit', 'pipe'], // Read from terminal, but capture output
|
|
174
|
+
shell: true,
|
|
175
|
+
env: {
|
|
176
|
+
...envObj,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
if (key === 'app') {
|
|
180
|
+
child.on('sigint', () => {
|
|
181
|
+
console.log('SIGINT received for app service');
|
|
182
|
+
});
|
|
183
|
+
child.on('exit', () => {
|
|
184
|
+
console.log('exit received for app service');
|
|
185
|
+
});
|
|
186
|
+
}
|
|
174
187
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
188
|
+
childProcesses[key] = child;
|
|
189
|
+
childManager(child, devServices[key], true);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
179
192
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
193
|
+
while (!ngrokUrl) {
|
|
194
|
+
try {
|
|
195
|
+
ngrokUrl = (await getNgrokUrl()) + '/';
|
|
196
|
+
} catch (e) {
|
|
197
|
+
console.log('Ngrok failed to start. Retrying in 2 seconds...');
|
|
198
|
+
console.log(e);
|
|
199
|
+
await new Promise((res) => setTimeout(res, 2000)); // Delay before retry
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
190
203
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
204
|
+
let envObj = generateEnvValues(forceProd, ngrokUrl, useAtlas);
|
|
205
|
+
if (stage) {
|
|
206
|
+
envObj.EXPO_PUBLIC_API_URL = `${STAGING_URL}`;
|
|
207
|
+
envObj.ApiUrl = `${STAGING_URL}`;
|
|
208
|
+
envObj.NEXT_FORCE_PROD = 'true';
|
|
209
|
+
} else {
|
|
210
|
+
const publicUrl = process.env.EXPO_PUBLIC_API_URL || `${STAGING_URL}`;
|
|
211
|
+
envObj.EXPO_PUBLIC_API_URL = publicUrl;
|
|
212
|
+
envObj.ApiUrl = `${STAGING_URL}`;
|
|
213
|
+
}
|
|
201
214
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
setTimeout(
|
|
216
|
+
() => {
|
|
217
|
+
console.log('ngrokUrl', ngrokUrl);
|
|
218
|
+
console.log('envObj', envObj);
|
|
219
|
+
getContinuedServices().forEach((key) => {
|
|
220
|
+
if (stage && key === 'app') {
|
|
221
|
+
startService(key, forceProd, ngrokUrl, stage, envObj);
|
|
222
|
+
} else {
|
|
223
|
+
if (!stage && acceptedServices.includes(key)) {
|
|
224
|
+
startService(key, forceProd, ngrokUrl, stage, envObj);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
!forceProd ? 5000 : 100
|
|
230
|
+
);
|
|
218
231
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
232
|
+
async function shutdown() {
|
|
233
|
+
console.log('\n🛑 Shutting down all services...');
|
|
234
|
+
for (const [key, child] of Object.entries(childProcesses)) {
|
|
235
|
+
if (
|
|
236
|
+
child &&
|
|
237
|
+
child.pid &&
|
|
238
|
+
!child.killed &&
|
|
239
|
+
devServices[key].continue &&
|
|
240
|
+
!['docker'].includes(key)
|
|
241
|
+
) {
|
|
242
|
+
console.log(`→ Killing service: ${key}`);
|
|
243
|
+
await new Promise((resolve) => {
|
|
244
|
+
treeKill(child.pid, 'SIGTERM', (err) => {
|
|
245
|
+
if (!err) {
|
|
246
|
+
console.log(`✅ ${key} has been tree-killed.`);
|
|
247
|
+
}
|
|
248
|
+
resolve();
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
if (key === ' docker') {
|
|
253
|
+
spawn(command, {
|
|
254
|
+
stdio: 'docker-compose down', // Read from terminal, but capture output
|
|
255
|
+
shell: true,
|
|
256
|
+
env: {
|
|
257
|
+
...envObj,
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
250
263
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
264
|
+
process.on('SIGINT', () => {
|
|
265
|
+
shutdown().then(() => process.exit(0));
|
|
266
|
+
});
|
|
254
267
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
268
|
+
process.on('SIGTERM', () => {
|
|
269
|
+
shutdown().then(() => process.exit(0));
|
|
270
|
+
});
|
|
258
271
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
272
|
+
// Exit signal
|
|
273
|
+
process.on('exit', () => {
|
|
274
|
+
console.log('👋 Process exiting...');
|
|
275
|
+
});
|
|
263
276
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { spawn } from 'child_process'
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
2
|
|
|
3
|
-
import { program } from '../../app.js'
|
|
4
|
-
import { generateEnvValues } from '../../app.js'
|
|
5
|
-
import { STAGING_URL } from '../../config.js'
|
|
3
|
+
import { program } from '../../app.js';
|
|
4
|
+
import { generateEnvValues } from '../../app.js';
|
|
5
|
+
import { STAGING_URL } from '../../config.js';
|
|
6
6
|
|
|
7
7
|
program
|
|
8
8
|
.command('submit')
|
|
@@ -10,29 +10,29 @@ program
|
|
|
10
10
|
.option('--android', 'Build to target preview profile')
|
|
11
11
|
.option('--ios', 'Build to target production profile')
|
|
12
12
|
.action((str, options) => {
|
|
13
|
-
console.log('its me')
|
|
14
|
-
console.log('test')
|
|
13
|
+
console.log('its me');
|
|
14
|
+
console.log('test');
|
|
15
15
|
//console.log(options);
|
|
16
|
-
console.log(str)
|
|
16
|
+
console.log(str);
|
|
17
17
|
|
|
18
|
-
let envObj = generateEnvValues(true, '', false)
|
|
18
|
+
let envObj = generateEnvValues(true, '', false);
|
|
19
19
|
|
|
20
|
-
envObj.EXPO_PUBLIC_API_URL = `${STAGING_URL}
|
|
21
|
-
envObj.
|
|
22
|
-
envObj.EAS_BUILD_PROFILE = 'production'
|
|
20
|
+
envObj.EXPO_PUBLIC_API_URL = `${STAGING_URL}`;
|
|
21
|
+
envObj.NEXT_FORCE_PROD = 'true';
|
|
22
|
+
envObj.EAS_BUILD_PROFILE = 'production';
|
|
23
23
|
|
|
24
|
-
const command = `workspace app eas submit ${str.android ? `--platform android` : `--platform ios`}
|
|
25
|
-
console.log('Running command:', command)
|
|
24
|
+
const command = `workspace app eas submit ${str.android ? `--platform android` : `--platform ios`}`;
|
|
25
|
+
console.log('Running command:', command);
|
|
26
26
|
const child = spawn('yarn', [command], {
|
|
27
27
|
stdio: 'inherit',
|
|
28
28
|
shell: true, // required if using shell-style commands or cross-platform support
|
|
29
29
|
env: {
|
|
30
30
|
...envObj,
|
|
31
31
|
},
|
|
32
|
-
})
|
|
32
|
+
});
|
|
33
33
|
|
|
34
34
|
child.on('exit', (code) => {
|
|
35
|
-
console.log(`Process exited with code ${code}`)
|
|
36
|
-
process.exit(code ?? 0)
|
|
37
|
-
})
|
|
38
|
-
})
|
|
35
|
+
console.log(`Process exited with code ${code}`);
|
|
36
|
+
process.exit(code ?? 0);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { spawn } from 'child_process'
|
|
2
|
-
import inquirer from 'inquirer'
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
3
|
|
|
4
|
-
import { program } from '../../app.js'
|
|
5
|
-
import { STAGING_URL } from '../../config.js'
|
|
6
|
-
import { getEASBranches } from './eas.js'
|
|
4
|
+
import { program } from '../../app.js';
|
|
5
|
+
import { STAGING_URL } from '../../config.js';
|
|
6
|
+
import { getEASBranches } from './eas.js';
|
|
7
7
|
|
|
8
|
-
const EXPO_PUBLIC_API_URL = STAGING_URL
|
|
9
|
-
const
|
|
10
|
-
const EXPO_BUILD_PROFILE = 'production'
|
|
8
|
+
const EXPO_PUBLIC_API_URL = STAGING_URL;
|
|
9
|
+
const NEXT_FORCE_PROD = true;
|
|
10
|
+
const EXPO_BUILD_PROFILE = 'production';
|
|
11
11
|
|
|
12
12
|
program
|
|
13
13
|
.command('update')
|
|
@@ -16,7 +16,7 @@ program
|
|
|
16
16
|
.action(async (str) => {
|
|
17
17
|
//console.log(raw.toString());
|
|
18
18
|
|
|
19
|
-
const { auto } = str
|
|
19
|
+
const { auto } = str;
|
|
20
20
|
|
|
21
21
|
if (auto) {
|
|
22
22
|
const fastChild = spawn(`yarn eas update --auto`, {
|
|
@@ -24,26 +24,26 @@ program
|
|
|
24
24
|
shell: true,
|
|
25
25
|
env: {
|
|
26
26
|
...process.env,
|
|
27
|
-
|
|
27
|
+
NEXT_FORCE_PROD,
|
|
28
28
|
EXPO_PUBLIC_API_URL,
|
|
29
29
|
EXPO_BUILD_PROFILE,
|
|
30
30
|
},
|
|
31
|
-
})
|
|
31
|
+
});
|
|
32
32
|
fastChild.stdout.on('data', (data) => {
|
|
33
|
-
process.stdout.write(data) // pipe to main stdout
|
|
34
|
-
})
|
|
33
|
+
process.stdout.write(data); // pipe to main stdout
|
|
34
|
+
});
|
|
35
35
|
|
|
36
36
|
fastChild.stderr.on('data', (data) => {
|
|
37
|
-
process.stderr.write(data) // pipe errors
|
|
38
|
-
})
|
|
37
|
+
process.stderr.write(data); // pipe errors
|
|
38
|
+
});
|
|
39
39
|
fastChild.on('message', (data) => {
|
|
40
|
-
console.log(`Message from child process: ${data}`)
|
|
41
|
-
})
|
|
42
|
-
return
|
|
40
|
+
console.log(`Message from child process: ${data}`);
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const branches = getEASBranches().map((branch) => branch.name)
|
|
46
|
-
console.log('branches', branches)
|
|
45
|
+
const branches = getEASBranches().map((branch) => branch.name);
|
|
46
|
+
console.log('branches', branches);
|
|
47
47
|
|
|
48
48
|
const { branch } = await inquirer.prompt([
|
|
49
49
|
{
|
|
@@ -56,7 +56,7 @@ program
|
|
|
56
56
|
})),
|
|
57
57
|
default: Object.keys(branches).map((key) => branches[key]),
|
|
58
58
|
},
|
|
59
|
-
])
|
|
59
|
+
]);
|
|
60
60
|
|
|
61
61
|
const { message } = await inquirer.prompt([
|
|
62
62
|
{
|
|
@@ -66,27 +66,27 @@ program
|
|
|
66
66
|
default: 'No message provided', // Optional default
|
|
67
67
|
validate: (input) => input.trim() !== '' || 'Message cannot be empty.',
|
|
68
68
|
},
|
|
69
|
-
])
|
|
70
|
-
const command = `yarn eas update --branch ${branch} --message "${message}"
|
|
69
|
+
]);
|
|
70
|
+
const command = `yarn eas update --branch ${branch} --message "${message}"`;
|
|
71
71
|
const child = spawn(`${command} --non-interactive`, {
|
|
72
72
|
stdio: ['inherit', 'pipe', 'pipe'], // Read from terminal, but capture output
|
|
73
73
|
shell: true,
|
|
74
74
|
env: {
|
|
75
75
|
...process.env,
|
|
76
|
-
|
|
76
|
+
NEXT_FORCE_PROD,
|
|
77
77
|
EXPO_PUBLIC_API_URL,
|
|
78
78
|
EXPO_BUILD_PROFILE,
|
|
79
79
|
},
|
|
80
|
-
})
|
|
80
|
+
});
|
|
81
81
|
|
|
82
82
|
child.stdout.on('data', (data) => {
|
|
83
|
-
process.stdout.write(data) // pipe to main stdout
|
|
84
|
-
})
|
|
83
|
+
process.stdout.write(data); // pipe to main stdout
|
|
84
|
+
});
|
|
85
85
|
|
|
86
86
|
child.stderr.on('data', (data) => {
|
|
87
|
-
process.stderr.write(data) // pipe errors
|
|
88
|
-
})
|
|
87
|
+
process.stderr.write(data); // pipe errors
|
|
88
|
+
});
|
|
89
89
|
child.on('message', (data) => {
|
|
90
|
-
console.log(`Message from child process: ${data}`)
|
|
91
|
-
})
|
|
92
|
-
})
|
|
90
|
+
console.log(`Message from child process: ${data}`);
|
|
91
|
+
});
|
|
92
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mono-labs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.63",
|
|
4
4
|
"description": "A CLI tool for building and deploying projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"deploy",
|
|
31
31
|
"tool"
|
|
32
32
|
],
|
|
33
|
-
"author": "
|
|
33
|
+
"author": "Cody Jones",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
36
|
+
"node": ">=20.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@aws-sdk/client-dynamodb": "^3.848.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"lib/",
|
|
55
55
|
"README.md"
|
|
56
56
|
],
|
|
57
|
-
"packageManager": "yarn@
|
|
57
|
+
"packageManager": "yarn@4.5.0"
|
|
58
58
|
}
|