@raisenow/tamaro-cli 1.0.25 → 1.1.0

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-XC5QT3RG.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 glob 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,15 +64,15 @@ 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"]);
71
71
  const { ifLocalCore } = getIfUtils(env, ["localCore"]);
72
72
  const { ifCore } = getIfCoreFns();
73
73
  const paths = getPaths(ifCore);
74
- const appHtmlFiles = glob.sync(paths.appHtml);
75
- const appEnvFiles = glob.sync(paths.appEnv);
74
+ const appHtmlFiles = globSync(paths.appHtml);
75
+ const appEnvFiles = globSync(paths.appEnv);
76
76
  const envVars = getEnvVars(appEnvFiles, ifMin, ifCore, ifLocalCore, ifHttps);
77
77
  const { ifHmr } = getIfUtils({ hmr: process.env.HMR_ENABLED === "true" }, ["hmr"]);
78
78
  const useTailwind = ifCore() && paths.appTailwindConfig && existsSync(paths.appTailwindConfig);
@@ -165,6 +165,7 @@ var getWebpackConfig = async (env) => {
165
165
  ),
166
166
  module: {
167
167
  rules: removeEmpty([
168
+ // Source maps
168
169
  ifNotMin({
169
170
  enforce: "pre",
170
171
  exclude: /@babel\/runtime/,
@@ -173,6 +174,8 @@ var getWebpackConfig = async (env) => {
173
174
  }),
174
175
  {
175
176
  oneOf: [
177
+ // App Javascript and Typescript (Babel)
178
+ // and some dependencies distributed in a non-es5 formats
176
179
  {
177
180
  test: /\.(js|ts)x?$/,
178
181
  include: ifCore(
@@ -225,9 +228,11 @@ var getWebpackConfig = async (env) => {
225
228
  ])
226
229
  }
227
230
  },
231
+ // Other Javascript (not in app) - no transformation
228
232
  {
229
233
  test: /\.(js|mjs)$/
230
234
  },
235
+ // Styles (not modules)
231
236
  {
232
237
  test: /\.s?css$/,
233
238
  exclude: /\.module\.s?css$/,
@@ -235,12 +240,14 @@ var getWebpackConfig = async (env) => {
235
240
  modules: false
236
241
  })
237
242
  },
243
+ // Styles (modules)
238
244
  {
239
245
  test: /\.module\.s?css$/,
240
246
  use: getCssLoaders({
241
247
  modules: { localIdentName: "[local]__[hash:base64]" }
242
248
  })
243
249
  },
250
+ // Images and fonts
244
251
  {
245
252
  test: /\.(png|jpe?g|svg|webp|gif|ico|ttf|eot|woff2?)$/,
246
253
  type: "asset",
@@ -250,6 +257,7 @@ var getWebpackConfig = async (env) => {
250
257
  }
251
258
  }
252
259
  },
260
+ // YML
253
261
  {
254
262
  test: /\.ya?ml$/,
255
263
  use: [
@@ -260,6 +268,7 @@ var getWebpackConfig = async (env) => {
260
268
  }
261
269
  ]
262
270
  },
271
+ // HTML
263
272
  {
264
273
  test: /\.html$/,
265
274
  loader: require2.resolve("html-loader"),
@@ -267,6 +276,8 @@ var getWebpackConfig = async (env) => {
267
276
  minimize: false
268
277
  }
269
278
  },
279
+ // All other files - fallback
280
+ // This must be the latest rule!
270
281
  {
271
282
  exclude: [/^$/, /\.(js|jsx|ts|tsx|mjs)$/, /\.html$/, /\.json$/],
272
283
  type: "asset/resource"
@@ -301,8 +312,12 @@ var getWebpackConfig = async (env) => {
301
312
  })
302
313
  },
303
314
  optimization: {
315
+ // minimize: false,
304
316
  removeEmptyChunks: true,
317
+ // moduleIds: 'deterministic', // todo: use instead of HashedModuleIdsPlugin
318
+ // chunkIds: 'named',
305
319
  minimizer: ["...", new CssMinimizerPlugin()]
320
+ // sourceMaps: true?
306
321
  },
307
322
  plugins: removeEmpty([
308
323
  new webpack.ProgressPlugin(),
@@ -313,7 +328,9 @@ var getWebpackConfig = async (env) => {
313
328
  resolvePluginsRelativeTo: paths.app
314
329
  }),
315
330
  ifMin(
316
- new CleanWebpackPlugin({})
331
+ new CleanWebpackPlugin({
332
+ // verbose: true,
333
+ })
317
334
  ),
318
335
  ...appHtmlFiles.map(
319
336
  (file) => new HtmlWebpackPlugin2({
@@ -321,6 +338,19 @@ var getWebpackConfig = async (env) => {
321
338
  filename: basename(file),
322
339
  inject: false,
323
340
  minify: false
341
+ // ...ifMin({
342
+ // minify: {
343
+ // collapseWhitespace: true,
344
+ // removeComments: true,
345
+ // removeRedundantAttributes: true,
346
+ // removeScriptTypeAttributes: true,
347
+ // removeStyleLinkTypeAttributes: true,
348
+ // useShortDoctype: true,
349
+ // quoteCharacter: '"',
350
+ // minifyJS: true,
351
+ // minifyCSS: true,
352
+ // },
353
+ // }),
324
354
  })
325
355
  ),
326
356
  new InterpolateHtmlPlugin(envVars.raw),
@@ -355,7 +385,9 @@ var getWebpackConfig = async (env) => {
355
385
  resourceRegExp: /^\.\/locale$/,
356
386
  contextRegExp: /moment$/
357
387
  }),
388
+ // eslint-disable-next-line import/no-named-as-default-member
358
389
  ifMin(new webpack.ids.HashedModuleIdsPlugin()),
390
+ // todo: remove?
359
391
  ifMin() && ifCore() ? new CopyPlugin({
360
392
  patterns: ["*.md", "*.html"]
361
393
  }) : void 0,
@@ -363,7 +395,7 @@ var getWebpackConfig = async (env) => {
363
395
  name: ifCore("tamaro-core", "tamaro-customer-config"),
364
396
  saveReportTo: "reports/report.html",
365
397
  saveStatsTo: "reports/stats-[name]-[hash].json",
366
- additionalStats: glob.sync("reports/*.json"),
398
+ additionalStats: globSync("reports/*.json"),
367
399
  open: false
368
400
  }) : void 0
369
401
  ]),
package/package.json CHANGED
@@ -1,94 +1,104 @@
1
1
  {
2
2
  "name": "@raisenow/tamaro-cli",
3
- "version": "1.0.25",
3
+ "version": "1.1.0",
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.20.7",
24
- "@babel/core": "^7.20.12",
25
- "@babel/plugin-proposal-decorators": "^7.20.13",
25
+ "@babel/cli": "^7.22.15",
26
+ "@babel/core": "^7.22.17",
27
+ "@babel/plugin-proposal-decorators": "^7.22.15",
26
28
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
27
- "@babel/plugin-transform-runtime": "^7.19.6",
28
- "@babel/preset-env": "^7.20.2",
29
- "@babel/preset-react": "^7.18.6",
30
- "@babel/preset-typescript": "^7.18.6",
31
- "@babel/runtime-corejs3": "^7.20.13",
32
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
33
- "@statoscope/webpack-plugin": "^5.24.0",
34
- "@types/columnify": "^1.5.1",
35
- "@types/lodash": "^4.14.191",
36
- "@types/node": "^18.11.18",
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.50.0",
41
- "@typescript-eslint/parser": "^5.50.0",
42
- "autoprefixer": "^10.4.13",
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.27.2",
52
- "css-loader": "^6.7.3",
53
- "css-minimizer-webpack-plugin": "^4.2.2",
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.33.0",
58
- "eslint-config-prettier": "^8.6.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": "^1.5.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": "^3.2.0",
62
- "execa": "^6.1.0",
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
- "fork-ts-checker-webpack-plugin": "^7.3.0",
65
- "glob": "^8.1.0",
72
+ "fork-ts-checker-webpack-plugin": "^8.0.0",
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.2",
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.1",
75
- "postcss-loader": "^7.0.2",
76
- "prettier": "^2.8.3",
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.58.0",
80
- "sass-loader": "^13.2.0",
88
+ "sass": "^1.66.1",
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.1",
84
- "tsconfig-paths-webpack-plugin": "^4.0.0",
85
- "tsup": "^6.5.0",
86
- "typescript": "^4.9.5",
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.75.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.11.1",
100
+ "webpack-dev-server": "^4.15.1",
92
101
  "yaml-loader": "^0.8.0"
93
- }
102
+ },
103
+ "packageManager": "pnpm@8.7.5"
94
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,15 @@
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'
4
+ import {build, type BuildOptions} from 'commands/build'
5
+ import {deploy, type DeployOptions} from 'commands/deploy'
6
+ import {deployEmailConfig} from 'commands/deploy-email-config'
7
+ import {dev, type DevOptions} from 'commands/dev'
8
+ import {listDeployed, type ListDeployedOptions} from 'commands/list-deployed'
9
+ import {serve, type ServeOptions} from 'commands/serve'
10
+ import {DEFAULT_PORT, DEFAULT_TAG} from 'lib/constants'
11
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'
17
- import {
18
- deployEmailConfig,
19
- DeployEmailConfigOptions,
20
- } from 'commands/deploy-email-config'
12
+ import pkg from '../package.json'
21
13
 
22
14
  ///////////////////////////////////////////////////////////////////////////////
23
15
 
@@ -89,11 +81,6 @@ cli
89
81
  'Tag which should be used for the deployment of the bundle',
90
82
  DEFAULT_TAG,
91
83
  )
92
- .option(
93
- '--profile <profile>',
94
- 'AWS profile which should be used for the deployment of the bundle',
95
- DEFAULT_AWS_PROFILE,
96
- )
97
84
  .action(async (options: BuildOptions & ServeOptions & DeployOptions) => {
98
85
  await build(options)
99
86
 
@@ -129,11 +116,6 @@ cli
129
116
  'Tag which should be used for the deployment of the bundle',
130
117
  DEFAULT_TAG,
131
118
  )
132
- .option(
133
- '--profile <profile>',
134
- 'AWS profile which should be used for the deployment of the bundle',
135
- DEFAULT_AWS_PROFILE,
136
- )
137
119
  .action(async (options: DeployOptions) => {
138
120
  await deploy(options)
139
121
  })
@@ -147,30 +129,15 @@ cli
147
129
  '--config <config>',
148
130
  'Configuration name (default: current customer configuration)',
149
131
  )
150
- .option(
151
- '--profile <profile>',
152
- 'AWS profile which should be used for fetching deployments',
153
- DEFAULT_AWS_PROFILE,
154
- )
155
132
  .action(async (options: ListDeployedOptions) => {
156
133
  await listDeployed(options)
157
134
  })
158
135
 
159
136
  cli
160
137
  .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
- )
172
- .action(async (options: DeployEmailConfigOptions) => {
173
- await deployEmailConfig(options)
138
+ .description("Deploy a widget's email configuration to AWS S3")
139
+ .action(async () => {
140
+ await deployEmailConfig()
174
141
  })
175
142
 
176
143
  ///////////////////////////////////////////////////////////////////////////////
@@ -183,6 +150,7 @@ cli
183
150
  // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
184
151
  logError(`\n${error.signalDescription}`)
185
152
  } else {
153
+ // eslint-disable-next-line no-console
186
154
  console.log('')
187
155
  logError(error.stack)
188
156
  }
@@ -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 {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
 
@@ -22,7 +22,7 @@ export type BuildOptions = {
22
22
  https: boolean
23
23
  serve: boolean
24
24
  deploy: boolean
25
- env: string
25
+ env?: string
26
26
  }
27
27
 
28
28
  ///////////////////////////////////////////////////////////////////////////////
@@ -30,7 +30,15 @@ export type BuildOptions = {
30
30
  export const build = async (
31
31
  options: BuildOptions & DeployOptions,
32
32
  ): Promise<void> => {
33
+ const {env} = options
34
+
33
35
  assertOptionsValid(options)
36
+ assertProfilesPresent()
37
+ applyEnv(env)
38
+
39
+ if (options.deploy) {
40
+ options.profile = await promptProfile()
41
+ }
34
42
 
35
43
  const flags = prepareFlags([], options).join(' ')
36
44
  const {ifCore} = getIfCoreFns()
@@ -38,7 +46,7 @@ export const build = async (
38
46
  const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid())
39
47
  const title = ifCore(
40
48
  'Building optimised (minified) bundle of Tamaro Core …',
41
- `Building optimised (minified) bundle of “${configName} customer configuration …`,
49
+ `Building optimised (minified) bundle of "${configName}" customer configuration …`,
42
50
  )
43
51
 
44
52
  const wpBin = resolveBin('webpack')
@@ -56,7 +64,8 @@ export const build = async (
56
64
 
57
65
  /////////////////////////////////////////////////////////////////////////////
58
66
 
59
- logTitle(`\nBundle for “${configName} customer configuration is done.`)
67
+ logTitle(`\nBundle for "${configName}" customer configuration is done.`)
68
+ // eslint-disable-next-line no-console
60
69
  console.log(`Path: ${paths.appDist}\n`)
61
70
 
62
71
  /////////////////////////////////////////////////////////////////////////////
@@ -64,7 +73,7 @@ export const build = async (
64
73
  process.on('exit', () => {
65
74
  notify({
66
75
  title: 'build',
67
- message: `Bundle for “${configName} customer configuration is done.`,
76
+ message: `Bundle for "${configName}" customer configuration is done.`,
68
77
  })
69
78
  })
70
79
  }
@@ -72,22 +81,21 @@ export const build = async (
72
81
  ///////////////////////////////////////////////////////////////////////////////
73
82
 
74
83
  const assertOptionsValid = (options: BuildOptions & DeployOptions) => {
75
- const {localCore, https, deploy, profile, env} = options
84
+ const {localCore, https, deploy, env} = options
76
85
  const {ifCore} = getIfCoreFns()
77
86
 
78
87
  if (ifCore() && localCore) {
79
- 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.')
80
89
  }
81
90
 
82
91
  if (localCore && deploy) {
83
- halt('Flags “--local-core and “--deploy must not be used together.')
92
+ halt('Flags "--local-core" and "--deploy" must not be used together.')
84
93
  }
85
94
 
86
95
  if (https) {
87
96
  assertCrtExists()
88
97
  }
89
98
 
90
- assertProfileValid(profile)
91
99
  assertEnvValid(env)
92
100
  }
93
101