@mono-labs/cli 0.0.5

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.
@@ -0,0 +1,92 @@
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 EXPO_PUBLIC_API_URL = STAGING_URL
9
+ const EXPO_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
+ //console.log(raw.toString());
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
+ EXPO_FORCE_PROD,
28
+ EXPO_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
+ console.log(`Message from child process: ${data}`)
41
+ })
42
+ return
43
+ }
44
+
45
+ const branches = getEASBranches().map((branch) => branch.name)
46
+ console.log('branches', branches)
47
+
48
+ const { branch } = await inquirer.prompt([
49
+ {
50
+ type: 'list',
51
+ name: 'branch',
52
+ message: 'Select branch to update',
53
+ choices: Object.keys(branches).map((key) => ({
54
+ name: branches[key],
55
+ value: branches[key],
56
+ })),
57
+ default: Object.keys(branches).map((key) => branches[key]),
58
+ },
59
+ ])
60
+
61
+ const { message } = await inquirer.prompt([
62
+ {
63
+ type: 'input',
64
+ name: 'message',
65
+ message: 'Enter a message for the update:',
66
+ default: 'No message provided', // Optional default
67
+ validate: (input) => input.trim() !== '' || 'Message cannot be empty.',
68
+ },
69
+ ])
70
+ const command = `yarn eas update --branch ${branch} --message "${message}"`
71
+ const child = spawn(`${command} --non-interactive`, {
72
+ stdio: ['inherit', 'pipe', 'pipe'], // Read from terminal, but capture output
73
+ shell: true,
74
+ env: {
75
+ ...process.env,
76
+ EXPO_FORCE_PROD,
77
+ EXPO_PUBLIC_API_URL,
78
+ EXPO_BUILD_PROFILE,
79
+ },
80
+ })
81
+
82
+ child.stdout.on('data', (data) => {
83
+ process.stdout.write(data) // pipe to main stdout
84
+ })
85
+
86
+ child.stderr.on('data', (data) => {
87
+ process.stderr.write(data) // pipe errors
88
+ })
89
+ child.on('message', (data) => {
90
+ console.log(`Message from child process: ${data}`)
91
+ })
92
+ })
package/lib/config.js ADDED
@@ -0,0 +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
package/lib/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import 'dotenv/config'
2
+
3
+ import { program } from './app.js'
4
+ import './commands/build/index.js'
5
+ import './commands/deploy/index.js'
6
+ import './commands/destroy.js'
7
+ import './commands/dev/index.js'
8
+ import './commands/generate/index.js'
9
+ import './commands/init/index.js'
10
+ import './commands/prune/index.js'
11
+ import './commands/reset.js'
12
+ import './commands/seed/index.js'
13
+ import './commands/squash/index.js'
14
+ import './commands/submit/index.js'
15
+ import './commands/update/index.js'
16
+ //import './commands/test/index.js'
17
+ import './commands/build-process/index.js'
18
+
19
+ program.parse()
@@ -0,0 +1,2 @@
1
+ export * from './v0'
2
+ export * from './v1'
@@ -0,0 +1,3 @@
1
+ export const v0 = (item) => {
2
+ return item
3
+ }
@@ -0,0 +1,4 @@
1
+ export const v1 = (item) => {
2
+ console.log(item)
3
+ return item
4
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@mono-labs/cli",
3
+ "version": "0.0.5",
4
+ "description": "A CLI tool for building and deploying projects",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "bin": {
8
+ "haste-cli": "./bin/haste.js"
9
+ },
10
+ "scripts": {
11
+ "start": "node bin/haste.js",
12
+ "dev": "node bin/haste.js",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "keywords": [
16
+ "cli",
17
+ "build",
18
+ "deploy",
19
+ "tool"
20
+ ],
21
+ "author": "Your Name",
22
+ "license": "MIT",
23
+ "engines": {
24
+ "node": ">=14.0.0"
25
+ },
26
+ "dependencies": {
27
+ "@aws-sdk/client-dynamodb": "^3.848.0",
28
+ "@aws-sdk/util-dynamodb": "^3.848.0",
29
+ "chalk": "^4.1.2",
30
+ "commander": "^11.1.0",
31
+ "dotenv": "^17.2.0",
32
+ "inquirer": "^12.8.2",
33
+ "tree-kill": "^1.2.2"
34
+ },
35
+ "devDependencies": {
36
+ "eslint": "^8.57.0"
37
+ },
38
+ "files": [
39
+ "bin/",
40
+ "lib/",
41
+ "README.md"
42
+ ]
43
+ }