@mono-labs/cli 0.0.165 → 0.0.170
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 +49 -49
- package/lib/commands/build-process/cliFactory.js +7 -2
- package/lib/commands/build-process/runHasteCommand.js +20 -6
- package/lib/commands/build-process/testflag.js +1 -0
- package/lib/commands/generate/generateSeed.js +223 -223
- package/lib/commands/generate/index.js +30 -30
- package/lib/commands/prune/index.js +12 -12
- package/lib/commands/prune/prune.js +50 -50
- package/lib/commands/seed/import.js +30 -30
- package/lib/commands/seed/index.js +12 -12
- package/lib/commands/submit/index.js +38 -38
- package/lib/commands/update/eas.js +39 -39
- package/lib/commands/update/index.js +87 -87
- package/lib/config.js +4 -4
- package/lib/index.js +57 -57
- package/package.json +2 -3
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { program } from '../../app.js'
|
|
2
|
-
import { exportTable } from './generateSeed.js'
|
|
3
|
-
|
|
4
|
-
program
|
|
5
|
-
.command('generate')
|
|
6
|
-
.description('Generate seed data in ./docker/seed')
|
|
7
|
-
.argument('[<string>]', 'Tables to generateFrom')
|
|
8
|
-
.option('-o, --owner <owner>', 'Owner of the tables')
|
|
9
|
-
.option('-n, --newowner <newowner>', 'New owner of the tables')
|
|
10
|
-
.option('-p, --live', 'Pull from live')
|
|
11
|
-
.option('-r, --region <region>', 'Region to deploy to')
|
|
12
|
-
.option('-d, --db <db>', 'Databases to rewrite to')
|
|
13
|
-
.option('--profiles', 'Profiles only seed generation')
|
|
14
|
-
.action(async (str, options) => {
|
|
15
|
-
const owner = options.owner || 'dev'
|
|
16
|
-
const profilesOnly = options.profiles || false
|
|
17
|
-
const tables = (str || '').split(',')
|
|
18
|
-
let nameRedirect = []
|
|
19
|
-
if (options.db) nameRedirect = options.db.split(',')
|
|
20
|
-
|
|
21
|
-
exportTable(
|
|
22
|
-
tables,
|
|
23
|
-
owner,
|
|
24
|
-
options.newowner,
|
|
25
|
-
nameRedirect,
|
|
26
|
-
options.live,
|
|
27
|
-
options.region,
|
|
28
|
-
profilesOnly,
|
|
29
|
-
)
|
|
30
|
-
})
|
|
1
|
+
import { program } from '../../app.js'
|
|
2
|
+
import { exportTable } from './generateSeed.js'
|
|
3
|
+
|
|
4
|
+
program
|
|
5
|
+
.command('generate')
|
|
6
|
+
.description('Generate seed data in ./docker/seed')
|
|
7
|
+
.argument('[<string>]', 'Tables to generateFrom')
|
|
8
|
+
.option('-o, --owner <owner>', 'Owner of the tables')
|
|
9
|
+
.option('-n, --newowner <newowner>', 'New owner of the tables')
|
|
10
|
+
.option('-p, --live', 'Pull from live')
|
|
11
|
+
.option('-r, --region <region>', 'Region to deploy to')
|
|
12
|
+
.option('-d, --db <db>', 'Databases to rewrite to')
|
|
13
|
+
.option('--profiles', 'Profiles only seed generation')
|
|
14
|
+
.action(async (str, options) => {
|
|
15
|
+
const owner = options.owner || 'dev'
|
|
16
|
+
const profilesOnly = options.profiles || false
|
|
17
|
+
const tables = (str || '').split(',')
|
|
18
|
+
let nameRedirect = []
|
|
19
|
+
if (options.db) nameRedirect = options.db.split(',')
|
|
20
|
+
|
|
21
|
+
exportTable(
|
|
22
|
+
tables,
|
|
23
|
+
owner,
|
|
24
|
+
options.newowner,
|
|
25
|
+
nameRedirect,
|
|
26
|
+
options.live,
|
|
27
|
+
options.region,
|
|
28
|
+
profilesOnly,
|
|
29
|
+
)
|
|
30
|
+
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
|
|
3
|
-
import { program } from '../../app.js';
|
|
4
|
-
import { pruneRepo } from './prune.js';
|
|
5
|
-
|
|
6
|
-
program
|
|
7
|
-
.command('prune2')
|
|
8
|
-
.description('Prune local branches that are not on origin')
|
|
9
|
-
|
|
10
|
-
.action(() => {
|
|
11
|
-
pruneRepo();
|
|
12
|
-
});
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
|
|
3
|
+
import { program } from '../../app.js';
|
|
4
|
+
import { pruneRepo } from './prune.js';
|
|
5
|
+
|
|
6
|
+
program
|
|
7
|
+
.command('prune2')
|
|
8
|
+
.description('Prune local branches that are not on origin')
|
|
9
|
+
|
|
10
|
+
.action(() => {
|
|
11
|
+
pruneRepo();
|
|
12
|
+
});
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
|
|
3
|
-
const log = (...args) => console.log(...args);
|
|
4
|
-
const err = (...args) => console.error(...args);
|
|
5
|
-
export function pruneRepo() {
|
|
6
|
-
try {
|
|
7
|
-
// Fetch and prune remote branches
|
|
8
|
-
log('Fetching latest branch data from origin...');
|
|
9
|
-
execSync('git fetch --prune', { stdio: 'inherit' });
|
|
10
|
-
|
|
11
|
-
// Get local branches (trim whitespace)
|
|
12
|
-
const localBranches = execSync("git branch --format '%(refname:short)'")
|
|
13
|
-
.toString()
|
|
14
|
-
.trim()
|
|
15
|
-
.split('\n')
|
|
16
|
-
.map((branch) => branch.trim().replaceAll("'", ''));
|
|
17
|
-
|
|
18
|
-
// Get remote branches (remove "origin/" prefix)
|
|
19
|
-
const remoteBranches = execSync('git branch -r')
|
|
20
|
-
.toString()
|
|
21
|
-
.trim()
|
|
22
|
-
.split('\n')
|
|
23
|
-
.map((branch) => branch.replace(/^\s*origin\//, '').trim());
|
|
24
|
-
|
|
25
|
-
// Find local branches that are NOT in remote branches
|
|
26
|
-
const branchesToDelete = localBranches.filter(
|
|
27
|
-
(branch) => !remoteBranches.includes(branch)
|
|
28
|
-
);
|
|
29
|
-
if (branchesToDelete.length === 0) {
|
|
30
|
-
log('No local branches to delete.');
|
|
31
|
-
process.exit(0);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Delete untracked local branches
|
|
35
|
-
log('Deleting local branches that are not on origin...');
|
|
36
|
-
branchesToDelete.forEach((branch) => {
|
|
37
|
-
log(`Attempting to delete: ${branch}`);
|
|
38
|
-
try {
|
|
39
|
-
execSync(`git branch -D ${branch}`, { stdio: 'inherit' });
|
|
40
|
-
log(`Deleted: ${branch}`);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
error(`Failed to delete branch ${branch}:`, error.message);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
log('Cleanup complete!');
|
|
47
|
-
} catch (error) {
|
|
48
|
-
err('An error occurred:', error.message);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
|
|
3
|
+
const log = (...args) => console.log(...args);
|
|
4
|
+
const err = (...args) => console.error(...args);
|
|
5
|
+
export function pruneRepo() {
|
|
6
|
+
try {
|
|
7
|
+
// Fetch and prune remote branches
|
|
8
|
+
log('Fetching latest branch data from origin...');
|
|
9
|
+
execSync('git fetch --prune', { stdio: 'inherit' });
|
|
10
|
+
|
|
11
|
+
// Get local branches (trim whitespace)
|
|
12
|
+
const localBranches = execSync("git branch --format '%(refname:short)'")
|
|
13
|
+
.toString()
|
|
14
|
+
.trim()
|
|
15
|
+
.split('\n')
|
|
16
|
+
.map((branch) => branch.trim().replaceAll("'", ''));
|
|
17
|
+
|
|
18
|
+
// Get remote branches (remove "origin/" prefix)
|
|
19
|
+
const remoteBranches = execSync('git branch -r')
|
|
20
|
+
.toString()
|
|
21
|
+
.trim()
|
|
22
|
+
.split('\n')
|
|
23
|
+
.map((branch) => branch.replace(/^\s*origin\//, '').trim());
|
|
24
|
+
|
|
25
|
+
// Find local branches that are NOT in remote branches
|
|
26
|
+
const branchesToDelete = localBranches.filter(
|
|
27
|
+
(branch) => !remoteBranches.includes(branch)
|
|
28
|
+
);
|
|
29
|
+
if (branchesToDelete.length === 0) {
|
|
30
|
+
log('No local branches to delete.');
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Delete untracked local branches
|
|
35
|
+
log('Deleting local branches that are not on origin...');
|
|
36
|
+
branchesToDelete.forEach((branch) => {
|
|
37
|
+
log(`Attempting to delete: ${branch}`);
|
|
38
|
+
try {
|
|
39
|
+
execSync(`git branch -D ${branch}`, { stdio: 'inherit' });
|
|
40
|
+
log(`Deleted: ${branch}`);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
error(`Failed to delete branch ${branch}:`, error.message);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
log('Cleanup complete!');
|
|
47
|
+
} catch (error) {
|
|
48
|
+
err('An error occurred:', error.message);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
export function importAllDynamoBatches(folderPath, useRemote = false) {
|
|
6
|
-
const files = fs
|
|
7
|
-
.readdirSync(folderPath)
|
|
8
|
-
.filter(
|
|
9
|
-
(file) => file.startsWith('dynamodb-seed-') && file.endsWith('.json')
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
files.sort(); // Optional: ensures files run in order
|
|
13
|
-
|
|
14
|
-
for (const file of files) {
|
|
15
|
-
const fullPath = path.resolve(path.join(folderPath, file));
|
|
16
|
-
|
|
17
|
-
const baseCommand =
|
|
18
|
-
useRemote ?
|
|
19
|
-
`aws dynamodb batch-write-item --request-items file://${fullPath}`
|
|
20
|
-
: `aws dynamodb batch-write-item --endpoint-url http://localhost:8000 --request-items file://${fullPath}`;
|
|
21
|
-
try {
|
|
22
|
-
execSync(baseCommand, {
|
|
23
|
-
stdio: 'inherit',
|
|
24
|
-
});
|
|
25
|
-
} catch (err) {
|
|
26
|
-
console.error(`❌ Error with ${file}:`, err.message);
|
|
27
|
-
break; // or continue if you want to skip failed files
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
export function importAllDynamoBatches(folderPath, useRemote = false) {
|
|
6
|
+
const files = fs
|
|
7
|
+
.readdirSync(folderPath)
|
|
8
|
+
.filter(
|
|
9
|
+
(file) => file.startsWith('dynamodb-seed-') && file.endsWith('.json')
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
files.sort(); // Optional: ensures files run in order
|
|
13
|
+
|
|
14
|
+
for (const file of files) {
|
|
15
|
+
const fullPath = path.resolve(path.join(folderPath, file));
|
|
16
|
+
|
|
17
|
+
const baseCommand =
|
|
18
|
+
useRemote ?
|
|
19
|
+
`aws dynamodb batch-write-item --request-items file://${fullPath}`
|
|
20
|
+
: `aws dynamodb batch-write-item --endpoint-url http://localhost:8000 --request-items file://${fullPath}`;
|
|
21
|
+
try {
|
|
22
|
+
execSync(baseCommand, {
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
});
|
|
25
|
+
} catch (err) {
|
|
26
|
+
console.error(`❌ Error with ${file}:`, err.message);
|
|
27
|
+
break; // or continue if you want to skip failed files
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { spawn } from 'child_process'
|
|
2
|
-
|
|
3
|
-
import { program } from '../../app.js'
|
|
4
|
-
import { importAllDynamoBatches } from './import.js'
|
|
5
|
-
|
|
6
|
-
program
|
|
7
|
-
.command('seed')
|
|
8
|
-
.description('Execute eas build command')
|
|
9
|
-
.option('-p, --live', 'Pull from live')
|
|
10
|
-
.action(async (options) => {
|
|
11
|
-
importAllDynamoBatches('./docker/seed', options.live)
|
|
12
|
-
})
|
|
1
|
+
import { spawn } from 'child_process'
|
|
2
|
+
|
|
3
|
+
import { program } from '../../app.js'
|
|
4
|
+
import { importAllDynamoBatches } from './import.js'
|
|
5
|
+
|
|
6
|
+
program
|
|
7
|
+
.command('seed')
|
|
8
|
+
.description('Execute eas build command')
|
|
9
|
+
.option('-p, --live', 'Pull from live')
|
|
10
|
+
.action(async (options) => {
|
|
11
|
+
importAllDynamoBatches('./docker/seed', options.live)
|
|
12
|
+
})
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
|
|
3
|
-
import { program } from '../../app.js';
|
|
4
|
-
import { generateEnvValues } from '../../app.js';
|
|
5
|
-
import { STAGING_URL } from '../../config.js';
|
|
6
|
-
import os from 'node:os';
|
|
7
|
-
import path from 'node:path';
|
|
8
|
-
const homeBin = path.join(os.homedir(), 'bin');
|
|
9
|
-
const PATH = [homeBin, process.env.PATH].filter(Boolean).join(path.delimiter);
|
|
10
|
-
program
|
|
11
|
-
.command('submit')
|
|
12
|
-
.description('Execute eas build command')
|
|
13
|
-
.option('--android', 'Build to target preview profile')
|
|
14
|
-
.option('--ios', 'Build to target production profile')
|
|
15
|
-
.action((str, options) => {
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
let envObj = generateEnvValues(true, '', false);
|
|
19
|
-
|
|
20
|
-
envObj.NEXT_PUBLIC_API_URL = `${STAGING_URL}`;
|
|
21
|
-
envObj.NEXT_FORCE_PROD = 'true';
|
|
22
|
-
envObj.EAS_BUILD_PROFILE = 'production';
|
|
23
|
-
|
|
24
|
-
const command = `workspace app eas submit ${str.android ? `--platform android` : `--platform ios`}`;
|
|
25
|
-
|
|
26
|
-
const child = spawn('yarn', [command], {
|
|
27
|
-
stdio: 'inherit',
|
|
28
|
-
shell: true, // required if using shell-style commands or cross-platform support
|
|
29
|
-
env: {
|
|
30
|
-
...envObj,
|
|
31
|
-
PATH,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
child.on('exit', (code) => {
|
|
36
|
-
process.exit(code ?? 0);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
|
|
3
|
+
import { program } from '../../app.js';
|
|
4
|
+
import { generateEnvValues } from '../../app.js';
|
|
5
|
+
import { STAGING_URL } from '../../config.js';
|
|
6
|
+
import os from 'node:os';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
const homeBin = path.join(os.homedir(), 'bin');
|
|
9
|
+
const PATH = [homeBin, process.env.PATH].filter(Boolean).join(path.delimiter);
|
|
10
|
+
program
|
|
11
|
+
.command('submit')
|
|
12
|
+
.description('Execute eas build command')
|
|
13
|
+
.option('--android', 'Build to target preview profile')
|
|
14
|
+
.option('--ios', 'Build to target production profile')
|
|
15
|
+
.action((str, options) => {
|
|
16
|
+
//
|
|
17
|
+
|
|
18
|
+
let envObj = generateEnvValues(true, '', false);
|
|
19
|
+
|
|
20
|
+
envObj.NEXT_PUBLIC_API_URL = `${STAGING_URL}`;
|
|
21
|
+
envObj.NEXT_FORCE_PROD = 'true';
|
|
22
|
+
envObj.EAS_BUILD_PROFILE = 'production';
|
|
23
|
+
|
|
24
|
+
const command = `workspace app eas submit ${str.android ? `--platform android` : `--platform ios`}`;
|
|
25
|
+
|
|
26
|
+
const child = spawn('yarn', [command], {
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
shell: true, // required if using shell-style commands or cross-platform support
|
|
29
|
+
env: {
|
|
30
|
+
...envObj,
|
|
31
|
+
PATH,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
child.on('exit', (code) => {
|
|
36
|
+
process.exit(code ?? 0);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { execSync } from 'child_process'
|
|
2
|
-
|
|
3
|
-
export function getEASChannels() {
|
|
4
|
-
const channelsData = execSync(
|
|
5
|
-
'yarn eas channel:list --non-interactive --json',
|
|
6
|
-
{ stdio: ['pipe', 'pipe', 'ignore'] }, // Ignore stderr
|
|
7
|
-
).toString()
|
|
8
|
-
|
|
9
|
-
// Extract valid JSON from any extra noise
|
|
10
|
-
const jsonStart = channelsData.indexOf('[')
|
|
11
|
-
const jsonEnd = channelsData.lastIndexOf(']') + 1
|
|
12
|
-
|
|
13
|
-
if (jsonStart === -1 || jsonEnd === -1) {
|
|
14
|
-
throw new Error('JSON output not found in command output')
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const jsonSlice = channelsData.slice(jsonStart, jsonEnd)
|
|
18
|
-
const channels = JSON.parse(jsonSlice)
|
|
19
|
-
return channels
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getEASBranches() {
|
|
23
|
-
const channelsData = execSync(
|
|
24
|
-
'yarn eas branch:list --non-interactive --json',
|
|
25
|
-
{ stdio: ['pipe', 'pipe', 'ignore'] }, // Ignore stderr
|
|
26
|
-
).toString()
|
|
27
|
-
|
|
28
|
-
// Extract valid JSON from any extra noise
|
|
29
|
-
const jsonStart = channelsData.indexOf('[')
|
|
30
|
-
const jsonEnd = channelsData.lastIndexOf(']') + 1
|
|
31
|
-
|
|
32
|
-
if (jsonStart === -1 || jsonEnd === -1) {
|
|
33
|
-
throw new Error('JSON output not found in command output')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const jsonSlice = channelsData.slice(jsonStart, jsonEnd)
|
|
37
|
-
const channels = JSON.parse(jsonSlice)
|
|
38
|
-
return channels
|
|
39
|
-
}
|
|
1
|
+
import { execSync } from 'child_process'
|
|
2
|
+
|
|
3
|
+
export function getEASChannels() {
|
|
4
|
+
const channelsData = execSync(
|
|
5
|
+
'yarn eas channel:list --non-interactive --json',
|
|
6
|
+
{ stdio: ['pipe', 'pipe', 'ignore'] }, // Ignore stderr
|
|
7
|
+
).toString()
|
|
8
|
+
|
|
9
|
+
// Extract valid JSON from any extra noise
|
|
10
|
+
const jsonStart = channelsData.indexOf('[')
|
|
11
|
+
const jsonEnd = channelsData.lastIndexOf(']') + 1
|
|
12
|
+
|
|
13
|
+
if (jsonStart === -1 || jsonEnd === -1) {
|
|
14
|
+
throw new Error('JSON output not found in command output')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const jsonSlice = channelsData.slice(jsonStart, jsonEnd)
|
|
18
|
+
const channels = JSON.parse(jsonSlice)
|
|
19
|
+
return channels
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getEASBranches() {
|
|
23
|
+
const channelsData = execSync(
|
|
24
|
+
'yarn eas branch:list --non-interactive --json',
|
|
25
|
+
{ stdio: ['pipe', 'pipe', 'ignore'] }, // Ignore stderr
|
|
26
|
+
).toString()
|
|
27
|
+
|
|
28
|
+
// Extract valid JSON from any extra noise
|
|
29
|
+
const jsonStart = channelsData.indexOf('[')
|
|
30
|
+
const jsonEnd = channelsData.lastIndexOf(']') + 1
|
|
31
|
+
|
|
32
|
+
if (jsonStart === -1 || jsonEnd === -1) {
|
|
33
|
+
throw new Error('JSON output not found in command output')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const jsonSlice = channelsData.slice(jsonStart, jsonEnd)
|
|
37
|
+
const channels = JSON.parse(jsonSlice)
|
|
38
|
+
return channels
|
|
39
|
+
}
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
import inquirer from 'inquirer';
|
|
3
|
-
|
|
4
|
-
import { program } from '../../app.js';
|
|
5
|
-
import { STAGING_URL } from '../../config.js';
|
|
6
|
-
import { getEASBranches } from './eas.js';
|
|
7
|
-
|
|
8
|
-
const NEXT_PUBLIC_API_URL = STAGING_URL;
|
|
9
|
-
const NEXT_FORCE_PROD = true;
|
|
10
|
-
const EXPO_BUILD_PROFILE = 'production';
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.command('update')
|
|
14
|
-
.description('Prune local branches that are not on origin')
|
|
15
|
-
.option('--auto', 'Auto run')
|
|
16
|
-
.action(async (str) => {
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
const { auto } = str;
|
|
20
|
-
|
|
21
|
-
if (auto) {
|
|
22
|
-
const fastChild = spawn(`yarn eas update --auto`, {
|
|
23
|
-
stdio: ['inherit', 'pipe', 'pipe'], // Read from terminal, but capture output
|
|
24
|
-
shell: true,
|
|
25
|
-
env: {
|
|
26
|
-
...process.env,
|
|
27
|
-
NEXT_FORCE_PROD,
|
|
28
|
-
NEXT_PUBLIC_API_URL,
|
|
29
|
-
EXPO_BUILD_PROFILE,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
fastChild.stdout.on('data', (data) => {
|
|
33
|
-
process.stdout.write(data); // pipe to main stdout
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
fastChild.stderr.on('data', (data) => {
|
|
37
|
-
process.stderr.write(data); // pipe errors
|
|
38
|
-
});
|
|
39
|
-
fastChild.on('message', (data) => {});
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const branches = getEASBranches().map((branch) => branch.name);
|
|
44
|
-
|
|
45
|
-
const { branch } = await inquirer.prompt([
|
|
46
|
-
{
|
|
47
|
-
type: 'list',
|
|
48
|
-
name: 'branch',
|
|
49
|
-
message: 'Select branch to update',
|
|
50
|
-
choices: Object.keys(branches).map((key) => ({
|
|
51
|
-
name: branches[key],
|
|
52
|
-
value: branches[key],
|
|
53
|
-
})),
|
|
54
|
-
default: Object.keys(branches).map((key) => branches[key]),
|
|
55
|
-
},
|
|
56
|
-
]);
|
|
57
|
-
|
|
58
|
-
const { message } = await inquirer.prompt([
|
|
59
|
-
{
|
|
60
|
-
type: 'input',
|
|
61
|
-
name: 'message',
|
|
62
|
-
message: 'Enter a message for the update:',
|
|
63
|
-
default: 'No message provided', // Optional default
|
|
64
|
-
validate: (input) => input.trim() !== '' || 'Message cannot be empty.',
|
|
65
|
-
},
|
|
66
|
-
]);
|
|
67
|
-
const command = `yarn eas update --branch ${branch} --message "${message}"`;
|
|
68
|
-
const child = spawn(`${command} --non-interactive`, {
|
|
69
|
-
stdio: ['inherit', 'pipe', 'pipe'], // Read from terminal, but capture output
|
|
70
|
-
shell: true,
|
|
71
|
-
env: {
|
|
72
|
-
...process.env,
|
|
73
|
-
NEXT_FORCE_PROD,
|
|
74
|
-
NEXT_PUBLIC_API_URL,
|
|
75
|
-
EXPO_BUILD_PROFILE,
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
child.stdout.on('data', (data) => {
|
|
80
|
-
process.stdout.write(data); // pipe to main stdout
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
child.stderr.on('data', (data) => {
|
|
84
|
-
process.stderr.write(data); // pipe errors
|
|
85
|
-
});
|
|
86
|
-
child.on('message', (data) => {});
|
|
87
|
-
});
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
|
|
4
|
+
import { program } from '../../app.js';
|
|
5
|
+
import { STAGING_URL } from '../../config.js';
|
|
6
|
+
import { getEASBranches } from './eas.js';
|
|
7
|
+
|
|
8
|
+
const NEXT_PUBLIC_API_URL = STAGING_URL;
|
|
9
|
+
const NEXT_FORCE_PROD = true;
|
|
10
|
+
const EXPO_BUILD_PROFILE = 'production';
|
|
11
|
+
|
|
12
|
+
program
|
|
13
|
+
.command('update')
|
|
14
|
+
.description('Prune local branches that are not on origin')
|
|
15
|
+
.option('--auto', 'Auto run')
|
|
16
|
+
.action(async (str) => {
|
|
17
|
+
//
|
|
18
|
+
|
|
19
|
+
const { auto } = str;
|
|
20
|
+
|
|
21
|
+
if (auto) {
|
|
22
|
+
const fastChild = spawn(`yarn eas update --auto`, {
|
|
23
|
+
stdio: ['inherit', 'pipe', 'pipe'], // Read from terminal, but capture output
|
|
24
|
+
shell: true,
|
|
25
|
+
env: {
|
|
26
|
+
...process.env,
|
|
27
|
+
NEXT_FORCE_PROD,
|
|
28
|
+
NEXT_PUBLIC_API_URL,
|
|
29
|
+
EXPO_BUILD_PROFILE,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
fastChild.stdout.on('data', (data) => {
|
|
33
|
+
process.stdout.write(data); // pipe to main stdout
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
fastChild.stderr.on('data', (data) => {
|
|
37
|
+
process.stderr.write(data); // pipe errors
|
|
38
|
+
});
|
|
39
|
+
fastChild.on('message', (data) => {});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const branches = getEASBranches().map((branch) => branch.name);
|
|
44
|
+
|
|
45
|
+
const { branch } = await inquirer.prompt([
|
|
46
|
+
{
|
|
47
|
+
type: 'list',
|
|
48
|
+
name: 'branch',
|
|
49
|
+
message: 'Select branch to update',
|
|
50
|
+
choices: Object.keys(branches).map((key) => ({
|
|
51
|
+
name: branches[key],
|
|
52
|
+
value: branches[key],
|
|
53
|
+
})),
|
|
54
|
+
default: Object.keys(branches).map((key) => branches[key]),
|
|
55
|
+
},
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
const { message } = await inquirer.prompt([
|
|
59
|
+
{
|
|
60
|
+
type: 'input',
|
|
61
|
+
name: 'message',
|
|
62
|
+
message: 'Enter a message for the update:',
|
|
63
|
+
default: 'No message provided', // Optional default
|
|
64
|
+
validate: (input) => input.trim() !== '' || 'Message cannot be empty.',
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
const command = `yarn eas update --branch ${branch} --message "${message}"`;
|
|
68
|
+
const child = spawn(`${command} --non-interactive`, {
|
|
69
|
+
stdio: ['inherit', 'pipe', 'pipe'], // Read from terminal, but capture output
|
|
70
|
+
shell: true,
|
|
71
|
+
env: {
|
|
72
|
+
...process.env,
|
|
73
|
+
NEXT_FORCE_PROD,
|
|
74
|
+
NEXT_PUBLIC_API_URL,
|
|
75
|
+
EXPO_BUILD_PROFILE,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
child.stdout.on('data', (data) => {
|
|
80
|
+
process.stdout.write(data); // pipe to main stdout
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
child.stderr.on('data', (data) => {
|
|
84
|
+
process.stderr.write(data); // pipe errors
|
|
85
|
+
});
|
|
86
|
+
child.on('message', (data) => {});
|
|
87
|
+
});
|
package/lib/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//export const STAGE_URL = 'https://77df2h2jif6xrvk6eexwrlkeke0xibqc.lambda-url.us-east-2.on.aws/'
|
|
2
|
-
export const STAGE_URL = 'https://p2po52rai264bk62bec2cmtzdi0rqhnw.lambda-url.us-east-2.on.aws/'
|
|
3
|
-
|
|
4
|
-
export const STAGING_URL = process.env.STAGE_URL || STAGE_URL
|
|
1
|
+
//export const STAGE_URL = 'https://77df2h2jif6xrvk6eexwrlkeke0xibqc.lambda-url.us-east-2.on.aws/'
|
|
2
|
+
export const STAGE_URL = 'https://p2po52rai264bk62bec2cmtzdi0rqhnw.lambda-url.us-east-2.on.aws/'
|
|
3
|
+
|
|
4
|
+
export const STAGING_URL = process.env.STAGE_URL || STAGE_URL
|