@raisenow/tamaro-cli 1.1.0 → 1.1.2
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/dist/{chunk-S4M23KNZ.js → chunk-64RBHHXZ.js} +1 -1
- package/dist/cli.js +34 -41
- package/dist/webpack.config.js +1 -1
- package/package.json +10 -10
- package/src/cli.ts +10 -3
- package/src/commands/build.ts +2 -2
- package/src/commands/deploy-email-config.ts +19 -8
- package/src/commands/deploy.ts +2 -2
- package/src/commands/list-deployed.ts +4 -2
- package/src/lib/aws.ts +5 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/.pnpm/tsup@7.2.0_postcss@8.4.
|
|
1
|
+
// node_modules/.pnpm/tsup@7.2.0_postcss@8.4.30_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import path from "path";
|
|
4
4
|
var getFilename = () => fileURLToPath(import.meta.url);
|
package/dist/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveBin,
|
|
23
23
|
resolveOwn,
|
|
24
24
|
runCommandSync
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-64RBHHXZ.js";
|
|
26
26
|
|
|
27
27
|
// src/cli.ts
|
|
28
28
|
import { createCommand } from "commander";
|
|
@@ -36,7 +36,7 @@ var withAwsAuthenticate = (fn, options) => {
|
|
|
36
36
|
return fn();
|
|
37
37
|
};
|
|
38
38
|
var awsAuthenticate = (options) => {
|
|
39
|
-
if (
|
|
39
|
+
if (options.ci) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
@@ -45,13 +45,7 @@ var awsAuthenticate = (options) => {
|
|
|
45
45
|
login(options);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
var isSetEnv = () => {
|
|
49
|
-
return !!(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY);
|
|
50
|
-
};
|
|
51
48
|
var assertProfilesPresent = () => {
|
|
52
|
-
if (isSetEnv()) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
49
|
const profiles = getAvailableProfiles();
|
|
56
50
|
if (profiles.length === 0) {
|
|
57
51
|
halt(
|
|
@@ -83,15 +77,12 @@ var login = (options) => {
|
|
|
83
77
|
};
|
|
84
78
|
var prepareFlags = (flags, options) => {
|
|
85
79
|
const { profile } = options;
|
|
86
|
-
if (
|
|
80
|
+
if (profile) {
|
|
87
81
|
flags.push(`--profile ${profile}`);
|
|
88
82
|
}
|
|
89
83
|
return flags;
|
|
90
84
|
};
|
|
91
85
|
var promptProfile = async () => {
|
|
92
|
-
if (isSetEnv()) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
86
|
const profiles = getAvailableProfiles().filter((v) => !!v).map((v) => ({ title: v, value: v }));
|
|
96
87
|
const { profile } = await prompts(
|
|
97
88
|
[
|
|
@@ -167,9 +158,9 @@ var notify = (args) => {
|
|
|
167
158
|
var build = async (options) => {
|
|
168
159
|
const { env } = options;
|
|
169
160
|
assertOptionsValid(options);
|
|
170
|
-
assertProfilesPresent();
|
|
171
161
|
applyEnv(env);
|
|
172
|
-
if (options.deploy) {
|
|
162
|
+
if (options.deploy && !options.ci) {
|
|
163
|
+
assertProfilesPresent();
|
|
173
164
|
options.profile = await promptProfile();
|
|
174
165
|
}
|
|
175
166
|
const flags = prepareFlags2([], options).join(" ");
|
|
@@ -238,8 +229,8 @@ var deploy = async (options) => {
|
|
|
238
229
|
const paths = getPaths(ifCore);
|
|
239
230
|
assertOptionsValid2(options);
|
|
240
231
|
assertDistPathExists(paths.appDist);
|
|
241
|
-
|
|
242
|
-
|
|
232
|
+
if (!options.ci && !options.profile) {
|
|
233
|
+
assertProfilesPresent();
|
|
243
234
|
options.profile = await promptProfile();
|
|
244
235
|
}
|
|
245
236
|
const flags = prepareFlags([], options).join(" ");
|
|
@@ -336,16 +327,18 @@ var assertTagValid = (tag) => {
|
|
|
336
327
|
|
|
337
328
|
// src/commands/deploy-email-config.ts
|
|
338
329
|
import { existsSync as existsSync3 } from "fs";
|
|
339
|
-
var deployEmailConfig = async () => {
|
|
330
|
+
var deployEmailConfig = async (options) => {
|
|
340
331
|
const { ifCore } = getIfCoreFns();
|
|
341
332
|
const paths = getPaths(ifCore);
|
|
342
333
|
const emailConfigPath = `${paths.app}/email-config`;
|
|
343
334
|
assertIsNotCore();
|
|
344
335
|
assertEmailConfigPathExists(emailConfigPath);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
336
|
+
if (!options.ci) {
|
|
337
|
+
assertProfilesPresent();
|
|
338
|
+
options.profile = await promptProfile();
|
|
339
|
+
}
|
|
340
|
+
const bucket = options.ci ? AWS_S3_EMAIL_CONFIG_PROD_BUCKET : await promptBucket();
|
|
341
|
+
const flags = prepareFlags([], options).join(" ");
|
|
349
342
|
const configName = getWidgetUuid();
|
|
350
343
|
const deployUrl = `s3://${bucket}/${configName}`;
|
|
351
344
|
const cmd = `
|
|
@@ -359,9 +352,7 @@ var deployEmailConfig = async () => {
|
|
|
359
352
|
);
|
|
360
353
|
logCommand(cmd);
|
|
361
354
|
try {
|
|
362
|
-
withAwsAuthenticate(() => runCommandSync(cmd, { stdout: "inherit" }),
|
|
363
|
-
profile
|
|
364
|
-
});
|
|
355
|
+
withAwsAuthenticate(() => runCommandSync(cmd, { stdout: "inherit" }), options);
|
|
365
356
|
} catch (error) {
|
|
366
357
|
halt(error.stderr);
|
|
367
358
|
}
|
|
@@ -441,8 +432,10 @@ var prepareFlags3 = async (flags, options) => {
|
|
|
441
432
|
// src/commands/list-deployed.ts
|
|
442
433
|
var listDeployed = async (options) => {
|
|
443
434
|
assertOptionsValid4(options);
|
|
444
|
-
|
|
445
|
-
|
|
435
|
+
if (!options.ci) {
|
|
436
|
+
assertProfilesPresent();
|
|
437
|
+
options.profile = await promptProfile();
|
|
438
|
+
}
|
|
446
439
|
const flags = prepareFlags([], options).join(" ");
|
|
447
440
|
const { config } = options;
|
|
448
441
|
const { ifCore } = getIfCoreFns();
|
|
@@ -539,7 +532,7 @@ var prepareFlags4 = async (flags, options) => {
|
|
|
539
532
|
// package.json
|
|
540
533
|
var package_default = {
|
|
541
534
|
name: "@raisenow/tamaro-cli",
|
|
542
|
-
version: "1.1.
|
|
535
|
+
version: "1.1.2",
|
|
543
536
|
author: {
|
|
544
537
|
name: "RaiseNow",
|
|
545
538
|
email: "development@raisenow.com"
|
|
@@ -562,11 +555,11 @@ var package_default = {
|
|
|
562
555
|
},
|
|
563
556
|
dependencies: {
|
|
564
557
|
"@babel/cli": "^7.22.15",
|
|
565
|
-
"@babel/core": "^7.22.
|
|
558
|
+
"@babel/core": "^7.22.20",
|
|
566
559
|
"@babel/plugin-proposal-decorators": "^7.22.15",
|
|
567
560
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
568
561
|
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
569
|
-
"@babel/preset-env": "^7.22.
|
|
562
|
+
"@babel/preset-env": "^7.22.20",
|
|
570
563
|
"@babel/preset-react": "^7.22.15",
|
|
571
564
|
"@babel/preset-typescript": "^7.22.15",
|
|
572
565
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
@@ -574,13 +567,13 @@ var package_default = {
|
|
|
574
567
|
"@statoscope/webpack-plugin": "^5.27.0",
|
|
575
568
|
"@types/columnify": "^1.5.2",
|
|
576
569
|
"@types/lodash": "^4.14.198",
|
|
577
|
-
"@types/node": "^18.17.
|
|
570
|
+
"@types/node": "^18.17.18",
|
|
578
571
|
"@types/node-notifier": "^8.0.2",
|
|
579
572
|
"@types/prompts": "^2.4.4",
|
|
580
573
|
"@types/resolve-bin": "^0.4.1",
|
|
581
574
|
"@types/webpack-config-utils": "^2.3.1",
|
|
582
|
-
"@typescript-eslint/eslint-plugin": "^6.7.
|
|
583
|
-
"@typescript-eslint/parser": "^6.7.
|
|
575
|
+
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
576
|
+
"@typescript-eslint/parser": "^6.7.2",
|
|
584
577
|
autoprefixer: "^10.4.15",
|
|
585
578
|
"babel-loader": "^9.1.3",
|
|
586
579
|
"babel-plugin-istanbul": "^6.1.1",
|
|
@@ -599,7 +592,7 @@ var package_default = {
|
|
|
599
592
|
eslint: "^8.49.0",
|
|
600
593
|
"eslint-config-prettier": "^9.0.0",
|
|
601
594
|
"eslint-import-resolver-typescript": "^3.6.0",
|
|
602
|
-
"eslint-plugin-deprecation": "^
|
|
595
|
+
"eslint-plugin-deprecation": "^2.0.0",
|
|
603
596
|
"eslint-plugin-import": "^2.28.1",
|
|
604
597
|
"eslint-plugin-markdownlint": "^0.5.0",
|
|
605
598
|
"eslint-plugin-promise": "^6.1.1",
|
|
@@ -617,14 +610,14 @@ var package_default = {
|
|
|
617
610
|
"mini-css-extract-plugin": "^2.7.6",
|
|
618
611
|
"node-notifier": "^10.0.1",
|
|
619
612
|
portfinder: "^1.0.32",
|
|
620
|
-
postcss: "^8.4.
|
|
621
|
-
"postcss-custom-properties": "^13.3.
|
|
613
|
+
postcss: "^8.4.30",
|
|
614
|
+
"postcss-custom-properties": "^13.3.1",
|
|
622
615
|
"postcss-loader": "^7.3.3",
|
|
623
616
|
prettier: "^3.0.3",
|
|
624
617
|
prompts: "^2.4.2",
|
|
625
618
|
"react-refresh": "^0.14.0",
|
|
626
619
|
"resolve-url-loader": "^5.0.0",
|
|
627
|
-
sass: "^1.
|
|
620
|
+
sass: "^1.67.0",
|
|
628
621
|
"sass-loader": "^13.3.2",
|
|
629
622
|
"source-map-loader": "^4.0.1",
|
|
630
623
|
"strip-indent": "^4.0.0",
|
|
@@ -673,7 +666,7 @@ cli.command("build").description(
|
|
|
673
666
|
"--https",
|
|
674
667
|
"Let local web server serve Tamaro with SSL encryption",
|
|
675
668
|
false
|
|
676
|
-
).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").option(
|
|
669
|
+
).option("--port <port>", "Web server port", `${DEFAULT_PORT}`).option("--env <env>", "Environment (dev, stage, prod)").option("--ci", "CI environment", false).option(
|
|
677
670
|
"--deploy",
|
|
678
671
|
"Deploy Tamaro Core or a customer configuration bundle to AWS S3",
|
|
679
672
|
false
|
|
@@ -699,7 +692,7 @@ cli.command("serve").description("Run a local web server for pre-built bundle").
|
|
|
699
692
|
});
|
|
700
693
|
cli.command("deploy").description(
|
|
701
694
|
"Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3"
|
|
702
|
-
).option(
|
|
695
|
+
).option("--ci", "CI environment", false).option(
|
|
703
696
|
"--tag <tag>",
|
|
704
697
|
"Tag which should be used for the deployment of the bundle",
|
|
705
698
|
DEFAULT_TAG
|
|
@@ -708,14 +701,14 @@ cli.command("deploy").description(
|
|
|
708
701
|
});
|
|
709
702
|
cli.command("list-deployed").description(
|
|
710
703
|
"List deployments of Tamaro Core or a particular customer configuration"
|
|
711
|
-
).option(
|
|
704
|
+
).option("--ci", "CI environment", false).option(
|
|
712
705
|
"--config <config>",
|
|
713
706
|
"Configuration name (default: current customer configuration)"
|
|
714
707
|
).action(async (options) => {
|
|
715
708
|
await listDeployed(options);
|
|
716
709
|
});
|
|
717
|
-
cli.command("deploy-email-config").description("Deploy a widget's email configuration to AWS S3").action(async () => {
|
|
718
|
-
await deployEmailConfig();
|
|
710
|
+
cli.command("deploy-email-config").description("Deploy a widget's email configuration to AWS S3").option("--ci", "CI environment", false).action(async (options) => {
|
|
711
|
+
await deployEmailConfig(options);
|
|
719
712
|
});
|
|
720
713
|
(async () => {
|
|
721
714
|
try {
|
package/dist/webpack.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raisenow/tamaro-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "RaiseNow",
|
|
6
6
|
"email": "development@raisenow.com"
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@babel/cli": "^7.22.15",
|
|
26
|
-
"@babel/core": "^7.22.
|
|
26
|
+
"@babel/core": "^7.22.20",
|
|
27
27
|
"@babel/plugin-proposal-decorators": "^7.22.15",
|
|
28
28
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
29
29
|
"@babel/plugin-transform-runtime": "^7.22.15",
|
|
30
|
-
"@babel/preset-env": "^7.22.
|
|
30
|
+
"@babel/preset-env": "^7.22.20",
|
|
31
31
|
"@babel/preset-react": "^7.22.15",
|
|
32
32
|
"@babel/preset-typescript": "^7.22.15",
|
|
33
33
|
"@babel/runtime-corejs3": "^7.22.15",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"@statoscope/webpack-plugin": "^5.27.0",
|
|
36
36
|
"@types/columnify": "^1.5.2",
|
|
37
37
|
"@types/lodash": "^4.14.198",
|
|
38
|
-
"@types/node": "^18.17.
|
|
38
|
+
"@types/node": "^18.17.18",
|
|
39
39
|
"@types/node-notifier": "^8.0.2",
|
|
40
40
|
"@types/prompts": "^2.4.4",
|
|
41
41
|
"@types/resolve-bin": "^0.4.1",
|
|
42
42
|
"@types/webpack-config-utils": "^2.3.1",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^6.7.
|
|
44
|
-
"@typescript-eslint/parser": "^6.7.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
44
|
+
"@typescript-eslint/parser": "^6.7.2",
|
|
45
45
|
"autoprefixer": "^10.4.15",
|
|
46
46
|
"babel-loader": "^9.1.3",
|
|
47
47
|
"babel-plugin-istanbul": "^6.1.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"eslint": "^8.49.0",
|
|
61
61
|
"eslint-config-prettier": "^9.0.0",
|
|
62
62
|
"eslint-import-resolver-typescript": "^3.6.0",
|
|
63
|
-
"eslint-plugin-deprecation": "^
|
|
63
|
+
"eslint-plugin-deprecation": "^2.0.0",
|
|
64
64
|
"eslint-plugin-import": "^2.28.1",
|
|
65
65
|
"eslint-plugin-markdownlint": "^0.5.0",
|
|
66
66
|
"eslint-plugin-promise": "^6.1.1",
|
|
@@ -78,14 +78,14 @@
|
|
|
78
78
|
"mini-css-extract-plugin": "^2.7.6",
|
|
79
79
|
"node-notifier": "^10.0.1",
|
|
80
80
|
"portfinder": "^1.0.32",
|
|
81
|
-
"postcss": "^8.4.
|
|
82
|
-
"postcss-custom-properties": "^13.3.
|
|
81
|
+
"postcss": "^8.4.30",
|
|
82
|
+
"postcss-custom-properties": "^13.3.1",
|
|
83
83
|
"postcss-loader": "^7.3.3",
|
|
84
84
|
"prettier": "^3.0.3",
|
|
85
85
|
"prompts": "^2.4.2",
|
|
86
86
|
"react-refresh": "^0.14.0",
|
|
87
87
|
"resolve-url-loader": "^5.0.0",
|
|
88
|
-
"sass": "^1.
|
|
88
|
+
"sass": "^1.67.0",
|
|
89
89
|
"sass-loader": "^13.3.2",
|
|
90
90
|
"source-map-loader": "^4.0.1",
|
|
91
91
|
"strip-indent": "^4.0.0",
|
package/src/cli.ts
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
import {createCommand} from 'commander'
|
|
4
4
|
import {build, type BuildOptions} from 'commands/build'
|
|
5
5
|
import {deploy, type DeployOptions} from 'commands/deploy'
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
deployEmailConfig,
|
|
8
|
+
type DeployEmailConfigOptions,
|
|
9
|
+
} from 'commands/deploy-email-config'
|
|
7
10
|
import {dev, type DevOptions} from 'commands/dev'
|
|
8
11
|
import {listDeployed, type ListDeployedOptions} from 'commands/list-deployed'
|
|
9
12
|
import {serve, type ServeOptions} from 'commands/serve'
|
|
@@ -71,6 +74,7 @@ cli
|
|
|
71
74
|
)
|
|
72
75
|
.option('--port <port>', 'Web server port', `${DEFAULT_PORT}`)
|
|
73
76
|
.option('--env <env>', 'Environment (dev, stage, prod)')
|
|
77
|
+
.option('--ci', 'CI environment', false)
|
|
74
78
|
.option(
|
|
75
79
|
'--deploy',
|
|
76
80
|
'Deploy Tamaro Core or a customer configuration bundle to AWS S3',
|
|
@@ -111,6 +115,7 @@ cli
|
|
|
111
115
|
.description(
|
|
112
116
|
'Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3',
|
|
113
117
|
)
|
|
118
|
+
.option('--ci', 'CI environment', false)
|
|
114
119
|
.option(
|
|
115
120
|
'--tag <tag>',
|
|
116
121
|
'Tag which should be used for the deployment of the bundle',
|
|
@@ -125,6 +130,7 @@ cli
|
|
|
125
130
|
.description(
|
|
126
131
|
'List deployments of Tamaro Core or a particular customer configuration',
|
|
127
132
|
)
|
|
133
|
+
.option('--ci', 'CI environment', false)
|
|
128
134
|
.option(
|
|
129
135
|
'--config <config>',
|
|
130
136
|
'Configuration name (default: current customer configuration)',
|
|
@@ -136,8 +142,9 @@ cli
|
|
|
136
142
|
cli
|
|
137
143
|
.command('deploy-email-config')
|
|
138
144
|
.description("Deploy a widget's email configuration to AWS S3")
|
|
139
|
-
.
|
|
140
|
-
|
|
145
|
+
.option('--ci', 'CI environment', false)
|
|
146
|
+
.action(async (options: DeployEmailConfigOptions) => {
|
|
147
|
+
await deployEmailConfig(options)
|
|
141
148
|
})
|
|
142
149
|
|
|
143
150
|
///////////////////////////////////////////////////////////////////////////////
|
package/src/commands/build.ts
CHANGED
|
@@ -33,10 +33,10 @@ export const build = async (
|
|
|
33
33
|
const {env} = options
|
|
34
34
|
|
|
35
35
|
assertOptionsValid(options)
|
|
36
|
-
assertProfilesPresent()
|
|
37
36
|
applyEnv(env)
|
|
38
37
|
|
|
39
|
-
if (options.deploy) {
|
|
38
|
+
if (options.deploy && !options.ci) {
|
|
39
|
+
assertProfilesPresent()
|
|
40
40
|
options.profile = await promptProfile()
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -1,31 +1,44 @@
|
|
|
1
1
|
import {existsSync} from 'fs'
|
|
2
2
|
import {
|
|
3
3
|
assertProfilesPresent,
|
|
4
|
+
type AwsOptions,
|
|
4
5
|
prepareFlags,
|
|
5
6
|
promptBucket,
|
|
6
7
|
promptProfile,
|
|
7
8
|
withAwsAuthenticate,
|
|
8
9
|
} from 'lib/aws'
|
|
9
10
|
import {halt, runCommandSync} from 'lib/command'
|
|
11
|
+
import {AWS_S3_EMAIL_CONFIG_PROD_BUCKET} from 'lib/constants'
|
|
10
12
|
import {logCommand, logDataTable, logTitle} from 'lib/logging'
|
|
11
13
|
import {notify} from 'lib/notifier'
|
|
12
14
|
import {getIfCoreFns, getPaths, getWidgetUuid} from 'lib/resolve'
|
|
13
15
|
|
|
14
16
|
///////////////////////////////////////////////////////////////////////////////
|
|
15
17
|
|
|
16
|
-
export
|
|
18
|
+
export type DeployEmailConfigOptions = AwsOptions
|
|
19
|
+
|
|
20
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
21
|
+
|
|
22
|
+
export const deployEmailConfig = async (
|
|
23
|
+
options: DeployEmailConfigOptions,
|
|
24
|
+
): Promise<void> => {
|
|
17
25
|
const {ifCore} = getIfCoreFns()
|
|
18
26
|
const paths = getPaths(ifCore)
|
|
19
27
|
const emailConfigPath = `${paths.app}/email-config`
|
|
20
28
|
|
|
21
29
|
assertIsNotCore()
|
|
22
30
|
assertEmailConfigPathExists(emailConfigPath)
|
|
23
|
-
assertProfilesPresent()
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
if (!options.ci) {
|
|
33
|
+
assertProfilesPresent()
|
|
34
|
+
options.profile = await promptProfile()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const bucket = options.ci
|
|
38
|
+
? AWS_S3_EMAIL_CONFIG_PROD_BUCKET
|
|
39
|
+
: await promptBucket()
|
|
27
40
|
|
|
28
|
-
const flags = prepareFlags([],
|
|
41
|
+
const flags = prepareFlags([], options).join(' ')
|
|
29
42
|
const configName = getWidgetUuid()
|
|
30
43
|
const deployUrl = `s3://${bucket}/${configName}`
|
|
31
44
|
|
|
@@ -41,9 +54,7 @@ export const deployEmailConfig = async (): Promise<void> => {
|
|
|
41
54
|
logCommand(cmd)
|
|
42
55
|
|
|
43
56
|
try {
|
|
44
|
-
withAwsAuthenticate(() => runCommandSync(cmd, {stdout: 'inherit'}),
|
|
45
|
-
profile,
|
|
46
|
-
})
|
|
57
|
+
withAwsAuthenticate(() => runCommandSync(cmd, {stdout: 'inherit'}), options)
|
|
47
58
|
} catch (error: any) {
|
|
48
59
|
halt(error.stderr)
|
|
49
60
|
}
|
package/src/commands/deploy.ts
CHANGED
|
@@ -31,9 +31,9 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
|
|
|
31
31
|
|
|
32
32
|
assertOptionsValid(options)
|
|
33
33
|
assertDistPathExists(paths.appDist)
|
|
34
|
-
assertProfilesPresent()
|
|
35
34
|
|
|
36
|
-
if (!options.profile) {
|
|
35
|
+
if (!options.ci && !options.profile) {
|
|
36
|
+
assertProfilesPresent()
|
|
37
37
|
options.profile = await promptProfile()
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -22,9 +22,11 @@ export const listDeployed = async (
|
|
|
22
22
|
options: ListDeployedOptions,
|
|
23
23
|
): Promise<void> => {
|
|
24
24
|
assertOptionsValid(options)
|
|
25
|
-
assertProfilesPresent()
|
|
26
25
|
|
|
27
|
-
options.
|
|
26
|
+
if (!options.ci) {
|
|
27
|
+
assertProfilesPresent()
|
|
28
|
+
options.profile = await promptProfile()
|
|
29
|
+
}
|
|
28
30
|
|
|
29
31
|
const flags = prepareFlags([], options).join(' ')
|
|
30
32
|
const {config} = options
|
package/src/lib/aws.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
export type AwsOptions = {
|
|
14
14
|
profile?: string
|
|
15
|
+
ci?: boolean
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
///////////////////////////////////////////////////////////////////////////////
|
|
@@ -28,10 +29,10 @@ export const withAwsAuthenticate = <Result = any>(
|
|
|
28
29
|
///////////////////////////////////////////////////////////////////////////////
|
|
29
30
|
|
|
30
31
|
export const awsAuthenticate = (options: AwsOptions) => {
|
|
31
|
-
if (
|
|
32
|
+
if (options.ci) {
|
|
32
33
|
// Don't try to authenticate the user.
|
|
33
|
-
// This
|
|
34
|
-
//
|
|
34
|
+
// This is done when CLI is running within an automated system like pipeline,
|
|
35
|
+
// In this case "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY" are used instead of "AWS_PROFILE".
|
|
35
36
|
return
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -44,18 +45,7 @@ export const awsAuthenticate = (options: AwsOptions) => {
|
|
|
44
45
|
|
|
45
46
|
///////////////////////////////////////////////////////////////////////////////
|
|
46
47
|
|
|
47
|
-
// Returns true if "AWS_ACCESS_KEY_ID" and "AWS_SECRET_ACCESS_KEY" environment variables are set.
|
|
48
|
-
export const isSetEnv = () => {
|
|
49
|
-
return !!(process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
53
|
-
|
|
54
48
|
export const assertProfilesPresent = () => {
|
|
55
|
-
if (isSetEnv()) {
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
49
|
const profiles = getAvailableProfiles()
|
|
60
50
|
|
|
61
51
|
if (profiles.length === 0) {
|
|
@@ -112,7 +102,7 @@ export const prepareFlags = (
|
|
|
112
102
|
): string[] => {
|
|
113
103
|
const {profile} = options
|
|
114
104
|
|
|
115
|
-
if (
|
|
105
|
+
if (profile) {
|
|
116
106
|
flags.push(`--profile ${profile}`)
|
|
117
107
|
}
|
|
118
108
|
|
|
@@ -122,10 +112,6 @@ export const prepareFlags = (
|
|
|
122
112
|
///////////////////////////////////////////////////////////////////////////////
|
|
123
113
|
|
|
124
114
|
export const promptProfile = async (): Promise<string | undefined> => {
|
|
125
|
-
if (isSetEnv()) {
|
|
126
|
-
return
|
|
127
|
-
}
|
|
128
|
-
|
|
129
115
|
const profiles = getAvailableProfiles()
|
|
130
116
|
.filter((v) => !!v)
|
|
131
117
|
.map((v) => ({title: v, value: v}))
|