Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
noise64 committed Dec 9, 2024
1 parent 4603e87 commit e899e53
Show file tree
Hide file tree
Showing 27 changed files with 67 additions and 195 deletions.
6 changes: 6 additions & 0 deletions examples/go/INSTRUCTIONS-app
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
See the documentation about installing tooling: https://learn.golem.cloud/docs/go-language-guide/setup

Generate wit and bindings, build and link component:
golem-cli app build

The `out/linked-components/component_name.wasm` file is ready to be uploaded to Golem Cloud!
15 changes: 0 additions & 15 deletions examples/go/go-default/Makefile

This file was deleted.

35 changes: 27 additions & 8 deletions examples/go/go-default/golem.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
# Schema for IDEA:
# $schema: https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# $schema: https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json
# Schema for vscode-yaml
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json

tempDir: build/golem-temp
components:
pack:name:
sourceWit: wit
generatedWit: wit-generated
componentWasm: build/components/component_name.wasm
componentWasm: build/adapted-components/component_name.wasm
linkedWasm: build/linked-components/component_name_linked.wasm
build:
- command: componentize-py bindings bindings
- command: wit-bindgen tiny-go --rename-package binding --out-dir binding ./wit-generated
sources:
- wit-generated
targets:
- bindings
- command: componentize-py componentize main -o build/components/component_name.wasm
- binding
- command: tinygo build -target=wasi -tags=purego -o build/components/component_name.wasm main.go
mkdirs:
- build/components
sources:
- bindings
- main.py
- component_name
- main.go
targets:
- build/components/component_name.wasm
- command: wasm-tools component embed wit-generated build/components/component_name.wasm --output build/embedded-components/component_name.wasm
mkdirs:
- build/embedded-components
sources:
- wit-generated
- build/components/component_name.wasm
targets:
- build/embedded-components/component_name.wasm
- command: wasm-tools component new build/embedded-components/component_name.wasm -o build/adapted-components/component_name.wasm --adapt adapters/tier1/wasi_snapshot_preview1.wasm
mkdirs:
- build/adapted-components
sources:
- adapters/tier1/wasi_snapshot_preview1.wasm
- build/embedded-components/component_name.wasm
targets:
- build/adapted-components/component_name.wasm
clean:
- build
- binding
4 changes: 2 additions & 2 deletions examples/go/go-default/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"github.com/golemcloud/golem-go/std"

"pack/name/component_name"
"pack/name/binding"
)

type RequestBody struct {
Expand All @@ -15,7 +15,7 @@ type ResponseBody struct {
}

func init() {
component_name.SetExportsPackNameApi(&ComponentNameImpl{})
binding.SetExportsPackNameInterfaceApi(&ComponentNameImpl{})
}

// total State can be stored in global variables
Expand Down
4 changes: 3 additions & 1 deletion examples/go/go-default/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"requiresAdapter": true,
"requiresGolemHostWIT": true,
"requiresWASI": true,
"instructions": "INSTRUCTIONS-app",
"exclude": [
"component_name",
"wit-generated",
"build",
"main.wasm"
]
}
4 changes: 2 additions & 2 deletions examples/js/js-default/golem.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Schema for IDEA:
# $schema: https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# $schema: https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json
# Schema for vscode-yaml
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json

tempDir: out/golem-temp
components:
Expand Down
4 changes: 2 additions & 2 deletions examples/python/python-default/golem.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Schema for IDEA:
# $schema: https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# $schema: https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json
# Schema for vscode-yaml
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json

tempDir: build/golem-temp
components:
Expand Down
11 changes: 6 additions & 5 deletions examples/ts/ts-default/golem.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Schema for IDEA:
# $schema: https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# $schema: https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json
# Schema for vscode-yaml
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json

tempDir: out/golem-temp
components:
Expand All @@ -11,11 +11,11 @@ components:
componentWasm: out/components/component_name.wasm
linkedWasm: out/linked-components/component_name_linked.wasm
build:
- command: npx jco stubgen wit-generated -o src/generated
- command: npx jco stubgen wit-generated -o src/binding
sources:
- wit-generated
targets:
- src/generated
- src/binding
- command: npx rollup --config
sources:
- src
Expand All @@ -30,7 +30,8 @@ components:
targets:
- out/components/component_name.wasm
clean:
- src/generated
- src/binding
- wit-generated
customCommands:
install:
- command: npm install
4 changes: 2 additions & 2 deletions examples/ts/ts-default/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"requiresAdapter": false,
"requiresGolemHostWIT": true,
"requiresWASI": true,
"instructions": "INSTRUCTIONS-ap",
"instructions": "INSTRUCTIONS-app",
"exclude": [
"node_modules",
"out",
"src/generated"
"src/binding"
]
}
6 changes: 0 additions & 6 deletions examples/ts/ts-default/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"scripts": {
"stub": "jco stubgen wit -o src/generated",
"build": "rollup --config",
"componentize": "npm run stub && npm run build && jco componentize -w wit -o out/component_name.wasm out/main.js",
"clean": "rm -rf out src/generated"
},
"devDependencies": {
"@golemcloud/componentize-js": "0.10.5-golem.3",
"@golemcloud/golem-ts": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/ts/ts-default/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Api } from './generated/component-name.js';
import { Api } from './binding/component-name.js';

let state = BigInt(0);

Expand Down
2 changes: 1 addition & 1 deletion examples/ts/ts-multi-rpc/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async function generateNewComponents(args: string[]) {
let template = fs.readFileSync(sourcePath).toString();
template = template.replaceAll("pck-ns", cfg.pckNs);
template = template.replaceAll("comp-name", componentName);
template = template.replaceAll("componentName", componentNameCamel);
template = template.replaceAll("compName", componentNameCamel);
template = template.replaceAll("CompName", componentNamePascal);

fs.writeFileSync(targetPath, new Uint8Array(Buffer.from(template)));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Schema for IDEA:
# $schema: https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# $schema: https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json
# Schema for vscode-yaml
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json

components:
comp-name:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CompNameApi} from "./generated/comp-name";
import {CompNameApi} from "./binding/comp-name";

let state = BigInt(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ interface comp-name-api {
}

world comp-name {
<<<<<<< HEAD
=======
// Golem dependencies
import golem:api/[email protected];
import golem:rpc/[email protected];

>>>>>>> main
// WASI dependencies
import wasi:blobstore/blobstore;
import wasi:blobstore/container;
Expand Down
7 changes: 4 additions & 3 deletions examples/ts/ts-multi-rpc/golem.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Schema for IDEA:
# $schema: https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# $schema: https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json
# Schema for vscode-yaml
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json

tempDir: out/golem-temp
includes:
Expand Down Expand Up @@ -36,7 +36,8 @@ templates:
targets:
- out/components/{{ componentName }}.wasm
clean:
- src/generated
- binding
- wit-generated
customCommands:
install:
- command: npm install
1 change: 1 addition & 0 deletions examples/ts/ts-multi-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"fmt": "npx tsx build.ts fmt",
"lint": "npx tsx build.ts lint",
"fix": "npx tsx build.ts fix",
"generateNewComponent": "npx tsx build.ts generateNewComponent",
"rollupComponent": "npx tsx build.ts rollupComponent",
"deploy": "npx tsx build.ts deploy",
"deployComponent": "npx tsx build.ts deployComponent",
Expand Down
2 changes: 1 addition & 1 deletion examples/ts/ts-multi-rpc/src/build-tools/build-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type Commands = { [key: string]: Command };

export function getComponentNameFromArgs(args: string[]) {
if (args.length != 1) {
throw new Error(`generateNewComponents expected exactly one argument (component-name), got: [${args.join(", ")}]`);
throw new Error(`expected exactly one argument (component-name), got: [${args.join(", ")}]`);
}

const componentName = args[0];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Schema for IDEA:
# $schema: https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# $schema: https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json
# Schema for vscode-yaml
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json

components:
component-one:
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ interface component-one-api {

world component-one {
// Golem dependencies
<<<<<<< HEAD
import golem:api/host@0.2.0;
=======
import golem:api/host@1.1.0;
import golem:rpc/types@0.1.0;
>>>>>>> main

// WASI dependencies
import wasi:blobstore/blobstore;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Schema for IDEA:
# $schema: https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# $schema: https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json
# Schema for vscode-yaml
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0-rc3/golem.schema.json
# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.1.0/golem.schema.json

components:
component-three:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ interface component-three-api {

world component-three {
// Golem dependencies
<<<<<<< HEAD
import golem:api/host@0.2.0;
=======
import golem:api/host@1.1.0;
import golem:rpc/types@0.1.0;
>>>>>>> main

// WASI dependencies
import wasi:blobstore/blobstore;
Expand Down
Loading

0 comments on commit e899e53

Please sign in to comment.