@mono-labs/cli 0.0.93 → 0.0.95
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.
|
@@ -4,11 +4,12 @@ import runHasteCommand from './runHasteCommand.js';
|
|
|
4
4
|
import { verifyOptionValue } from './validators.js';
|
|
5
5
|
import { mergeData, setData } from './dataLayer.js';
|
|
6
6
|
import { getHasteConfig } from '../loadFromRoot.js';
|
|
7
|
+
import { pruneRepo } from '../prune/prune.js';
|
|
7
8
|
/**
|
|
8
9
|
* Register commander commands for each haste file definition.
|
|
9
10
|
* Handles argument, options, validation, and action wiring.
|
|
10
11
|
*/
|
|
11
|
-
export function
|
|
12
|
+
export function createConfigCommands() {
|
|
12
13
|
const config = new Command('config').description('Manage configuration');
|
|
13
14
|
|
|
14
15
|
config
|
|
@@ -35,6 +36,19 @@ export function createCliCommands() {
|
|
|
35
36
|
return config;
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
export function createCliCommands() {
|
|
40
|
+
const tools = new Command('tools').description('Manage tools');
|
|
41
|
+
|
|
42
|
+
tools
|
|
43
|
+
.command('prune')
|
|
44
|
+
.description('Prune unused branches in git')
|
|
45
|
+
.action(() => {
|
|
46
|
+
console.log('Pruning unused branches...');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return tools;
|
|
50
|
+
}
|
|
51
|
+
|
|
38
52
|
export function buildCommands(files) {
|
|
39
53
|
const { config } = getHasteConfig();
|
|
40
54
|
Object.entries(files).forEach(([commandName, configObject]) => {
|
|
@@ -71,6 +85,13 @@ export function buildCommands(files) {
|
|
|
71
85
|
if (meta.default !== undefined) setData(optionKey, meta.default);
|
|
72
86
|
}
|
|
73
87
|
});
|
|
88
|
+
config.prodFlag = config.prodFlag || 'prod';
|
|
89
|
+
|
|
90
|
+
current = current.option(
|
|
91
|
+
`--${config.prodFlag}`,
|
|
92
|
+
'Process execution mode: prduction or dev',
|
|
93
|
+
false
|
|
94
|
+
);
|
|
74
95
|
|
|
75
96
|
current.action(async (arg, cmd) => {
|
|
76
97
|
let envDefaults = {};
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
import assert from 'assert'
|
|
2
|
-
import { spawn } from 'child_process'
|
|
3
|
-
import { readFileSync } from 'fs'
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
4
|
|
|
5
|
-
import { program } from '../../app.js'
|
|
5
|
+
import { program } from '../../app.js';
|
|
6
6
|
|
|
7
7
|
import { join } from 'node:path';
|
|
8
|
-
const packageJSON = JSON.parse(
|
|
8
|
+
const packageJSON = JSON.parse(
|
|
9
|
+
readFileSync(join(process.cwd(), 'package.json'), 'utf8')
|
|
10
|
+
);
|
|
9
11
|
|
|
10
|
-
console.log('Deploy command loaded')
|
|
12
|
+
console.log('Deploy command loaded');
|
|
11
13
|
|
|
12
|
-
const awsObject = packageJSON['aws'] || {}
|
|
14
|
+
const awsObject = packageJSON['aws'] || {};
|
|
13
15
|
|
|
14
|
-
const accountId = process.env.CDK_DEPLOY_ACCOUNT
|
|
15
|
-
const awsProfile = process.env.CDK_DEPLOY_PROFILE || 'default'
|
|
16
|
+
const accountId = process.env.CDK_DEPLOY_ACCOUNT;
|
|
17
|
+
const awsProfile = process.env.CDK_DEPLOY_PROFILE || 'default';
|
|
16
18
|
|
|
17
19
|
program
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
.command('init2')
|
|
21
|
+
.description('Execute cdk deploy command')
|
|
22
|
+
.action((str, options) => {
|
|
23
|
+
const owner = str || 'dev';
|
|
24
|
+
const region = options.region || 'us-east-2';
|
|
25
|
+
console.log(`Deploying to ${owner} environment`);
|
|
26
|
+
const command = `workspace infra cdk bootstrap`;
|
|
27
|
+
const child = spawn('yarn', [`${command}`], {
|
|
28
|
+
stdio: 'inherit',
|
|
29
|
+
shell: true, // required if using shell-style commands or cross-platform support
|
|
30
|
+
env: {
|
|
31
|
+
AWS_PROFILE: awsProfile,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
child.on('exit', (code) => {
|
|
36
|
+
console.log(`Process exited with code ${code}`);
|
|
37
|
+
process.exit(code ?? 0);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { spawn } from 'child_process'
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
2
|
|
|
3
|
-
import { program } from '../../app.js'
|
|
4
|
-
import { pruneRepo } from './prune.js'
|
|
3
|
+
import { program } from '../../app.js';
|
|
4
|
+
import { pruneRepo } from './prune.js';
|
|
5
5
|
|
|
6
6
|
program
|
|
7
|
-
.command('
|
|
7
|
+
.command('prune2')
|
|
8
8
|
.description('Prune local branches that are not on origin')
|
|
9
9
|
|
|
10
10
|
.action(() => {
|
|
11
|
-
pruneRepo()
|
|
12
|
-
})
|
|
11
|
+
pruneRepo();
|
|
12
|
+
});
|