@raisenow/tamaro-cli 1.0.8 → 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/.eslintignore CHANGED
@@ -1,2 +1,3 @@
1
1
  dist/*
2
2
  node_modules/*
3
+ tsconfig.json
@@ -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: {
@@ -21,33 +16,26 @@ module.exports = {
21
16
  'eslint:recommended',
22
17
  'plugin:node/recommended',
23
18
  'plugin:promise/recommended',
24
- // 'plugin:unicorn/recommended',
25
19
  'plugin:@typescript-eslint/recommended',
26
- 'plugin:prettier/recommended',
20
+ 'prettier',
27
21
  ],
28
22
  plugins: [],
29
23
  rules: {
30
24
  curly: 1,
31
-
32
25
  'node/no-unsupported-features/es-syntax': 0,
33
26
  'node/no-missing-import': 0,
34
27
  'node/shebang': 0,
35
28
  'no-process-exit': 0,
36
-
37
29
  '@typescript-eslint/ban-ts-comment': 0,
38
30
  '@typescript-eslint/no-explicit-any': 0,
39
31
  '@typescript-eslint/no-non-null-assertion': 0,
40
32
  '@typescript-eslint/prefer-optional-chain': 1,
41
-
42
- 'prettier/prettier': 1,
43
- 'arrow-body-style': 0,
44
- 'prefer-arrow-callback': 0,
45
33
  },
46
34
  overrides: [
47
35
  {
48
36
  files: ['*.ts', '*.tsx'],
49
37
  parserOptions: {
50
- project: resolve(__dirname, 'tsconfig.json'),
38
+ project: 'tsconfig.json',
51
39
  },
52
40
  },
53
41
  ],
package/.gitignore CHANGED
@@ -1,14 +1,13 @@
1
1
  /*
2
2
  !src
3
3
  !.eslintignore
4
- !.eslintrc.js
4
+ !.eslintrc.cjs
5
5
  !.gitignore
6
6
  !.nvmrc
7
7
  !.prettierignore
8
- !.prettierrc.js
9
- !global.d.ts
8
+ !.prettierrc.cjs
10
9
  !package.json
11
10
  !package-lock.json
12
- !readme.html
13
- !readme.md
14
11
  !tsconfig.json
12
+ !readme.html
13
+ !README.md
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 16.13.2
1
+ 16.14.0
package/.prettierignore CHANGED
@@ -1,2 +1,3 @@
1
1
  dist/*
2
2
  node_modules/*
3
+ tsconfig.json
File without changes
package/README.md ADDED
@@ -0,0 +1,229 @@
1
+ # Getting started
2
+
3
+ It’s a command-line interface for all operations with Tamaro customer configurations and _Tamaro Core_.
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 with NPM.
6
+
7
+ # Usage
8
+
9
+ To see an overview of all possible commands just run the following command without any arguments.
10
+
11
+ ```bash
12
+ npx -y @raisenow/tamaro-cli
13
+ ```
14
+
15
+ To see the informoation about some particular command (for example `dev` command), prepend `help` before the command name:
16
+
17
+ ```bash
18
+ npx -y @raisenow/tamaro-cli help dev
19
+ ```
20
+
21
+ Substitute `dev` with the command you want to get information about.
22
+
23
+ # Commands
24
+
25
+ Available commands:
26
+
27
+ - [`dev`](#dev)
28
+ - [`build`](#build)
29
+ - [`serve`](#serve)
30
+ - [`deploy`](#deploy)
31
+ - [`list-deployed`](#list-deployed)
32
+ - [`deploy-email-config`](#deploy-email-config)
33
+
34
+ ## `dev`
35
+
36
+ Runs the local development server for _Tamaro Core_ or a particular customer configuration.
37
+
38
+ ### Options
39
+
40
+ - `--local-core` – Load _Tamaro Core_ from localhost:1234 instead of the CDN
41
+ - `--port <port>` – Web server port (default: 1234)
42
+
43
+ ### Run local server using Tamaro Core from CDN
44
+
45
+ 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).
46
+
47
+ ```bash
48
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
49
+ npx -y @raisenow/tamaro-cli dev
50
+ ```
51
+
52
+ ### Run local server using a locally running Tamaro Core
53
+
54
+ 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).
55
+
56
+ ```bash
57
+ cd /path/to/tamaro-core
58
+ npx -y @raisenow/tamaro-cli dev
59
+ ```
60
+
61
+ 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).
62
+
63
+ ```bash
64
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
65
+ npx -y @raisenow/tamaro-cli dev --local-core
66
+ ```
67
+
68
+ ## `build`
69
+
70
+ Build an optimised (minified) bundle of _Tamaro Core_ or a customer configuration.
71
+
72
+ ### Options
73
+
74
+ - `--local-core` – Load _Tamaro Core_ from localhost:1234 instead of the CDN
75
+ - `--analyze` – Generate bundle statistics to `reports` folder
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
79
+ - `--tag <tag>` – Tag which should be used for the deployment of the bundle (default: “latest”)
80
+ - `--profile <profile>` – AWS profile which should be used for the deployment of the bundle (default: “payments-prod-cs-deployer”)
81
+
82
+ ### Build and deploy a customer configuration
83
+
84
+ Build and deploy an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration.
85
+
86
+ ```bash
87
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
88
+ npx -y @raisenow/tamaro-cli build --deploy
89
+ ```
90
+
91
+ As a result, the bundle should be deployed to: https://tamaro.raisenow.com/example-02-typical-customisations/latest/
92
+
93
+ ### Build and deploy a customer configuration with a specific tag
94
+
95
+ Build and deploy an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration with the tag _WEB-123_.
96
+
97
+ ```bash
98
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
99
+ npx -y @raisenow/tamaro-cli build --deploy --tag WEB-123
100
+ ```
101
+
102
+ As a result, the bundle should be deployed to: https://tamaro.raisenow.com/example-02-typical-customisations/WEB-123/
103
+
104
+ ### Build and serve a customer configuration
105
+
106
+ Build and serve an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration.
107
+
108
+ After running this command, a local web server should be running on http://localhost:1234 (port may differ, see console output).
109
+
110
+ ```bash
111
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
112
+ npx -y @raisenow/tamaro-cli build --serve
113
+ ```
114
+
115
+ ## `serve`
116
+
117
+ Run a local web server for pre-built bundle.
118
+
119
+ ### Example
120
+
121
+ 1. Build an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration
122
+
123
+ ```bash
124
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
125
+ npx -y @raisenow/tamaro-cli build
126
+ ```
127
+
128
+ 2. Serve it. After running this command, web-server should be running on http://localhost:1234 (port may differ, see console output).
129
+
130
+ ```bash
131
+ npx -y @raisenow/tamaro-cli serve
132
+ ```
133
+
134
+ ## `deploy`
135
+
136
+ Deploy a pre-built _Tamaro Core_ or customer configuration bundle to AWS S3.
137
+
138
+ ### Options
139
+
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.
144
+
145
+ ### Example
146
+
147
+ 1. Build an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration
148
+
149
+ ```bash
150
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
151
+ npx -y @raisenow/tamaro-cli build
152
+ ```
153
+
154
+ 2. Deploy it
155
+
156
+ ```bash
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
164
+ ```
165
+
166
+ ## `list-deployed`
167
+
168
+ List deployments of _Tamaro Core_ or a particular customer configuration.
169
+
170
+ ### Options
171
+
172
+ - `--config <config>` – Configuration name (default: current customer configuration)
173
+ - `--profile <profile>` – AWS profile which should be used for fetching deployments (default: “payments-prod-cs-deployer”)
174
+
175
+ ### Example
176
+
177
+ ```bash
178
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
179
+ npx -y @raisenow/tamaro-cli list-deployed
180
+ ```
181
+
182
+ ## `deploy-email-config`
183
+
184
+ Deploy a widget’s email configuration to AWS S3.
185
+
186
+ ### Options
187
+
188
+ - `--bucket <bucket>` – AWS S3 bucket where it should be deployed (default: “rnw-email-service”)
189
+ - `--profile <profile>` – AWS profile which should be used for the deployment of email configuration (default: “payments-prod-cs-deployer”)
190
+
191
+ ### Example
192
+
193
+ ```bash
194
+ cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
195
+ npx -y @raisenow/tamaro-cli deploy-email-config
196
+ ```
197
+
198
+ # Development
199
+
200
+ Make sure you have installed and activated the proper `node` and `npm` versions.
201
+
202
+ - `node: ">= 16"`
203
+ - `npm: ">= 8"`
204
+
205
+ Clone the repository and install its dependencies:
206
+
207
+ ```bash
208
+ git clone git@bitbucket.org:raisenow/tamaro-cli.git
209
+ cd tamaro-cli
210
+ npm ci
211
+ ```
212
+
213
+ Link package source to be able to run its local version:
214
+
215
+ ```bash
216
+ npm link .
217
+ ```
218
+
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.
220
+
221
+ ```bash
222
+ npm run build:watch
223
+ ```
224
+
225
+ To use the locally linked version of _Tamaro CLI_, use it without `@raisenow/` scope, `-y` flag is also not needed:
226
+
227
+ ```bash
228
+ npx tamaro-cli dev
229
+ ```
@@ -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
+ };