@raisenow/tamaro-cli 1.0.26 → 1.1.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.
@@ -10,29 +10,29 @@ import {
10
10
  logTitle,
11
11
  moduleFileExtensions,
12
12
  resolveApp
13
- } from "./chunk-ZAKDPU5F.js";
13
+ } from "./chunk-S4M23KNZ.js";
14
14
 
15
15
  // src/webpack.config.ts
16
+ import { existsSync } from "fs";
16
17
  import { createRequire } from "module";
17
18
  import { basename, dirname, resolve } from "path";
18
- import { existsSync } from "fs";
19
- import { globSync } from "glob";
20
- import { getIfUtils, removeEmpty } from "webpack-config-utils";
21
- import webpack from "webpack";
22
- import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
23
- import { CleanWebpackPlugin } from "clean-webpack-plugin";
24
- import HtmlWebpackPlugin2 from "html-webpack-plugin";
25
- import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
26
19
  import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
27
- import MiniCssExtractPlugin from "mini-css-extract-plugin";
20
+ import StatoscopeWebpackPlugin from "@statoscope/webpack-plugin";
21
+ import { CleanWebpackPlugin } from "clean-webpack-plugin";
22
+ import CopyPlugin from "copy-webpack-plugin";
28
23
  import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
29
24
  import ESLintPlugin from "eslint-webpack-plugin";
30
- import CopyPlugin from "copy-webpack-plugin";
31
- import StatoscopeWebpackPlugin from "@statoscope/webpack-plugin";
25
+ import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
26
+ import { globSync } from "glob";
27
+ import HtmlWebpackPlugin2 from "html-webpack-plugin";
28
+ import MiniCssExtractPlugin from "mini-css-extract-plugin";
29
+ import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
30
+ import webpack from "webpack";
31
+ import { getIfUtils, removeEmpty } from "webpack-config-utils";
32
32
 
33
33
  // src/lib/InterpolateHtmlPlugin.ts
34
- import HtmlWebpackPlugin from "html-webpack-plugin";
35
34
  import escapeStringRegexp from "escape-string-regexp";
35
+ import HtmlWebpackPlugin from "html-webpack-plugin";
36
36
  var PLUGIN_NAME = "InterpolateHtmlPlugin";
37
37
  var InterpolateHtmlPlugin = class {
38
38
  replacements;
@@ -43,16 +43,16 @@ var InterpolateHtmlPlugin = class {
43
43
  compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
44
44
  const hooks = HtmlWebpackPlugin.getHooks(compilation);
45
45
  hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
46
- const publicUrl = this.replacements["PUBLIC_URL"] ?? "";
47
- const entry = assets.headTags[0].attributes["src"];
48
- this.replacements["ENTRY"] = `${publicUrl}${entry}`;
46
+ const publicUrl = this.replacements.PUBLIC_URL ?? "";
47
+ const entry = assets.headTags[0].attributes.src;
48
+ this.replacements.ENTRY = `${publicUrl}${entry}`;
49
49
  return assets;
50
50
  });
51
51
  hooks.afterTemplateExecution.tap(PLUGIN_NAME, (data) => {
52
52
  Object.entries(this.replacements).forEach(([key, value]) => {
53
53
  data.html = data.html.replace(
54
54
  new RegExp(`%${escapeStringRegexp(key)}%`, "g"),
55
- value || ""
55
+ value ?? ""
56
56
  );
57
57
  });
58
58
  return data;
@@ -64,7 +64,7 @@ var InterpolateHtmlPlugin = class {
64
64
  // src/webpack.config.ts
65
65
  var require2 = createRequire(import.meta.url);
66
66
  var imageInlineSizeLimit = 0;
67
- var getWebpackConfig = async (env) => {
67
+ var getWebpackConfig = (env) => {
68
68
  const { ifMin, ifNotMin } = getIfUtils(env, ["min"]);
69
69
  const { ifAnalyze } = getIfUtils(env, ["analyze"]);
70
70
  const { ifHttps } = getIfUtils(env, ["https"]);
@@ -105,7 +105,6 @@ var getWebpackConfig = async (env) => {
105
105
  postcssOptions: {
106
106
  plugins: removeEmpty([
107
107
  useTailwind ? [
108
- // eslint-disable-next-line node/no-missing-require
109
108
  require2.resolve("tailwindcss", {
110
109
  paths: [paths.appNodeModules]
111
110
  }),
@@ -386,6 +385,7 @@ var getWebpackConfig = async (env) => {
386
385
  resourceRegExp: /^\.\/locale$/,
387
386
  contextRegExp: /moment$/
388
387
  }),
388
+ // eslint-disable-next-line import/no-named-as-default-member
389
389
  ifMin(new webpack.ids.HashedModuleIdsPlugin()),
390
390
  // todo: remove?
391
391
  ifMin() && ifCore() ? new CopyPlugin({
package/package.json CHANGED
@@ -1,99 +1,104 @@
1
1
  {
2
2
  "name": "@raisenow/tamaro-cli",
3
- "version": "1.0.26",
3
+ "version": "1.1.1",
4
4
  "author": {
5
5
  "name": "RaiseNow",
6
6
  "email": "development@raisenow.com"
7
7
  },
8
8
  "type": "module",
9
9
  "scripts": {
10
- "prepare": "npm run build",
11
- "start": "npm run dev",
10
+ "prepare": "pnpm build",
11
+ "tscheck": "tsc --noEmit",
12
12
  "build": "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
13
- "build:watch": "npm run build -- --watch --ignore-watch .idea",
14
- "docs": "npx -y http-server . --cors -o /readme.html",
15
- "lint": "eslint --fix . && prettier --write ."
13
+ "build:watch": "pnpm build --watch --ignore-watch .history --ignore-watch .idea",
14
+ "readme": "pnpx http-server . --cors -o /readme.html",
15
+ "lint": "eslint .",
16
+ "lint:fix": "eslint --fix .",
17
+ "format": "prettier --write ."
16
18
  },
17
19
  "bin": "dist/cli.js",
18
20
  "engines": {
19
- "node": ">=16",
20
- "npm": ">=8"
21
+ "node": ">=18",
22
+ "npm": ">=10"
21
23
  },
22
24
  "dependencies": {
23
- "@babel/cli": "^7.21.0",
24
- "@babel/core": "^7.21.4",
25
- "@babel/plugin-proposal-decorators": "^7.21.0",
25
+ "@babel/cli": "^7.22.15",
26
+ "@babel/core": "^7.22.19",
27
+ "@babel/plugin-proposal-decorators": "^7.22.15",
26
28
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
27
- "@babel/plugin-transform-runtime": "^7.21.4",
28
- "@babel/preset-env": "^7.21.4",
29
- "@babel/preset-react": "^7.18.6",
30
- "@babel/preset-typescript": "^7.21.4",
31
- "@babel/runtime-corejs3": "^7.21.0",
32
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
33
- "@statoscope/webpack-plugin": "^5.26.2",
34
- "@types/columnify": "^1.5.1",
35
- "@types/lodash": "^4.14.192",
36
- "@types/node": "^18.15.11",
29
+ "@babel/plugin-transform-runtime": "^7.22.15",
30
+ "@babel/preset-env": "^7.22.15",
31
+ "@babel/preset-react": "^7.22.15",
32
+ "@babel/preset-typescript": "^7.22.15",
33
+ "@babel/runtime-corejs3": "^7.22.15",
34
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
35
+ "@statoscope/webpack-plugin": "^5.27.0",
36
+ "@types/columnify": "^1.5.2",
37
+ "@types/lodash": "^4.14.198",
38
+ "@types/node": "^18.17.15",
37
39
  "@types/node-notifier": "^8.0.2",
40
+ "@types/prompts": "^2.4.4",
38
41
  "@types/resolve-bin": "^0.4.1",
39
42
  "@types/webpack-config-utils": "^2.3.1",
40
- "@typescript-eslint/eslint-plugin": "^5.57.1",
41
- "@typescript-eslint/parser": "^5.57.1",
42
- "autoprefixer": "^10.4.14",
43
- "babel-loader": "^9.1.2",
43
+ "@typescript-eslint/eslint-plugin": "^6.7.0",
44
+ "@typescript-eslint/parser": "^6.7.0",
45
+ "autoprefixer": "^10.4.15",
46
+ "babel-loader": "^9.1.3",
44
47
  "babel-plugin-istanbul": "^6.1.1",
45
48
  "babel-plugin-lodash": "^3.3.4",
46
- "chalk": "^5.2.0",
49
+ "chalk": "^5.3.0",
47
50
  "clean-webpack-plugin": "^4.0.0",
48
51
  "columnify": "^1.6.0",
49
- "commander": "^10.0.0",
52
+ "commander": "^11.0.0",
50
53
  "copy-webpack-plugin": "^11.0.0",
51
- "core-js": "^3.30.0",
52
- "css-loader": "^6.7.3",
53
- "css-minimizer-webpack-plugin": "^5.0.0",
54
- "dotenv": "^16.0.3",
54
+ "core-js": "^3.32.2",
55
+ "css-loader": "^6.8.1",
56
+ "css-minimizer-webpack-plugin": "^5.0.1",
57
+ "dotenv": "^16.3.1",
55
58
  "dotenv-expand": "^10.0.0",
56
59
  "escape-string-regexp": "^5.0.0",
57
- "eslint": "^8.37.0",
58
- "eslint-config-prettier": "^8.8.0",
59
- "eslint-plugin-node": "^11.1.0",
60
+ "eslint": "^8.49.0",
61
+ "eslint-config-prettier": "^9.0.0",
62
+ "eslint-import-resolver-typescript": "^3.6.0",
63
+ "eslint-plugin-deprecation": "^2.0.0",
64
+ "eslint-plugin-import": "^2.28.1",
65
+ "eslint-plugin-markdownlint": "^0.5.0",
60
66
  "eslint-plugin-promise": "^6.1.1",
61
- "eslint-webpack-plugin": "^4.0.0",
62
- "execa": "^7.1.1",
67
+ "eslint-plugin-unused-imports": "^3.0.0",
68
+ "eslint-plugin-yml": "^1.9.0",
69
+ "eslint-webpack-plugin": "^4.0.1",
70
+ "execa": "^8.0.1",
63
71
  "file-loader": "^6.2.0",
64
72
  "fork-ts-checker-webpack-plugin": "^8.0.0",
65
- "glob": "^9.3.4",
73
+ "glob": "^10.3.4",
66
74
  "html-loader": "^4.2.0",
67
- "html-webpack-plugin": "^5.5.0",
75
+ "html-webpack-plugin": "^5.5.3",
68
76
  "json-loader": "^0.5.7",
69
77
  "lodash": "^4.17.21",
70
- "mini-css-extract-plugin": "^2.7.5",
78
+ "mini-css-extract-plugin": "^2.7.6",
71
79
  "node-notifier": "^10.0.1",
72
80
  "portfinder": "^1.0.32",
73
- "postcss": "^8.4.21",
74
- "postcss-custom-properties": "^13.1.4",
75
- "postcss-loader": "^7.2.4",
76
- "prettier": "^2.8.7",
81
+ "postcss": "^8.4.29",
82
+ "postcss-custom-properties": "^13.3.0",
83
+ "postcss-loader": "^7.3.3",
84
+ "prettier": "^3.0.3",
85
+ "prompts": "^2.4.2",
77
86
  "react-refresh": "^0.14.0",
78
87
  "resolve-url-loader": "^5.0.0",
79
- "sass": "^1.60.0",
80
- "sass-loader": "^13.2.2",
88
+ "sass": "^1.67.0",
89
+ "sass-loader": "^13.3.2",
81
90
  "source-map-loader": "^4.0.1",
82
91
  "strip-indent": "^4.0.0",
83
- "style-loader": "^3.3.2",
84
- "tsconfig-paths-webpack-plugin": "^4.0.1",
85
- "tsup": "^6.7.0",
86
- "typescript": "^5.0.3",
92
+ "style-loader": "^3.3.3",
93
+ "tsconfig-paths-webpack-plugin": "^4.1.0",
94
+ "tsup": "^7.2.0",
95
+ "typescript": "^5.2.2",
87
96
  "url-loader": "^4.1.1",
88
- "webpack": "^5.78.0",
89
- "webpack-cli": "^5.0.1",
97
+ "webpack": "^5.88.2",
98
+ "webpack-cli": "^5.1.4",
90
99
  "webpack-config-utils": "^2.3.1",
91
- "webpack-dev-server": "^4.13.2",
100
+ "webpack-dev-server": "^4.15.1",
92
101
  "yaml-loader": "^0.8.0"
93
102
  },
94
- "overrides": {
95
- "babel-plugin-lodash": {
96
- "@babel/types": "~7.20.0"
97
- }
98
- }
103
+ "packageManager": "pnpm@8.7.5"
99
104
  }
package/readme.html CHANGED
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
package/src/cli.ts CHANGED
@@ -1,23 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import {createCommand} from 'commander'
4
- import pkg from '../package.json'
5
- import {
6
- DEFAULT_AWS_PROFILE,
7
- DEFAULT_AWS_S3_EMAIL_CONFIG_BUCKET,
8
- DEFAULT_PORT,
9
- DEFAULT_TAG,
10
- } from 'lib/constants'
11
- import {logError} from 'lib/logging'
12
- import {dev, DevOptions} from 'commands/dev'
13
- import {build, BuildOptions} from 'commands/build'
14
- import {deploy, DeployOptions} from 'commands/deploy'
15
- import {serve, ServeOptions} from 'commands/serve'
16
- import {listDeployed, ListDeployedOptions} from 'commands/list-deployed'
4
+ import {build, type BuildOptions} from 'commands/build'
5
+ import {deploy, type DeployOptions} from 'commands/deploy'
17
6
  import {
18
7
  deployEmailConfig,
19
- DeployEmailConfigOptions,
8
+ type DeployEmailConfigOptions,
20
9
  } from 'commands/deploy-email-config'
10
+ import {dev, type DevOptions} from 'commands/dev'
11
+ import {listDeployed, type ListDeployedOptions} from 'commands/list-deployed'
12
+ import {serve, type ServeOptions} from 'commands/serve'
13
+ import {DEFAULT_PORT, DEFAULT_TAG} from 'lib/constants'
14
+ import {logError} from 'lib/logging'
15
+ import pkg from '../package.json'
21
16
 
22
17
  ///////////////////////////////////////////////////////////////////////////////
23
18
 
@@ -79,6 +74,7 @@ cli
79
74
  )
80
75
  .option('--port <port>', 'Web server port', `${DEFAULT_PORT}`)
81
76
  .option('--env <env>', 'Environment (dev, stage, prod)')
77
+ .option('--ci', 'CI environment', false)
82
78
  .option(
83
79
  '--deploy',
84
80
  'Deploy Tamaro Core or a customer configuration bundle to AWS S3',
@@ -89,11 +85,6 @@ cli
89
85
  'Tag which should be used for the deployment of the bundle',
90
86
  DEFAULT_TAG,
91
87
  )
92
- .option(
93
- '--profile <profile>',
94
- 'AWS profile which should be used for the deployment of the bundle',
95
- DEFAULT_AWS_PROFILE,
96
- )
97
88
  .action(async (options: BuildOptions & ServeOptions & DeployOptions) => {
98
89
  await build(options)
99
90
 
@@ -124,16 +115,12 @@ cli
124
115
  .description(
125
116
  'Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3',
126
117
  )
118
+ .option('--ci', 'CI environment', false)
127
119
  .option(
128
120
  '--tag <tag>',
129
121
  'Tag which should be used for the deployment of the bundle',
130
122
  DEFAULT_TAG,
131
123
  )
132
- .option(
133
- '--profile <profile>',
134
- 'AWS profile which should be used for the deployment of the bundle',
135
- DEFAULT_AWS_PROFILE,
136
- )
137
124
  .action(async (options: DeployOptions) => {
138
125
  await deploy(options)
139
126
  })
@@ -143,32 +130,19 @@ cli
143
130
  .description(
144
131
  'List deployments of Tamaro Core or a particular customer configuration',
145
132
  )
133
+ .option('--ci', 'CI environment', false)
146
134
  .option(
147
135
  '--config <config>',
148
136
  'Configuration name (default: current customer configuration)',
149
137
  )
150
- .option(
151
- '--profile <profile>',
152
- 'AWS profile which should be used for fetching deployments',
153
- DEFAULT_AWS_PROFILE,
154
- )
155
138
  .action(async (options: ListDeployedOptions) => {
156
139
  await listDeployed(options)
157
140
  })
158
141
 
159
142
  cli
160
143
  .command('deploy-email-config')
161
- .description('Deploy a widgets email configuration to AWS S3')
162
- .option(
163
- '--bucket <bucket>',
164
- 'AWS S3 bucket where it should be deployed',
165
- DEFAULT_AWS_S3_EMAIL_CONFIG_BUCKET,
166
- )
167
- .option(
168
- '--profile <profile>',
169
- 'AWS profile which should be used for the deployment of email configuration',
170
- DEFAULT_AWS_PROFILE,
171
- )
144
+ .description("Deploy a widget's email configuration to AWS S3")
145
+ .option('--ci', 'CI environment', false)
172
146
  .action(async (options: DeployEmailConfigOptions) => {
173
147
  await deployEmailConfig(options)
174
148
  })
@@ -183,6 +157,7 @@ cli
183
157
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
184
158
  logError(`\n${error.signalDescription}`)
185
159
  } else {
160
+ // eslint-disable-next-line no-console
186
161
  console.log('')
187
162
  logError(error.stack)
188
163
  }
@@ -1,5 +1,11 @@
1
+ import {type DeployOptions} from 'commands/deploy'
2
+ import {assertProfilesPresent, promptProfile} from 'lib/aws'
3
+ import {halt, runCommandSync} from 'lib/command'
1
4
  import {CORE_CONFIG_NAME} from 'lib/constants'
2
- import {assertProfileValid} from 'lib/aws'
5
+ import {applyEnv, assertEnvValid} from 'lib/env'
6
+ import {assertCrtExists} from 'lib/https'
7
+ import {logCommand, logTitle} from 'lib/logging'
8
+ import {notify} from 'lib/notifier'
3
9
  import {
4
10
  getIfCoreFns,
5
11
  getPaths,
@@ -7,12 +13,6 @@ import {
7
13
  resolveBin,
8
14
  resolveOwn,
9
15
  } from 'lib/resolve'
10
- import {applyEnv, assertEnvValid} from 'lib/env'
11
- import {assertCrtExists} from 'lib/https'
12
- import {logCommand, logTitle} from 'lib/logging'
13
- import {notify} from 'lib/notifier'
14
- import {halt, runCommandSync} from 'lib/command'
15
- import {DeployOptions} from 'commands/deploy'
16
16
 
17
17
  ///////////////////////////////////////////////////////////////////////////////
18
18
 
@@ -35,13 +35,18 @@ export const build = async (
35
35
  assertOptionsValid(options)
36
36
  applyEnv(env)
37
37
 
38
+ if (options.deploy && !options.ci) {
39
+ assertProfilesPresent()
40
+ options.profile = await promptProfile()
41
+ }
42
+
38
43
  const flags = prepareFlags([], options).join(' ')
39
44
  const {ifCore} = getIfCoreFns()
40
45
  const paths = getPaths(ifCore)
41
46
  const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid())
42
47
  const title = ifCore(
43
48
  'Building optimised (minified) bundle of Tamaro Core …',
44
- `Building optimised (minified) bundle of “${configName} customer configuration …`,
49
+ `Building optimised (minified) bundle of "${configName}" customer configuration …`,
45
50
  )
46
51
 
47
52
  const wpBin = resolveBin('webpack')
@@ -59,7 +64,8 @@ export const build = async (
59
64
 
60
65
  /////////////////////////////////////////////////////////////////////////////
61
66
 
62
- logTitle(`\nBundle for “${configName} customer configuration is done.`)
67
+ logTitle(`\nBundle for "${configName}" customer configuration is done.`)
68
+ // eslint-disable-next-line no-console
63
69
  console.log(`Path: ${paths.appDist}\n`)
64
70
 
65
71
  /////////////////////////////////////////////////////////////////////////////
@@ -67,7 +73,7 @@ export const build = async (
67
73
  process.on('exit', () => {
68
74
  notify({
69
75
  title: 'build',
70
- message: `Bundle for “${configName} customer configuration is done.`,
76
+ message: `Bundle for "${configName}" customer configuration is done.`,
71
77
  })
72
78
  })
73
79
  }
@@ -75,22 +81,21 @@ export const build = async (
75
81
  ///////////////////////////////////////////////////////////////////////////////
76
82
 
77
83
  const assertOptionsValid = (options: BuildOptions & DeployOptions) => {
78
- const {localCore, https, deploy, profile, env} = options
84
+ const {localCore, https, deploy, env} = options
79
85
  const {ifCore} = getIfCoreFns()
80
86
 
81
87
  if (ifCore() && localCore) {
82
- halt('Flag “--local-core is redundant if running in Tamaro Core context.')
88
+ halt('Flag "--local-core" is redundant if running in Tamaro Core context.')
83
89
  }
84
90
 
85
91
  if (localCore && deploy) {
86
- halt('Flags “--local-core and “--deploy must not be used together.')
92
+ halt('Flags "--local-core" and "--deploy" must not be used together.')
87
93
  }
88
94
 
89
95
  if (https) {
90
96
  assertCrtExists()
91
97
  }
92
98
 
93
- assertProfileValid(profile)
94
99
  assertEnvValid(env)
95
100
  }
96
101
 
@@ -1,20 +1,21 @@
1
1
  import {existsSync} from 'fs'
2
2
  import {
3
- assertProfileValid,
4
- AwsOptions,
3
+ assertProfilesPresent,
4
+ type AwsOptions,
5
+ prepareFlags,
6
+ promptBucket,
7
+ promptProfile,
5
8
  withAwsAuthenticate,
6
- prepareFlags as prepareAwsFlags,
7
9
  } from 'lib/aws'
10
+ import {halt, runCommandSync} from 'lib/command'
11
+ import {AWS_S3_EMAIL_CONFIG_PROD_BUCKET} from 'lib/constants'
8
12
  import {logCommand, logDataTable, logTitle} from 'lib/logging'
9
- import {getIfCoreFns, getPaths, getWidgetUuid} from 'lib/resolve'
10
13
  import {notify} from 'lib/notifier'
11
- import {halt, runCommandSync} from 'lib/command'
14
+ import {getIfCoreFns, getPaths, getWidgetUuid} from 'lib/resolve'
12
15
 
13
16
  ///////////////////////////////////////////////////////////////////////////////
14
17
 
15
- export type DeployEmailConfigOptions = AwsOptions & {
16
- bucket: string
17
- }
18
+ export type DeployEmailConfigOptions = AwsOptions
18
19
 
19
20
  ///////////////////////////////////////////////////////////////////////////////
20
21
 
@@ -25,12 +26,19 @@ export const deployEmailConfig = async (
25
26
  const paths = getPaths(ifCore)
26
27
  const emailConfigPath = `${paths.app}/email-config`
27
28
 
28
- assertOptionsValid(options)
29
29
  assertIsNotCore()
30
30
  assertEmailConfigPathExists(emailConfigPath)
31
31
 
32
+ if (!options.ci) {
33
+ assertProfilesPresent()
34
+ options.profile = await promptProfile()
35
+ }
36
+
37
+ const bucket = options.ci
38
+ ? AWS_S3_EMAIL_CONFIG_PROD_BUCKET
39
+ : await promptBucket()
40
+
32
41
  const flags = prepareFlags([], options).join(' ')
33
- const {bucket} = options
34
42
  const configName = getWidgetUuid()
35
43
  const deployUrl = `s3://${bucket}/${configName}`
36
44
 
@@ -41,7 +49,7 @@ export const deployEmailConfig = async (
41
49
  ${flags}
42
50
  `
43
51
  logTitle(
44
- `Deploying email configuration for “${configName} customer configuration to AWS S3 …`,
52
+ `Deploying email configuration for "${configName}" customer configuration to AWS S3 …`,
45
53
  )
46
54
  logCommand(cmd)
47
55
 
@@ -54,7 +62,7 @@ export const deployEmailConfig = async (
54
62
  /////////////////////////////////////////////////////////////////////////////
55
63
 
56
64
  logTitle(
57
- `Email configuration for “${configName} customer configuration is deployed.`,
65
+ `Email configuration for "${configName}" customer configuration is deployed.`,
58
66
  )
59
67
  logDataTable({'Deploy URL:': deployUrl})
60
68
 
@@ -62,23 +70,14 @@ export const deployEmailConfig = async (
62
70
 
63
71
  process.on('exit', () => {
64
72
  notify({
65
- title: `deploy-email-config`,
66
- message: `Email configuration for “${configName} customer configuration is deployed.`,
73
+ title: 'deploy-email-config',
74
+ message: `Email configuration for "${configName}" customer configuration is deployed.`,
67
75
  })
68
76
  })
69
77
  }
70
78
 
71
79
  ///////////////////////////////////////////////////////////////////////////////
72
80
 
73
- const assertOptionsValid = (options: DeployEmailConfigOptions) => {
74
- const {bucket, profile} = options
75
-
76
- assertBucketValid(bucket)
77
- assertProfileValid(profile)
78
- }
79
-
80
- ///////////////////////////////////////////////////////////////////////////////
81
-
82
81
  const assertEmailConfigPathExists = (distPath: string) => {
83
82
  if (!existsSync(distPath)) {
84
83
  halt('Email config folder does not exists. Nothing to deploy.', 0)
@@ -87,18 +86,6 @@ const assertEmailConfigPathExists = (distPath: string) => {
87
86
 
88
87
  ///////////////////////////////////////////////////////////////////////////////
89
88
 
90
- const assertBucketValid = (tag: string) => {
91
- const regex = /^[a-zA-Z0-9-_]+$/
92
-
93
- if (!regex.test(tag)) {
94
- halt(
95
- `Flag “--bucket” has forbidden format. Allowed format: ${regex.toString()}.`,
96
- )
97
- }
98
- }
99
-
100
- ///////////////////////////////////////////////////////////////////////////////
101
-
102
89
  const assertIsNotCore = () => {
103
90
  const {ifCore} = getIfCoreFns()
104
91
 
@@ -106,12 +93,3 @@ const assertIsNotCore = () => {
106
93
  halt('You cannot deploy widget email configuration for Tamaro Core.')
107
94
  }
108
95
  }
109
-
110
- ///////////////////////////////////////////////////////////////////////////////
111
-
112
- const prepareFlags = (
113
- flags: string[],
114
- options: DeployEmailConfigOptions,
115
- ): string[] => {
116
- return prepareAwsFlags(flags, options)
117
- }