@raisenow/tamaro-cli 1.0.10 → 1.0.11
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/{.eslintrc.js → .eslintrc.cjs} +2 -9
- package/.gitignore +3 -3
- package/.nvmrc +1 -1
- package/{.prettierrc.js → .prettierrc.cjs} +0 -0
- package/{readme.md → README.md} +34 -32
- package/dist/chunk-PIEFLCDU.js +144 -0
- package/dist/cli.js +243 -300
- package/dist/webpack.config.js +114 -252
- package/package.json +23 -31
- package/readme.html +1 -1
- package/src/cli.ts +29 -19
- package/src/commands/build.ts +27 -25
- package/src/commands/deploy-email-config.ts +28 -20
- package/src/commands/deploy.ts +49 -37
- package/src/commands/dev.ts +24 -17
- package/src/commands/list-deployed.ts +22 -12
- package/src/commands/serve.ts +36 -12
- package/src/lib/InterpolateHtmlPlugin.ts +10 -8
- package/src/lib/aws.ts +43 -35
- package/src/lib/command.ts +27 -0
- package/src/lib/constants.ts +7 -0
- package/src/lib/env.ts +102 -0
- package/src/lib/logging.ts +32 -0
- package/src/lib/notifier.ts +22 -0
- package/src/lib/resolve.ts +144 -0
- package/src/webpack.config.ts +23 -31
- package/tsconfig.json +1 -1
- package/src/lib/helpers.ts +0 -356
- package/src/lib/polyfills.js +0 -8
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
2
|
-
const {resolve} = require('path')
|
|
3
|
-
|
|
4
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
-
|
|
6
1
|
module.exports = {
|
|
7
2
|
root: true,
|
|
8
3
|
env: {
|
|
@@ -22,17 +17,15 @@ module.exports = {
|
|
|
22
17
|
'plugin:node/recommended',
|
|
23
18
|
'plugin:promise/recommended',
|
|
24
19
|
'plugin:@typescript-eslint/recommended',
|
|
25
|
-
'
|
|
20
|
+
'prettier',
|
|
26
21
|
],
|
|
27
22
|
plugins: [],
|
|
28
23
|
rules: {
|
|
29
24
|
curly: 1,
|
|
30
|
-
|
|
31
25
|
'node/no-unsupported-features/es-syntax': 0,
|
|
32
26
|
'node/no-missing-import': 0,
|
|
33
27
|
'node/shebang': 0,
|
|
34
28
|
'no-process-exit': 0,
|
|
35
|
-
|
|
36
29
|
'@typescript-eslint/ban-ts-comment': 0,
|
|
37
30
|
'@typescript-eslint/no-explicit-any': 0,
|
|
38
31
|
'@typescript-eslint/no-non-null-assertion': 0,
|
|
@@ -42,7 +35,7 @@ module.exports = {
|
|
|
42
35
|
{
|
|
43
36
|
files: ['*.ts', '*.tsx'],
|
|
44
37
|
parserOptions: {
|
|
45
|
-
project:
|
|
38
|
+
project: 'tsconfig.json',
|
|
46
39
|
},
|
|
47
40
|
},
|
|
48
41
|
],
|
package/.gitignore
CHANGED
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
16.
|
|
1
|
+
16.14.0
|
|
File without changes
|
package/{readme.md → README.md}
RENAMED
|
@@ -26,8 +26,8 @@ Available commands:
|
|
|
26
26
|
|
|
27
27
|
- [`dev`](#dev)
|
|
28
28
|
- [`build`](#build)
|
|
29
|
-
- [`deploy`](#deploy)
|
|
30
29
|
- [`serve`](#serve)
|
|
30
|
+
- [`deploy`](#deploy)
|
|
31
31
|
- [`list-deployed`](#list-deployed)
|
|
32
32
|
- [`deploy-email-config`](#deploy-email-config)
|
|
33
33
|
|
|
@@ -37,7 +37,8 @@ Runs the local development server for _Tamaro Core_ or a particular customer con
|
|
|
37
37
|
|
|
38
38
|
### Options
|
|
39
39
|
|
|
40
|
-
- `--local-core` – Load _Tamaro Core_ from localhost instead of the CDN
|
|
40
|
+
- `--local-core` – Load _Tamaro Core_ from localhost:1234 instead of the CDN
|
|
41
|
+
- `--port <port>` – Web server port (default: 1234)
|
|
41
42
|
|
|
42
43
|
### Run local server using Tamaro Core from CDN
|
|
43
44
|
|
|
@@ -70,10 +71,11 @@ Build an optimised (minified) bundle of _Tamaro Core_ or a customer configuratio
|
|
|
70
71
|
|
|
71
72
|
### Options
|
|
72
73
|
|
|
73
|
-
- `--local-core` – Load _Tamaro Core_ from localhost instead of the CDN
|
|
74
|
+
- `--local-core` – Load _Tamaro Core_ from localhost:1234 instead of the CDN
|
|
74
75
|
- `--analyze` – Generate bundle statistics to `reports` folder
|
|
75
|
-
- `--deploy` – Deploy _Tamaro Core_ or a customer configuration bundle to AWS S3
|
|
76
76
|
- `--serve` – Run the generated bundle with a local web server
|
|
77
|
+
- `--port <port>` – Web server port (default: 1234)
|
|
78
|
+
- `--deploy` – Deploy _Tamaro Core_ or a customer configuration bundle to AWS S3
|
|
77
79
|
- `--tag <tag>` – Tag which should be used for the deployment of the bundle (default: “latest”)
|
|
78
80
|
- `--profile <profile>` – AWS profile which should be used for the deployment of the bundle (default: “payments-prod-cs-deployer”)
|
|
79
81
|
|
|
@@ -110,41 +112,35 @@ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
|
110
112
|
npx -y @raisenow/tamaro-cli build --serve
|
|
111
113
|
```
|
|
112
114
|
|
|
113
|
-
## `
|
|
114
|
-
|
|
115
|
-
Deploy a pre-built _Tamaro Core_ or customer configuration bundle to AWS S3.
|
|
116
|
-
|
|
117
|
-
### Options
|
|
118
|
-
|
|
119
|
-
- `--tag <tag>` – Tag which should be used for the deployment of the bundle (default: “latest”)
|
|
120
|
-
- `--profile <profile>` – AWS profile which should be used for the deployment of the bundle (default: “payments-prod-cs-deployer”)
|
|
115
|
+
## `serve`
|
|
121
116
|
|
|
122
|
-
|
|
117
|
+
Run a local web server for pre-built bundle.
|
|
123
118
|
|
|
124
119
|
### Example
|
|
125
120
|
|
|
126
|
-
1.
|
|
121
|
+
1. Build an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration
|
|
127
122
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
```bash
|
|
124
|
+
cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
|
|
125
|
+
npx -y @raisenow/tamaro-cli build
|
|
126
|
+
```
|
|
132
127
|
|
|
133
|
-
2.
|
|
128
|
+
2. Serve it. After running this command, web-server should be running on http://localhost:1234 (port may differ, see console output).
|
|
134
129
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
```bash
|
|
131
|
+
npx -y @raisenow/tamaro-cli serve
|
|
132
|
+
```
|
|
138
133
|
|
|
139
|
-
|
|
134
|
+
## `deploy`
|
|
140
135
|
|
|
141
|
-
|
|
142
|
-
npx -y @raisenow/tamaro-cli deploy --tag WEB-123
|
|
143
|
-
```
|
|
136
|
+
Deploy a pre-built _Tamaro Core_ or customer configuration bundle to AWS S3.
|
|
144
137
|
|
|
145
|
-
|
|
138
|
+
### Options
|
|
146
139
|
|
|
147
|
-
|
|
140
|
+
- `--tag <tag>` – Tag which should be used for the deployment of the bundle (default: “latest”)
|
|
141
|
+
- `--profile <profile>` – AWS profile which should be used for the deployment of the bundle (default: “payments-prod-cs-deployer”)
|
|
142
|
+
|
|
143
|
+
Make sure you have built the bundle before deploying it with this command, otherwise you may mistakenly deploy the bundle from a previous build.
|
|
148
144
|
|
|
149
145
|
### Example
|
|
150
146
|
|
|
@@ -155,10 +151,16 @@ Run a local web server for pre-built bundle.
|
|
|
155
151
|
npx -y @raisenow/tamaro-cli build
|
|
156
152
|
```
|
|
157
153
|
|
|
158
|
-
2.
|
|
154
|
+
2. Deploy it
|
|
159
155
|
|
|
160
156
|
```bash
|
|
161
|
-
npx -y @raisenow/tamaro-cli
|
|
157
|
+
npx -y @raisenow/tamaro-cli deploy
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
3. Optionally, deploy it with the _WEB-123_ tag
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npx -y @raisenow/tamaro-cli deploy --tag WEB-123
|
|
162
164
|
```
|
|
163
165
|
|
|
164
166
|
## `list-deployed`
|
|
@@ -214,10 +216,10 @@ Link package source to be able to run its local version:
|
|
|
214
216
|
npm link .
|
|
215
217
|
```
|
|
216
218
|
|
|
217
|
-
Run the `
|
|
219
|
+
Run the `build:watch` script to watch source files and automatically rebuild on changes. It must be running during the _Tamaro CLI_ development process.
|
|
218
220
|
|
|
219
221
|
```bash
|
|
220
|
-
npm run
|
|
222
|
+
npm run build:watch
|
|
221
223
|
```
|
|
222
224
|
|
|
223
225
|
To use the locally linked version of _Tamaro CLI_, use it without `@raisenow/` scope, `-y` flag is also not needed:
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// node_modules/tsup/assets/esm_shims.js
|
|
19
|
+
import { fileURLToPath } from "url";
|
|
20
|
+
import path from "path";
|
|
21
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
22
|
+
var getDirname = () => path.dirname(getFilename());
|
|
23
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
24
|
+
|
|
25
|
+
// src/lib/logging.ts
|
|
26
|
+
import chalk from "chalk";
|
|
27
|
+
import stripIndent from "strip-indent";
|
|
28
|
+
import columnify from "columnify";
|
|
29
|
+
var logTitle = (title) => {
|
|
30
|
+
console.log(`${chalk.bold(title)}`);
|
|
31
|
+
};
|
|
32
|
+
var logError = (message) => {
|
|
33
|
+
if (message) {
|
|
34
|
+
console.log(chalk.red(message));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var logCommand = (cmd) => {
|
|
38
|
+
console.log(`
|
|
39
|
+
${chalk.dim(stripIndent(cmd).trim())}
|
|
40
|
+
`);
|
|
41
|
+
};
|
|
42
|
+
var logDataTable = (data) => {
|
|
43
|
+
console.log(columnify(data, { showHeaders: false }));
|
|
44
|
+
console.log("");
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/lib/resolve.ts
|
|
48
|
+
import { createRequire } from "module";
|
|
49
|
+
import { basename, dirname, join, relative, resolve } from "path";
|
|
50
|
+
import { existsSync, realpathSync } from "fs";
|
|
51
|
+
import { getIfUtils } from "webpack-config-utils";
|
|
52
|
+
import stripIndent2 from "strip-indent";
|
|
53
|
+
import chalk2 from "chalk";
|
|
54
|
+
var require2 = createRequire(import.meta.url);
|
|
55
|
+
var moduleFileExtensions = ["ts", "tsx", "js", "jsx"];
|
|
56
|
+
var extensions = moduleFileExtensions.map((v) => `.${v}`);
|
|
57
|
+
var TAMARO_CORE_PACKAGE_NAMES = ["@raisenow/tamaro-core"];
|
|
58
|
+
var TAMARO_CONFIGURATIONS_PACKAGE_NAMES = ["@raisenow/tamaro-configurations"];
|
|
59
|
+
var resolveApp = (relativePath) => resolve(realpathSync(process.cwd()), relativePath);
|
|
60
|
+
var resolveOwn = (relativePath) => resolve(__dirname, "..", relativePath);
|
|
61
|
+
var resolveModule = (resolveFn, filePath) => {
|
|
62
|
+
const extension = moduleFileExtensions.find((extension2) => existsSync(resolveFn(`${filePath}.${extension2}`)));
|
|
63
|
+
if (extension) {
|
|
64
|
+
return resolveFn(`${filePath}.${extension}`);
|
|
65
|
+
}
|
|
66
|
+
return resolveFn(`${filePath}.js`);
|
|
67
|
+
};
|
|
68
|
+
var resolveBin = (name) => {
|
|
69
|
+
const pkgPath = require2.resolve(`${name}/package.json`);
|
|
70
|
+
const { bin } = require2(pkgPath);
|
|
71
|
+
const dir = dirname(pkgPath);
|
|
72
|
+
const binPath = typeof bin === "object" ? bin[name] : bin;
|
|
73
|
+
return join(dir, binPath);
|
|
74
|
+
};
|
|
75
|
+
var getWidgetUuid = () => basename(resolveApp("."));
|
|
76
|
+
var getPaths = (ifCore) => {
|
|
77
|
+
return ifCore({
|
|
78
|
+
app: resolveApp("."),
|
|
79
|
+
appEntry: resolveModule(resolveApp, "src/index"),
|
|
80
|
+
appDist: resolveApp("dist"),
|
|
81
|
+
appNodeModules: resolveApp("node_modules"),
|
|
82
|
+
appTsConfig: resolveApp("tsconfig.json"),
|
|
83
|
+
appHtml: resolveApp("src/*.html"),
|
|
84
|
+
appEnv: resolveApp(".env"),
|
|
85
|
+
appTailwindConfig: resolveApp("tailwind.config.js")
|
|
86
|
+
}, {
|
|
87
|
+
app: resolveApp("."),
|
|
88
|
+
appEntry: resolveModule(resolveApp, "widget"),
|
|
89
|
+
appDist: resolveApp(`../../dist/${getWidgetUuid()}`),
|
|
90
|
+
appNodeModules: resolveApp("../../node_modules"),
|
|
91
|
+
appTsConfig: resolveApp("tsconfig.json"),
|
|
92
|
+
appHtml: resolveApp("*.html"),
|
|
93
|
+
appEnv: resolveApp(".env"),
|
|
94
|
+
appTailwindConfig: void 0
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
var getRelativePaths = (paths) => {
|
|
98
|
+
const relativePaths = {};
|
|
99
|
+
for (const [type, absPath] of Object.entries(paths)) {
|
|
100
|
+
if (absPath) {
|
|
101
|
+
relativePaths[type] = relative("./", absPath) || ".";
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return relativePaths;
|
|
105
|
+
};
|
|
106
|
+
var getIfCoreFns = () => {
|
|
107
|
+
const corePkgPath = resolveApp("package.json");
|
|
108
|
+
const configsPkgPath = resolveApp("../../package.json");
|
|
109
|
+
if (existsSync(corePkgPath)) {
|
|
110
|
+
const { name } = require2(corePkgPath);
|
|
111
|
+
if (TAMARO_CORE_PACKAGE_NAMES.includes(name)) {
|
|
112
|
+
return getIfUtils({ core: true }, ["core"]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (existsSync(configsPkgPath)) {
|
|
116
|
+
const { name } = require2(configsPkgPath);
|
|
117
|
+
if (TAMARO_CONFIGURATIONS_PACKAGE_NAMES.includes(name)) {
|
|
118
|
+
return getIfUtils({ core: false }, ["core"]);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
logError(stripIndent2(` You must run "npx @raisenow/tamaro-cli" commands from:
|
|
122
|
+
1. Root of "${chalk2.bold(TAMARO_CORE_PACKAGE_NAMES[0])}" package folder.
|
|
123
|
+
2. Root of particular customer configuration folder of "${chalk2.bold(TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0])}" package.
|
|
124
|
+
You are currently in "${chalk2.bold(realpathSync(process.cwd()))}".
|
|
125
|
+
`));
|
|
126
|
+
process.exit(1);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
__spreadValues,
|
|
131
|
+
logTitle,
|
|
132
|
+
logError,
|
|
133
|
+
logCommand,
|
|
134
|
+
logDataTable,
|
|
135
|
+
moduleFileExtensions,
|
|
136
|
+
extensions,
|
|
137
|
+
resolveApp,
|
|
138
|
+
resolveOwn,
|
|
139
|
+
resolveBin,
|
|
140
|
+
getWidgetUuid,
|
|
141
|
+
getPaths,
|
|
142
|
+
getRelativePaths,
|
|
143
|
+
getIfCoreFns
|
|
144
|
+
};
|