@raisenow/tamaro-cli 1.0.26 → 1.1.0
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/.eslintignore +3 -0
- package/.eslintrc.cjs +142 -42
- package/.nvmrc +1 -1
- package/.prettierignore +3 -0
- package/README.md +14 -22
- package/dist/{chunk-ZAKDPU5F.js → chunk-S4M23KNZ.js} +35 -33
- package/dist/cli.js +331 -329
- package/dist/webpack.config.js +19 -19
- package/package.json +62 -57
- package/readme.html +1 -1
- package/src/cli.ts +12 -44
- package/src/commands/build.ts +19 -14
- package/src/commands/deploy-email-config.ts +19 -52
- package/src/commands/deploy.ts +18 -19
- package/src/commands/dev.ts +4 -4
- package/src/commands/list-deployed.ts +15 -20
- package/src/commands/serve.ts +3 -3
- package/src/lib/InterpolateHtmlPlugin.ts +7 -7
- package/src/lib/aws.ts +72 -26
- package/src/lib/command.ts +5 -1
- package/src/lib/constants.ts +2 -1
- package/src/lib/env.ts +12 -13
- package/src/lib/https.ts +2 -2
- package/src/lib/logging.ts +9 -4
- package/src/lib/resolve.ts +5 -7
- package/src/webpack.config.ts +18 -17
- package/tsconfig.json +5 -1
- package/.gitignore +0 -14
- package/tsconfig.eslint.json +0 -7
package/.eslintignore
CHANGED
package/.eslintrc.cjs
CHANGED
|
@@ -1,47 +1,147 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
root: true,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
overrides: [
|
|
4
|
+
{
|
|
5
|
+
files: ['*.{js,cjs,ts}'],
|
|
6
|
+
env: {
|
|
7
|
+
node: true,
|
|
8
|
+
es2021: true,
|
|
9
|
+
},
|
|
10
|
+
settings: {
|
|
11
|
+
'import/resolver': {
|
|
12
|
+
typescript: {
|
|
13
|
+
alwaysTryTypes: true,
|
|
14
|
+
project: ['./tsconfig.json'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
parser: '@typescript-eslint/parser',
|
|
19
|
+
parserOptions: {
|
|
20
|
+
ecmaVersion: 2021,
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
tsconfigRootDir: __dirname,
|
|
23
|
+
project: ['./tsconfig.json'],
|
|
24
|
+
extraFileExtensions: ['.cjs'],
|
|
25
|
+
},
|
|
26
|
+
extends: [
|
|
27
|
+
'eslint:recommended',
|
|
28
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
29
|
+
'plugin:@typescript-eslint/strict-type-checked',
|
|
30
|
+
'plugin:@typescript-eslint/stylistic-type-checked',
|
|
31
|
+
'plugin:promise/recommended',
|
|
32
|
+
'plugin:deprecation/recommended',
|
|
33
|
+
'plugin:import/recommended',
|
|
34
|
+
'plugin:import/typescript',
|
|
35
|
+
'prettier',
|
|
36
|
+
],
|
|
37
|
+
plugins: ['unused-imports'],
|
|
38
|
+
rules: {
|
|
39
|
+
curly: 1,
|
|
40
|
+
'prefer-const': 1,
|
|
41
|
+
'no-console': 1,
|
|
42
|
+
strict: 1,
|
|
43
|
+
'no-debugger': 1,
|
|
44
|
+
|
|
45
|
+
'no-extra-boolean-cast': 0,
|
|
46
|
+
'@typescript-eslint/no-explicit-any': 0,
|
|
47
|
+
'@typescript-eslint/no-non-null-assertion': 0,
|
|
48
|
+
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
49
|
+
'@typescript-eslint/no-unsafe-argument': 0,
|
|
50
|
+
'@typescript-eslint/no-unsafe-member-access': 0,
|
|
51
|
+
'@typescript-eslint/no-unsafe-return': 0,
|
|
52
|
+
// '@typescript-eslint/no-unsafe-enum-comparison': 0,
|
|
53
|
+
// '@typescript-eslint/no-unsafe-call': 0,
|
|
54
|
+
// '@typescript-eslint/explicit-function-return-type': 0,
|
|
55
|
+
'@typescript-eslint/consistent-type-definitions': 0,
|
|
56
|
+
// '@typescript-eslint/no-dynamic-delete': 0,
|
|
57
|
+
|
|
58
|
+
'@typescript-eslint/ban-ts-comment': [2, {'ts-expect-error': false}],
|
|
59
|
+
'@typescript-eslint/no-unused-vars': [1, {varsIgnorePattern: '^_'}],
|
|
60
|
+
'@typescript-eslint/prefer-optional-chain': 1,
|
|
61
|
+
'@typescript-eslint/member-delimiter-style': [
|
|
62
|
+
1,
|
|
63
|
+
{multiline: {delimiter: 'none'}},
|
|
64
|
+
],
|
|
65
|
+
|
|
66
|
+
'@typescript-eslint/no-confusing-void-expression': [
|
|
67
|
+
2,
|
|
68
|
+
{ignoreArrowShorthand: true},
|
|
69
|
+
],
|
|
70
|
+
|
|
71
|
+
'import/newline-after-import': 2,
|
|
72
|
+
|
|
73
|
+
'unused-imports/no-unused-imports': 1,
|
|
74
|
+
|
|
75
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
76
|
+
2,
|
|
77
|
+
{
|
|
78
|
+
prefer: 'type-imports',
|
|
79
|
+
fixStyle: 'inline-type-imports',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
|
|
83
|
+
'sort-imports': [2, {ignoreCase: true, ignoreDeclarationSort: true}],
|
|
84
|
+
'import/order': [
|
|
85
|
+
2,
|
|
86
|
+
{
|
|
87
|
+
groups: [
|
|
88
|
+
'builtin',
|
|
89
|
+
'external',
|
|
90
|
+
'internal',
|
|
91
|
+
['parent', 'sibling', 'index'],
|
|
92
|
+
],
|
|
93
|
+
pathGroups: [
|
|
94
|
+
{
|
|
95
|
+
pattern: '**/*.json',
|
|
96
|
+
group: 'unknown',
|
|
97
|
+
position: 'after',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
pattern: '**/*.yml',
|
|
101
|
+
group: 'unknown',
|
|
102
|
+
position: 'after',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
distinctGroup: false,
|
|
106
|
+
alphabetize: {
|
|
107
|
+
order: 'asc',
|
|
108
|
+
orderImportKind: 'asc',
|
|
109
|
+
caseInsensitive: true,
|
|
110
|
+
},
|
|
111
|
+
'newlines-between': 'never',
|
|
112
|
+
|
|
113
|
+
// Since docs for "pathGroupsExcludedImportTypes" option are confusing,
|
|
114
|
+
// see more info about how to correctly use it here:
|
|
115
|
+
// https://github.com/import-js/eslint-plugin-import/pull/2156#issuecomment-927559466
|
|
116
|
+
pathGroupsExcludedImportTypes: [],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
files: ['*.{yml,yaml}'],
|
|
123
|
+
extends: ['plugin:yml/standard'],
|
|
124
|
+
rules: {
|
|
125
|
+
// 'yml/no-irregular-whitespace': 0,
|
|
126
|
+
// 'yml/quotes': [2, {prefer: 'double', avoidEscape: true}],
|
|
127
|
+
'yml/plain-scalar': 0,
|
|
128
|
+
'yml/no-multiple-empty-lines': [2, {max: 1}],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
files: ['*.md'],
|
|
133
|
+
parser: 'eslint-plugin-markdownlint/parser',
|
|
134
|
+
extends: ['plugin:markdownlint/recommended'],
|
|
135
|
+
rules: {
|
|
136
|
+
// Rules docs:
|
|
137
|
+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
|
|
138
|
+
|
|
139
|
+
'markdownlint/md013': 0, // Line length
|
|
140
|
+
'markdownlint/md024': [2, {siblings_only: true}], // Multiple headings with the same content
|
|
141
|
+
'markdownlint/md025': 0, // Multiple top-level headings in the same document
|
|
142
|
+
'markdownlint/md033': 0, // Inline HTML
|
|
143
|
+
'markdownlint/md041': 0, // First line in a file should be a top-level heading
|
|
144
|
+
},
|
|
12
145
|
},
|
|
13
|
-
ecmaVersion: 2021,
|
|
14
|
-
sourceType: 'module',
|
|
15
|
-
tsconfigRootDir: __dirname,
|
|
16
|
-
project: './tsconfig.eslint.json',
|
|
17
|
-
extraFileExtensions: ['.cjs'],
|
|
18
|
-
},
|
|
19
|
-
extends: [
|
|
20
|
-
'eslint:recommended',
|
|
21
|
-
'plugin:node/recommended',
|
|
22
|
-
'plugin:promise/recommended',
|
|
23
|
-
'plugin:@typescript-eslint/recommended',
|
|
24
|
-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
25
|
-
'prettier',
|
|
26
146
|
],
|
|
27
|
-
plugins: [],
|
|
28
|
-
rules: {
|
|
29
|
-
curly: 1,
|
|
30
|
-
'prefer-const': 2,
|
|
31
|
-
'require-await': 0,
|
|
32
|
-
'no-process-exit': 0,
|
|
33
|
-
'node/no-unsupported-features/es-syntax': 0,
|
|
34
|
-
'node/no-missing-import': 0,
|
|
35
|
-
'node/shebang': 0,
|
|
36
|
-
'@typescript-eslint/ban-ts-comment': 0,
|
|
37
|
-
'@typescript-eslint/no-explicit-any': 0,
|
|
38
|
-
'@typescript-eslint/no-non-null-assertion': 0,
|
|
39
|
-
'@typescript-eslint/prefer-optional-chain': 1,
|
|
40
|
-
'@typescript-eslint/require-await': 0,
|
|
41
|
-
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
42
|
-
'@typescript-eslint/no-unsafe-member-access': 0,
|
|
43
|
-
'@typescript-eslint/no-unsafe-call': 0,
|
|
44
|
-
'@typescript-eslint/no-unsafe-return': 0,
|
|
45
|
-
'@typescript-eslint/no-unsafe-argument': 0,
|
|
46
|
-
},
|
|
47
147
|
}
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
18.
|
|
1
|
+
18.17.1
|
package/.prettierignore
CHANGED
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ To see an overview of all possible commands just run the following command witho
|
|
|
12
12
|
npx -y @raisenow/tamaro-cli
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
To see the
|
|
15
|
+
To see the information about some particular command (for example `dev` command), prepend `help` before the command name:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npx -y @raisenow/tamaro-cli help dev
|
|
@@ -44,7 +44,7 @@ Runs the local development server for _Tamaro Core_ or a particular customer con
|
|
|
44
44
|
|
|
45
45
|
### Run local server using Tamaro Core from CDN
|
|
46
46
|
|
|
47
|
-
Run the local development server for the _example-02-typical-customisations_ customer configuration. You will be able to access Tamaro on http://localhost:1234 (port may differ, see console output).
|
|
47
|
+
Run the local development server for the _example-02-typical-customisations_ customer configuration. You will be able to access Tamaro on <http://localhost:1234> (port may differ, see console output).
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
@@ -53,14 +53,14 @@ npx -y @raisenow/tamaro-cli dev
|
|
|
53
53
|
|
|
54
54
|
### Run local server using a locally running Tamaro Core
|
|
55
55
|
|
|
56
|
-
1.
|
|
56
|
+
1. Run the local development web server for _Tamaro Core_ in the first terminal tab. You will be able to access a default configuration of Tamaro on <http://localhost:1234> (port may differ, see console output).
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
59
|
cd /path/to/tamaro-core
|
|
60
60
|
npx -y @raisenow/tamaro-cli dev
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
2.
|
|
63
|
+
2. Run the local development web server for the _example-02-typical-customisations_ customer configuration in the second terminal tab. After running this command, you will able to access the configuration on <http://localhost:1235> (port may differ, see console output).
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
66
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
@@ -100,8 +100,7 @@ Build an optimised (minified) bundle of _Tamaro Core_ or a customer configuratio
|
|
|
100
100
|
- `--port <port>` – Web server port (default: 1234)
|
|
101
101
|
- `--env <env>` – Environment (dev, stage, prod)
|
|
102
102
|
- `--deploy` – Deploy _Tamaro Core_ or a customer configuration bundle to AWS S3
|
|
103
|
-
- `--tag <tag>` – Tag which should be used for the deployment of the bundle (default:
|
|
104
|
-
- `--profile <profile>` – AWS profile which should be used for the deployment of the bundle (default: “payments-prod-cs-deployer”)
|
|
103
|
+
- `--tag <tag>` – Tag which should be used for the deployment of the bundle (default: "latest")
|
|
105
104
|
|
|
106
105
|
### Build and deploy a customer configuration
|
|
107
106
|
|
|
@@ -112,7 +111,7 @@ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
|
112
111
|
npx -y @raisenow/tamaro-cli build --deploy
|
|
113
112
|
```
|
|
114
113
|
|
|
115
|
-
As a result, the bundle should be deployed to: https://tamaro.raisenow.com/example-02-typical-customisations/latest
|
|
114
|
+
As a result, the bundle should be deployed to: <https://tamaro.raisenow.com/example-02-typical-customisations/latest/>
|
|
116
115
|
|
|
117
116
|
### Build and deploy a customer configuration with a specific tag
|
|
118
117
|
|
|
@@ -123,13 +122,13 @@ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
|
123
122
|
npx -y @raisenow/tamaro-cli build --deploy --tag WEB-123
|
|
124
123
|
```
|
|
125
124
|
|
|
126
|
-
As a result, the bundle should be deployed to: https://tamaro.raisenow.com/example-02-typical-customisations/WEB-123
|
|
125
|
+
As a result, the bundle should be deployed to: <https://tamaro.raisenow.com/example-02-typical-customisations/WEB-123/>
|
|
127
126
|
|
|
128
127
|
### Build and serve a customer configuration
|
|
129
128
|
|
|
130
129
|
Build and serve an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration.
|
|
131
130
|
|
|
132
|
-
After running this command, a local web server should be running on http://localhost:1234 (port may differ, see console output).
|
|
131
|
+
After running this command, a local web server should be running on <http://localhost:1234> (port may differ, see console output).
|
|
133
132
|
|
|
134
133
|
```bash
|
|
135
134
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
@@ -142,14 +141,14 @@ Run a local web server for pre-built bundle.
|
|
|
142
141
|
|
|
143
142
|
### Example
|
|
144
143
|
|
|
145
|
-
1.
|
|
144
|
+
1. Build an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration
|
|
146
145
|
|
|
147
146
|
```bash
|
|
148
147
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
149
148
|
npx -y @raisenow/tamaro-cli build
|
|
150
149
|
```
|
|
151
150
|
|
|
152
|
-
2.
|
|
151
|
+
2. Serve it. After running this command, web-server should be running on <http://localhost:1234> (port may differ, see console output).
|
|
153
152
|
|
|
154
153
|
```bash
|
|
155
154
|
npx -y @raisenow/tamaro-cli serve
|
|
@@ -161,27 +160,26 @@ Deploy a pre-built _Tamaro Core_ or customer configuration bundle to AWS S3.
|
|
|
161
160
|
|
|
162
161
|
### Options
|
|
163
162
|
|
|
164
|
-
- `--tag <tag>` – Tag which should be used for the deployment of the bundle (default:
|
|
165
|
-
- `--profile <profile>` – AWS profile which should be used for the deployment of the bundle (default: “payments-prod-cs-deployer”)
|
|
163
|
+
- `--tag <tag>` – Tag which should be used for the deployment of the bundle (default: "latest")
|
|
166
164
|
|
|
167
165
|
Make sure you have built the bundle before deploying it with this command, otherwise you may mistakenly deploy the bundle from a previous build.
|
|
168
166
|
|
|
169
167
|
### Example
|
|
170
168
|
|
|
171
|
-
1.
|
|
169
|
+
1. Build an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration
|
|
172
170
|
|
|
173
171
|
```bash
|
|
174
172
|
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
175
173
|
npx -y @raisenow/tamaro-cli build
|
|
176
174
|
```
|
|
177
175
|
|
|
178
|
-
2.
|
|
176
|
+
2. Deploy it
|
|
179
177
|
|
|
180
178
|
```bash
|
|
181
179
|
npx -y @raisenow/tamaro-cli deploy
|
|
182
180
|
```
|
|
183
181
|
|
|
184
|
-
3.
|
|
182
|
+
3. Optionally, deploy it with the _WEB-123_ tag
|
|
185
183
|
|
|
186
184
|
```bash
|
|
187
185
|
npx -y @raisenow/tamaro-cli deploy --tag WEB-123
|
|
@@ -194,7 +192,6 @@ List deployments of _Tamaro Core_ or a particular customer configuration.
|
|
|
194
192
|
### Options
|
|
195
193
|
|
|
196
194
|
- `--config <config>` – Configuration name (default: current customer configuration)
|
|
197
|
-
- `--profile <profile>` – AWS profile which should be used for fetching deployments (default: “payments-prod-cs-deployer”)
|
|
198
195
|
|
|
199
196
|
### Example
|
|
200
197
|
|
|
@@ -207,11 +204,6 @@ npx -y @raisenow/tamaro-cli list-deployed
|
|
|
207
204
|
|
|
208
205
|
Deploy a widget’s email configuration to AWS S3.
|
|
209
206
|
|
|
210
|
-
### Options
|
|
211
|
-
|
|
212
|
-
- `--bucket <bucket>` – AWS S3 bucket where it should be deployed (default: “rnw-email-service”)
|
|
213
|
-
- `--profile <profile>` – AWS profile which should be used for the deployment of email configuration (default: “payments-prod-cs-deployer”)
|
|
214
|
-
|
|
215
207
|
### Example
|
|
216
208
|
|
|
217
209
|
```bash
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
// node_modules/tsup/assets/esm_shims.js
|
|
1
|
+
// node_modules/.pnpm/tsup@7.2.0_postcss@8.4.29_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);
|
|
5
5
|
var getDirname = () => path.dirname(getFilename());
|
|
6
6
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
7
7
|
|
|
8
|
-
// src/lib/constants.ts
|
|
9
|
-
var DEFAULT_TAG = "latest";
|
|
10
|
-
var DEFAULT_PORT = 1234;
|
|
11
|
-
var DEFAULT_AWS_PROFILE = "payments-prod-cs-deployer";
|
|
12
|
-
var DEFAULT_AWS_S3_EMAIL_CONFIG_BUCKET = "rnw-email-service";
|
|
13
|
-
var AWS_S3_BUCKET = "tamaro.raisenow.com";
|
|
14
|
-
var CORE_CONFIG_NAME = "tamaro-core";
|
|
15
|
-
var AWS_CLOUDFRONT_DISTRIBUTION_ID = "EHJ1OM458YQ0I";
|
|
16
|
-
var HTTPS_CRT_FILE = "localhost.crt";
|
|
17
|
-
var HTTPS_KEY_FILE = "localhost.key";
|
|
18
|
-
|
|
19
8
|
// src/lib/logging.ts
|
|
20
9
|
import chalk from "chalk";
|
|
21
|
-
import stripIndent from "strip-indent";
|
|
22
10
|
import columnify from "columnify";
|
|
11
|
+
import stripIndent from "strip-indent";
|
|
23
12
|
var logTitle = (title) => {
|
|
24
13
|
console.log(`${chalk.bold(title)}`);
|
|
25
14
|
};
|
|
@@ -38,13 +27,24 @@ var logDataTable = (data) => {
|
|
|
38
27
|
console.log("");
|
|
39
28
|
};
|
|
40
29
|
|
|
30
|
+
// src/lib/constants.ts
|
|
31
|
+
var DEFAULT_TAG = "latest";
|
|
32
|
+
var DEFAULT_PORT = 1234;
|
|
33
|
+
var AWS_S3_EMAIL_CONFIG_PROD_BUCKET = "rnw-email-service";
|
|
34
|
+
var AWS_S3_EMAIL_CONFIG_STAGE_BUCKET = "rnw-stage-email-service";
|
|
35
|
+
var AWS_S3_BUCKET = "tamaro.raisenow.com";
|
|
36
|
+
var CORE_CONFIG_NAME = "tamaro-core";
|
|
37
|
+
var AWS_CLOUDFRONT_DISTRIBUTION_ID = "EHJ1OM458YQ0I";
|
|
38
|
+
var HTTPS_CRT_FILE = "localhost.crt";
|
|
39
|
+
var HTTPS_KEY_FILE = "localhost.key";
|
|
40
|
+
|
|
41
41
|
// src/lib/resolve.ts
|
|
42
|
+
import { existsSync, realpathSync } from "fs";
|
|
42
43
|
import { createRequire } from "module";
|
|
43
44
|
import { basename, dirname, join, relative, resolve } from "path";
|
|
44
|
-
import { existsSync, realpathSync } from "fs";
|
|
45
|
-
import { getIfUtils } from "webpack-config-utils";
|
|
46
|
-
import stripIndent2 from "strip-indent";
|
|
47
45
|
import chalk2 from "chalk";
|
|
46
|
+
import stripIndent2 from "strip-indent";
|
|
47
|
+
import { getIfUtils } from "webpack-config-utils";
|
|
48
48
|
var require2 = createRequire(import.meta.url);
|
|
49
49
|
var moduleFileExtensions = ["ts", "tsx", "js", "jsx"];
|
|
50
50
|
var extensions = moduleFileExtensions.map((v) => `.${v}`);
|
|
@@ -137,13 +137,15 @@ var getIfCoreFns = () => {
|
|
|
137
137
|
// src/lib/env.ts
|
|
138
138
|
import { createRequire as createRequire2 } from "module";
|
|
139
139
|
import { basename as basename2 } from "path";
|
|
140
|
-
import { globSync } from "glob";
|
|
141
|
-
import { expand as dotenvExpand } from "dotenv-expand";
|
|
142
140
|
import { config as dotenvConfig } from "dotenv";
|
|
141
|
+
import { expand as dotenvExpand } from "dotenv-expand";
|
|
142
|
+
import { globSync } from "glob";
|
|
143
143
|
import stripIndent3 from "strip-indent";
|
|
144
144
|
|
|
145
145
|
// src/lib/command.ts
|
|
146
|
-
import {
|
|
146
|
+
import {
|
|
147
|
+
execaCommandSync
|
|
148
|
+
} from "execa";
|
|
147
149
|
var halt = (message, exitCode = 1) => {
|
|
148
150
|
logError(message);
|
|
149
151
|
process.exit(exitCode);
|
|
@@ -183,7 +185,7 @@ var getEnvVars = (files, ifMin, ifCore, ifLocalCore, ifHttps) => {
|
|
|
183
185
|
process.env.WIDGET_UUID = getWidgetUuid();
|
|
184
186
|
if (ifLocalCore()) {
|
|
185
187
|
const protocol = ifHttps() ? "https" : "http";
|
|
186
|
-
process.env.CORE_URL = `${protocol}://
|
|
188
|
+
process.env.CORE_URL = `${protocol}://localhost:1234/index.js`;
|
|
187
189
|
} else {
|
|
188
190
|
let version = process.env.CORE_VERSION;
|
|
189
191
|
version = version ? `@${version}` : "";
|
|
@@ -220,7 +222,7 @@ var getEnvVars = (files, ifMin, ifCore, ifLocalCore, ifHttps) => {
|
|
|
220
222
|
"EPMS_TWINT_CHECKOUT_URL_STAGE",
|
|
221
223
|
"EPMS_TWINT_CHECKOUT_URL_PROD"
|
|
222
224
|
];
|
|
223
|
-
const raw = Object.keys(process.env).filter((key) =>
|
|
225
|
+
const raw = Object.keys(process.env).filter((key) => key.startsWith("PUBLIC_") || varNames.includes(key)).reduce((env, key) => {
|
|
224
226
|
env[key] = process.env[key];
|
|
225
227
|
return env;
|
|
226
228
|
}, {});
|
|
@@ -239,18 +241,18 @@ var assertEnvValid = (env) => {
|
|
|
239
241
|
const envs = files.map((file) => basename2(file).replace(/^\.env\./, "")).map((file) => basename2(file).replace(/^\.env$/, "")).filter((v) => !!v);
|
|
240
242
|
if (envs.length === 0) {
|
|
241
243
|
if (env) {
|
|
242
|
-
console.log(
|
|
244
|
+
console.log('Flag "--env" is ignored.');
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
247
|
if (envs.length !== 0) {
|
|
246
248
|
if (!env) {
|
|
247
|
-
halt(
|
|
249
|
+
halt('Flag "--env" is required.');
|
|
248
250
|
}
|
|
249
251
|
if (env && !envs.includes(env)) {
|
|
250
252
|
halt(
|
|
251
253
|
stripIndent3(`
|
|
252
|
-
Flag
|
|
253
|
-
Available values are: ${envs.map((v) =>
|
|
254
|
+
Flag "--env" has wrong value.
|
|
255
|
+
Available values are: ${envs.map((v) => `"${v}"`).join(", ")}.
|
|
254
256
|
`)
|
|
255
257
|
);
|
|
256
258
|
}
|
|
@@ -270,19 +272,21 @@ var applyEnv = (env) => {
|
|
|
270
272
|
};
|
|
271
273
|
|
|
272
274
|
export {
|
|
275
|
+
logTitle,
|
|
276
|
+
logError,
|
|
277
|
+
logCommand,
|
|
278
|
+
logDataTable,
|
|
279
|
+
halt,
|
|
280
|
+
runCommandSync,
|
|
273
281
|
DEFAULT_TAG,
|
|
274
282
|
DEFAULT_PORT,
|
|
275
|
-
|
|
276
|
-
|
|
283
|
+
AWS_S3_EMAIL_CONFIG_PROD_BUCKET,
|
|
284
|
+
AWS_S3_EMAIL_CONFIG_STAGE_BUCKET,
|
|
277
285
|
AWS_S3_BUCKET,
|
|
278
286
|
CORE_CONFIG_NAME,
|
|
279
287
|
AWS_CLOUDFRONT_DISTRIBUTION_ID,
|
|
280
288
|
HTTPS_CRT_FILE,
|
|
281
289
|
HTTPS_KEY_FILE,
|
|
282
|
-
logTitle,
|
|
283
|
-
logError,
|
|
284
|
-
logCommand,
|
|
285
|
-
logDataTable,
|
|
286
290
|
moduleFileExtensions,
|
|
287
291
|
extensions,
|
|
288
292
|
resolveApp,
|
|
@@ -292,8 +296,6 @@ export {
|
|
|
292
296
|
getPaths,
|
|
293
297
|
getRelativePaths,
|
|
294
298
|
getIfCoreFns,
|
|
295
|
-
halt,
|
|
296
|
-
runCommandSync,
|
|
297
299
|
getEnvVars,
|
|
298
300
|
assertEnvValid,
|
|
299
301
|
applyEnv
|