@adobe/helix-deploy 4.15.1 → 5.0.3
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 +33 -0
- package/CONTRIBUTING.md +6 -0
- package/package.json +25 -28
- package/src/ActionBuilder.js +14 -14
- package/src/BaseConfig.js +6 -8
- package/src/DevelopmentServer.js +11 -7
- package/src/bundler/BaseBundler.js +16 -13
- package/src/bundler/EdgeBundler.js +12 -6
- package/src/bundler/RollupBundler.js +18 -13
- package/src/bundler/WebpackBundler.js +15 -8
- package/src/cli.js +17 -28
- package/src/deploy/AWSConfig.js +1 -3
- package/src/deploy/AWSDeployer.js +69 -66
- package/src/deploy/AzureConfig.js +1 -3
- package/src/deploy/AzureDeployer.js +7 -7
- package/src/deploy/BaseDeployer.js +18 -20
- package/src/deploy/CloudflareConfig.js +1 -3
- package/src/deploy/CloudflareDeployer.js +6 -7
- package/src/deploy/ComputeAtEdgeConfig.js +1 -3
- package/src/deploy/ComputeAtEdgeDeployer.js +13 -10
- package/src/deploy/GoogleConfig.js +1 -3
- package/src/deploy/GoogleDeployer.js +11 -12
- package/src/deploy/OpenWhiskConfig.js +1 -3
- package/src/deploy/OpenWhiskDeployer.js +16 -19
- package/src/gateway/FastlyConfig.js +1 -3
- package/src/gateway/FastlyGateway.js +7 -7
- package/src/index.js +1 -1
- package/src/{config/adobeioruntime-node10.js → package.cjs} +2 -13
- package/src/template/node-index.js +4 -3
- package/src/template/serviceworker-index.js +2 -2
- package/src/utils.js +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
## [5.0.3](https://github.com/adobe/helix-deploy/compare/v5.0.2...v5.0.3) (2021-12-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* wait for aws states completed between deploy steps ([#348](https://github.com/adobe/helix-deploy/issues/348)) ([9cf29ee](https://github.com/adobe/helix-deploy/commit/9cf29ee9807d6334fb951a2a21532ea56b7f9e72))
|
|
7
|
+
|
|
8
|
+
## [5.0.2](https://github.com/adobe/helix-deploy/compare/v5.0.1...v5.0.2) (2021-12-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update external fixes ([b898a1d](https://github.com/adobe/helix-deploy/commit/b898a1da4e06a20cb616cf524458a98608124e6c))
|
|
14
|
+
|
|
15
|
+
## [5.0.1](https://github.com/adobe/helix-deploy/compare/v5.0.0...v5.0.1) (2021-12-07)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **deps:** update external fixes ([eca546c](https://github.com/adobe/helix-deploy/commit/eca546ce271ba6c6d37fcf1572f5d1d0f5c068b2))
|
|
21
|
+
|
|
22
|
+
# [5.0.0](https://github.com/adobe/helix-deploy/compare/v4.15.1...v5.0.0) (2021-12-02)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* convert to ESM ([2946721](https://github.com/adobe/helix-deploy/commit/294672121135f32495cc48e58f636553b3473489))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### BREAKING CHANGES
|
|
31
|
+
|
|
32
|
+
* exported APIs only available through ESM
|
|
33
|
+
|
|
1
34
|
## [4.15.1](https://github.com/adobe/helix-deploy/compare/v4.15.0...v4.15.1) (2021-11-20)
|
|
2
35
|
|
|
3
36
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -72,3 +72,9 @@ The project's committers will release to the [Adobe organization on npmjs.org](h
|
|
|
72
72
|
Please contact the [Adobe Open Source Advisory Board](https://git.corp.adobe.com/OpenSourceAdvisoryBoard/discuss/issues) to get access to the npmjs organization.
|
|
73
73
|
|
|
74
74
|
The release process is fully automated using `semantic-release`, increasing the version numbers, etc. based on the contents of the commit messages found.
|
|
75
|
+
|
|
76
|
+
# Managing Secrets
|
|
77
|
+
|
|
78
|
+
## Azure
|
|
79
|
+
|
|
80
|
+
The Azure deployment is using an application secret that is expiring on a regular basis. To update the secret, refer to the [Azure Active Directory Documentation on configuring access policies on resources](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#option-2-create-a-new-application-secret)
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-deploy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.3",
|
|
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": "
|
|
24
|
-
"test-ci": "npm run lint &&
|
|
25
|
-
"integration-ci": "
|
|
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,38 +39,38 @@
|
|
|
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
|
-
"@aws-sdk/client-lambda": "3.
|
|
41
|
-
"@aws-sdk/client-s3": "3.
|
|
42
|
-
"@aws-sdk/client-secrets-manager": "3.
|
|
43
|
-
"@aws-sdk/client-ssm": "3.
|
|
42
|
+
"@aws-sdk/client-apigatewayv2": "3.43.0",
|
|
43
|
+
"@aws-sdk/client-lambda": "3.43.0",
|
|
44
|
+
"@aws-sdk/client-s3": "3.44.0",
|
|
45
|
+
"@aws-sdk/client-secrets-manager": "3.43.0",
|
|
46
|
+
"@aws-sdk/client-ssm": "3.44.0",
|
|
44
47
|
"@azure/arm-appservice": "9.0.0",
|
|
45
48
|
"@azure/ms-rest-nodeauth": "3.1.0",
|
|
46
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.16.
|
|
52
|
+
"@google-cloud/storage": "5.16.1",
|
|
50
53
|
"@rollup/plugin-alias": "3.1.8",
|
|
51
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",
|
|
55
|
-
"chalk": "
|
|
58
|
+
"chalk-template": "0.2.0",
|
|
56
59
|
"constants-browserify": "1.0.0",
|
|
57
60
|
"dotenv": "10.0.0",
|
|
58
61
|
"express": "4.17.1",
|
|
59
62
|
"form-data": "4.0.0",
|
|
60
63
|
"fs-extra": "10.0.0",
|
|
61
64
|
"get-stream": "6.0.1",
|
|
62
|
-
"isomorphic-git": "1.10.
|
|
65
|
+
"isomorphic-git": "1.10.2",
|
|
63
66
|
"openwhisk": "3.21.5",
|
|
64
67
|
"proxyquire": "2.1.3",
|
|
65
|
-
"rollup": "2.
|
|
68
|
+
"rollup": "2.61.1",
|
|
66
69
|
"rollup-plugin-terser": "7.0.2",
|
|
67
70
|
"semver": "7.3.5",
|
|
68
71
|
"tar": "6.1.11",
|
|
69
|
-
"webpack": "5.
|
|
70
|
-
"yargs": "17.
|
|
72
|
+
"webpack": "5.65.0",
|
|
73
|
+
"yargs": "17.3.0"
|
|
71
74
|
},
|
|
72
75
|
"devDependencies": {
|
|
73
76
|
"@adobe/eslint-config-helix": "1.3.1",
|
|
@@ -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.
|
|
86
|
+
"eslint": "8.4.1",
|
|
83
87
|
"eslint-plugin-header": "3.1.1",
|
|
84
88
|
"eslint-plugin-import": "2.25.3",
|
|
85
|
-
"
|
|
86
|
-
"lint-staged": "12.
|
|
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
94
|
"nock": "13.2.1",
|
|
91
|
-
"
|
|
92
|
-
"semantic-release": "18.0.0",
|
|
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
|
}
|
package/src/ActionBuilder.js
CHANGED
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/* eslint-disable no-await-in-loop */
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
import path from 'path';
|
|
15
|
+
import fs from 'fs';
|
|
16
|
+
import fse from 'fs-extra';
|
|
17
|
+
import chalk from 'chalk-template';
|
|
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
|
-
|
|
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
|
|
@@ -310,7 +310,7 @@ module.exports = class ActionBuilder {
|
|
|
310
310
|
// eslint-disable-next-line no-await-in-loop
|
|
311
311
|
await dep[fnName](...args);
|
|
312
312
|
} catch (e) {
|
|
313
|
-
cfg.log.error(
|
|
313
|
+
cfg.log.error(chalk`{red error:} ${dep.name} - ${e.message}`);
|
|
314
314
|
errors.push(e);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
@@ -338,7 +338,7 @@ module.exports = class ActionBuilder {
|
|
|
338
338
|
async updateLinks() {
|
|
339
339
|
const { cfg } = this;
|
|
340
340
|
if (cfg.baseName === cfg.name) {
|
|
341
|
-
cfg.log.warn(
|
|
341
|
+
cfg.log.warn(chalk`{yellow warn:} unable to create version links. unsupported action name format. should be: "name@version"`);
|
|
342
342
|
return false;
|
|
343
343
|
}
|
|
344
344
|
return this.execute('updateLinks', 'updating links on ');
|
|
@@ -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();
|
|
@@ -466,4 +466,4 @@ module.exports = class ActionBuilder {
|
|
|
466
466
|
await this.runAdditionalTasks();
|
|
467
467
|
return '';
|
|
468
468
|
}
|
|
469
|
-
}
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
import crypto from 'crypto';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import fse from 'fs-extra';
|
|
15
|
+
import chalk from 'chalk-template';
|
|
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;
|
package/src/DevelopmentServer.js
CHANGED
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
|
@@ -169,4 +173,4 @@ module.exports = class DevelopmentServer {
|
|
|
169
173
|
});
|
|
170
174
|
});
|
|
171
175
|
}
|
|
172
|
-
}
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
import fse from 'fs-extra';
|
|
15
|
+
import chalk from 'chalk-template';
|
|
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
|
-
|
|
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
|
|
@@ -62,7 +65,7 @@ module.exports = class BaseBundler {
|
|
|
62
65
|
cfg.log.error(chalk`{red error:}`, result.error);
|
|
63
66
|
throw Error(`Validation failed: ${result.error}`);
|
|
64
67
|
}
|
|
65
|
-
cfg.log.info(chalk`{green ok:} bundle can be loaded and has a {
|
|
68
|
+
cfg.log.info(chalk`{green ok:} bundle can be loaded and has a {grey main()} function.`);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
async createArchive() {
|
|
@@ -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
|
-
|
|
14
|
-
const
|
|
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
|
-
|
|
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: /\.
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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-template';
|
|
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
|
-
|
|
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
|
|
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-template';
|
|
17
|
+
import BaseBundler from './BaseBundler.js';
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
const
|
|
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
|
-
|
|
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: /\.
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
import yargs from 'yargs';
|
|
15
|
+
import chalk from 'chalk-template';
|
|
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
|
-
|
|
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 =
|
|
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
|
|
62
|
+
return new ActionBuilder()
|
|
72
63
|
.withConfig(config)
|
|
73
64
|
.withPlugins(plugins);
|
|
74
65
|
}
|
|
@@ -80,10 +71,8 @@ class CLI {
|
|
|
80
71
|
console.log(JSON.stringify(res, null, 2));
|
|
81
72
|
}
|
|
82
73
|
} catch (err) {
|
|
83
|
-
console.log(
|
|
74
|
+
console.log(chalk`{red error:} ${err.message}`);
|
|
84
75
|
process.exitCode = 1;
|
|
85
76
|
}
|
|
86
77
|
}
|
|
87
78
|
}
|
|
88
|
-
|
|
89
|
-
module.exports = CLI;
|
package/src/deploy/AWSConfig.js
CHANGED
|
@@ -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;
|