@raisenow/tamaro-cli 1.1.8 → 1.1.9
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/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/runConfigurations/build_watch.xml +13 -0
- package/.idea/runConfigurations/lint_fix.xml +13 -0
- package/.idea/runConfigurations/tscheck.xml +12 -0
- package/.idea/tamaro-cli.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +35 -13
- package/bitbucket-pipelines.yml +43 -0
- package/dist/cli.js +40 -1
- package/package.json +3 -1
- package/src/cli.ts +0 -178
- package/src/commands/build.ts +0 -131
- package/src/commands/deploy-email-config.ts +0 -159
- package/src/commands/deploy.ts +0 -164
- package/src/commands/dev.ts +0 -88
- package/src/commands/list-deployed.ts +0 -117
- package/src/commands/serve.ts +0 -69
- package/src/lib/InterpolateHtmlPlugin.ts +0 -47
- package/src/lib/aws.ts +0 -138
- package/src/lib/command.ts +0 -27
- package/src/lib/constants.ts +0 -9
- package/src/lib/env.ts +0 -175
- package/src/lib/https.ts +0 -27
- package/src/lib/logging.ts +0 -37
- package/src/lib/notifier.ts +0 -22
- package/src/lib/resolve.ts +0 -143
- package/src/webpack.config.ts +0 -437
- package/tsconfig.json +0 -38
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/tamaro-cli.iml" filepath="$PROJECT_DIR$/.idea/tamaro-cli.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="build:watch" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="build:watch" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<package-manager value="pnpm" />
|
|
10
|
+
<envs />
|
|
11
|
+
<method v="2" />
|
|
12
|
+
</configuration>
|
|
13
|
+
</component>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="lint:fix" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="lint:fix" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<package-manager value="pnpm" />
|
|
10
|
+
<envs />
|
|
11
|
+
<method v="2" />
|
|
12
|
+
</configuration>
|
|
13
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="tscheck" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="tscheck" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<envs />
|
|
10
|
+
<method v="2" />
|
|
11
|
+
</configuration>
|
|
12
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/vcs.xml
ADDED
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
It’s a command-line interface for all operations with Tamaro customer configurations and _Tamaro Core_.
|
|
4
4
|
|
|
5
|
-
You don’t need to install it manually. The recommended way to run it is by using the `npx` command, which comes along
|
|
5
|
+
You don’t need to install it manually. The recommended way to run it is by using the `npx` command, which comes along
|
|
6
|
+
with NPM.
|
|
6
7
|
|
|
7
8
|
# Usage
|
|
8
9
|
|
|
@@ -12,7 +13,8 @@ To see an overview of all possible commands just run the following command witho
|
|
|
12
13
|
npx -y @raisenow/tamaro-cli
|
|
13
14
|
```
|
|
14
15
|
|
|
15
|
-
To see the information about some particular command (for example `dev` command), prepend `help` before the command
|
|
16
|
+
To see the information about some particular command (for example `dev` command), prepend `help` before the command
|
|
17
|
+
name:
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
npx -y @raisenow/tamaro-cli help dev
|
|
@@ -44,7 +46,8 @@ Runs the local development server for _Tamaro Core_ or a particular customer con
|
|
|
44
46
|
|
|
45
47
|
### Run local server using Tamaro Core from CDN
|
|
46
48
|
|
|
47
|
-
Run the local development server for the _example-02-typical-customisations_ customer configuration. You will be able to
|
|
49
|
+
Run the local development server for the _example-02-typical-customisations_ customer configuration. You will be able to
|
|
50
|
+
access Tamaro on <http://localhost:1234> (port may differ, see console output).
|
|
48
51
|
|
|
49
52
|
```bash
|
|
50
53
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
@@ -53,14 +56,17 @@ npx -y @raisenow/tamaro-cli dev
|
|
|
53
56
|
|
|
54
57
|
### Run local server using a locally running Tamaro Core
|
|
55
58
|
|
|
56
|
-
1. Run the local development web server for _Tamaro Core_ in the first terminal tab. You will be able to access a
|
|
59
|
+
1. Run the local development web server for _Tamaro Core_ in the first terminal tab. You will be able to access a
|
|
60
|
+
default configuration of Tamaro on <http://localhost:1234> (port may differ, see console output).
|
|
57
61
|
|
|
58
62
|
```bash
|
|
59
63
|
cd /path/to/tamaro-core
|
|
60
64
|
npx -y @raisenow/tamaro-cli dev
|
|
61
65
|
```
|
|
62
66
|
|
|
63
|
-
2. Run the local development web server for the _example-02-typical-customisations_ customer configuration in the second
|
|
67
|
+
2. Run the local development web server for the _example-02-typical-customisations_ customer configuration in the second
|
|
68
|
+
terminal tab. After running this command, you will able to access the configuration on <http://localhost:1235> (port
|
|
69
|
+
may differ, see console output).
|
|
64
70
|
|
|
65
71
|
```bash
|
|
66
72
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
@@ -69,7 +75,10 @@ npx -y @raisenow/tamaro-cli dev
|
|
|
69
75
|
|
|
70
76
|
### Use Transport Level Security (HTTPS)
|
|
71
77
|
|
|
72
|
-
You might want to the local web server to serve Tamaro over HTTPS, for example for testing wallet payments over Google
|
|
78
|
+
You might want to the local web server to serve Tamaro over HTTPS, for example for testing wallet payments over Google
|
|
79
|
+
Pay. For that, you have to install [mkcert](https://mkcert.org/), then generate a local certificate and key file and
|
|
80
|
+
install it into your local trust stores using this command in the root directory of the Tamaro configuration
|
|
81
|
+
repository (or Tamaro Core):
|
|
73
82
|
|
|
74
83
|
Install `mkcert`:
|
|
75
84
|
|
|
@@ -83,9 +92,11 @@ Generate certificate:
|
|
|
83
92
|
mkcert -install -cert-file localhost.crt -key-file localhost.key localhost 127.0.0.1 0.0.0.0 ::1
|
|
84
93
|
```
|
|
85
94
|
|
|
86
|
-
You will see that the certificate and key files are created. Keep them for yourself. Do not share them or commit them. (
|
|
95
|
+
You will see that the certificate and key files are created. Keep them for yourself. Do not share them or commit them. (
|
|
96
|
+
They should be ignored by Git.)
|
|
87
97
|
|
|
88
|
-
You can then use the flag `--https` with the CLI. If you are using the local Tamaro Core, you also have to serve that
|
|
98
|
+
You can then use the flag `--https` with the CLI. If you are using the local Tamaro Core, you also have to serve that
|
|
99
|
+
over HTTPS. Certificate and key files must be copied to Tamaro Core folder as well.
|
|
89
100
|
|
|
90
101
|
## `build`
|
|
91
102
|
|
|
@@ -115,7 +126,8 @@ As a result, the bundle should be deployed to: <https://tamaro.raisenow.com/exam
|
|
|
115
126
|
|
|
116
127
|
### Build and deploy a customer configuration with a specific tag
|
|
117
128
|
|
|
118
|
-
Build and deploy an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration with
|
|
129
|
+
Build and deploy an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration with
|
|
130
|
+
the tag _WEB-123_.
|
|
119
131
|
|
|
120
132
|
```bash
|
|
121
133
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
@@ -128,7 +140,14 @@ As a result, the bundle should be deployed to: <https://tamaro.raisenow.com/exam
|
|
|
128
140
|
|
|
129
141
|
Build and serve an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration.
|
|
130
142
|
|
|
131
|
-
After running this command, a local web server should be running on <http://localhost:1234> (port may differ, see
|
|
143
|
+
After running this command, a local web server should be running on <http://localhost:1234> (port may differ, see
|
|
144
|
+
console output).
|
|
145
|
+
|
|
146
|
+
### Build and test locally with a Tamaro configuration
|
|
147
|
+
|
|
148
|
+
1. Build with `pnpm build` (or `pnpm build:watch` for convince).
|
|
149
|
+
2. Navigate to the Tamaro configuration directory you want to use.
|
|
150
|
+
3. Run by specifying the relative path, e.g. `../../tools/tamaro-cli/dist/cli.js dev --https`
|
|
132
151
|
|
|
133
152
|
```bash
|
|
134
153
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
@@ -148,7 +167,8 @@ Run a local web server for pre-built bundle.
|
|
|
148
167
|
npx -y @raisenow/tamaro-cli build
|
|
149
168
|
```
|
|
150
169
|
|
|
151
|
-
2. Serve it. After running this command, web-server should be running on <http://localhost:1234> (port may differ, see
|
|
170
|
+
2. Serve it. After running this command, web-server should be running on <http://localhost:1234> (port may differ, see
|
|
171
|
+
console output).
|
|
152
172
|
|
|
153
173
|
```bash
|
|
154
174
|
npx -y @raisenow/tamaro-cli serve
|
|
@@ -162,7 +182,8 @@ Deploy a pre-built _Tamaro Core_ or customer configuration bundle to AWS S3.
|
|
|
162
182
|
|
|
163
183
|
- `--tag <tag>` – Tag which should be used for the deployment of the bundle (default: "latest")
|
|
164
184
|
|
|
165
|
-
Make sure you have built the bundle before deploying it with this command, otherwise you may mistakenly deploy the
|
|
185
|
+
Make sure you have built the bundle before deploying it with this command, otherwise you may mistakenly deploy the
|
|
186
|
+
bundle from a previous build.
|
|
166
187
|
|
|
167
188
|
### Example
|
|
168
189
|
|
|
@@ -232,7 +253,8 @@ Link package source to be able to run its local version:
|
|
|
232
253
|
npm link .
|
|
233
254
|
```
|
|
234
255
|
|
|
235
|
-
Run the `build:watch` script to watch source files and automatically rebuild on changes. It must be running during the
|
|
256
|
+
Run the `build:watch` script to watch source files and automatically rebuild on changes. It must be running during the
|
|
257
|
+
_Tamaro CLI_ development process.
|
|
236
258
|
|
|
237
259
|
```bash
|
|
238
260
|
npm run build:watch
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
image: node:20.18
|
|
2
|
+
|
|
3
|
+
definitions:
|
|
4
|
+
caches:
|
|
5
|
+
node:
|
|
6
|
+
key:
|
|
7
|
+
files:
|
|
8
|
+
- pnpm-lock.yaml
|
|
9
|
+
- package.json
|
|
10
|
+
path: node_modules
|
|
11
|
+
pnpm:
|
|
12
|
+
key:
|
|
13
|
+
files:
|
|
14
|
+
- pnpm-lock.yaml
|
|
15
|
+
- package.json
|
|
16
|
+
path: $BITBUCKET_CLONE_DIR/.pnpm-store
|
|
17
|
+
scripts:
|
|
18
|
+
initialize: &initialize |-
|
|
19
|
+
corepack enable pnpm
|
|
20
|
+
corepack prepare --activate
|
|
21
|
+
steps:
|
|
22
|
+
- step: &install
|
|
23
|
+
name: Install dependencies
|
|
24
|
+
caches:
|
|
25
|
+
- node
|
|
26
|
+
- pnpm
|
|
27
|
+
script:
|
|
28
|
+
- *initialize
|
|
29
|
+
- pnpm install --prefer-offline
|
|
30
|
+
- step: &check
|
|
31
|
+
name: Check
|
|
32
|
+
caches:
|
|
33
|
+
- node
|
|
34
|
+
- pnpm
|
|
35
|
+
script:
|
|
36
|
+
- *initialize
|
|
37
|
+
- pnpm lint
|
|
38
|
+
- pnpm tscheck
|
|
39
|
+
|
|
40
|
+
pipelines:
|
|
41
|
+
default:
|
|
42
|
+
- step: *install
|
|
43
|
+
- step: *check
|
package/dist/cli.js
CHANGED
|
@@ -27,6 +27,37 @@ import {
|
|
|
27
27
|
// src/cli.ts
|
|
28
28
|
import { createCommand } from "commander";
|
|
29
29
|
|
|
30
|
+
// src/commands/validate.ts
|
|
31
|
+
import { glob } from "glob";
|
|
32
|
+
|
|
33
|
+
// src/lib/validators/validateEmailTemplates.ts
|
|
34
|
+
import fs from "node:fs/promises";
|
|
35
|
+
import handlebars from "handlebars";
|
|
36
|
+
var { compile } = handlebars;
|
|
37
|
+
var validateEmailTemplates = async (templateFiles) => {
|
|
38
|
+
const errors = [];
|
|
39
|
+
for (const templateFile of templateFiles) {
|
|
40
|
+
try {
|
|
41
|
+
const compiled = compile(await fs.readFile(templateFile, "utf-8"));
|
|
42
|
+
compiled({});
|
|
43
|
+
console.log(`${templateFile} is a valid email template`);
|
|
44
|
+
} catch (e) {
|
|
45
|
+
errors.push(`${templateFile} is invalid`);
|
|
46
|
+
errors.push(e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return errors;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/commands/validate.ts
|
|
53
|
+
var validate = async () => {
|
|
54
|
+
const errors = await validateEmailTemplates(await glob("email-config/templates/**/*.hbs"));
|
|
55
|
+
if (errors.length) {
|
|
56
|
+
halt(errors.map((el) => el.toString()).join("\n"));
|
|
57
|
+
}
|
|
58
|
+
logTitle("Valid. Bye.");
|
|
59
|
+
};
|
|
60
|
+
|
|
30
61
|
// src/lib/aws.ts
|
|
31
62
|
import { execaCommandSync } from "execa";
|
|
32
63
|
import prompts from "prompts";
|
|
@@ -151,6 +182,7 @@ var build = async (options) => {
|
|
|
151
182
|
options.profile = await promptProfile();
|
|
152
183
|
}
|
|
153
184
|
assertOptionsValid(options);
|
|
185
|
+
await validate();
|
|
154
186
|
const flags = prepareFlags2(options);
|
|
155
187
|
const { ifCore } = getIfCoreFns();
|
|
156
188
|
const paths = getPaths(ifCore);
|
|
@@ -228,6 +260,7 @@ var deploy = async (options) => {
|
|
|
228
260
|
options.profile = await promptProfile();
|
|
229
261
|
}
|
|
230
262
|
assertOptionsValid2(options);
|
|
263
|
+
await validate();
|
|
231
264
|
awsAuthenticate(options);
|
|
232
265
|
const flags = prepareFlags(options);
|
|
233
266
|
const { tag } = options;
|
|
@@ -335,6 +368,7 @@ var deployEmailConfig = async (options) => {
|
|
|
335
368
|
options.bucket = options.ci ? AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD : await promptBucketTamaroEmailConfig();
|
|
336
369
|
}
|
|
337
370
|
assertOptionsValid3(options);
|
|
371
|
+
await validate();
|
|
338
372
|
awsAuthenticate(options);
|
|
339
373
|
const flags = prepareFlags(options);
|
|
340
374
|
const configName = getWidgetUuid();
|
|
@@ -577,7 +611,7 @@ var prepareFlags4 = async (options) => {
|
|
|
577
611
|
// package.json
|
|
578
612
|
var package_default = {
|
|
579
613
|
name: "@raisenow/tamaro-cli",
|
|
580
|
-
version: "1.1.
|
|
614
|
+
version: "1.1.9",
|
|
581
615
|
author: {
|
|
582
616
|
name: "RaiseNow",
|
|
583
617
|
email: "development@raisenow.com"
|
|
@@ -650,6 +684,8 @@ var package_default = {
|
|
|
650
684
|
"file-loader": "^6.2.0",
|
|
651
685
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
|
652
686
|
glob: "^11.0.0",
|
|
687
|
+
handlebars: "^4.7.8",
|
|
688
|
+
"handlebars-helpers": "^0.10.0",
|
|
653
689
|
"html-loader": "^5.1.0",
|
|
654
690
|
"html-webpack-plugin": "^5.6.3",
|
|
655
691
|
"json-loader": "^0.5.7",
|
|
@@ -756,6 +792,9 @@ cli.command("list-deployed").description(
|
|
|
756
792
|
cli.command("deploy-email-config").description("Deploy a widget's email configuration to AWS S3").option("--profile <profile>", "AWS profile").option("--ci", "CI environment", false).option("--bucket <bucket>", "AWS bucket for email configs").action(async (options) => {
|
|
757
793
|
await deployEmailConfig(options);
|
|
758
794
|
});
|
|
795
|
+
cli.command("validate").description("Validate the current Tamaro configuration to avoid common errors").action(async () => {
|
|
796
|
+
await validate();
|
|
797
|
+
});
|
|
759
798
|
(async () => {
|
|
760
799
|
try {
|
|
761
800
|
logTitle(`${package_default.name} ${package_default.version}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raisenow/tamaro-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "RaiseNow",
|
|
6
6
|
"email": "development@raisenow.com"
|
|
@@ -73,6 +73,8 @@
|
|
|
73
73
|
"file-loader": "^6.2.0",
|
|
74
74
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
|
75
75
|
"glob": "^11.0.0",
|
|
76
|
+
"handlebars": "^4.7.8",
|
|
77
|
+
"handlebars-helpers": "^0.10.0",
|
|
76
78
|
"html-loader": "^5.1.0",
|
|
77
79
|
"html-webpack-plugin": "^5.6.3",
|
|
78
80
|
"json-loader": "^0.5.7",
|
package/src/cli.ts
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import {createCommand} from 'commander'
|
|
4
|
-
import {build, type BuildOptions} from 'commands/build'
|
|
5
|
-
import {deploy, type DeployOptions} from 'commands/deploy'
|
|
6
|
-
import {
|
|
7
|
-
deployEmailConfig,
|
|
8
|
-
type DeployEmailConfigOptions,
|
|
9
|
-
} from 'commands/deploy-email-config'
|
|
10
|
-
import {dev, type DevOptions} from 'commands/dev'
|
|
11
|
-
import {listDeployed, type ListDeployedOptions} from 'commands/list-deployed'
|
|
12
|
-
import {serve, type ServeOptions} from 'commands/serve'
|
|
13
|
-
import {halt} from 'lib/command'
|
|
14
|
-
import {DEFAULT_PORT, DEFAULT_TAG} from 'lib/constants'
|
|
15
|
-
import {logError, logTitle} from 'lib/logging'
|
|
16
|
-
import pkg from '../package.json'
|
|
17
|
-
|
|
18
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Makes the script crash on unhandled rejections instead of silently
|
|
22
|
-
* ignoring them. In the future, promise rejections that are not handled will
|
|
23
|
-
* terminate the Node.js process with a non-zero exit code.
|
|
24
|
-
*/
|
|
25
|
-
process.on('unhandledRejection', (error) => {
|
|
26
|
-
throw error
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
// Exit on ctrl+c
|
|
30
|
-
process.on('SIGINT', () => {
|
|
31
|
-
halt()
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
35
|
-
|
|
36
|
-
const cli = createCommand().name(pkg.name).version(pkg.version, '-v, --version')
|
|
37
|
-
|
|
38
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
39
|
-
|
|
40
|
-
cli
|
|
41
|
-
.command('dev')
|
|
42
|
-
.description(
|
|
43
|
-
'Run the local development server for Tamaro Core or a particular customer configuration',
|
|
44
|
-
)
|
|
45
|
-
.option(
|
|
46
|
-
'--local-core',
|
|
47
|
-
'Load Tamaro Core from localhost:1234 instead of the CDN',
|
|
48
|
-
false,
|
|
49
|
-
)
|
|
50
|
-
.option(
|
|
51
|
-
'--https',
|
|
52
|
-
'Let local web server serve Tamaro with SSL encryption',
|
|
53
|
-
false,
|
|
54
|
-
)
|
|
55
|
-
.option('--port <port>', 'Web server port', `${DEFAULT_PORT}`)
|
|
56
|
-
.option('--env <env>', 'Environment (dev, stage, prod)')
|
|
57
|
-
.option('--nolint', 'Disable ESLint', false)
|
|
58
|
-
.action(async (options: DevOptions) => {
|
|
59
|
-
await dev(options)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
cli
|
|
63
|
-
.command('build')
|
|
64
|
-
.description(
|
|
65
|
-
'Build an optimised (minified) bundle of Tamaro Core or a customer configuration',
|
|
66
|
-
)
|
|
67
|
-
.option(
|
|
68
|
-
'--local-core',
|
|
69
|
-
'Load Tamaro Core from localhost:1234 instead of the CDN',
|
|
70
|
-
false,
|
|
71
|
-
)
|
|
72
|
-
.option('--analyze', 'Generate bundle statistics to "reports" folder', false)
|
|
73
|
-
.option('--serve', 'Run the generated bundle with a local web server', false)
|
|
74
|
-
.option(
|
|
75
|
-
'--https',
|
|
76
|
-
'Let local web server serve Tamaro with SSL encryption',
|
|
77
|
-
false,
|
|
78
|
-
)
|
|
79
|
-
.option('--port <port>', 'Web server port', `${DEFAULT_PORT}`)
|
|
80
|
-
.option('--env <env>', 'Environment (dev, stage, prod)')
|
|
81
|
-
.option('--profile <profile>', 'AWS profile')
|
|
82
|
-
.option('--ci', 'CI environment', false)
|
|
83
|
-
.option(
|
|
84
|
-
'--deploy',
|
|
85
|
-
'Deploy Tamaro Core or a customer configuration bundle to AWS S3',
|
|
86
|
-
false,
|
|
87
|
-
)
|
|
88
|
-
.option(
|
|
89
|
-
'--tag <tag>',
|
|
90
|
-
'Tag which should be used for the deployment of the bundle',
|
|
91
|
-
DEFAULT_TAG,
|
|
92
|
-
)
|
|
93
|
-
.option('--nolint', 'Disable ESLint', false)
|
|
94
|
-
.action(async (options: BuildOptions & ServeOptions & DeployOptions) => {
|
|
95
|
-
await build(options)
|
|
96
|
-
|
|
97
|
-
if (options.serve) {
|
|
98
|
-
await serve(options)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (options.deploy) {
|
|
102
|
-
await deploy(options)
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
cli
|
|
107
|
-
.command('serve')
|
|
108
|
-
.description('Run a local web server for pre-built bundle')
|
|
109
|
-
.option('--port <port>', 'Web server port', `${DEFAULT_PORT}`)
|
|
110
|
-
.option(
|
|
111
|
-
'--https',
|
|
112
|
-
'Let local web server serve Tamaro with SSL encryption',
|
|
113
|
-
false,
|
|
114
|
-
)
|
|
115
|
-
.action(async (options: ServeOptions) => {
|
|
116
|
-
await serve(options)
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
cli
|
|
120
|
-
.command('deploy')
|
|
121
|
-
.description(
|
|
122
|
-
'Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3',
|
|
123
|
-
)
|
|
124
|
-
.option('--profile <profile>', 'AWS profile')
|
|
125
|
-
.option('--ci', 'CI environment', false)
|
|
126
|
-
.option(
|
|
127
|
-
'--tag <tag>',
|
|
128
|
-
'Tag which should be used for the deployment of the bundle',
|
|
129
|
-
DEFAULT_TAG,
|
|
130
|
-
)
|
|
131
|
-
.action(async (options: DeployOptions) => {
|
|
132
|
-
await deploy(options)
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
cli
|
|
136
|
-
.command('list-deployed')
|
|
137
|
-
.description(
|
|
138
|
-
'List deployments of Tamaro Core or a particular customer configuration',
|
|
139
|
-
)
|
|
140
|
-
.option('--profile <profile>', 'AWS profile')
|
|
141
|
-
.option('--ci', 'CI environment', false)
|
|
142
|
-
.option(
|
|
143
|
-
'--config <config>',
|
|
144
|
-
'Configuration name (default: current customer configuration)',
|
|
145
|
-
)
|
|
146
|
-
.action(async (options: ListDeployedOptions) => {
|
|
147
|
-
await listDeployed(options)
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
cli
|
|
151
|
-
.command('deploy-email-config')
|
|
152
|
-
.description("Deploy a widget's email configuration to AWS S3")
|
|
153
|
-
.option('--profile <profile>', 'AWS profile')
|
|
154
|
-
.option('--ci', 'CI environment', false)
|
|
155
|
-
.option('--bucket <bucket>', 'AWS bucket for email configs')
|
|
156
|
-
.action(async (options: DeployEmailConfigOptions) => {
|
|
157
|
-
await deployEmailConfig(options)
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
161
|
-
|
|
162
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
163
|
-
;(async () => {
|
|
164
|
-
try {
|
|
165
|
-
logTitle(`${pkg.name} ${pkg.version}\n`)
|
|
166
|
-
|
|
167
|
-
await cli.parseAsync(process.argv)
|
|
168
|
-
} catch (error: any) {
|
|
169
|
-
if (error.signal === 'SIGINT' && error.signalDescription) {
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
171
|
-
logError(`\n${error.signalDescription}`)
|
|
172
|
-
} else {
|
|
173
|
-
// eslint-disable-next-line no-console
|
|
174
|
-
console.log('')
|
|
175
|
-
logError(error.stack)
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
})()
|