Skip to content

Commit 80de147

Browse files
committed
update templates for v4 sdk
Signed-off-by: karthik2804 <[email protected]>
1 parent b88738b commit 80de147

File tree

16 files changed

+192
-176
lines changed

16 files changed

+192
-176
lines changed

templates/http-js/content/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

templates/http-js/content/config/knitwit.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

templates/http-js/content/package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "{{project-description}}",
55
"main": "index.js",
66
"scripts": {
7-
"build": "knitwit --out-dir build/wit/knitwit --out-world combined && npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{project-name | kebab_case}}.wasm",
7+
"build": "npx webpack && mkdirp dist && j2w -i build/bundle.js -n combined -o dist/{{ project-name | kebab_case }}.wasm",
88
"test": "echo \"Error: no test specified\" && exit 1"
99
},
1010
"keywords": [],
@@ -13,11 +13,19 @@
1313
"devDependencies": {
1414
"mkdirp": "^3.0.1",
1515
"webpack": "^5.74.0",
16-
"webpack-cli": "^4.10.0",
17-
"@fermyon/knitwit": "0.3.0"
16+
"webpack-cli": "^4.10.0"
1817
},
1918
"dependencies": {
20-
"@fermyon/spin-sdk": "^3.0.0",
19+
"@spinframework/build-tools": "1.0.0",
20+
"@spinframework/wasi-http-proxy": "1.0.0",
21+
"@spinframework/spin-kv": "1.0.0",
22+
"@spinframework/spin-llm": "1.0.0",
23+
"@spinframework/spin-mqtt": "1.0.0",
24+
"@spinframework/spin-mysql": "1.0.0",
25+
"@spinframework/spin-postgres": "1.0.0",
26+
"@spinframework/spin-redis": "1.0.0",
27+
"@spinframework/spin-sqlite": "1.0.0",
28+
"@spinframework/spin-variables": "1.0.0",
2129
"itty-router": "^5.0.18"
2230
}
2331
}
Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
const path = require('path');
2-
const SpinSdkPlugin = require("@fermyon/spin-sdk/plugins/webpack")
1+
import path from 'path';
2+
import SpinSdkPlugin from "@spinframework/build-tools/plugins/webpack/index.js";
33

4-
module.exports = {
5-
entry: './src/index.js',
6-
experiments: {
7-
outputModule: true,
8-
},
9-
output: {
10-
path: path.resolve(__dirname, './build'),
11-
filename: 'bundle.js',
12-
module: true,
13-
library: {
14-
type: "module",
15-
}
16-
},
17-
plugins: [
18-
new SpinSdkPlugin()
19-
],
20-
optimization: {
21-
minimize: false
22-
},
23-
performance: {
24-
hints: false,
25-
}
26-
};
4+
const config = async () => {
5+
let SpinPlugin = await SpinSdkPlugin.init()
6+
return {
7+
mode: 'production',
8+
stats: 'errors-only',
9+
entry: './src/index.ts',
10+
experiments: {
11+
outputModule: true,
12+
},
13+
resolve: {
14+
extensions: ['.js'],
15+
},
16+
output: {
17+
path: path.resolve(process.cwd(), './build'),
18+
filename: 'bundle.js',
19+
module: true,
20+
library: {
21+
type: "module",
22+
}
23+
},
24+
plugins: [
25+
SpinPlugin
26+
],
27+
optimization: {
28+
minimize: false
29+
},
30+
};
31+
}
32+
export default config

templates/http-ts/content/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

templates/http-ts/content/config/knitwit.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

templates/http-ts/content/package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "{{project-description}}",
55
"main": "index.js",
66
"scripts": {
7-
"build": "knitwit --out-dir build/wit/knitwit --out-world combined && npx webpack --mode=production && npx mkdirp dist && npx j2w -i build/bundle.js -d build/wit/knitwit -n combined -o dist/{{ project-name | kebab_case }}.wasm",
7+
"build": "npx webpack && mkdirp dist && j2w -i build/bundle.js -n combined -o dist/{{ project-name | kebab_case }}.wasm",
88
"test": "echo \"Error: no test specified\" && exit 1"
99
},
1010
"keywords": [],
@@ -15,11 +15,19 @@
1515
"ts-loader": "^9.4.1",
1616
"typescript": "^4.8.4",
1717
"webpack": "^5.74.0",
18-
"webpack-cli": "^4.10.0",
19-
"@fermyon/knitwit": "0.3.0"
18+
"webpack-cli": "^4.10.0"
2019
},
2120
"dependencies": {
22-
"@fermyon/spin-sdk": "^3.0.0",
21+
"@spinframework/build-tools": "1.0.0",
22+
"@spinframework/wasi-http-proxy": "1.0.0",
23+
"@spinframework/spin-kv": "1.0.0",
24+
"@spinframework/spin-llm": "1.0.0",
25+
"@spinframework/spin-mqtt": "1.0.0",
26+
"@spinframework/spin-mysql": "1.0.0",
27+
"@spinframework/spin-postgres": "1.0.0",
28+
"@spinframework/spin-redis": "1.0.0",
29+
"@spinframework/spin-sqlite": "1.0.0",
30+
"@spinframework/spin-variables": "1.0.0",
2331
"itty-router": "^5.0.18"
2432
}
2533
}
Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
1-
const path = require('path');
2-
const SpinSdkPlugin = require("@fermyon/spin-sdk/plugins/webpack")
1+
import path from 'path';
2+
import SpinSdkPlugin from "@spinframework/build-tools/plugins/webpack/index.js";
33

4-
module.exports = {
5-
entry: './src/index.ts',
6-
experiments: {
7-
outputModule: true,
8-
},
9-
module: {
10-
rules: [
11-
{
12-
test: /\.tsx?$/,
13-
use: 'ts-loader',
14-
exclude: /node_modules/,
15-
},
4+
const config = async () => {
5+
let SpinPlugin = await SpinSdkPlugin.init()
6+
return {
7+
mode: 'production',
8+
stats: 'errors-only',
9+
entry: './src/index.ts',
10+
experiments: {
11+
outputModule: true,
12+
},
13+
module: {
14+
rules: [
15+
{
16+
test: /\.tsx?$/,
17+
use: 'ts-loader',
18+
exclude: /node_modules/,
19+
},
20+
],
21+
},
22+
resolve: {
23+
extensions: ['.tsx', '.ts', '.js'],
24+
},
25+
output: {
26+
path: path.resolve(process.cwd(), './build'),
27+
filename: 'bundle.js',
28+
module: true,
29+
library: {
30+
type: "module",
31+
}
32+
},
33+
plugins: [
34+
SpinPlugin
1635
],
17-
},
18-
resolve: {
19-
extensions: ['.tsx', '.ts', '.js'],
20-
},
21-
output: {
22-
path: path.resolve(__dirname, './build'),
23-
filename: 'bundle.js',
24-
module: true,
25-
library: {
26-
type: "module",
36+
optimization: {
37+
minimize: false
38+
},
39+
performance: {
40+
hints: false,
2741
}
28-
},
29-
plugins: [
30-
new SpinSdkPlugin()
31-
],
32-
optimization: {
33-
minimize: false
34-
},
35-
performance: {
36-
hints: false,
37-
}
38-
};
42+
};
43+
}
44+
export default config

templates/redis-js/content/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

templates/redis-js/content/config/knitwit.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)