Skip to content

Commit

Permalink
Merge pull request #3 from hyperweb-io/feat/build
Browse files Browse the repository at this point in the history
build
  • Loading branch information
Anmol1696 authored Oct 2, 2024
2 parents 5cf636b + 272da91 commit 156716b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@
"url": "https://github.com/cosmology-tech/hyperweb/issues"
},
"scripts": {
"copy": "copyfiles -f LICENSE README.md package.json dist",
"clean": "rimraf dist/**",
"prepare": "npm run build",
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
"clean": "rimraf contracts/**",
"build": "ts-node scripts/build.ts",
"test": "jest --verbose --bail",
"test:debug": "jest --runInBand --verbose --bail",
"starship": "starship --config configs/local.yaml",
"starship:ci": "starship --config configs/ci.yaml"
},
"devDependencies": {
"@types/node": "^22.7.4",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"copyfiles": "^2.4.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
Expand Down
25 changes: 25 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { join } from 'path';
import { InterwebBuild, InterwebBuildOptions } from '@interweb/build';

const root = join(__dirname, '/../');
const outputDir = join(root, 'contracts');
const srcDir = join(root, 'src');

async function main() {
const outfile = join(outputDir, 'bundle.js');

const options: Partial<InterwebBuildOptions> = {
entryPoints: [join(srcDir, 'contract1/index.ts')],
outfile,
external: ['otherpackage', '~somepackage']
};

try {
await InterwebBuild.build(options);
console.log('Build completed successfully!');
} catch (error) {
console.error('Build failed:', error);
}
}

main().catch(console.error);
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==

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

0 comments on commit 156716b

Please sign in to comment.