@raisenow/tamaro-cli 1.0.9 → 1.0.12

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.
@@ -0,0 +1,144 @@
1
+ import {createRequire} from 'module'
2
+ import {basename, dirname, join, relative, resolve} from 'path'
3
+ import {existsSync, realpathSync} from 'fs'
4
+ import {getIfUtils, IfUtils, IfUtilsFn} from 'webpack-config-utils'
5
+ import {logError} from 'lib/logging'
6
+ import stripIndent from 'strip-indent'
7
+ import chalk from 'chalk'
8
+
9
+ ///////////////////////////////////////////////////////////////////////////////
10
+
11
+ export type ResolveFn = (relativePath: string) => string
12
+
13
+ ///////////////////////////////////////////////////////////////////////////////
14
+
15
+ const require = createRequire(import.meta.url)
16
+ export const moduleFileExtensions = ['ts', 'tsx', 'js', 'jsx']
17
+ export const extensions = moduleFileExtensions.map((v) => `.${v}`)
18
+
19
+ ///////////////////////////////////////////////////////////////////////////////
20
+
21
+ const TAMARO_CORE_PACKAGE_NAMES = ['@raisenow/tamaro-core']
22
+ const TAMARO_CONFIGURATIONS_PACKAGE_NAMES = ['@raisenow/tamaro-configurations']
23
+
24
+ ///////////////////////////////////////////////////////////////////////////////
25
+
26
+ export const resolveApp: ResolveFn = (relativePath) =>
27
+ resolve(realpathSync(process.cwd()), relativePath)
28
+
29
+ ///////////////////////////////////////////////////////////////////////////////
30
+
31
+ // __dirname is "dist" in runtime
32
+ export const resolveOwn: ResolveFn = (relativePath) =>
33
+ resolve(__dirname, '..', relativePath)
34
+
35
+ ///////////////////////////////////////////////////////////////////////////////
36
+
37
+ export const resolveModule = (resolveFn: ResolveFn, filePath: string) => {
38
+ const extension = moduleFileExtensions.find((extension) =>
39
+ existsSync(resolveFn(`${filePath}.${extension}`)),
40
+ )
41
+
42
+ if (extension) {
43
+ return resolveFn(`${filePath}.${extension}`)
44
+ }
45
+
46
+ return resolveFn(`${filePath}.js`)
47
+ }
48
+
49
+ ///////////////////////////////////////////////////////////////////////////////
50
+
51
+ export const resolveBin = (name: string) => {
52
+ const pkgPath = require.resolve(`${name}/package.json`)
53
+ const {bin} = require(pkgPath)
54
+ const dir = dirname(pkgPath)
55
+ const binPath = typeof bin === 'object' ? bin[name] : bin
56
+
57
+ return join(dir, binPath)
58
+ }
59
+
60
+ ///////////////////////////////////////////////////////////////////////////////
61
+
62
+ export const getWidgetUuid = () => basename(resolveApp('.'))
63
+
64
+ ///////////////////////////////////////////////////////////////////////////////
65
+
66
+ export const getPaths = (ifCore: IfUtilsFn) => {
67
+ return ifCore(
68
+ {
69
+ app: resolveApp('.'),
70
+ appEntry: resolveModule(resolveApp, 'src/index'),
71
+ appDist: resolveApp('dist'),
72
+ appNodeModules: resolveApp('node_modules'),
73
+ appTsConfig: resolveApp('tsconfig.json'),
74
+ appHtml: resolveApp('src/*.html'),
75
+ appEnv: resolveApp('.env'),
76
+ appTailwindConfig: resolveApp('tailwind.config.js'),
77
+ },
78
+ {
79
+ app: resolveApp('.'),
80
+ appEntry: resolveModule(resolveApp, 'widget'),
81
+ appDist: resolveApp(`../../dist/${getWidgetUuid()}`),
82
+ appNodeModules: resolveApp('../../node_modules'),
83
+ appTsConfig: resolveApp('tsconfig.json'),
84
+ appHtml: resolveApp('*.html'),
85
+ appEnv: resolveApp('.env'),
86
+ appTailwindConfig: undefined,
87
+ },
88
+ )
89
+ }
90
+
91
+ ///////////////////////////////////////////////////////////////////////////////
92
+
93
+ type Paths = {
94
+ [key: string]: string | undefined
95
+ }
96
+
97
+ export const getRelativePaths = (paths: Paths): Paths => {
98
+ const relativePaths: Paths = {}
99
+
100
+ for (const [type, absPath] of Object.entries(paths)) {
101
+ if (absPath) {
102
+ relativePaths[type] = relative('./', absPath) || '.'
103
+ }
104
+ }
105
+
106
+ return relativePaths
107
+ }
108
+
109
+ ///////////////////////////////////////////////////////////////////////////////
110
+
111
+ export const getIfCoreFns = (): IfUtils => {
112
+ const corePkgPath = resolveApp('package.json')
113
+ const configsPkgPath = resolveApp('../../package.json')
114
+
115
+ if (existsSync(corePkgPath)) {
116
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
117
+ const {name} = require(corePkgPath)
118
+
119
+ if (TAMARO_CORE_PACKAGE_NAMES.includes(name)) {
120
+ return getIfUtils({core: true}, ['core'])
121
+ }
122
+ }
123
+
124
+ if (existsSync(configsPkgPath)) {
125
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
126
+ const {name} = require(configsPkgPath)
127
+
128
+ if (TAMARO_CONFIGURATIONS_PACKAGE_NAMES.includes(name)) {
129
+ return getIfUtils({core: false}, ['core'])
130
+ }
131
+ }
132
+
133
+ logError(
134
+ stripIndent(`\
135
+ You must run "npx @raisenow/tamaro-cli" commands from:
136
+ 1. Root of "${chalk.bold(TAMARO_CORE_PACKAGE_NAMES[0])}" package folder.
137
+ 2. Root of particular customer configuration folder of "${chalk.bold(
138
+ TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0],
139
+ )}" package.
140
+ You are currently in "${chalk.bold(realpathSync(process.cwd()))}".
141
+ `),
142
+ )
143
+ process.exit(1)
144
+ }
@@ -1,15 +1,10 @@
1
+ import {createRequire} from 'module'
1
2
  import {basename, dirname} from 'path'
2
3
  import {existsSync} from 'fs'
3
4
  import glob from 'glob'
4
5
  import {getIfUtils, removeEmpty} from 'webpack-config-utils'
5
- import webpack, {
6
- Configuration,
7
- DefinePlugin,
8
- IgnorePlugin,
9
- ProgressPlugin,
10
- RuleSetUseItem,
11
- } from 'webpack'
12
- import {getPortPromise} from 'portfinder'
6
+ import webpack from 'webpack'
7
+ import type {Configuration, RuleSetUseItem} from 'webpack'
13
8
  import {TsconfigPathsPlugin} from 'tsconfig-paths-webpack-plugin'
14
9
  import {CleanWebpackPlugin} from 'clean-webpack-plugin'
15
10
  import HtmlWebpackPlugin from 'html-webpack-plugin'
@@ -22,21 +17,21 @@ import {} from 'webpack-dev-server'
22
17
  import ESLintPlugin from 'eslint-webpack-plugin'
23
18
  import CopyPlugin from 'copy-webpack-plugin'
24
19
  import StatoscopeWebpackPlugin from '@statoscope/webpack-plugin'
25
- import InterpolateHtmlPlugin from 'lib/InterpolateHtmlPlugin'
20
+ import {InterpolateHtmlPlugin} from 'lib/InterpolateHtmlPlugin'
26
21
  import {
27
22
  extensions,
28
- getEnvVars,
29
23
  getIfCoreFns,
30
24
  getPaths,
31
25
  getRelativePaths,
32
- logDataTable,
33
26
  moduleFileExtensions,
34
27
  resolveApp,
35
- resolveOwn,
36
- } from 'lib/helpers'
28
+ } from 'lib/resolve'
29
+ import {getEnvVars} from 'lib/env'
30
+ import {logDataTable, logTitle} from 'lib/logging'
37
31
 
38
32
  ///////////////////////////////////////////////////////////////////////////////
39
33
 
34
+ const require = createRequire(import.meta.url)
40
35
  const imageInlineSizeLimit = 0
41
36
  // const imageInlineSizeLimit = 8 * 1024 // 8kb
42
37
 
@@ -51,12 +46,14 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
51
46
  const appHtmlFiles = glob.sync(paths.appHtml)
52
47
  const envVars = getEnvVars(paths.appEnv, ifMin, ifCore, ifLocalCore)
53
48
  const {ifHmr} = getIfUtils({hmr: process.env.HMR_ENABLED === 'true'}, ['hmr'])
54
- const port = await getPortPromise({port: 1234})
55
49
  const useTailwind =
56
50
  ifCore() && paths.appTailwindConfig && existsSync(paths.appTailwindConfig)
57
51
 
58
- logDataTable(getRelativePaths(paths), 'Paths')
59
- logDataTable(envVars.raw, 'Environment variables')
52
+ logTitle('Paths:')
53
+ logDataTable(getRelativePaths(paths))
54
+
55
+ logTitle('Environment variables:')
56
+ logDataTable(envVars.raw)
60
57
 
61
58
  const getCssLoaders = (cssOptions: any = {}): RuleSetUseItem[] => {
62
59
  return removeEmpty([
@@ -121,7 +118,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
121
118
  }),
122
119
  ],
123
120
  },
124
- entry: [resolveOwn('src/lib/polyfills.js'), paths.appEntry],
121
+ entry: paths.appEntry,
125
122
  output: {
126
123
  publicPath: 'auto',
127
124
  path: ifMin(paths.appDist, undefined),
@@ -321,7 +318,6 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
321
318
  devtool: ifMin(false, 'cheap-module-source-map'),
322
319
 
323
320
  devServer: {
324
- port,
325
321
  static: false,
326
322
  historyApiFallback: {
327
323
  disableDotRule: true,
@@ -347,7 +343,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
347
343
  },
348
344
 
349
345
  plugins: removeEmpty([
350
- new ProgressPlugin(),
346
+ new webpack.ProgressPlugin(),
351
347
  new ESLintPlugin({
352
348
  extensions: moduleFileExtensions,
353
349
  eslintPath: require.resolve('eslint'),
@@ -384,7 +380,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
384
380
  ),
385
381
 
386
382
  new InterpolateHtmlPlugin(envVars.raw),
387
- new DefinePlugin(envVars.stringified),
383
+ new webpack.DefinePlugin(envVars.stringified),
388
384
 
389
385
  new ForkTsCheckerWebpackPlugin({
390
386
  typescript: {
@@ -415,7 +411,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
415
411
  }),
416
412
  ),
417
413
 
418
- new IgnorePlugin({
414
+ new webpack.IgnorePlugin({
419
415
  resourceRegExp: /^\.\/locale$/,
420
416
  contextRegExp: /moment$/,
421
417
  }),
@@ -424,12 +420,7 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
424
420
 
425
421
  ifMin() && ifCore()
426
422
  ? new CopyPlugin({
427
- patterns: [
428
- {
429
- from: 'docs',
430
- to: 'docs',
431
- },
432
- ],
423
+ patterns: ['README.md', 'readme.html'],
433
424
  })
434
425
  : undefined,
435
426
 
@@ -443,6 +434,11 @@ const getWebpackConfig = async (env: any): Promise<Configuration> => {
443
434
  })
444
435
  : undefined,
445
436
  ]),
437
+
438
+ infrastructureLogging: {
439
+ stream: process.stdout,
440
+ appendOnly: false,
441
+ },
446
442
  }
447
443
 
448
444
  // console.log(util.inspect(config, {showHidden: false, depth: null}))
package/tsconfig.json CHANGED
@@ -5,7 +5,7 @@
5
5
  /* Basic Options */
6
6
  // "incremental": true, /* Enable incremental compilation */
7
7
  "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
8
- "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
8
+ "module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
9
9
  // "lib": [], /* Specify library files to be included in the compilation. */
10
10
  "allowJs": true, /* Allow javascript files to be compiled. */
11
11
  // "checkJs": true, /* Report errors in .js files. */
@@ -1,356 +0,0 @@
1
- import {basename, relative, resolve} from 'path'
2
- import {existsSync, realpathSync} from 'fs'
3
- import chalk from 'chalk'
4
- import notifier from 'node-notifier'
5
- import {getIfUtils, IfUtils, IfUtilsFn} from 'webpack-config-utils'
6
- import columnify from 'columnify'
7
- import boxen from 'boxen'
8
- import {expand as dotenvExpand} from 'dotenv-expand'
9
- import {config as dotenvConfig} from 'dotenv'
10
- import open from 'open'
11
- import stripIndent from 'strip-indent'
12
- import {commandSync, ExecaSyncReturnValue, SyncOptions} from 'execa'
13
-
14
- ///////////////////////////////////////////////////////////////////////////////
15
-
16
- export type ResolveFn = (relativePath: string) => string
17
-
18
- export type EnvVars = {
19
- [key: string]: string | undefined
20
- }
21
-
22
- ///////////////////////////////////////////////////////////////////////////////
23
- // Supported packages
24
- ///////////////////////////////////////////////////////////////////////////////
25
-
26
- const TAMARO_CORE_PACKAGE_NAMES = ['@raisenow/tamaro-core']
27
- const TAMARO_CONFIGURATIONS_PACKAGE_NAMES = ['@raisenow/tamaro-configurations']
28
-
29
- ///////////////////////////////////////////////////////////////////////////////
30
-
31
- export const getIfCoreFns = (): IfUtils => {
32
- const corePkgPath = resolveApp('package.json')
33
- const configsPkgPath = resolveApp('../../package.json')
34
-
35
- if (existsSync(corePkgPath)) {
36
- // eslint-disable-next-line @typescript-eslint/no-var-requires
37
- const {name} = require(corePkgPath)
38
-
39
- if (TAMARO_CORE_PACKAGE_NAMES.includes(name)) {
40
- return getIfUtils({core: true}, ['core'])
41
- }
42
- }
43
-
44
- if (existsSync(configsPkgPath)) {
45
- // eslint-disable-next-line @typescript-eslint/no-var-requires
46
- const {name} = require(configsPkgPath)
47
-
48
- if (TAMARO_CONFIGURATIONS_PACKAGE_NAMES.includes(name)) {
49
- return getIfUtils({core: false}, ['core'])
50
- }
51
- }
52
-
53
- logError(
54
- stripIndent(`\
55
- You must run "npx @raisenow/tamaro-cli" commands from:
56
- 1. Root of "${chalk.bold(TAMARO_CORE_PACKAGE_NAMES[0])}" package folder.
57
- 2. Root of particular customer configuration folder of "${chalk.bold(
58
- TAMARO_CONFIGURATIONS_PACKAGE_NAMES[0],
59
- )}" package.
60
- You are currently in "${chalk.bold(realpathSync(process.cwd()))}".
61
- `),
62
- )
63
- process.exit(1)
64
- }
65
-
66
- ///////////////////////////////////////////////////////////////////////////////
67
- // Extensions
68
- ///////////////////////////////////////////////////////////////////////////////
69
-
70
- export const moduleFileExtensions = ['ts', 'tsx', 'js', 'jsx']
71
- export const extensions = moduleFileExtensions.map((v) => `.${v}`)
72
-
73
- ///////////////////////////////////////////////////////////////////////////////
74
- // Paths
75
- ///////////////////////////////////////////////////////////////////////////////
76
-
77
- export const resolveApp: ResolveFn = (relativePath) =>
78
- resolve(realpathSync(process.cwd()), relativePath)
79
-
80
- ///////////////////////////////////////////////////////////////////////////////
81
-
82
- // __dirname is "dist" in runtime
83
- export const resolveOwn: ResolveFn = (relativePath) =>
84
- resolve(__dirname, '..', relativePath)
85
-
86
- ///////////////////////////////////////////////////////////////////////////////
87
-
88
- export const resolveModule = (resolveFn: ResolveFn, filePath: string) => {
89
- const extension = moduleFileExtensions.find((extension) =>
90
- existsSync(resolveFn(`${filePath}.${extension}`)),
91
- )
92
-
93
- if (extension) {
94
- return resolveFn(`${filePath}.${extension}`)
95
- }
96
-
97
- return resolveFn(`${filePath}.js`)
98
- }
99
-
100
- ///////////////////////////////////////////////////////////////////////////////
101
-
102
- export const getWidgetUuid = () => basename(resolveApp('.'))
103
-
104
- ///////////////////////////////////////////////////////////////////////////////
105
-
106
- export const getPaths = (ifCore: IfUtilsFn) => {
107
- return ifCore(
108
- {
109
- app: resolveApp('.'),
110
- appEntry: resolveModule(resolveApp, 'src/index'),
111
- appDist: resolveApp('dist'),
112
- appNodeModules: resolveApp('node_modules'),
113
- appTsConfig: resolveApp('tsconfig.json'),
114
- appHtml: resolveApp('src/*.html'),
115
- appEnv: resolveApp('.env'),
116
- appTailwindConfig: resolveApp('tailwind.config.js'),
117
- },
118
- {
119
- app: resolveApp('.'),
120
- appEntry: resolveModule(resolveApp, 'widget'),
121
- appDist: resolveApp(`../../dist/${getWidgetUuid()}`),
122
- appNodeModules: resolveApp('../../node_modules'),
123
- appTsConfig: resolveApp('tsconfig.json'),
124
- appHtml: resolveApp('*.html'),
125
- appEnv: resolveApp('.env'),
126
- appTailwindConfig: undefined,
127
- },
128
- )
129
- }
130
-
131
- ///////////////////////////////////////////////////////////////////////////////
132
-
133
- type Paths = {
134
- [key: string]: string | undefined
135
- }
136
-
137
- export const getRelativePaths = (paths: Paths): Paths => {
138
- const relativePaths: Paths = {}
139
-
140
- for (const [type, absPath] of Object.entries(paths)) {
141
- if (absPath) {
142
- relativePaths[type] = relative('./', absPath) || '.'
143
- }
144
- }
145
-
146
- return relativePaths
147
- }
148
-
149
- ///////////////////////////////////////////////////////////////////////////////
150
- // Env vars
151
- ///////////////////////////////////////////////////////////////////////////////
152
-
153
- export const getEnvVars = (
154
- filePath: string,
155
- ifMin: IfUtilsFn,
156
- ifCore: IfUtilsFn,
157
- ifLocalCore: IfUtilsFn,
158
- ) => {
159
- dotenvExpand(dotenvConfig({path: filePath}))
160
-
161
- process.env.NODE_ENV ??= ifMin('production', 'development')
162
- process.env.BABEL_ENV ??= ifMin('production', 'development')
163
- process.env.EXPOSE_VAR ??= ifCore('rnw.tamaroCore', 'rnw.tamaro')
164
- process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET ??= ifCore(
165
- 'rnw-tamaro-core',
166
- 'rnw-tamaro',
167
- )
168
- process.env.WEBPACK_UNIQUE_NAME ??= ifCore('RnwTamaroCore', 'RnwTamaro')
169
-
170
- // HMR doesn't work in ie11, it breaks everything.
171
- // If you want to run dev-server and test in ie11, set HMR_ENABLED to 'false'
172
- process.env.HMR_ENABLED ??= ifMin('false', 'true')
173
-
174
- if (ifCore()) {
175
- process.env.PRODUCT_NAME = 'tamaro'
176
-
177
- const corePkgPath = resolveApp('package.json')
178
- // eslint-disable-next-line @typescript-eslint/no-var-requires
179
- const {version} = require(corePkgPath)
180
-
181
- process.env.PRODUCT_VERSION = version
182
- }
183
-
184
- if (!ifCore()) {
185
- process.env.WIDGET_UUID = getWidgetUuid()
186
-
187
- if (ifLocalCore()) {
188
- process.env.CORE_URL = `http://0.0.0.0:1234/index.js`
189
- } else {
190
- let version = process.env.CORE_VERSION
191
- version = version ? `@${version}` : ''
192
-
193
- process.env.CORE_URL ??= `https://cdn.jsdelivr.net/npm/@raisenow/tamaro-core${version}/dist/index.js`
194
- }
195
- }
196
-
197
- // var names which will be exposed along with "PUBLIC_*" var names
198
- const varNames = [
199
- // common
200
- 'NODE_ENV',
201
- 'BABEL_ENV',
202
- 'EXPOSE_VAR',
203
- 'ELEMENT_ATTRIBUTE_DATA_WIDGET',
204
- 'WEBPACK_UNIQUE_NAME',
205
-
206
- // core
207
- 'PRODUCT_NAME',
208
- 'PRODUCT_VERSION',
209
-
210
- // config
211
- 'WIDGET_UUID',
212
- 'CORE_URL',
213
- 'CORE_VERSION', // must be explicitly specified in each config
214
- 'IS_CREDIT_CARD_IFRAME',
215
-
216
- // // todo: Environment variables for twint-qr-base
217
- // 'EPMS_ENV',
218
- // 'SOLUTION_CONFIG_BASE_URL',
219
- // 'SHORT_ID_RESOLUTION_URL',
220
- // 'HANDSHAKE_RESOLUTION_URL',
221
- // 'TWINT_CHECKOUT_PAGE',
222
- ]
223
-
224
- // Collect all vars which names start from "PUBLIC_" or present in "varNames" array
225
- const raw = Object.keys(process.env)
226
- .filter((key) => /^PUBLIC_/.test(key) || varNames.includes(key))
227
- .reduce<EnvVars>((env, key) => {
228
- env[key] = process.env[key]
229
-
230
- return env
231
- }, {})
232
-
233
- // Stringify all values so we can feed into webpack DefinePlugin
234
- const stringified = {
235
- 'process.env': Object.keys(raw).reduce<EnvVars>((env, key) => {
236
- env[key] = JSON.stringify(raw[key])
237
-
238
- return env
239
- }, {}),
240
- }
241
-
242
- return {raw, stringified}
243
- }
244
-
245
- ///////////////////////////////////////////////////////////////////////////////
246
- // Other
247
- ///////////////////////////////////////////////////////////////////////////////
248
-
249
- export const delay = (ms: number) =>
250
- new Promise((resolve) => setTimeout(resolve, ms))
251
-
252
- ///////////////////////////////////////////////////////////////////////////////
253
-
254
- export const logTitle = (title: string) => {
255
- console.log(`\n${chalk.bold(title)}`)
256
- }
257
-
258
- ///////////////////////////////////////////////////////////////////////////////
259
-
260
- export const logError = (message?: string) => {
261
- if (message) {
262
- console.log(chalk.red(message))
263
- }
264
- }
265
-
266
- ///////////////////////////////////////////////////////////////////////////////
267
-
268
- export const fail = (message?: string) => {
269
- logError(message)
270
- process.exit(1)
271
- }
272
-
273
- ///////////////////////////////////////////////////////////////////////////////
274
-
275
- export const logCommand = (command: string): void => {
276
- console.log(chalk.dim(stripIndent(command)))
277
- }
278
-
279
- ///////////////////////////////////////////////////////////////////////////////
280
-
281
- export const prepareCommand = (command: string): string => {
282
- return command
283
- .replace(/\n/gm, ' ')
284
- .replace(/[ \t]{2,}/gm, ' ')
285
- .trim()
286
- }
287
-
288
- ///////////////////////////////////////////////////////////////////////////////
289
-
290
- export const runCommandSync = (
291
- command: string,
292
- options?: SyncOptions,
293
- ): ExecaSyncReturnValue => {
294
- return commandSync(prepareCommand(command), options)
295
- }
296
-
297
- ///////////////////////////////////////////////////////////////////////////////
298
-
299
- export const logDataTable = (
300
- vars: {[key: string]: string | undefined},
301
- title?: string,
302
- ): void => {
303
- logTable(columnify(vars, {showHeaders: false}), title)
304
- }
305
-
306
- ///////////////////////////////////////////////////////////////////////////////
307
-
308
- export const logTable = (text: string, title?: string): void => {
309
- let out = ''
310
- const boxTitle = title ? chalk.bold(`${title}`) : undefined
311
-
312
- if (boxTitle) {
313
- out += `${boxTitle}\n`
314
- }
315
-
316
- out += text
317
-
318
- console.log(
319
- boxen(out, {
320
- margin: 0,
321
- padding: {
322
- top: 0,
323
- right: 1,
324
- bottom: 0,
325
- left: 1,
326
- },
327
- borderColor: 'green',
328
- }),
329
- )
330
- }
331
-
332
- ///////////////////////////////////////////////////////////////////////////////
333
-
334
- export type NotifyArgs = {
335
- title: string
336
- message: string
337
- target?: string
338
- }
339
-
340
- export const notify = (args: NotifyArgs): void => {
341
- const {title, message, target} = args
342
-
343
- notifier.notify({
344
- title,
345
- message,
346
- contentImage: 'https://assets.raisenow.io/favicon.png',
347
- sound: 'Funk',
348
- timeout: 30,
349
- })
350
-
351
- if (target) {
352
- notifier.on('click', () => {
353
- open(target)
354
- })
355
- }
356
- }
@@ -1,8 +0,0 @@
1
- import 'core-js/stable'
2
- // import 'core-js/features/promise'
3
- // import 'core-js/features/symbol'
4
- // import 'core-js/features/object/assign'
5
- // import 'core-js/features/string/match-all'
6
- import 'element-closest/browser.js'
7
- import 'unfetch/polyfill'
8
- import 'current-script-polyfill'