Skip to content

Commit 4691813

Browse files
authored
fix: esm node build (#36)
* fix: esm node build * chore: import esbuild * chore: fix build * update pitcher * make edge default * fix
1 parent 8c56c58 commit 4691813

File tree

11 files changed

+479
-291
lines changed

11 files changed

+479
-291
lines changed

.codesandbox/ci.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

esbuild.js renamed to esbuild.cjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ Promise.all([
5757
bundle: true,
5858
format: "esm",
5959
platform: "node",
60+
banner: {
61+
js: `
62+
import { fileURLToPath } from 'url';
63+
import { createRequire as topLevelCreateRequire } from 'module';
64+
const require = topLevelCreateRequire(import.meta.url);
65+
`.trim(),
66+
},
6067
outdir: "dist/esm",
6168
plugins: [browserifyPlugin],
6269
}),

openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,6 +1586,6 @@
15861586
}
15871587
},
15881588
"security": [],
1589-
"servers": [{ "url": "https://api.codesandbox.io", "variables": {} }],
1589+
"servers": [{ "url": "https://api.codesandbox.stream", "variables": {} }],
15901590
"tags": []
15911591
}

package-lock.json

Lines changed: 47 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"author": "CodeSandbox",
66
"license": "MIT",
77
"repository": "git+https://github.com/codesandbox/codesandbox-sdk.git",
8+
"type": "module",
89
"bin": {
910
"csb": "dist/bin/codesandbox.js"
1011
},
@@ -52,7 +53,7 @@
5253
"build": "npm run clean && npm run build:esbuild && npm run build:cjs:types && npm run build:esm:types && chmod +x dist/bin/codesandbox.js",
5354
"build:cjs": "tsc -p ./tsconfig.build-cjs.json",
5455
"build:esm": "tsc -p ./tsconfig.build-esm.json",
55-
"build:esbuild": "node esbuild.js",
56+
"build:esbuild": "node esbuild.cjs",
5657
"build:cjs:types": "tsc -p ./tsconfig.build-cjs.json --emitDeclarationOnly",
5758
"build:esm:types": "tsc -p ./tsconfig.build-esm.json --emitDeclarationOnly",
5859
"build-openapi": "rimraf src/client && curl -o openapi.json https://api.codesandbox.io/meta/openapi && npx prettier --write ./openapi.json && node_modules/.bin/openapi-ts -i ./openapi.json -o src/client -c @hey-api/client-fetch",
@@ -77,8 +78,8 @@
7778
"@codesandbox/pitcher-client": "1.1.5",
7879
"@codesandbox/pitcher-common": "0.360.2",
7980
"@codesandbox/pitcher-protocol": "0.360.4",
80-
"@hey-api/client-fetch": "^0.5.1",
81-
"@hey-api/openapi-ts": "0.60.1",
81+
"@hey-api/client-fetch": "^0.7.3",
82+
"@hey-api/openapi-ts": "^0.63.2",
8283
"@types/blessed": "^0.1.25",
8384
"@types/yargs": "^17.0.33",
8485
"blessed": "^0.1.81",

src/client/client.gen.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
3+
import { createClient, createConfig } from '@hey-api/client-fetch';
4+
5+
export const client = createClient(createConfig());

src/client/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// This file is auto-generated by @hey-api/openapi-ts
2-
export * from './sdk.gen';
3-
export * from './types.gen';
2+
export * from './types.gen';
3+
export * from './sdk.gen';

0 commit comments

Comments
 (0)