@raisenow/tamaro-cli 1.9.0-dev.3 → 3.0.0-dev.1
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/tamaro-cli.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/workspace.xml +58 -0
- package/README.md +155 -195
- package/dist/cli.js +348 -306
- package/package.json +18 -64
- package/pnpm-workspace.yaml +0 -2
- package/dist/env-DZ3cWM6p.js +0 -347
- package/dist/webpack.config.js +0 -347
package/package.json
CHANGED
|
@@ -1,99 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raisenow/tamaro-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-dev.1",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "RaiseNow",
|
|
6
6
|
"email": "development@raisenow.com"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
11
|
-
"pnpm": ">=11.0
|
|
10
|
+
"node": ">=24.16.0",
|
|
11
|
+
"pnpm": ">=11.7.0",
|
|
12
12
|
"npm": "please-use-pnpm",
|
|
13
13
|
"yarn": "please-use-pnpm"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@aws-sdk/client-s3": "^3.
|
|
17
|
-
"@babel/cli": "^7.28.6",
|
|
18
|
-
"@babel/core": "^7.29.0",
|
|
19
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
20
|
-
"@babel/preset-env": "^7.29.5",
|
|
21
|
-
"@babel/preset-react": "^7.28.5",
|
|
22
|
-
"@babel/preset-typescript": "^7.28.5",
|
|
23
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.6.2",
|
|
24
|
-
"@statoscope/webpack-plugin": "^5.29.0",
|
|
25
|
-
"@types/columnify": "^1.5.4",
|
|
26
|
-
"@types/handlebars-helpers": "^0.5.6",
|
|
27
|
-
"@types/lodash": "^4.17.24",
|
|
28
|
-
"@types/node": "^22.19.18",
|
|
29
|
-
"@types/node-notifier": "^8.0.5",
|
|
30
|
-
"@types/prompts": "^2.4.9",
|
|
31
|
-
"@types/resolve-bin": "^0.4.3",
|
|
32
|
-
"@types/webpack-config-utils": "^2.3.4",
|
|
33
|
-
"autoprefixer": "^10.5.0",
|
|
34
|
-
"babel-loader": "^10.1.1",
|
|
35
|
-
"babel-plugin-istanbul": "^8.0.0",
|
|
36
|
-
"babel-plugin-lodash": "^3.3.4",
|
|
16
|
+
"@aws-sdk/client-s3": "^3.1068.0",
|
|
37
17
|
"chalk": "^5.6.2",
|
|
38
|
-
"clean-webpack-plugin": "^4.0.0",
|
|
39
18
|
"columnify": "^1.6.0",
|
|
40
19
|
"commander": "^14.0.3",
|
|
41
|
-
"
|
|
42
|
-
"core-js": "^3.49.0",
|
|
43
|
-
"css-loader": "^7.1.4",
|
|
44
|
-
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
20
|
+
"dedent": "^1.7.2",
|
|
45
21
|
"dotenv": "^17.4.2",
|
|
46
22
|
"env-paths": "^4.0.0",
|
|
47
|
-
"escape-string-regexp": "^5.0.0",
|
|
48
|
-
"eslint-webpack-plugin": "^6.0.0",
|
|
49
23
|
"execa": "^9.6.1",
|
|
50
|
-
"file-loader": "^6.2.0",
|
|
51
|
-
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
|
52
24
|
"glob": "^13.0.6",
|
|
53
|
-
"handlebars": "^4.7.9",
|
|
54
25
|
"handlebars-helpers": "^0.10.0",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"js-yaml": "^4.1.1",
|
|
58
|
-
"json-loader": "^0.5.7",
|
|
26
|
+
"handlebars": "^4.7.9",
|
|
27
|
+
"js-yaml": "^4.2.0",
|
|
59
28
|
"ky": "^1.14.3",
|
|
60
|
-
"lodash": "^4.18.1",
|
|
61
|
-
"mini-css-extract-plugin": "^2.10.2",
|
|
62
29
|
"node-notifier": "^10.0.1",
|
|
63
30
|
"open": "^11.0.0",
|
|
64
31
|
"portfinder": "^1.0.38",
|
|
65
|
-
"postcss": "^8.5.14",
|
|
66
|
-
"postcss-import": "^16.1.1",
|
|
67
|
-
"postcss-loader": "^8.2.1",
|
|
68
|
-
"postcss-nested": "^7.0.2",
|
|
69
32
|
"prompts": "^2.4.2",
|
|
70
|
-
"
|
|
71
|
-
"resolve-url-loader": "^5.0.0",
|
|
72
|
-
"sass": "^1.99.0",
|
|
73
|
-
"sass-loader": "^16.0.8",
|
|
74
|
-
"strip-indent": "^4.1.1",
|
|
75
|
-
"style-loader": "^4.0.0",
|
|
76
|
-
"terser-webpack-plugin": "^5.6.0",
|
|
77
|
-
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
78
|
-
"tsdown": "^0.22.0",
|
|
79
|
-
"typescript": "^6.0.3",
|
|
80
|
-
"url-loader": "^4.1.1",
|
|
81
|
-
"vitest": "^4.1.5",
|
|
82
|
-
"webpack": "^5.106.2",
|
|
83
|
-
"webpack-cli": "^7.0.2",
|
|
84
|
-
"webpack-config-utils": "^2.3.1",
|
|
85
|
-
"webpack-dev-server": "^5.2.3",
|
|
86
|
-
"yaml-loader": "^0.9.0",
|
|
87
|
-
"zod": "^4.3.6"
|
|
33
|
+
"zod": "^4.4.3"
|
|
88
34
|
},
|
|
89
35
|
"devDependencies": {
|
|
90
36
|
"@rnw-npm/eslint-config": "^2.0.0",
|
|
91
37
|
"@rnw-npm/prettier-config": "^1.0.0",
|
|
92
|
-
"
|
|
38
|
+
"@types/columnify": "^1.5.4",
|
|
39
|
+
"@types/handlebars-helpers": "^0.5.6",
|
|
93
40
|
"@types/js-yaml": "^4.0.9",
|
|
41
|
+
"@types/node-notifier": "^8.0.5",
|
|
42
|
+
"@types/node": "^24.13.2",
|
|
43
|
+
"@types/prompts": "^2.4.9",
|
|
44
|
+
"eslint": "^10.5.0",
|
|
94
45
|
"husky": "^9.1.7",
|
|
95
46
|
"lint-staged": "^16.4.0",
|
|
96
|
-
"prettier": "^3.8.
|
|
47
|
+
"prettier": "^3.8.4",
|
|
48
|
+
"tsdown": "^0.22.2",
|
|
49
|
+
"typescript": "^6.0.3",
|
|
50
|
+
"vitest": "^4.1.7"
|
|
97
51
|
},
|
|
98
52
|
"prettier": "@rnw-npm/prettier-config",
|
|
99
53
|
"lint-staged": {
|
package/pnpm-workspace.yaml
CHANGED
package/dist/env-DZ3cWM6p.js
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import { existsSync, realpathSync } from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import stripIndent from "strip-indent";
|
|
5
|
-
import { execaCommandSync } from "execa";
|
|
6
|
-
import prompts from "prompts";
|
|
7
|
-
import chalk from "chalk";
|
|
8
|
-
import columnify from "columnify";
|
|
9
|
-
import envPaths from "env-paths";
|
|
10
|
-
import { fileURLToPath } from "node:url";
|
|
11
|
-
import { getIfUtils } from "webpack-config-utils";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
import { globSync } from "glob";
|
|
14
|
-
import { config } from "dotenv";
|
|
15
|
-
//#region src/lib/logging.ts
|
|
16
|
-
const logTitle = (title) => {
|
|
17
|
-
console.log(chalk.bold(title));
|
|
18
|
-
};
|
|
19
|
-
const logError = (message) => {
|
|
20
|
-
if (message) console.log(chalk.red(message));
|
|
21
|
-
};
|
|
22
|
-
const logSuccess = (message) => {
|
|
23
|
-
if (message) console.log(chalk.green(message));
|
|
24
|
-
};
|
|
25
|
-
const logInfo = (message) => {
|
|
26
|
-
if (message) console.log(chalk.blue(message));
|
|
27
|
-
};
|
|
28
|
-
const logCommand = (cmd) => {
|
|
29
|
-
console.log(`\n${chalk.dim(stripIndent(cmd).trim())}\n`);
|
|
30
|
-
};
|
|
31
|
-
const logDataTable = (data) => {
|
|
32
|
-
console.log(columnify(data, { showHeaders: false }));
|
|
33
|
-
console.log("");
|
|
34
|
-
};
|
|
35
|
-
const createTerminalLink = (text, url) => {
|
|
36
|
-
return `\u001B]8;;${url}\u001B\\${text}\u001B]8;;\u001B\\`;
|
|
37
|
-
};
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/lib/command.ts
|
|
40
|
-
const halt = (message) => {
|
|
41
|
-
logError(message);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
};
|
|
44
|
-
const prepareCommand = (cmd) => {
|
|
45
|
-
return cmd.replaceAll("\n", " ").replaceAll(/[ \t]{2,}/g, " ").trim();
|
|
46
|
-
};
|
|
47
|
-
const runCommandSync = (cmd, options) => {
|
|
48
|
-
return execaCommandSync(prepareCommand(cmd), options);
|
|
49
|
-
};
|
|
50
|
-
const promptConfirmation = async (message, skipConfirmation) => {
|
|
51
|
-
if (skipConfirmation) return;
|
|
52
|
-
const { confirmed } = await prompts([{
|
|
53
|
-
initial: false,
|
|
54
|
-
message,
|
|
55
|
-
name: "confirmed",
|
|
56
|
-
type: "confirm"
|
|
57
|
-
}], { onCancel: () => halt() });
|
|
58
|
-
if (!confirmed) halt("Operation cancelled.");
|
|
59
|
-
};
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/lib/constants.ts
|
|
62
|
-
const DEFAULT_TAG = "latest";
|
|
63
|
-
const DEFAULT_PORT = 1234;
|
|
64
|
-
const DEFAULT_HTTP_TIMEOUT = 1e4;
|
|
65
|
-
const AWS_S3_BUCKET_TAMARO = "tamaro.raisenow.com";
|
|
66
|
-
const AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_STAGE = "rnw-stage-email-service";
|
|
67
|
-
const AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD = "rnw-email-service";
|
|
68
|
-
const EPMS_API_BASE_URL_STAGE = "https://api.stage.mesos.raisenow.net";
|
|
69
|
-
const EPMS_API_BASE_URL_PROD = "https://api.raisenow.io";
|
|
70
|
-
const EPMS_AUTH_BASE_URL_STAGE = "https://login.stage.mesos.raisenow.net";
|
|
71
|
-
const EPMS_AUTH_BASE_URL_PROD = "https://login.raisenow.com";
|
|
72
|
-
const EPMS_OAUTH_CLIENT_ID = "tamaro-cli";
|
|
73
|
-
const CORE_CONFIG_NAME = "tamaro-core";
|
|
74
|
-
const AUTH_PORT = 4571;
|
|
75
|
-
const AWS_CLOUDFRONT_DISTRIBUTION_ID = "EHJ1OM458YQ0I";
|
|
76
|
-
const HTTPS_CRT_FILE = "localhost.crt";
|
|
77
|
-
const HTTPS_KEY_FILE = "localhost.key";
|
|
78
|
-
const CACHE_DIR = envPaths("tamaro-cli", { suffix: "" }).cache;
|
|
79
|
-
const TAMARO_VERSION_IN_URL_REGEX = /tamaro-core\/(.*)\/index.js/;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region node_modules/.pnpm/tsdown@0.22.0_tsx@4.19.1_typescript@6.0.3_unrun@0.2.37_synckit@0.11.11_/node_modules/tsdown/esm-shims.js
|
|
82
|
-
const getFilename = () => fileURLToPath(import.meta.url);
|
|
83
|
-
const getDirname = () => path.dirname(getFilename());
|
|
84
|
-
const __dirname = /* @__PURE__ */ getDirname();
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/lib/resolve.ts
|
|
87
|
-
const require$1 = createRequire(import.meta.url);
|
|
88
|
-
const moduleFileExtensions = [
|
|
89
|
-
"ts",
|
|
90
|
-
"tsx",
|
|
91
|
-
"js",
|
|
92
|
-
"jsx"
|
|
93
|
-
];
|
|
94
|
-
const extensions = moduleFileExtensions.map((v) => `.${v}`);
|
|
95
|
-
const TAMARO_CORE_PACKAGE_NAMES = ["@raisenow/tamaro-core"];
|
|
96
|
-
const TAMARO_CONFIGURATIONS_PACKAGE_NAMES = ["@raisenow/tamaro-configurations"];
|
|
97
|
-
const TAMARO_SELF_SERVICE_PACKAGE_NAMES = ["@raisenow/tamaro-self-service"];
|
|
98
|
-
const resolveApp = (relativePath) => path.resolve(realpathSync(process.cwd()), relativePath);
|
|
99
|
-
const resolveOwn = (relativePath) => path.resolve(__dirname, "..", relativePath);
|
|
100
|
-
const resolveModule = (resolveFn, filePath) => {
|
|
101
|
-
const extension = moduleFileExtensions.find((extension) => existsSync(resolveFn(`${filePath}.${extension}`)));
|
|
102
|
-
if (extension) return resolveFn(`${filePath}.${extension}`);
|
|
103
|
-
return resolveFn(`${filePath}.js`);
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Since Tamaro CLI is used to build different packages
|
|
107
|
-
* (Tamaro Core, Tamaro Self Service, Tamaro Configurations)
|
|
108
|
-
* and they may use differnt ESLint versions and config formats,
|
|
109
|
-
* we need to correctly resolve it before passing into Webpack ESLint plugin.
|
|
110
|
-
*/
|
|
111
|
-
const resolveEslintPluginConfig = (paths) => {
|
|
112
|
-
try {
|
|
113
|
-
const opts = { paths: [paths.appNodeModules] };
|
|
114
|
-
const eslintPath = require$1.resolve("eslint", opts);
|
|
115
|
-
const configType = require$1(require$1.resolve("eslint/package.json", opts)).version.startsWith("8.") ? "eslintrc" : "flat";
|
|
116
|
-
return {
|
|
117
|
-
extensions: moduleFileExtensions,
|
|
118
|
-
eslintPath,
|
|
119
|
-
cwd: paths.app,
|
|
120
|
-
configType
|
|
121
|
-
};
|
|
122
|
-
} catch (error) {
|
|
123
|
-
console.error(error);
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
const resolveBin = (name) => {
|
|
128
|
-
const pkgPath = require$1.resolve(`${name}/package.json`);
|
|
129
|
-
const { bin } = require$1(pkgPath);
|
|
130
|
-
const dir = path.dirname(pkgPath);
|
|
131
|
-
const binPath = typeof bin === "object" ? bin[name] : bin;
|
|
132
|
-
return path.join(dir, binPath);
|
|
133
|
-
};
|
|
134
|
-
const getWidgetUuid = () => path.basename(resolveApp("."));
|
|
135
|
-
/**
|
|
136
|
-
* Get the appropriate tsconfig file.
|
|
137
|
-
* Prefers tsconfig.app.json (composite config structure) but falls back to
|
|
138
|
-
* tsconfig.json for backwards compatibility with older versions.
|
|
139
|
-
*/
|
|
140
|
-
const getTsConfigPath = () => {
|
|
141
|
-
const appTsConfig = resolveApp("tsconfig.app.json");
|
|
142
|
-
if (existsSync(appTsConfig)) return appTsConfig;
|
|
143
|
-
return resolveApp("tsconfig.json");
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Get the appropriate tailwind config file.
|
|
147
|
-
* Prefers tailwind.config.cjs (for ESM compatibility) but falls back to
|
|
148
|
-
* tailwind.config.js for backwards compatibility.
|
|
149
|
-
*/
|
|
150
|
-
const getTailwindConfigPath = () => {
|
|
151
|
-
const cjsConfig = resolveApp("tailwind.config.cjs");
|
|
152
|
-
if (existsSync(cjsConfig)) return cjsConfig;
|
|
153
|
-
const jsConfig = resolveApp("tailwind.config.js");
|
|
154
|
-
if (existsSync(jsConfig)) return jsConfig;
|
|
155
|
-
};
|
|
156
|
-
const getPaths = (ifCore) => {
|
|
157
|
-
return ifCore({
|
|
158
|
-
root: resolveApp("."),
|
|
159
|
-
app: resolveApp("."),
|
|
160
|
-
appEntry: resolveModule(resolveApp, "src/index"),
|
|
161
|
-
appDist: resolveApp("dist"),
|
|
162
|
-
appNodeModules: resolveApp("node_modules"),
|
|
163
|
-
appTsConfig: getTsConfigPath(),
|
|
164
|
-
appHtml: resolveApp("src/*.html"),
|
|
165
|
-
appEnv: resolveApp(".env*"),
|
|
166
|
-
appTailwindConfig: getTailwindConfigPath()
|
|
167
|
-
}, {
|
|
168
|
-
root: resolveApp("../.."),
|
|
169
|
-
app: resolveApp("."),
|
|
170
|
-
appEntry: resolveModule(resolveApp, "widget"),
|
|
171
|
-
appDist: resolveApp(`../../dist/${getWidgetUuid()}`),
|
|
172
|
-
appNodeModules: resolveApp("../../node_modules"),
|
|
173
|
-
appTsConfig: resolveApp("tsconfig.json"),
|
|
174
|
-
appHtml: resolveApp("*.html"),
|
|
175
|
-
appEnv: resolveApp(".env*"),
|
|
176
|
-
configYml: resolveApp("config.yml"),
|
|
177
|
-
appTailwindConfig: void 0
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
const getRelativePaths = (paths) => {
|
|
181
|
-
const relativePaths = {};
|
|
182
|
-
for (const [type, absPath] of Object.entries(paths)) if (absPath) relativePaths[type] = path.relative("./", absPath) || ".";
|
|
183
|
-
return relativePaths;
|
|
184
|
-
};
|
|
185
|
-
const getIfCoreFns = ({ allowArchived = false } = {}) => {
|
|
186
|
-
const corePkgPath = resolveApp("package.json");
|
|
187
|
-
const configsPkgPath = resolveApp("../../package.json");
|
|
188
|
-
const archivedConfigsPkgPath = resolveApp("../../../package.json");
|
|
189
|
-
let packageName;
|
|
190
|
-
if (existsSync(corePkgPath)) packageName = require$1(corePkgPath).name;
|
|
191
|
-
else if (existsSync(configsPkgPath)) packageName = require$1(configsPkgPath).name;
|
|
192
|
-
else if (allowArchived && existsSync(archivedConfigsPkgPath)) packageName = require$1(archivedConfigsPkgPath).name;
|
|
193
|
-
if (packageName) return getIfUtils({ core: TAMARO_CORE_PACKAGE_NAMES.includes(packageName) }, ["core"]);
|
|
194
|
-
logError(stripIndent(`\
|
|
195
|
-
You must run "npx @raisenow/tamaro-cli" commands from:
|
|
196
|
-
1. Root of "${chalk.bold(TAMARO_CORE_PACKAGE_NAMES[0])}" package folder.
|
|
197
|
-
2. Root of particular customer configuration folder of "${chalk.bold(TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0])}" package.
|
|
198
|
-
3. "src/self-service" folder of "${chalk.bold(TAMARO_SELF_SERVICE_PACKAGE_NAMES[0])}" package.
|
|
199
|
-
You are currently in "${chalk.bold(realpathSync(process.cwd()))}".
|
|
200
|
-
`));
|
|
201
|
-
process.exit(1);
|
|
202
|
-
};
|
|
203
|
-
const resolveAccountUuidFromConfig = (rawConfig, field) => {
|
|
204
|
-
const epmsConfig = z.object({ [field]: z.record(z.string(), z.unknown()) }).safeParse(rawConfig);
|
|
205
|
-
if (!epmsConfig.success) return;
|
|
206
|
-
const configContent = epmsConfig.data[field];
|
|
207
|
-
const accountUuid = configContent.account_mapping ?? configContent.account_uuid;
|
|
208
|
-
const accountUuidValidation = z.uuid().safeParse(accountUuid);
|
|
209
|
-
if (!accountUuidValidation.success) halt(stripIndent(`Could not extract EPMS account UUID from config.yml. Please ensure that the "${field}" field is correctly formatted. Expected formats:
|
|
210
|
-
1. ${field}:
|
|
211
|
-
account_uuid: <UUID>
|
|
212
|
-
|
|
213
|
-
Alternatively, if the account_uuid is conditional using "if" / "then" / "else" statements, it must be provided using the "account_mapping" format:
|
|
214
|
-
2. ${field}:
|
|
215
|
-
account_mapping: <UUID>
|
|
216
|
-
`));
|
|
217
|
-
return accountUuidValidation.data;
|
|
218
|
-
};
|
|
219
|
-
const resolveManagedByFromConfig = (rawConfig) => {
|
|
220
|
-
const managedByConfig = z.object({ managed_by: z.string().trim().min(1).max(255).optional() }).safeParse(rawConfig);
|
|
221
|
-
if (!managedByConfig.success) halt("Could not extract \"managed_by\" from config.yml. Please ensure it is a non-empty string.");
|
|
222
|
-
return managedByConfig.data?.managed_by ?? "RaiseNow";
|
|
223
|
-
};
|
|
224
|
-
const extractTamaroVersionFromUrl = (url) => {
|
|
225
|
-
const match = url.match(TAMARO_VERSION_IN_URL_REGEX);
|
|
226
|
-
if (match) return match[1].toString();
|
|
227
|
-
};
|
|
228
|
-
const resolveCoreVersion = () => {
|
|
229
|
-
if (process.env.CORE_VERSION) return process.env.CORE_VERSION;
|
|
230
|
-
if (process.env.CORE_URL) return extractTamaroVersionFromUrl(process.env.CORE_URL);
|
|
231
|
-
};
|
|
232
|
-
//#endregion
|
|
233
|
-
//#region src/lib/env.ts
|
|
234
|
-
const require = createRequire(import.meta.url);
|
|
235
|
-
const execGitCommand = (command) => {
|
|
236
|
-
try {
|
|
237
|
-
const { stdout } = execaCommandSync(command);
|
|
238
|
-
return stdout.trim();
|
|
239
|
-
} catch {
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
const getGitCommitHash = () => {
|
|
244
|
-
return execGitCommand("git rev-parse HEAD");
|
|
245
|
-
};
|
|
246
|
-
const getGitBranchName = () => {
|
|
247
|
-
return execGitCommand("git rev-parse --abbrev-ref HEAD");
|
|
248
|
-
};
|
|
249
|
-
const getGitTagName = () => {
|
|
250
|
-
return execGitCommand("git describe --tags --exact-match");
|
|
251
|
-
};
|
|
252
|
-
const getEnvVars = (files, ifMin, ifCore, ifLocalCore, ifHttps) => {
|
|
253
|
-
const filePath = files.find((file) => path.basename(file) === ".env");
|
|
254
|
-
if (filePath) config({ path: filePath });
|
|
255
|
-
process.env.NODE_ENV ??= ifMin("production", "development");
|
|
256
|
-
process.env.BABEL_ENV ??= ifMin("production", "development");
|
|
257
|
-
process.env.EXPOSE_VAR ??= ifCore("rnw.tamaroCore", "rnw.tamaro");
|
|
258
|
-
process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET ??= ifCore("rnw-tamaro-core", "rnw-tamaro");
|
|
259
|
-
process.env.WEBPACK_UNIQUE_NAME ??= ifCore("RnwTamaroCore", "RnwTamaro");
|
|
260
|
-
process.env.BUILD_DATE = (/* @__PURE__ */ new Date()).toISOString();
|
|
261
|
-
process.env.PUBLIC_URL ??= "";
|
|
262
|
-
process.env.HMR_ENABLED ??= ifMin("false", "true");
|
|
263
|
-
if (ifCore()) {
|
|
264
|
-
process.env.PRODUCT_NAME = "tamaro";
|
|
265
|
-
const { version } = require(resolveApp("package.json"));
|
|
266
|
-
process.env.PRODUCT_VERSION = version;
|
|
267
|
-
}
|
|
268
|
-
if (!ifCore()) {
|
|
269
|
-
process.env.WIDGET_UUID = getWidgetUuid();
|
|
270
|
-
if (ifLocalCore()) {
|
|
271
|
-
const protocol = ifHttps() ? "https" : "http";
|
|
272
|
-
process.env.CORE_URL = `${protocol}://localhost:1234/index.js`;
|
|
273
|
-
} else {
|
|
274
|
-
let version = process.env.CORE_VERSION;
|
|
275
|
-
version = version ? `@${version}` : "";
|
|
276
|
-
process.env.CORE_URL_PATTERN ??= "https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core{{version}}/dist/index.js";
|
|
277
|
-
process.env.CORE_URL ??= process.env.CORE_URL_PATTERN.replace("{{version}}", version);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
const gitCommitHash = getGitCommitHash();
|
|
281
|
-
const gitBranchName = getGitBranchName();
|
|
282
|
-
const gitTagName = getGitTagName();
|
|
283
|
-
if (gitCommitHash) process.env.GIT_COMMIT_HASH = gitCommitHash;
|
|
284
|
-
if (gitBranchName) process.env.GIT_BRANCH_NAME = gitBranchName;
|
|
285
|
-
if (gitTagName) process.env.GIT_TAG_NAME = gitTagName;
|
|
286
|
-
const varNames = new Set([
|
|
287
|
-
"NODE_ENV",
|
|
288
|
-
"BABEL_ENV",
|
|
289
|
-
"EXPOSE_VAR",
|
|
290
|
-
"ELEMENT_ATTRIBUTE_DATA_WIDGET",
|
|
291
|
-
"WEBPACK_UNIQUE_NAME",
|
|
292
|
-
"BUILD_DATE",
|
|
293
|
-
"PUBLIC_URL",
|
|
294
|
-
"PRODUCT_NAME",
|
|
295
|
-
"PRODUCT_VERSION",
|
|
296
|
-
"WIDGET_UUID",
|
|
297
|
-
"CORE_URL",
|
|
298
|
-
"CORE_URL_PATTERN",
|
|
299
|
-
"CORE_VERSION",
|
|
300
|
-
"DISABLE_URL_VERSION_OVERRIDE",
|
|
301
|
-
"GIT_COMMIT_HASH",
|
|
302
|
-
"GIT_BRANCH_NAME",
|
|
303
|
-
"GIT_TAG_NAME",
|
|
304
|
-
"EPP_API_KEY_DEFAULT",
|
|
305
|
-
"EPP_API_URL_STAGE",
|
|
306
|
-
"EPP_API_URL_PROD",
|
|
307
|
-
"EPMS_API_URL_STAGE",
|
|
308
|
-
"EPMS_API_URL_PROD",
|
|
309
|
-
"EPP_PROXY_URL_STAGE",
|
|
310
|
-
"EPP_PROXY_URL_PROD",
|
|
311
|
-
"EPMS_PROXY_URL_STAGE",
|
|
312
|
-
"EPMS_PROXY_URL_PROD",
|
|
313
|
-
"EPMS_TWINT_CHECKOUT_URL_STAGE",
|
|
314
|
-
"EPMS_TWINT_CHECKOUT_URL_PROD"
|
|
315
|
-
]);
|
|
316
|
-
const raw = Object.keys(process.env).filter((key) => key.startsWith("PUBLIC_") || varNames.has(key)).reduce((env, key) => {
|
|
317
|
-
env[key] = process.env[key];
|
|
318
|
-
return env;
|
|
319
|
-
}, {});
|
|
320
|
-
return {
|
|
321
|
-
raw,
|
|
322
|
-
stringified: { "process.env": Object.keys(raw).reduce((env, key) => {
|
|
323
|
-
env[key] = JSON.stringify(raw[key]);
|
|
324
|
-
return env;
|
|
325
|
-
}, {}) }
|
|
326
|
-
};
|
|
327
|
-
};
|
|
328
|
-
const assertEnvValid = (env) => {
|
|
329
|
-
const { ifCore } = getIfCoreFns();
|
|
330
|
-
const envs = globSync(getPaths(ifCore).appEnv).map((file) => path.basename(file).replace(/^\.env\./, "")).map((file) => path.basename(file).replace(/^\.env$/, "")).filter((v) => !!v);
|
|
331
|
-
if (envs.length === 0 && env) console.log("Flag \"--env\" is ignored.");
|
|
332
|
-
if (envs.length > 0) {
|
|
333
|
-
if (!env) halt("Flag \"--env\" is required.");
|
|
334
|
-
if (env && !envs.includes(env)) halt(stripIndent(`
|
|
335
|
-
Flag "--env" has wrong value.
|
|
336
|
-
Available values are: ${envs.map((v) => `"${v}"`).join(", ")}.
|
|
337
|
-
`));
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
const applyEnv = (env) => {
|
|
341
|
-
if (!env) return;
|
|
342
|
-
const { ifCore } = getIfCoreFns();
|
|
343
|
-
const filePath = globSync(getPaths(ifCore).appEnv).find((file) => path.basename(file) === `.env.${env}`);
|
|
344
|
-
if (filePath) config({ path: filePath });
|
|
345
|
-
};
|
|
346
|
-
//#endregion
|
|
347
|
-
export { EPMS_OAUTH_CLIENT_ID as A, logInfo as B, DEFAULT_HTTP_TIMEOUT as C, EPMS_API_BASE_URL_STAGE as D, EPMS_API_BASE_URL_PROD as E, runCommandSync as F, logTitle as H, createTerminalLink as I, logCommand as L, HTTPS_KEY_FILE as M, halt as N, EPMS_AUTH_BASE_URL_PROD as O, promptConfirmation as P, logDataTable as R, CORE_CONFIG_NAME as S, DEFAULT_TAG as T, logSuccess as V, AWS_CLOUDFRONT_DISTRIBUTION_ID as _, getIfCoreFns as a, AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_STAGE as b, getWidgetUuid as c, resolveBin as d, resolveCoreVersion as f, AUTH_PORT as g, resolveOwn as h, extensions as i, HTTPS_CRT_FILE as j, EPMS_AUTH_BASE_URL_STAGE as k, resolveAccountUuidFromConfig as l, resolveManagedByFromConfig as m, assertEnvValid as n, getPaths as o, resolveEslintPluginConfig as p, getEnvVars as r, getRelativePaths as s, applyEnv as t, resolveApp as u, AWS_S3_BUCKET_TAMARO as v, DEFAULT_PORT as w, CACHE_DIR as x, AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD as y, logError as z };
|