@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.
@@ -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
- 'plugin:prettier/recommended',
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: resolve(__dirname, 'tsconfig.json'),
38
+ project: 'tsconfig.json',
46
39
  },
47
40
  },
48
41
  ],
package/.gitignore CHANGED
@@ -1,13 +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
8
+ !.prettierrc.cjs
9
9
  !package.json
10
10
  !package-lock.json
11
11
  !tsconfig.json
12
12
  !readme.html
13
- !readme.md
13
+ !README.md
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 16.13.2
1
+ 16.14.0
File without changes
@@ -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
- ## `deploy`
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
- Make sure you have built the bundle before deploying it with this command, otherwise you may mistakenly deploy the bundle from a previous build.
117
+ Run a local web server for pre-built bundle.
123
118
 
124
119
  ### Example
125
120
 
126
- 1. Build an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration
121
+ 1. Build an optimised (minified) bundle of the _example-02-typical-customisations_ customer configuration
127
122
 
128
- ```bash
129
- cd /path/to/tamaro-configurations/configs/example-02-typical-customisations
130
- npx -y @raisenow/tamaro-cli build
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. Deploy it
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
- ```bash
136
- npx -y @raisenow/tamaro-cli deploy
137
- ```
130
+ ```bash
131
+ npx -y @raisenow/tamaro-cli serve
132
+ ```
138
133
 
139
- 3. Optionally, deploy it with the _WEB-123_ tag
134
+ ## `deploy`
140
135
 
141
- ```bash
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
- ## `serve`
138
+ ### Options
146
139
 
147
- Run a local web server for pre-built bundle.
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. Serve it. After running this command, web-server should be running on http://localhost:1234 (port may differ, see console output).
154
+ 2. Deploy it
159
155
 
160
156
  ```bash
161
- npx -y @raisenow/tamaro-cli serve
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 `dev` script to watch source files and automatically rebuild on changes. It must be running during the _Tamaro CLI_ development process.
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 dev
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
+ };