Skip to content

Commit 156716b

Browse files
authored
Merge pull request #3 from hyperweb-io/feat/build
build
2 parents 5cf636b + 272da91 commit 156716b

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,18 @@
2020
"url": "https://github.com/cosmology-tech/hyperweb/issues"
2121
},
2222
"scripts": {
23-
"copy": "copyfiles -f LICENSE README.md package.json dist",
24-
"clean": "rimraf dist/**",
25-
"prepare": "npm run build",
26-
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
23+
"clean": "rimraf contracts/**",
24+
"build": "ts-node scripts/build.ts",
2725
"test": "jest --verbose --bail",
2826
"test:debug": "jest --runInBand --verbose --bail",
2927
"starship": "starship --config configs/local.yaml",
3028
"starship:ci": "starship --config configs/ci.yaml"
3129
},
3230
"devDependencies": {
31+
"@types/node": "^22.7.4",
3332
"@types/jest": "^29.5.11",
3433
"@typescript-eslint/eslint-plugin": "^6.18.1",
3534
"@typescript-eslint/parser": "^6.18.1",
36-
"copyfiles": "^2.4.1",
3735
"eslint-config-prettier": "^9.1.0",
3836
"eslint-plugin-simple-import-sort": "^10.0.0",
3937
"eslint-plugin-unused-imports": "^3.0.0",

scripts/build.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { join } from 'path';
2+
import { InterwebBuild, InterwebBuildOptions } from '@interweb/build';
3+
4+
const root = join(__dirname, '/../');
5+
const outputDir = join(root, 'contracts');
6+
const srcDir = join(root, 'src');
7+
8+
async function main() {
9+
const outfile = join(outputDir, 'bundle.js');
10+
11+
const options: Partial<InterwebBuildOptions> = {
12+
entryPoints: [join(srcDir, 'contract1/index.ts')],
13+
outfile,
14+
external: ['otherpackage', '~somepackage']
15+
};
16+
17+
try {
18+
await InterwebBuild.build(options);
19+
console.log('Build completed successfully!');
20+
} catch (error) {
21+
console.error('Build failed:', error);
22+
}
23+
}
24+
25+
main().catch(console.error);

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@
20202020
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
20212021
integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==
20222022

2023-
"@types/node@*", "@types/node@>=13.7.0":
2023+
"@types/node@*", "@types/node@>=13.7.0", "@types/node@^22.7.4":
20242024
version "22.7.4"
20252025
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.4.tgz#e35d6f48dca3255ce44256ddc05dee1c23353fcc"
20262026
integrity sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==

0 commit comments

Comments
 (0)