Skip to content

Commit

Permalink
fix(build): fix gcp functions build
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed Jun 18, 2022
1 parent bd22ec4 commit 8070ed5
Show file tree
Hide file tree
Showing 7 changed files with 407 additions and 955 deletions.
1,192 changes: 251 additions & 941 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/whook-create/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions packages/whook-create/src/services/createWhook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ Mr Bean
"chokidar": "^3.5.1",
"esbuild": "^0.14.43",
"esbuild-jest": "^0.5.0",
"esbuild-node-externals": "^1.4.1",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
Expand Down Expand Up @@ -276,7 +277,7 @@ Mr Bean
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
"prettier": "prettier --write 'src/**/*.ts'",
"start": "PROJECT_SRC=\\"$PWD/dist\\" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
"test": "npm run jest",
"test": "NODE_ENV=test npm run build && npm run jest",
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/watch.js",
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/whook.js",
Expand Down Expand Up @@ -388,6 +389,7 @@ Mr Bean
"chokidar": "^3.5.1",
"esbuild": "^0.14.43",
"esbuild-jest": "^0.5.0",
"esbuild-node-externals": "^1.4.1",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
Expand Down Expand Up @@ -495,7 +497,7 @@ Mr Bean
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
"prettier": "prettier --write 'src/**/*.ts'",
"start": "PROJECT_SRC=\\"$PWD/dist\\" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
"test": "npm run jest",
"test": "NODE_ENV=test npm run build && npm run jest",
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/watch.js",
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/whook.js",
Expand Down Expand Up @@ -592,6 +594,7 @@ Mr Bean
"chokidar": "^3.5.1",
"esbuild": "^0.14.43",
"esbuild-jest": "^0.5.0",
"esbuild-node-externals": "^1.4.1",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
Expand Down Expand Up @@ -699,7 +702,7 @@ Mr Bean
"postbuild": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/build.js",
"prettier": "prettier --write 'src/**/*.ts'",
"start": "PROJECT_SRC=\\"$PWD/dist\\" NODE_ENV=\${NODE_ENV:-development} node bin/start.js",
"test": "npm run jest",
"test": "NODE_ENV=test npm run build && npm run jest",
"watch": "NODE_ENV=\${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/watch.js",
"whook": "NODE_ENV=\${NODE_ENV:-development} whook",
"whook-dev": "PROJECT_SRC=\\"$PWD/src\\" NODE_ENV=\${NODE_ENV:-development} ts-node --esm --files -- bin/whook.js",
Expand Down
136 changes: 136 additions & 0 deletions packages/whook-example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/whook-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"metapak": "metapak",
"prettier": "prettier --write 'src/**/*.ts'",
"start": "PROJECT_SRC=\"$PWD/dist\" NODE_ENV=${NODE_ENV:-development} node bin/start.js",
"test": "npm run jest",
"test": "NODE_ENV=test npm run build && npm run jest",
"watch": "NODE_ENV=${NODE_ENV:-development} DEV_MODE=1 DESTROY_SOCKETS=1 ts-node --esm --files bin/watch.js",
"whook": "NODE_ENV=${NODE_ENV:-development} whook",
"whook-dev": "PROJECT_SRC=\"$PWD/src\" NODE_ENV=${NODE_ENV:-development} ts-node --esm --files -- bin/whook.js",
Expand Down Expand Up @@ -102,6 +102,7 @@
"axios": "^0.27.2",
"chokidar": "^3.5.1",
"esbuild": "^0.14.43",
"esbuild-node-externals": "^1.4.1",
"esbuild-jest": "^0.5.0",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/whook-gcp-functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function prepareBuildEnvironment<T extends Knifecycle>(
$.register(
constant('INITIALIZER_PATH_MAP', {
ENV: '@whook/whook/dist/services/ProxyedENV',
log: __dirname + '/services/log',
log: '@whook/gcp-functions/dist/services/log',
time: 'common-services/dist/time',
delay: 'common-services/dist/delay',
}),
Expand Down Expand Up @@ -195,9 +195,8 @@ async function processOperations(
log,
$autoload,
buildInitializer,
}: {
}: WhookGCPBuildConfig & {
NODE_ENV: string;
BUILD_PARALLELISM: number;
PROJECT_DIR: string;
compiler: WhookCompilerService;
log: LogService;
Expand Down Expand Up @@ -263,8 +262,9 @@ async function buildAnyLambda(
const { operationId } = operation;

try {
const whookConfig: WhookAPIOperationGCPFunctionConfig =
operation['x-whook'] || {};
const whookConfig: WhookAPIOperationGCPFunctionConfig = operation[
'x-whook'
] || { type: 'http' };
const operationType = whookConfig.type || 'http';
const sourceOperationId = whookConfig.sourceOperationId;
const entryPoint = operationId;
Expand All @@ -274,7 +274,7 @@ async function buildAnyLambda(
log('warning', `Building ${operationType} "${finalEntryPoint}"...`);
const buildDefinition = BUILD_DEFINITIONS[operationType];
// eslint-disable-next-line
const applyWrapper = require(buildDefinition.wrapper.path).default;
const applyWrapper = (await import(buildDefinition.wrapper.path)).default;
const rootNode = await $autoload(
entryPoint + (buildDefinition.suffix || ''),
);
Expand Down

0 comments on commit 8070ed5

Please sign in to comment.