Skip to content

Commit

Permalink
configure knitwit
Browse files Browse the repository at this point in the history
Signed-off-by: karthik2804 <[email protected]>

update componentizeJS

Signed-off-by: karthik2804 <[email protected]>
  • Loading branch information
karthik2804 committed Jul 19, 2024
1 parent fe11981 commit c2c8d71
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 42 deletions.
2 changes: 1 addition & 1 deletion bin/j2w.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const args = yargs(hideBin(process.argv))
.option('trigger-type', {
alias: '-n',
describe: "Spin trigger to target",
choices: validSpinWorlds,
demandOption: true
})
.argv;
Expand All @@ -50,6 +49,7 @@ const { component } = await componentize(source, {
witPath: resolve(args.witPath),
worldName: args.triggerType,
disableFeatures: [],
enableFeatures: ["http"],
});

await writeFile(args.output, component);
Expand Down
1 change: 0 additions & 1 deletion bin/wit/spin.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package fermyon:[email protected];

world spin-imports {
import wasi:http/outgoing-handler@0.2.0;
include wasi:cli/imports@0.2.0;
import llm;
import redis;
import postgres;
Expand Down
142 changes: 109 additions & 33 deletions package-lock.json

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

15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"fmt": "prettier --write \"src/**/*.{ts,tsx,js,jsx}\"",
"fmt-check": "prettier --check \"src/**/*.{ts,tsx,js,jsx}\"",
"build": "tsc && cp -r src/types ./lib/"
"build": "tsc && cp -r src/types ./lib/",
"postinstall": "knitwit-postinstall"
},
"sideEffects": false,
"author": "",
Expand All @@ -21,8 +22,16 @@
"typescript": "^5.4.3"
},
"dependencies": {
"@bytecodealliance/componentize-js": "https://github.com/fermyon/ComponentizeJS#use_fetch_event",
"@bytecodealliance/componentize-js": "^0.10.1",
"itty-router": "^3.0.12",
"yargs": "^17.7.2"
"yargs": "^17.7.2",
"@fermyon/knitwit": "https://github.com/fermyon/knitwit"
},
"config": {
"wit": "test",
"knitwit": {
"witPath": "../../bin/wit",
"world": "spin-imports"
}
}
}
9 changes: 9 additions & 0 deletions templates/http-ts/content/knitwit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": 1,
"project": {
"worlds": [
"spin-http"
]
},
"packages": {}
}
10 changes: 6 additions & 4 deletions templates/http-ts/content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "{{project-description}}",
"main": "index.js",
"scripts": {
"build": "npx webpack --mode=production && npx mkdirp target && npx j2w -i dist.js -n spin-http -o target/{{project-name | kebab_case}}.wasm",
"test": "echo \"Error: no test specified\" && exit 1"
"build": "npx webpack --mode=production && npx mkdirp target && npx j2w -i dist.js -d combined-wit -n combined -o target/{{project-name | kebab_case}}.wasm",
"test": "echo \"Error: no test specified\" && exit 1",
"postinstall": "knitwit"
},
"keywords": [],
"author": "",
Expand All @@ -15,9 +16,10 @@
"ts-loader": "^9.4.1",
"typescript": "^4.8.4",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
"webpack-cli": "^4.10.0",
"@fermyon/knitwit": "https://github.com/fermyon/knitwit"
},
"dependencies": {
"@fermyon/spin-sdk": "^2.0.0-alpha.2"
}
}
}

0 comments on commit c2c8d71

Please sign in to comment.