@adobe/helix-deploy 4.14.0 → 5.0.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,36 @@
1
+ # [5.0.0](https://github.com/adobe/helix-deploy/compare/v4.15.1...v5.0.0) (2021-12-02)
2
+
3
+
4
+ ### Features
5
+
6
+ * convert to ESM ([2946721](https://github.com/adobe/helix-deploy/commit/294672121135f32495cc48e58f636553b3473489))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * exported APIs only available through ESM
12
+
13
+ ## [4.15.1](https://github.com/adobe/helix-deploy/compare/v4.15.0...v4.15.1) (2021-11-20)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **deps:** update external fixes ([21e2af6](https://github.com/adobe/helix-deploy/commit/21e2af69186b80607747d390aa4f98507b02e070))
19
+
20
+ # [4.15.0](https://github.com/adobe/helix-deploy/compare/v4.14.1...v4.15.0) (2021-11-20)
21
+
22
+
23
+ ### Features
24
+
25
+ * improve development server setup ([#338](https://github.com/adobe/helix-deploy/issues/338)) ([9d2b44a](https://github.com/adobe/helix-deploy/commit/9d2b44a6a8d14953fe351dd0b8362ebdfd4a9a6b))
26
+
27
+ ## [4.14.1](https://github.com/adobe/helix-deploy/compare/v4.14.0...v4.14.1) (2021-11-15)
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * update package in gateway is missing dicts ([854b87e](https://github.com/adobe/helix-deploy/commit/854b87e929dcbdc22bbc33d03f60dcf3dcd82a7b))
33
+
1
34
  # [4.14.0](https://github.com/adobe/helix-deploy/compare/v4.13.0...v4.14.0) (2021-11-12)
2
35
 
3
36
 
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "4.14.0",
3
+ "version": "5.0.0",
4
4
  "description": "Library and Commandline Tools to build and deploy OpenWhisk Actions",
5
5
  "license": "Apache-2.0",
6
+ "homepage": "https://github.com/adobe/helix-deploy#readme",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "https://github.com/adobe/helix-deploy.git"
@@ -15,15 +16,17 @@
15
16
  "serverless"
16
17
  ],
17
18
  "main": "index.js",
19
+ "type": "module",
18
20
  "bin": {
19
21
  "hedy": "src/index.js"
20
22
  },
21
23
  "scripts": {
22
24
  "lint": "eslint .",
23
- "test": "nyc mocha -i -g Integration",
24
- "test-ci": "npm run lint && nyc mocha -i -g Integration && codecov",
25
- "integration-ci": "nyc mocha --reporter-options=configFile=.mocha-multi.json -g Integration && codecov",
26
- "semantic-release": "semantic-release"
25
+ "test": "c8 mocha -i -g Integration",
26
+ "test-ci": "npm run lint && c8 mocha -i -g Integration && codecov",
27
+ "integration-ci": "c8 mocha -g Integration && codecov",
28
+ "semantic-release": "semantic-release",
29
+ "prepare": "husky install"
27
30
  },
28
31
  "mocha": {
29
32
  "reporter": "mocha-multi-reporters",
@@ -36,19 +39,19 @@
36
39
  "dependencies": {
37
40
  "@adobe/fastly-native-promises": "2.0.0",
38
41
  "@adobe/helix-fetch": "3.0.0",
39
- "@aws-sdk/client-apigatewayv2": "3.40.0",
40
- "@aws-sdk/client-lambda": "3.40.0",
41
- "@aws-sdk/client-s3": "3.40.0",
42
- "@aws-sdk/client-secrets-manager": "3.40.0",
43
- "@aws-sdk/client-ssm": "3.40.0",
42
+ "@aws-sdk/client-apigatewayv2": "3.42.0",
43
+ "@aws-sdk/client-lambda": "3.42.0",
44
+ "@aws-sdk/client-s3": "3.42.0",
45
+ "@aws-sdk/client-secrets-manager": "3.42.0",
46
+ "@aws-sdk/client-ssm": "3.42.0",
44
47
  "@azure/arm-appservice": "9.0.0",
45
48
  "@azure/ms-rest-nodeauth": "3.1.0",
46
- "@fastly/js-compute": "0.2.0",
49
+ "@fastly/js-compute": "0.2.1",
47
50
  "@google-cloud/functions": "1.2.0",
48
51
  "@google-cloud/secret-manager": "3.10.1",
49
- "@google-cloud/storage": "5.15.5",
50
- "@rollup/plugin-alias": "3.1.6",
51
- "@rollup/plugin-commonjs": "21.0.0",
52
+ "@google-cloud/storage": "5.16.0",
53
+ "@rollup/plugin-alias": "3.1.8",
54
+ "@rollup/plugin-commonjs": "21.0.1",
52
55
  "@rollup/plugin-json": "4.1.0",
53
56
  "@rollup/plugin-node-resolve": "13.0.6",
54
57
  "archiver": "5.3.0",
@@ -60,13 +63,13 @@
60
63
  "fs-extra": "10.0.0",
61
64
  "get-stream": "6.0.1",
62
65
  "isomorphic-git": "1.10.1",
63
- "openwhisk": "3.21.4",
66
+ "openwhisk": "3.21.5",
64
67
  "proxyquire": "2.1.3",
65
- "rollup": "2.58.0",
68
+ "rollup": "2.60.1",
66
69
  "rollup-plugin-terser": "7.0.2",
67
70
  "semver": "7.3.5",
68
71
  "tar": "6.1.11",
69
- "webpack": "5.62.1",
72
+ "webpack": "5.64.4",
70
73
  "yargs": "17.2.1"
71
74
  },
72
75
  "devDependencies": {
@@ -76,20 +79,20 @@
76
79
  "@adobe/helix-universal-logger": "2.0.0",
77
80
  "@semantic-release/changelog": "6.0.1",
78
81
  "@semantic-release/git": "10.0.1",
82
+ "c8": "7.10.0",
79
83
  "chai": "4.3.4",
80
84
  "chai-http": "4.3.0",
81
85
  "codecov": "3.8.3",
82
- "eslint": "8.2.0",
86
+ "eslint": "8.3.0",
83
87
  "eslint-plugin-header": "3.1.1",
84
- "eslint-plugin-import": "2.25.2",
85
- "ghooks": "2.0.4",
86
- "lint-staged": "11.2.6",
88
+ "eslint-plugin-import": "2.25.3",
89
+ "husky": "7.0.4",
90
+ "lint-staged": "12.1.2",
87
91
  "mocha": "9.1.3",
88
92
  "mocha-junit-reporter": "2.0.2",
89
93
  "mocha-multi-reporters": "1.5.1",
90
- "nock": "13.1.4",
91
- "nyc": "15.1.0",
92
- "semantic-release": "18.0.0",
94
+ "nock": "13.2.1",
95
+ "semantic-release": "18.0.1",
93
96
  "sinon": "12.0.1",
94
97
  "yauzl": "2.10.0"
95
98
  },
@@ -98,11 +101,5 @@
98
101
  },
99
102
  "lint-staged": {
100
103
  "*.js": "eslint"
101
- },
102
- "config": {
103
- "ghooks": {
104
- "pre-commit": "npx lint-staged"
105
- }
106
- },
107
- "homepage": "https://github.com/adobe/helix-deploy#readme"
104
+ }
108
105
  }
@@ -11,15 +11,15 @@
11
11
  */
12
12
  /* eslint-disable no-await-in-loop */
13
13
 
14
- const path = require('path');
15
- const fs = require('fs');
16
- const fse = require('fs-extra');
17
- const chalk = require('chalk');
18
- const git = require('isomorphic-git');
19
- const WebpackBundler = require('./bundler/WebpackBundler');
20
- const EdgeBundler = require('./bundler/EdgeBundler');
21
- const RollupBundler = require('./bundler/RollupBundler');
22
- const { version } = require('../package.json');
14
+ import path from 'path';
15
+ import fs from 'fs';
16
+ import fse from 'fs-extra';
17
+ import chalk from 'chalk';
18
+ import git from 'isomorphic-git';
19
+ import WebpackBundler from './bundler/WebpackBundler.js';
20
+ import EdgeBundler from './bundler/EdgeBundler.js';
21
+ import RollupBundler from './bundler/RollupBundler.js';
22
+ import pkgJson from './package.cjs';
23
23
 
24
24
  const Bundlers = {
25
25
  node: {
@@ -62,7 +62,7 @@ async function getCurrentRevision(dir) {
62
62
  }
63
63
  }
64
64
 
65
- module.exports = class ActionBuilder {
65
+ export default class ActionBuilder {
66
66
  /**
67
67
  * Iterates the given params and resolves potential file references.
68
68
  * @param {object} params the params
@@ -372,7 +372,7 @@ module.exports = class ActionBuilder {
372
372
 
373
373
  async _run() {
374
374
  const { cfg } = this;
375
- cfg.log.info(chalk`{grey universal-action-builder v${version}}`);
375
+ cfg.log.info(chalk`{grey universal-action-builder v${pkgJson.version}}`);
376
376
  await this.validate();
377
377
  await this.validateAdditionalTasks();
378
378
  await this.validateBundlers();
@@ -423,29 +423,32 @@ module.exports = class ActionBuilder {
423
423
  await this.runCleanup();
424
424
  }
425
425
 
426
+ // update gateway
426
427
  if (this._gateways.fastly && this._gateways.fastly.ready()) {
427
- await this.validateDeployers();
428
- Object.values(this._deployers).forEach((d) => {
429
- this._gateways.fastly.withDeployer(d);
430
- });
428
+ Object.values(this._deployers)
429
+ .filter((deployer) => !deployer.noGatewayBackend)
430
+ .forEach((deplyer) => {
431
+ this._gateways.fastly.withDeployer(deplyer);
432
+ });
431
433
 
432
- this._gateways.fastly.init();
433
- await this._gateways.fastly.deploy();
434
- }
434
+ const updateLinks = cfg.links && cfg.links.length;
435
+ const updatePackage = cfg.updatePackage && cfg.packageParams && cfg.packageToken;
435
436
 
436
- if (this._gateways.fastly
437
- && this._gateways.fastly.updateable()
438
- && cfg.links && cfg.links.length) {
439
- await this.validateDeployers();
440
- this._gateways.fastly.init();
441
- await this._gateways.fastly.updateLinks(cfg.links, cfg.version);
442
- }
437
+ // links and package also need a deployed gateway
438
+ if ((updateLinks || updatePackage || cfg.deploy)) {
439
+ this._gateways.fastly.init();
440
+ if (this._gateways.fastly.canDeploy()) {
441
+ await this._gateways.fastly.deploy();
442
+ }
443
+ }
444
+
445
+ if (updateLinks) {
446
+ await this._gateways.fastly.updateLinks(cfg.links, cfg.version);
447
+ }
443
448
 
444
- if (this._gateways.fastly
445
- && this._gateways.fastly.updateable()
446
- && cfg.packageParams && cfg.packageToken) {
447
- this._gateways.fastly.init();
448
- await this._gateways.fastly.updatePackage();
449
+ if (updatePackage) {
450
+ await this._gateways.fastly.updatePackage();
451
+ }
449
452
  }
450
453
 
451
454
  if (cfg.deploy) {
@@ -463,4 +466,4 @@ module.exports = class ActionBuilder {
463
466
  await this.runAdditionalTasks();
464
467
  return '';
465
468
  }
466
- };
469
+ }
package/src/BaseConfig.js CHANGED
@@ -9,11 +9,11 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- const crypto = require('crypto');
13
- const path = require('path');
14
- const fse = require('fs-extra');
15
- const chalk = require('chalk');
16
- const dotenv = require('dotenv');
12
+ import crypto from 'crypto';
13
+ import path from 'path';
14
+ import fse from 'fs-extra';
15
+ import chalk from 'chalk';
16
+ import dotenv from 'dotenv';
17
17
 
18
18
  // eslint-disable-next-line no-template-curly-in-string
19
19
  const DEFAULT_ACTION_FORMAT = '/${packageName}/${baseName}/${version}';
@@ -41,7 +41,7 @@ function coerceDate(value) {
41
41
  * @field baseName Name of the function w/o the version. eg `my-action`
42
42
  * @field packageName Name of the function package. eg `my-package`
43
43
  */
44
- class BaseConfig {
44
+ export default class BaseConfig {
45
45
  constructor() {
46
46
  Object.assign(this, {
47
47
  cwd: process.cwd(),
@@ -806,5 +806,3 @@ class BaseConfig {
806
806
  });
807
807
  }
808
808
  }
809
-
810
- module.exports = BaseConfig;
@@ -9,12 +9,16 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- const fse = require('fs-extra');
13
- const path = require('path');
14
- const express = require('express');
12
+ import { createRequire } from 'module';
13
+ import fse from 'fs-extra';
14
+ import path from 'path';
15
+ import express from 'express';
16
+ import ActionBuilder from './ActionBuilder.js';
17
+ import BaseConfig from './BaseConfig.js';
18
+
19
+ // load proxyquire specially since it doesn't support ESM yet.
20
+ const require = createRequire(import.meta.url);
15
21
  const proxyquire = require('proxyquire').noCallThru();
16
- const ActionBuilder = require('./ActionBuilder');
17
- const BaseConfig = require('./BaseConfig.js');
18
22
 
19
23
  function rawBody() {
20
24
  return (req, res, next) => {
@@ -61,7 +65,7 @@ function addRequestHeader(name, value) {
61
65
  *
62
66
  * @type {DevelopmentServer}
63
67
  */
64
- module.exports = class DevelopmentServer {
68
+ export default class DevelopmentServer {
65
69
  /**
66
70
  * Creates a new development server using the given universal function.
67
71
  * @param {UniversalFunction} main - The universal function
@@ -70,6 +74,7 @@ module.exports = class DevelopmentServer {
70
74
  this._main = main;
71
75
  this._cwd = process.cwd();
72
76
  this._port = process.env.WEBSERVER_PORT || 3000;
77
+ this._xfh = 'helix-pages.anywhere.run';
73
78
  }
74
79
 
75
80
  withPort(value) {
@@ -77,6 +82,11 @@ module.exports = class DevelopmentServer {
77
82
  return this;
78
83
  }
79
84
 
85
+ withXFH(value) {
86
+ this._xfh = value;
87
+ return this;
88
+ }
89
+
80
90
  get port() {
81
91
  return this._port;
82
92
  }
@@ -131,21 +141,21 @@ module.exports = class DevelopmentServer {
131
141
  */
132
142
  async start() {
133
143
  this.app = express();
134
- this.app.use(rawBody());
135
- this.app.use(addRequestHeader('x-forwarded-host', 'helix-pages.anywhere.run'));
136
- this.app.all('*', this._handler);
137
144
  await new Promise((resolve, reject) => {
138
145
  try {
139
146
  this.server = this.app.listen(this._port, () => {
140
147
  this._port = this.server.address().port;
141
148
  // eslint-disable-next-line no-console
142
- console.log(`Started development server on port ${this._port}`);
149
+ console.log(`Started development server at http://localhost:${this._port}/`);
143
150
  resolve();
144
151
  });
145
152
  } catch (e) {
146
153
  reject(e);
147
154
  }
148
155
  });
156
+ this.app.use(rawBody());
157
+ this.app.use(addRequestHeader('x-forwarded-host', this._xfh.replace('{port}', this._port)));
158
+ this.app.all('*', this._handler);
149
159
  }
150
160
 
151
161
  /**
@@ -163,4 +173,4 @@ module.exports = class DevelopmentServer {
163
173
  });
164
174
  });
165
175
  }
166
- };
176
+ }
@@ -9,19 +9,22 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
-
13
- const path = require('path');
14
- const fse = require('fs-extra');
15
- const chalk = require('chalk');
16
- const archiver = require('archiver');
17
- const semver = require('semver');
18
- const { validateBundle } = require('../utils.js');
19
- const { dependencies } = require('../../package.json');
12
+ import path from 'path';
13
+ import { fileURLToPath } from 'url';
14
+ import fse from 'fs-extra';
15
+ import chalk from 'chalk';
16
+ import archiver from 'archiver';
17
+ import semver from 'semver';
18
+ import { validateBundle } from '../utils.js';
19
+ import pkgJson from '../package.cjs';
20
+
21
+ // eslint-disable-next-line no-underscore-dangle
22
+ const __dirname = path.resolve(fileURLToPath(import.meta.url), '..');
20
23
 
21
24
  /**
22
25
  * Base for all bundlers
23
26
  */
24
- module.exports = class BaseBundler {
27
+ export default class BaseBundler {
25
28
  /**
26
29
  * Simple string substitute. Replaces all `${key}` occurrences from the given object.
27
30
  * @param {string} str string to substitute
@@ -112,8 +115,8 @@ module.exports = class BaseBundler {
112
115
  // google cloud installs these dependencies at deploy time
113
116
  // all other environments ignore them – this allows us to
114
117
  // avoid bundling something that only google needs
115
- '@google-cloud/secret-manager': dependencies['@google-cloud/secret-manager'],
116
- '@google-cloud/storage': dependencies['@google-cloud/storage'],
118
+ '@google-cloud/secret-manager': pkgJson.dependencies['@google-cloud/secret-manager'],
119
+ '@google-cloud/storage': pkgJson.dependencies['@google-cloud/storage'],
117
120
  },
118
121
  };
119
122
  archive.pipe(output);
@@ -186,4 +189,4 @@ module.exports = class BaseBundler {
186
189
  archive.file(path.resolve(__dirname, '..', 'template', 'aws-esm-adapter.js'), { name: 'esm-adapter/index.js' });
187
190
  }
188
191
  }
189
- };
192
+ }
@@ -9,15 +9,18 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
+ import { fileURLToPath } from 'url';
13
+ import path from 'path';
14
+ import webpack from 'webpack';
15
+ import WebpackBundler from './WebpackBundler.js';
12
16
 
13
- const path = require('path');
14
- const webpack = require('webpack');
15
- const WebpackBundler = require('./WebpackBundler.js');
17
+ // eslint-disable-next-line no-underscore-dangle
18
+ const __dirname = path.resolve(fileURLToPath(import.meta.url), '..');
16
19
 
17
20
  /**
18
21
  * Creates the action bundle
19
22
  */
20
- module.exports = class EdgeBundler extends WebpackBundler {
23
+ export default class EdgeBundler extends WebpackBundler {
21
24
  async getWebpackConfig() {
22
25
  const { cfg } = this;
23
26
  const opts = {
@@ -48,8 +51,11 @@ module.exports = class EdgeBundler extends WebpackBundler {
48
51
  }, {}),
49
52
  module: {
50
53
  rules: [{
51
- test: /\.mjs$/,
54
+ test: /\.js$/,
52
55
  type: 'javascript/auto',
56
+ }, {
57
+ test: /\.mjs$/,
58
+ type: 'javascript/esm',
53
59
  }],
54
60
  },
55
61
  resolve: {
@@ -115,4 +121,4 @@ module.exports = class EdgeBundler extends WebpackBundler {
115
121
  }
116
122
  return this.createWebpackBundle('edge');
117
123
  }
118
- };
124
+ }
@@ -10,21 +10,26 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- const path = require('path');
14
- const fse = require('fs-extra');
15
- const rollup = require('rollup');
16
- const chalk = require('chalk');
17
- const { nodeResolve } = require('@rollup/plugin-node-resolve');
18
- const commonjs = require('@rollup/plugin-commonjs');
19
- const alias = require('@rollup/plugin-alias');
20
- const pluginJson = require('@rollup/plugin-json');
21
- const { terser } = require('rollup-plugin-terser');
22
- const BaseBundler = require('./BaseBundler.js');
13
+ import path from 'path';
14
+ import fse from 'fs-extra';
15
+ import { fileURLToPath } from 'url';
16
+ import { rollup } from 'rollup';
17
+ import chalk from 'chalk';
18
+ import { nodeResolve } from '@rollup/plugin-node-resolve';
19
+ import commonjs from '@rollup/plugin-commonjs';
20
+ import alias from '@rollup/plugin-alias';
21
+ import pluginJson from '@rollup/plugin-json';
22
+ import { terser } from 'rollup-plugin-terser';
23
+
24
+ import BaseBundler from './BaseBundler.js';
25
+
26
+ // eslint-disable-next-line no-underscore-dangle
27
+ const __dirname = path.resolve(fileURLToPath(import.meta.url), '..');
23
28
 
24
29
  /**
25
30
  * Creates the action bundle using rollup
26
31
  */
27
- module.exports = class Bundler extends BaseBundler {
32
+ export default class Bundler extends BaseBundler {
28
33
  async getRollupConfig() {
29
34
  const { cfg } = this;
30
35
  /**
@@ -92,7 +97,7 @@ module.exports = class Bundler extends BaseBundler {
92
97
 
93
98
  cfg.log.info(`--: creating ${cfg.esm ? 'esm ' : ''}${cfg.minify ? 'minified ' : ''}bundle using rollup...`);
94
99
  const config = await this.getRollupConfig();
95
- const bundle = await rollup.rollup(config);
100
+ const bundle = await rollup(config);
96
101
 
97
102
  const { output } = await bundle.generate(config.output);
98
103
  await this.resolveDependencyInfos(output);
@@ -162,4 +167,4 @@ module.exports = class Bundler extends BaseBundler {
162
167
  .sort((d0, d1) => d0.name.localeCompare(d1.name));
163
168
  });
164
169
  }
165
- };
170
+ }
@@ -9,17 +9,20 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
+ import { fileURLToPath } from 'url';
13
+ import path from 'path';
14
+ import fse from 'fs-extra';
15
+ import webpack from 'webpack';
16
+ import chalk from 'chalk';
17
+ import BaseBundler from './BaseBundler.js';
12
18
 
13
- const path = require('path');
14
- const fse = require('fs-extra');
15
- const webpack = require('webpack');
16
- const chalk = require('chalk');
17
- const BaseBundler = require('./BaseBundler.js');
19
+ // eslint-disable-next-line no-underscore-dangle
20
+ const __dirname = path.resolve(fileURLToPath(import.meta.url), '..');
18
21
 
19
22
  /**
20
23
  * Webpack based bundler
21
24
  */
22
- module.exports = class WebpackBundler extends BaseBundler {
25
+ export default class WebpackBundler extends BaseBundler {
23
26
  async init() {
24
27
  if (this.cfg.esm) {
25
28
  throw new Error('Webpack bundler does not support ESM builds.');
@@ -33,6 +36,7 @@ module.exports = class WebpackBundler extends BaseBundler {
33
36
  mode: 'development',
34
37
  // the universal adapter is the entry point
35
38
  entry: cfg.adapterFile || path.resolve(__dirname, '..', 'template', 'node-index.js'),
39
+ context: cfg.cwd,
36
40
  output: {
37
41
  path: cfg.cwd,
38
42
  filename: path.relative(cfg.cwd, cfg.bundle),
@@ -56,8 +60,11 @@ module.exports = class WebpackBundler extends BaseBundler {
56
60
  }, {}),
57
61
  module: {
58
62
  rules: [{
59
- test: /\.mjs$/,
63
+ test: /\.js$/,
60
64
  type: 'javascript/auto',
65
+ }, {
66
+ test: /\.mjs$/,
67
+ type: 'javascript/esm',
61
68
  }],
62
69
  },
63
70
  resolve: {
@@ -197,4 +204,4 @@ module.exports = class WebpackBundler extends BaseBundler {
197
204
  .sort((d0, d1) => d0.name.localeCompare(d1.name));
198
205
  });
199
206
  }
200
- };
207
+ }
package/src/cli.js CHANGED
@@ -11,18 +11,18 @@
11
11
  */
12
12
 
13
13
  /* eslint-disable no-console */
14
- const yargs = require('yargs');
15
- const chalk = require('chalk');
16
-
17
- const BaseConfig = require('./BaseConfig.js');
18
-
19
- const OpenWhiskDeployer = require('./deploy/OpenWhiskDeployer');
20
- const AWSDeployer = require('./deploy/AWSDeployer');
21
- const AzureDeployer = require('./deploy/AzureDeployer');
22
- const GoogleDeployer = require('./deploy/GoogleDeployer');
23
- const CloudflareDeployer = require('./deploy/CloudflareDeployer');
24
- const ComputeAtEdgeDeployer = require('./deploy/ComputeAtEdgeDeployer');
25
- const FastlyGateway = require('./gateway/FastlyGateway');
14
+ import yargs from 'yargs';
15
+ import chalk from 'chalk';
16
+ import { config as envConfig } from 'dotenv';
17
+ import BaseConfig from './BaseConfig.js';
18
+ import OpenWhiskDeployer from './deploy/OpenWhiskDeployer.js';
19
+ import AWSDeployer from './deploy/AWSDeployer.js';
20
+ import AzureDeployer from './deploy/AzureDeployer.js';
21
+ import GoogleDeployer from './deploy/GoogleDeployer.js';
22
+ import CloudflareDeployer from './deploy/CloudflareDeployer.js';
23
+ import ComputeAtEdgeDeployer from './deploy/ComputeAtEdgeDeployer.js';
24
+ import FastlyGateway from './gateway/FastlyGateway.js';
25
+ import ActionBuilder from './ActionBuilder.js';
26
26
 
27
27
  const PLUGINS = [
28
28
  OpenWhiskDeployer,
@@ -34,11 +34,9 @@ const PLUGINS = [
34
34
  FastlyGateway,
35
35
  ];
36
36
 
37
- const defaultConfig = require('./config/adobeioruntime-node10.js');
38
-
39
- require('dotenv').config();
37
+ envConfig();
40
38
 
41
- class CLI {
39
+ export default class CLI {
42
40
  constructor() {
43
41
  this._yargs = yargs()
44
42
  .pkgConf('wsk')
@@ -48,18 +46,11 @@ class CLI {
48
46
  this._yargs.help();
49
47
  }
50
48
 
51
- // eslint-disable-next-line class-methods-use-this
52
- createBuilder() {
53
- // eslint-disable-next-line global-require
54
- const ActionBuilder = require('./ActionBuilder.js');
55
- return new ActionBuilder();
56
- }
57
-
58
49
  prepare(args) {
59
50
  const argv = this._yargs.parse(args);
60
51
 
61
52
  if (argv.externals.length === 0) {
62
- argv.externals = defaultConfig.externals;
53
+ argv.externals = [/^openwhisk(\/.*)?$/];
63
54
  }
64
55
 
65
56
  const config = new BaseConfig().configure(argv);
@@ -68,7 +59,7 @@ class CLI {
68
59
  return new PluginClass(config, pluginConfig);
69
60
  });
70
61
 
71
- return this.createBuilder()
62
+ return new ActionBuilder()
72
63
  .withConfig(config)
73
64
  .withPlugins(plugins);
74
65
  }
@@ -85,5 +76,3 @@ class CLI {
85
76
  }
86
77
  }
87
78
  }
88
-
89
- module.exports = CLI;
@@ -13,7 +13,7 @@
13
13
  // eslint-disable-next-line no-template-curly-in-string
14
14
  const DEFAULT_LAMBDA_FORMAT = '${packageName}--${baseName}';
15
15
 
16
- class AWSConfig {
16
+ export default class AWSConfig {
17
17
  constructor() {
18
18
  Object.assign(this, {
19
19
  region: '',
@@ -125,5 +125,3 @@ class AWSConfig {
125
125
  });
126
126
  }
127
127
  }
128
-
129
- module.exports = AWSConfig;