Skip to content

Commit

Permalink
[go] Update to esbuild script (#10468)
Browse files Browse the repository at this point in the history
Co-authored-by: Nathan Rajlich <n@n8.io>
  • Loading branch information
Chris Barber and TooTallNate committed Sep 8, 2023
1 parent 6baefc8 commit 6784e77
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 86 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-baboons-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@vercel/go': patch
---

Update to esbuild script
File renamed without changes.
25 changes: 0 additions & 25 deletions packages/go/build.js

This file was deleted.

13 changes: 7 additions & 6 deletions packages/go/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,33 @@
"directory": "packages/go"
},
"scripts": {
"build": "node build",
"build": "node ../../utils/build-builder.mjs",
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
"test-e2e": "pnpm test"
},
"files": [
"dist"
"dist",
"*.go"
],
"devDependencies": {
"@tootallnate/once": "1.1.2",
"@types/async-retry": "1.4.2",
"@types/async-retry": "1.4.5",
"@types/execa": "^0.9.0",
"@types/fs-extra": "^5.0.5",
"@types/jest": "28.1.6",
"@types/node": "14.18.33",
"@types/node-fetch": "^2.3.0",
"@types/tar": "^4.0.0",
"@types/tar": "6.1.5",
"@types/yauzl-promise": "2.1.0",
"@vercel/build-utils": "7.1.1",
"@vercel/ncc": "0.24.0",
"async-retry": "1.3.1",
"async-retry": "1.3.3",
"execa": "^1.0.0",
"fs-extra": "^7.0.0",
"jest-junit": "16.0.0",
"node-fetch": "^2.2.1",
"string-argv": "0.3.1",
"tar": "4.4.6",
"tar": "6.2.0",
"typescript": "4.3.4",
"xdg-app-paths": "5.1.0",
"yauzl-promise": "2.1.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function getAnalyzedEntrypoint({
const isAnalyzeExist = await pathExists(bin);
if (!isAnalyzeExist) {
debug(`Building analyze bin: ${bin}`);
const src = join(__dirname, 'util', 'analyze.go');
const src = join(__dirname, '../analyze.go');
let go;
const createOpts = {
modulePath,
Expand Down
7 changes: 5 additions & 2 deletions packages/go/index.ts → packages/go/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ async function copyDevServer(
functionName: string,
dest: string
): Promise<void> {
const data = await readFile(join(__dirname, 'dev-server.go'), 'utf8');
const data = await readFile(join(__dirname, '../dev-server.go'), 'utf8');

// Populate the handler function name
const patched = data.replace('__HANDLER_FUNC_NAME', functionName);
Expand All @@ -634,7 +634,10 @@ async function writeEntrypoint(
goPackageName: string,
goFuncName: string
) {
const modMainGoContents = await readFile(join(__dirname, 'main.go'), 'utf8');
const modMainGoContents = await readFile(
join(__dirname, '../main.go'),
'utf8'
);
const mainModGoContents = modMainGoContents
.replace('__VC_HANDLER_PACKAGE_NAME', goPackageName)
.replace('__VC_HANDLER_FUNC_NAME', goFuncName);
Expand Down
2 changes: 1 addition & 1 deletion packages/go/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getNewHandlerFunctionName } from '../index';
import { getNewHandlerFunctionName } from '../src/index';

describe('getNewHandlerFunctionName', function () {
it('does nothing with empty original function name', async () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/go/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitThis": false,
"outDir": "./dist",
"types": ["node", "jest"],
"strict": true,
"target": "ES2021"
}
},
"include": ["src/**/*"]
}
77 changes: 27 additions & 50 deletions pnpm-lock.yaml

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

0 comments on commit 6784e77

Please sign in to comment.