@raisenow/tamaro-cli 1.1.5 → 1.1.7

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,7 +10,7 @@ import {
10
10
  logTitle,
11
11
  moduleFileExtensions,
12
12
  resolveApp
13
- } from "./chunk-TXIBRHT6.js";
13
+ } from "./chunk-NJVU7WR2.js";
14
14
 
15
15
  // src/webpack.config.ts
16
16
  import { existsSync } from "fs";
@@ -123,7 +123,7 @@ var getWebpackConfig = (env) => {
123
123
  },
124
124
  {
125
125
  loader: require2.resolve("sass-loader"),
126
- options: { sourceMap: true }
126
+ options: { api: "modern-compiler", sourceMap: true }
127
127
  }
128
128
  ]);
129
129
  };
@@ -175,8 +175,10 @@ var getWebpackConfig = (env) => {
175
175
  }),
176
176
  {
177
177
  oneOf: [
178
- // App Javascript and Typescript (Babel)
179
- // and some dependencies distributed in a non-es5 formats
178
+ /**
179
+ * App Javascript and Typescript (Babel)
180
+ * and some dependencies distributed in a non-es5 formats
181
+ */
180
182
  {
181
183
  test: /\.(js|ts)x?$/,
182
184
  include: ifCore(
@@ -277,8 +279,10 @@ var getWebpackConfig = (env) => {
277
279
  minimize: false
278
280
  }
279
281
  },
280
- // All other files - fallback
281
- // This must be the latest rule!
282
+ /**
283
+ * All other files - fallback
284
+ * This must be the latest rule!
285
+ */
282
286
  {
283
287
  exclude: [/^$/, /\.(js|jsx|ts|tsx|mjs)$/, /\.html$/, /\.json$/],
284
288
  type: "asset/resource"
package/package.json CHANGED
@@ -1,104 +1,106 @@
1
1
  {
2
2
  "name": "@raisenow/tamaro-cli",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "author": {
5
5
  "name": "RaiseNow",
6
6
  "email": "development@raisenow.com"
7
7
  },
8
8
  "type": "module",
9
+ "bin": "dist/cli.js",
10
+ "packageManager": "pnpm@9.12.3",
11
+ "engines": {
12
+ "node": ">=20",
13
+ "pnpm": ">= 9.12",
14
+ "npm": "please-use-pnpm",
15
+ "yarn": "please-use-pnpm"
16
+ },
9
17
  "scripts": {
10
18
  "prepare": "pnpm build",
11
19
  "tscheck": "tsc --noEmit",
12
20
  "build": "tsup src/cli.ts src/webpack.config.ts --clean --shims --format esm",
13
21
  "build:watch": "pnpm build --watch --ignore-watch .history --ignore-watch .idea",
14
22
  "readme": "pnpx http-server . --cors -o /readme.html",
15
- "lint": "eslint .",
16
- "lint:fix": "eslint --fix .",
23
+ "lint": "DEBUG=eslint:cli-engine eslint .",
24
+ "lint:fix": "DEBUG=eslint:cli-engine eslint --fix .",
17
25
  "format": "prettier --write ."
18
26
  },
19
- "bin": "dist/cli.js",
20
- "engines": {
21
- "node": ">=20",
22
- "npm": ">=10"
23
- },
24
- "packageManager": "pnpm@9.0.5",
25
27
  "dependencies": {
26
- "@babel/cli": "^7.24.1",
27
- "@babel/core": "^7.24.4",
28
- "@babel/plugin-proposal-decorators": "^7.24.1",
28
+ "@babel/cli": "^7.25.9",
29
+ "@babel/core": "^7.26.0",
30
+ "@babel/plugin-proposal-decorators": "^7.25.9",
29
31
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
30
- "@babel/plugin-transform-runtime": "^7.24.3",
31
- "@babel/preset-env": "^7.24.4",
32
- "@babel/preset-react": "^7.24.1",
33
- "@babel/preset-typescript": "^7.24.1",
34
- "@babel/runtime-corejs3": "^7.24.4",
35
- "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
32
+ "@babel/plugin-transform-runtime": "^7.25.9",
33
+ "@babel/preset-env": "^7.26.0",
34
+ "@babel/preset-react": "^7.25.9",
35
+ "@babel/preset-typescript": "^7.26.0",
36
+ "@babel/runtime-corejs3": "^7.26.0",
37
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
36
38
  "@statoscope/webpack-plugin": "^5.28.2",
37
39
  "@types/columnify": "^1.5.4",
38
- "@types/lodash": "^4.17.0",
39
- "@types/node": "^20.12.7",
40
+ "@types/lodash": "^4.17.13",
41
+ "@types/node": "^20.17.6",
40
42
  "@types/node-notifier": "^8.0.5",
41
43
  "@types/prompts": "^2.4.9",
42
44
  "@types/resolve-bin": "^0.4.3",
43
45
  "@types/webpack-config-utils": "^2.3.4",
44
- "@typescript-eslint/eslint-plugin": "^7.7.1",
45
- "@typescript-eslint/parser": "^7.7.1",
46
- "autoprefixer": "^10.4.19",
47
- "babel-loader": "^9.1.3",
48
- "babel-plugin-istanbul": "^6.1.1",
46
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
47
+ "@typescript-eslint/parser": "^7.18.0",
48
+ "autoprefixer": "^10.4.20",
49
+ "babel-loader": "^9.2.1",
50
+ "babel-plugin-istanbul": "^7.0.0",
49
51
  "babel-plugin-lodash": "^3.3.4",
50
52
  "chalk": "^5.3.0",
51
53
  "clean-webpack-plugin": "^4.0.0",
52
54
  "columnify": "^1.6.0",
53
- "commander": "^12.0.0",
55
+ "commander": "^12.1.0",
54
56
  "copy-webpack-plugin": "^12.0.2",
55
- "core-js": "^3.37.0",
56
- "css-loader": "^7.1.1",
57
- "css-minimizer-webpack-plugin": "^6.0.0",
57
+ "core-js": "^3.39.0",
58
+ "css-loader": "^7.1.2",
59
+ "css-minimizer-webpack-plugin": "^7.0.0",
58
60
  "dotenv": "^16.4.5",
59
61
  "dotenv-expand": "^11.0.6",
60
62
  "escape-string-regexp": "^5.0.0",
61
- "eslint": "^8.57.0",
63
+ "eslint": "^8.57.1",
62
64
  "eslint-config-prettier": "^9.1.0",
63
- "eslint-import-resolver-typescript": "^3.6.1",
64
- "eslint-plugin-deprecation": "^2.0.0",
65
- "eslint-plugin-import": "^2.29.1",
66
- "eslint-plugin-markdownlint": "^0.5.0",
67
- "eslint-plugin-promise": "^6.1.1",
68
- "eslint-plugin-unused-imports": "^3.1.0",
69
- "eslint-plugin-yml": "^1.14.0",
70
- "eslint-webpack-plugin": "^4.1.0",
71
- "execa": "^8.0.1",
65
+ "eslint-import-resolver-typescript": "^3.6.3",
66
+ "eslint-plugin-deprecation": "^3.0.0",
67
+ "eslint-plugin-import": "^2.31.0",
68
+ "eslint-plugin-markdownlint": "^0.6.0",
69
+ "eslint-plugin-promise": "^7.1.0",
70
+ "eslint-plugin-unused-imports": "^3.2.0",
71
+ "eslint-plugin-yml": "^1.15.0",
72
+ "eslint-webpack-plugin": "^4.2.0",
73
+ "execa": "^9.5.1",
72
74
  "file-loader": "^6.2.0",
73
75
  "fork-ts-checker-webpack-plugin": "^9.0.2",
74
- "glob": "^10.3.12",
75
- "html-loader": "^5.0.0",
76
- "html-webpack-plugin": "^5.6.0",
76
+ "glob": "^11.0.0",
77
+ "html-loader": "^5.1.0",
78
+ "html-webpack-plugin": "^5.6.3",
77
79
  "json-loader": "^0.5.7",
78
80
  "lodash": "^4.17.21",
79
- "mini-css-extract-plugin": "^2.9.0",
81
+ "mini-css-extract-plugin": "^2.9.2",
80
82
  "node-notifier": "^10.0.1",
81
83
  "portfinder": "^1.0.32",
82
- "postcss": "^8.4.38",
83
- "postcss-custom-properties": "^13.3.8",
84
+ "postcss": "^8.4.47",
85
+ "postcss-custom-properties": "^14.0.4",
84
86
  "postcss-loader": "^8.1.1",
85
- "prettier": "^3.2.5",
87
+ "prettier": "^3.3.3",
86
88
  "prompts": "^2.4.2",
87
- "react-refresh": "^0.14.0",
89
+ "react-refresh": "^0.14.2",
88
90
  "resolve-url-loader": "^5.0.0",
89
- "sass": "^1.75.0",
90
- "sass-loader": "^14.2.1",
91
+ "sass": "^1.80.6",
92
+ "sass-loader": "^16.0.3",
91
93
  "source-map-loader": "^5.0.0",
92
94
  "strip-indent": "^4.0.0",
93
95
  "style-loader": "^4.0.0",
94
96
  "tsconfig-paths-webpack-plugin": "^4.1.0",
95
- "tsup": "^8.0.2",
96
- "typescript": "^5.4.5",
97
+ "tsup": "^8.3.5",
98
+ "typescript": "^5.6.3",
97
99
  "url-loader": "^4.1.1",
98
- "webpack": "^5.91.0",
100
+ "webpack": "^5.96.1",
99
101
  "webpack-cli": "^5.1.4",
100
102
  "webpack-config-utils": "^2.3.1",
101
- "webpack-dev-server": "^5.0.4",
103
+ "webpack-dev-server": "^5.1.0",
102
104
  "yaml-loader": "^0.8.1"
103
105
  }
104
106
  }
package/src/cli.ts CHANGED
@@ -10,22 +10,25 @@ import {
10
10
  import {dev, type DevOptions} from 'commands/dev'
11
11
  import {listDeployed, type ListDeployedOptions} from 'commands/list-deployed'
12
12
  import {serve, type ServeOptions} from 'commands/serve'
13
+ import {halt} from 'lib/command'
13
14
  import {DEFAULT_PORT, DEFAULT_TAG} from 'lib/constants'
14
- import {logError} from 'lib/logging'
15
+ import {logError, logTitle} from 'lib/logging'
15
16
  import pkg from '../package.json'
16
17
 
17
18
  ///////////////////////////////////////////////////////////////////////////////
18
19
 
19
- // Makes the script crash on unhandled rejections instead of silently
20
- // ignoring them. In the future, promise rejections that are not handled will
21
- // terminate the Node.js process with a non-zero exit code.
20
+ /**
21
+ * Makes the script crash on unhandled rejections instead of silently
22
+ * ignoring them. In the future, promise rejections that are not handled will
23
+ * terminate the Node.js process with a non-zero exit code.
24
+ */
22
25
  process.on('unhandledRejection', (error) => {
23
26
  throw error
24
27
  })
25
28
 
26
29
  // Exit on ctrl+c
27
30
  process.on('SIGINT', () => {
28
- process.exit(1)
31
+ halt()
29
32
  })
30
33
 
31
34
  ///////////////////////////////////////////////////////////////////////////////
@@ -75,6 +78,7 @@ cli
75
78
  )
76
79
  .option('--port <port>', 'Web server port', `${DEFAULT_PORT}`)
77
80
  .option('--env <env>', 'Environment (dev, stage, prod)')
81
+ .option('--profile <profile>', 'AWS profile')
78
82
  .option('--ci', 'CI environment', false)
79
83
  .option(
80
84
  '--deploy',
@@ -117,6 +121,7 @@ cli
117
121
  .description(
118
122
  'Deploy a pre-built Tamaro Core or customer configuration bundle to AWS S3',
119
123
  )
124
+ .option('--profile <profile>', 'AWS profile')
120
125
  .option('--ci', 'CI environment', false)
121
126
  .option(
122
127
  '--tag <tag>',
@@ -132,6 +137,7 @@ cli
132
137
  .description(
133
138
  'List deployments of Tamaro Core or a particular customer configuration',
134
139
  )
140
+ .option('--profile <profile>', 'AWS profile')
135
141
  .option('--ci', 'CI environment', false)
136
142
  .option(
137
143
  '--config <config>',
@@ -144,7 +150,9 @@ cli
144
150
  cli
145
151
  .command('deploy-email-config')
146
152
  .description("Deploy a widget's email configuration to AWS S3")
153
+ .option('--profile <profile>', 'AWS profile')
147
154
  .option('--ci', 'CI environment', false)
155
+ .option('--bucket <bucket>', 'AWS bucket for email configs')
148
156
  .action(async (options: DeployEmailConfigOptions) => {
149
157
  await deployEmailConfig(options)
150
158
  })
@@ -154,6 +162,8 @@ cli
154
162
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
155
163
  ;(async () => {
156
164
  try {
165
+ logTitle(`${pkg.name} ${pkg.version}\n`)
166
+
157
167
  await cli.parseAsync(process.argv)
158
168
  } catch (error: any) {
159
169
  if (error.signal === 'SIGINT' && error.signalDescription) {
@@ -1,5 +1,5 @@
1
1
  import {type DeployOptions} from 'commands/deploy'
2
- import {assertProfilesPresent, promptProfile} from 'lib/aws'
2
+ import {assertProfilesPresent, assertProfileValid, promptProfile} from 'lib/aws'
3
3
  import {halt, runCommandSync} from 'lib/command'
4
4
  import {CORE_CONFIG_NAME} from 'lib/constants'
5
5
  import {applyEnv, assertEnvValid} from 'lib/env'
@@ -33,15 +33,16 @@ export const build = async (
33
33
  ): Promise<void> => {
34
34
  const {env} = options
35
35
 
36
- assertOptionsValid(options)
37
36
  applyEnv(env)
38
37
 
39
- if (options.deploy && !options.ci) {
38
+ if (options.deploy && !options.profile && !options.ci) {
40
39
  assertProfilesPresent()
41
40
  options.profile = await promptProfile()
42
41
  }
43
42
 
44
- const flags = prepareFlags([], options).join(' ')
43
+ assertOptionsValid(options)
44
+
45
+ const flags = prepareFlags(options)
45
46
  const {ifCore} = getIfCoreFns()
46
47
  const paths = getPaths(ifCore)
47
48
  const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid())
@@ -82,7 +83,7 @@ export const build = async (
82
83
  ///////////////////////////////////////////////////////////////////////////////
83
84
 
84
85
  const assertOptionsValid = (options: BuildOptions & DeployOptions) => {
85
- const {localCore, https, deploy, env} = options
86
+ const {localCore, https, deploy, env, profile} = options
86
87
  const {ifCore} = getIfCoreFns()
87
88
 
88
89
  if (ifCore() && localCore) {
@@ -97,12 +98,17 @@ const assertOptionsValid = (options: BuildOptions & DeployOptions) => {
97
98
  assertCrtExists()
98
99
  }
99
100
 
101
+ if (profile) {
102
+ assertProfileValid(profile)
103
+ }
104
+
100
105
  assertEnvValid(env)
101
106
  }
102
107
 
103
108
  ///////////////////////////////////////////////////////////////////////////////
104
109
 
105
- const prepareFlags = (flags: string[], options: BuildOptions): string[] => {
110
+ const prepareFlags = (options: BuildOptions) => {
111
+ const flags: string[] = []
106
112
  const {localCore, analyze, https, nolint} = options
107
113
 
108
114
  if (localCore) {
@@ -121,5 +127,5 @@ const prepareFlags = (flags: string[], options: BuildOptions): string[] => {
121
127
  flags.push('--env nolint')
122
128
  }
123
129
 
124
- return flags
130
+ return flags.join(' ')
125
131
  }
@@ -1,21 +1,28 @@
1
1
  import {existsSync} from 'fs'
2
+ // eslint-disable-next-line import/no-named-as-default
3
+ import prompts from 'prompts'
2
4
  import {
3
5
  assertProfilesPresent,
6
+ assertProfileValid,
7
+ awsAuthenticate,
4
8
  type AwsOptions,
5
9
  prepareFlags,
6
- promptBucket,
7
10
  promptProfile,
8
- withAwsAuthenticate,
9
11
  } from 'lib/aws'
10
12
  import {halt, runCommandSync} from 'lib/command'
11
- import {AWS_S3_EMAIL_CONFIG_PROD_BUCKET} from 'lib/constants'
13
+ import {
14
+ AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD,
15
+ AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_STAGE,
16
+ } from 'lib/constants'
12
17
  import {logCommand, logDataTable, logTitle} from 'lib/logging'
13
18
  import {notify} from 'lib/notifier'
14
19
  import {getIfCoreFns, getPaths, getWidgetUuid} from 'lib/resolve'
15
20
 
16
21
  ///////////////////////////////////////////////////////////////////////////////
17
22
 
18
- export type DeployEmailConfigOptions = AwsOptions
23
+ export type DeployEmailConfigOptions = AwsOptions & {
24
+ bucket?: string
25
+ }
19
26
 
20
27
  ///////////////////////////////////////////////////////////////////////////////
21
28
 
@@ -29,18 +36,23 @@ export const deployEmailConfig = async (
29
36
  assertIsNotCore()
30
37
  assertEmailConfigPathExists(emailConfigPath)
31
38
 
32
- if (!options.ci) {
39
+ if (!options.profile && !options.ci) {
33
40
  assertProfilesPresent()
34
41
  options.profile = await promptProfile()
35
42
  }
36
43
 
37
- const bucket = options.ci
38
- ? AWS_S3_EMAIL_CONFIG_PROD_BUCKET
39
- : await promptBucket()
44
+ if (!options.bucket) {
45
+ options.bucket = options.ci
46
+ ? AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD
47
+ : await promptBucketTamaroEmailConfig()
48
+ }
49
+
50
+ assertOptionsValid(options)
51
+ awsAuthenticate(options)
40
52
 
41
- const flags = prepareFlags([], options).join(' ')
53
+ const flags = prepareFlags(options)
42
54
  const configName = getWidgetUuid()
43
- const deployUrl = `s3://${bucket}/${configName}`
55
+ const deployUrl = `s3://${options.bucket}/${configName}`
44
56
 
45
57
  const cmd = `
46
58
  aws s3 sync ${emailConfigPath} ${deployUrl}
@@ -54,7 +66,7 @@ export const deployEmailConfig = async (
54
66
  logCommand(cmd)
55
67
 
56
68
  try {
57
- withAwsAuthenticate(() => runCommandSync(cmd, {stdout: 'inherit'}), options)
69
+ runCommandSync(cmd, {stdout: 'inherit'})
58
70
  } catch (error: any) {
59
71
  halt(error.stderr)
60
72
  }
@@ -78,9 +90,23 @@ export const deployEmailConfig = async (
78
90
 
79
91
  ///////////////////////////////////////////////////////////////////////////////
80
92
 
93
+ const assertOptionsValid = (options: DeployEmailConfigOptions) => {
94
+ const {profile, bucket} = options
95
+
96
+ if (profile) {
97
+ assertProfileValid(profile)
98
+ }
99
+
100
+ if (bucket) {
101
+ assertBucketValid(bucket)
102
+ }
103
+ }
104
+
105
+ ///////////////////////////////////////////////////////////////////////////////
106
+
81
107
  const assertEmailConfigPathExists = (distPath: string) => {
82
108
  if (!existsSync(distPath)) {
83
- halt('Email config folder does not exists. Nothing to deploy.', 0)
109
+ halt('Email config folder does not exists. Nothing to deploy.')
84
110
  }
85
111
  }
86
112
 
@@ -93,3 +119,41 @@ const assertIsNotCore = () => {
93
119
  halt('You cannot deploy widget email configuration for Tamaro Core.')
94
120
  }
95
121
  }
122
+
123
+ ///////////////////////////////////////////////////////////////////////////////
124
+
125
+ const assertBucketValid = (bucket: string) => {
126
+ const buckets = [
127
+ AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_STAGE,
128
+ AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD,
129
+ ] as const
130
+
131
+ if (!buckets.includes(bucket as any)) {
132
+ halt('Invalid bucket name.')
133
+ }
134
+ }
135
+
136
+ ///////////////////////////////////////////////////////////////////////////////
137
+
138
+ const promptBucketTamaroEmailConfig = async (): Promise<string> => {
139
+ const buckets = [
140
+ {title: 'stage', value: AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_STAGE},
141
+ {title: 'prod', value: AWS_S3_BUCKET_TAMARO_EMAIL_CONFIG_PROD},
142
+ ]
143
+
144
+ const {bucket} = await prompts(
145
+ [
146
+ {
147
+ type: 'select',
148
+ name: 'bucket',
149
+ message: 'Select environment',
150
+ choices: buckets,
151
+ },
152
+ ],
153
+ {
154
+ onCancel: () => halt(),
155
+ },
156
+ )
157
+
158
+ return bucket
159
+ }
@@ -2,15 +2,16 @@ import {existsSync} from 'fs'
2
2
  import stripIndent from 'strip-indent'
3
3
  import {
4
4
  assertProfilesPresent,
5
+ assertProfileValid,
6
+ awsAuthenticate,
5
7
  type AwsOptions,
6
8
  prepareFlags,
7
9
  promptProfile,
8
- withAwsAuthenticate,
9
10
  } from 'lib/aws'
10
11
  import {halt, runCommandSync} from 'lib/command'
11
12
  import {
12
13
  AWS_CLOUDFRONT_DISTRIBUTION_ID,
13
- AWS_S3_BUCKET,
14
+ AWS_S3_BUCKET_TAMARO,
14
15
  CORE_CONFIG_NAME,
15
16
  } from 'lib/constants'
16
17
  import {logCommand, logDataTable, logTitle} from 'lib/logging'
@@ -29,24 +30,25 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
29
30
  const {ifCore} = getIfCoreFns()
30
31
  const paths = getPaths(ifCore)
31
32
 
32
- assertOptionsValid(options)
33
33
  assertDistPathExists(paths.appDist)
34
34
 
35
- if (!options.ci && !options.profile) {
35
+ if (!options.profile && !options.ci) {
36
36
  assertProfilesPresent()
37
37
  options.profile = await promptProfile()
38
38
  }
39
39
 
40
- const flags = prepareFlags([], options).join(' ')
40
+ assertOptionsValid(options)
41
+ awsAuthenticate(options)
42
+
43
+ const flags = prepareFlags(options)
41
44
  const {tag} = options
42
45
  const configName = ifCore(CORE_CONFIG_NAME, getWidgetUuid())
43
- const deployUrl = `s3://${AWS_S3_BUCKET}/${configName}/${tag}`
46
+ const deployUrl = `s3://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}`
44
47
  const entryFilename = ifCore('index.js', 'widget.js')
45
48
 
46
- /////////////////////////////////////////////////////////////////////////////
47
- // Sync all files except entrypoint (without deleting old files)
48
- /////////////////////////////////////////////////////////////////////////////
49
-
49
+ /**
50
+ * Sync all files except entrypoint (without deleting old files)
51
+ */
50
52
  const cmdSyncAll = `
51
53
  aws s3 sync ${paths.appDist} ${deployUrl}
52
54
  --acl public-read
@@ -58,18 +60,14 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
58
60
  logCommand(cmdSyncAll)
59
61
 
60
62
  try {
61
- withAwsAuthenticate(
62
- () => runCommandSync(cmdSyncAll, {stdout: 'inherit'}),
63
- options,
64
- )
63
+ runCommandSync(cmdSyncAll, {stdout: 'inherit'})
65
64
  } catch (error: any) {
66
65
  halt(error.stderr)
67
66
  }
68
67
 
69
- /////////////////////////////////////////////////////////////////////////////
70
- // Copy entrypoint
71
- /////////////////////////////////////////////////////////////////////////////
72
-
68
+ /**
69
+ * Copy entrypoint
70
+ */
73
71
  const cmdCpEntry = `
74
72
  aws s3 cp ${paths.appDist}/${entryFilename} ${deployUrl}/${entryFilename}
75
73
  --acl public-read
@@ -79,18 +77,14 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
79
77
  logCommand(cmdCpEntry)
80
78
 
81
79
  try {
82
- withAwsAuthenticate(
83
- () => runCommandSync(cmdCpEntry, {stdout: 'inherit'}),
84
- options,
85
- )
80
+ runCommandSync(cmdCpEntry, {stdout: 'inherit'})
86
81
  } catch (error: any) {
87
82
  halt(error.stderr)
88
83
  }
89
84
 
90
- /////////////////////////////////////////////////////////////////////////////
91
- // Invalidate cloudfront cache
92
- /////////////////////////////////////////////////////////////////////////////
93
-
85
+ /**
86
+ * Invalidate cloudfront cache
87
+ */
94
88
  const cmdInvalidateCache = `
95
89
  aws cloudfront create-invalidation
96
90
  --distribution-id ${AWS_CLOUDFRONT_DISTRIBUTION_ID}
@@ -102,15 +96,15 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
102
96
 
103
97
  try {
104
98
  // ignore output
105
- withAwsAuthenticate(() => runCommandSync(cmdInvalidateCache), options)
99
+ runCommandSync(cmdInvalidateCache)
106
100
  } catch (error: any) {
107
101
  halt(error.stderr)
108
102
  }
109
103
 
110
104
  /////////////////////////////////////////////////////////////////////////////
111
105
 
112
- const demoPage = `https://${AWS_S3_BUCKET}/${configName}/${tag}/index.html`
113
- const entryPoint = `https://${AWS_S3_BUCKET}/${configName}/${tag}/${entryFilename}`
106
+ const demoPage = `https://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}/index.html`
107
+ const entryPoint = `https://${AWS_S3_BUCKET_TAMARO}/${configName}/${tag}/${entryFilename}`
114
108
 
115
109
  logTitle(`\nBundle for "${configName}" is deployed with tag "${tag}".`)
116
110
  logDataTable({
@@ -135,7 +129,11 @@ export const deploy = async (options: DeployOptions): Promise<void> => {
135
129
  ///////////////////////////////////////////////////////////////////////////////
136
130
 
137
131
  const assertOptionsValid = (options: DeployOptions) => {
138
- const {tag} = options
132
+ const {profile, tag} = options
133
+
134
+ if (profile) {
135
+ assertProfileValid(profile)
136
+ }
139
137
 
140
138
  assertTagValid(tag)
141
139
  }
@@ -20,10 +20,10 @@ export type DevOptions = {
20
20
  export const dev = async (options: DevOptions): Promise<void> => {
21
21
  const {env} = options
22
22
 
23
- assertOptionsValid(options)
24
23
  applyEnv(env)
24
+ assertOptionsValid(options)
25
25
 
26
- const flags = (await prepareFlags([], options)).join(' ')
26
+ const flags = await prepareFlags(options)
27
27
  const {ifCore} = getIfCoreFns()
28
28
  const title = ifCore(
29
29
  'Running dev web-server for Tamaro Core …',
@@ -65,10 +65,8 @@ const assertOptionsValid = (options: DevOptions) => {
65
65
 
66
66
  ///////////////////////////////////////////////////////////////////////////////
67
67
 
68
- const prepareFlags = async (
69
- flags: string[],
70
- options: DevOptions,
71
- ): Promise<string[]> => {
68
+ const prepareFlags = async (options: DevOptions) => {
69
+ const flags: string[] = []
72
70
  const {localCore, port: defaultPort, https, nolint} = options
73
71
  const port = await getPortPromise({port: Number(defaultPort)})
74
72
 
@@ -86,5 +84,5 @@ const prepareFlags = async (
86
84
  flags.push('--env nolint')
87
85
  }
88
86
 
89
- return flags
87
+ return flags.join(' ')
90
88
  }