@adobe/helix-deploy 6.2.3 → 6.2.4

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,10 @@
1
+ ## [6.2.4](https://github.com/adobe/helix-deploy/compare/v6.2.3...v6.2.4) (2022-02-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix development server dev params ([#368](https://github.com/adobe/helix-deploy/issues/368)) ([2e91e18](https://github.com/adobe/helix-deploy/commit/2e91e18d24222f936f978410857f1f1a675bc0da))
7
+
1
8
  ## [6.2.3](https://github.com/adobe/helix-deploy/compare/v6.2.2...v6.2.3) (2022-02-04)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-deploy",
3
- "version": "6.2.3",
3
+ "version": "6.2.4",
4
4
  "description": "Library and Commandline Tools to build and deploy OpenWhisk Actions",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/adobe/helix-deploy#readme",
@@ -87,6 +87,11 @@ export default class DevelopmentServer {
87
87
  return this;
88
88
  }
89
89
 
90
+ withDirectory(value) {
91
+ this._cwd = value;
92
+ return this;
93
+ }
94
+
90
95
  get port() {
91
96
  return this._port;
92
97
  }
@@ -102,23 +107,33 @@ export default class DevelopmentServer {
102
107
  // load the action params params
103
108
  let pkgJson = {};
104
109
  try {
105
- pkgJson = await fse.readJson(path.resolve('package.json'));
110
+ pkgJson = await fse.readJson(path.resolve(this._cwd, 'package.json'));
106
111
  } catch (e) {
107
112
  // ignore
108
113
  }
109
114
  const config = new BaseConfig();
110
- if (pkgJson.wsk && pkgJson.wsk['params-file']) {
111
- config.withParamsFile(pkgJson.wsk['params-file']);
112
- }
113
- if (pkgJson.wsk && pkgJson.wsk.package && pkgJson.wsk.package['params-file']) {
114
- config.withParamsFile(pkgJson.wsk.package['params-file']);
115
- }
116
- if (pkgJson.wsk && pkgJson.wsk['dev-params-file']) {
117
- const file = pkgJson.wsk['dev-params-file'];
118
- if (await fse.exists(file)) {
119
- config.withParamsFile(file);
120
- }
115
+ if (pkgJson.wsk) {
116
+ const withParamsFile = async (file) => {
117
+ if (!file) {
118
+ return;
119
+ }
120
+ // eslint-disable-next-line no-param-reassign
121
+ const files = (Array.isArray(file) ? file : [file]).map((f) => path.resolve(this._cwd, f));
122
+ await Promise.all(files.map(async (f) => {
123
+ if (await fse.exists(f)) {
124
+ config.withParamsFile(f);
125
+ }
126
+ }));
127
+ };
128
+
129
+ await withParamsFile(pkgJson.wsk?.package?.['params-file']);
130
+ config.withParams(pkgJson.wsk?.package?.params);
131
+ await withParamsFile(pkgJson.wsk?.['params-file']);
132
+ config.withParams(pkgJson.wsk?.params);
133
+ await withParamsFile(pkgJson.wsk?.dev?.['params-file']);
134
+ config.withParams(pkgJson.wsk?.dev?.params);
121
135
  }
136
+
122
137
  const builder = new ActionBuilder().withConfig(config);
123
138
  await builder.validate();
124
139
 
@@ -129,7 +144,8 @@ export default class DevelopmentServer {
129
144
  './main.js': {
130
145
  main: this._main,
131
146
  },
132
- './google-package-params.js': () => (config.params),
147
+ './google-package-params.js': () => (config.params), // backward compatible
148
+ './google-secrets.js': () => (config.params),
133
149
  });
134
150
  this.params = config.params;
135
151
  return this;
@@ -154,7 +170,9 @@ export default class DevelopmentServer {
154
170
  }
155
171
  });
156
172
  this.app.use(rawBody());
157
- this.app.use(addRequestHeader('x-forwarded-host', this._xfh.replace('{port}', this._port)));
173
+ if (this._xfh) {
174
+ this.app.use(addRequestHeader('x-forwarded-host', this._xfh.replace('{port}', this._port)));
175
+ }
158
176
  this.app.all('*', this._handler);
159
177
  }
160
178