Skip to content

Commit 7ff93a7

Browse files
committed
fix: initial commit
1 parent 689552a commit 7ff93a7

File tree

13 files changed

+268
-0
lines changed

13 files changed

+268
-0
lines changed

.github/release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"release-type": "node",
44
"packages": {
55
"packages/homestar": {},
6+
"packages/homestar-wit": {},
67
"packages/channel": {},
78
"packages/ucan": {},
89
"packages/client": {},

.github/release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"packages/homestar": "2.0.3",
3+
"packages/homestar-wit": "0.0.1",
34
"packages/channel": "0.0.2",
45
"packages/ucan": "0.2.0",
56
"packages/client": "0.0.1",

.github/workflows/homestar-wit.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: homestar-wit
2+
env:
3+
CI: true
4+
FORCE_COLOR: 1
5+
on:
6+
push:
7+
branches: [main]
8+
paths:
9+
- 'packages/homestar-wit/**'
10+
- .github/workflows/homestar-wit.yml
11+
- pnpm-lock.yaml
12+
pull_request:
13+
paths:
14+
- 'packages/homestar-wit/**'
15+
- .github/workflows/homestar-wit.yml
16+
- pnpm-lock.yaml
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: pnpm/action-setup@v3
23+
with:
24+
version: latest
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: lts/*
28+
cache: pnpm
29+
- run: pnpm install
30+
- run: pnpm run build
31+
- run: pnpm -r --filter @fission-codes/homestar-wit run lint
32+
- run: pnpm -r --filter @fission-codes/homestar-wit run test
33+
- run: pnpm -r --filter @fission-codes/homestar-wit exec depcheck

packages/homestar-wit/package.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "@fission-codes/homestar-wit",
3+
"type": "module",
4+
"version": "0.0.1",
5+
"description": "WIT for Homestar",
6+
"author": "Hugo Dias <[email protected]> (hugodias.me)",
7+
"license": "MIT",
8+
"homepage": "https://github.com/fission-codes/stack/tree/main/packages/homestar-wit",
9+
"repository": {
10+
"url": "fission-codes/stack",
11+
"directory": "packages/homestar-wit"
12+
},
13+
"exports": {
14+
".": {
15+
"types": "./dist/src/index.d.ts",
16+
"default": "./src/index.js"
17+
},
18+
"./logging": {
19+
"types": "./dist/src/logging.d.ts",
20+
"default": "./src/logging.js"
21+
}
22+
},
23+
"main": "src/index.js",
24+
"types": "dist/src/index.d.ts",
25+
"typesVersions": {
26+
"*": {
27+
".": [
28+
"dist/src/index"
29+
],
30+
"logging": [
31+
"dist/src/logging"
32+
]
33+
}
34+
},
35+
"files": [
36+
"src",
37+
"wit",
38+
"dist/src/*.d.ts",
39+
"dist/src/*.d.ts.map"
40+
],
41+
"scripts": {
42+
"lint": "tsc --build && eslint . && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore",
43+
"build": "tsc --build",
44+
"test": "pnpm run test:node && pnpm run test:browser",
45+
"test:node": "playwright-test 'test/**/!(*.browser).test.js' --mode node",
46+
"test:browser": "playwright-test 'test/**/!(*.node).test.js'"
47+
},
48+
"dependencies": {},
49+
"devDependencies": {
50+
"@types/node": "^20.11.19",
51+
"playwright-test": "^14.1.1"
52+
},
53+
"publishConfig": {
54+
"provenance": true
55+
},
56+
"eslintConfig": {
57+
"extends": [
58+
"@fission-codes"
59+
],
60+
"env": {
61+
"mocha": true
62+
},
63+
"ignorePatterns": [
64+
"dist"
65+
]
66+
},
67+
"depcheck": {
68+
"specials": [
69+
"bin"
70+
],
71+
"ignores": [
72+
"@types/*"
73+
]
74+
}
75+
}

packages/homestar-wit/readme.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Homestar WIT interfaces
2+
3+
[![npm (scoped)](https://img.shields.io/npm/v/%40fission-codes/homestar-wit)](https://www.npmjs.com/package/@fission-codes/homestar-wit)
4+
[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fission-codes/stack/homestar-wit.yml)](https://github.com/fission-codes/stack/actions/workflows/homestar-wit.yml)
5+
[![Built by FISSION](https://img.shields.io/badge/built_by-⌘_Fission-purple.svg)](https://fission.codes)
6+
[![Discord](https://img.shields.io/discord/478735028319158273?&color=mediumslateblue)](https://discord.gg/zAQBDEq)
7+
[![Discourse users](<https://img.shields.io/discourse/users?server=https%3A%2F%2Ftalk.fission.codes&label=talk&color=rgb(14%2C%20118%2C%20178)>)](https://talk.fission.codes)
8+
9+
## Installation
10+
11+
```bash
12+
pnpm install @fission-codes/homestar-wit
13+
```
14+
15+
## Usage
16+
17+
```js
18+
import { log } from '@fission-codes/homestar-wit/logging'
19+
20+
log('error', 'http', `error message`)
21+
```
22+
23+
## Docs
24+
25+
Check <https://fission-codes.github.io/stack/modules/_fission_codes_homestar_wit.html>
26+
27+
## Contributing
28+
29+
- install rust tools
30+
- `cargo install wit-deps-cli`
31+
- wit-deps update
32+
33+
### Refs
34+
35+
- https://github.com/bytecodealliance/wit-deps
36+
37+
Read contributing guidelines [here](.github/CONTRIBUTING.md).
38+
39+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/fission-codes/stack)
40+
41+
## License
42+
43+
This project is licensed under either of
44+
45+
- Apache License, Version 2.0, ([LICENSE-APACHE](./LICENSE-APACHE) or
46+
[http://www.apache.org/licenses/LICENSE-2.0][apache])
47+
- MIT license ([LICENSE-MIT](./LICENSE-MIT) or
48+
[http://opensource.org/licenses/MIT][mit])
49+
50+
at your option.
51+
52+
### Contribution
53+
54+
Unless you explicitly state otherwise, any contribution intentionally
55+
submitted for inclusion in the work by you, as defined in the Apache-2.0
56+
license, shall be dual licensed as above, without any additional terms or
57+
conditions.
58+
59+
[apache]: https://www.apache.org/licenses/LICENSE-2.0
60+
[mit]: http://opensource.org/licenses/MIT

packages/homestar-wit/src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { log } from './logging.js'
2+
3+
log('info', 'homestar-wit', 'hello world!')
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// import { log as wasiLog } from 'wasi:logging/logging'
2+
3+
let wasiLog
4+
5+
/**
6+
* Emit a log message.
7+
8+
A log message has a `level` describing what kind of message is being
9+
sent, a context, which is an uninterpreted string meant to help
10+
consumers group similar messages, and a string containing the message
11+
text.
12+
*
13+
* @param {'trace' | 'debug' | 'info' | 'warn' | 'error' | 'critical' } level
14+
* @param {string} context
15+
* @param {string} message
16+
*/
17+
function _log(level, context, message) {
18+
// eslint-disable-next-line no-console
19+
console.log(level, context, message)
20+
}
21+
22+
/** @type {typeof _log} */
23+
export const log = wasiLog || _log
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { assert, suite } from 'playwright-test/taps'
2+
import { log } from '../src/logging.js'
3+
4+
const test = suite('homestar-wit logging')
5+
6+
test('should log', async function () {
7+
assert.doesNotThrow(() => {
8+
log('critical', 'test', 'message')
9+
})
10+
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"lib": ["ESNext", "DOM"],
5+
"emitDeclarationOnly": true,
6+
"outDir": "dist"
7+
},
8+
"include": ["src", "test", "package.json"],
9+
"exclude": ["node_modules", "dist", "out"],
10+
"typedocOptions": {
11+
"entryPointStrategy": "resolve",
12+
"entryPoints": ["src/logging.js"],
13+
"includeVersion": true,
14+
"excludeExternals": true,
15+
"internalModule": "<internal>"
16+
}
17+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[logging]
2+
url = "https://github.com/WebAssembly/wasi-logging/archive/main.tar.gz"
3+
sha256 = "9676b482485bb0fd2751a390374c1108865a096b7037f4b5dbe524f066bfb06e"
4+
sha512 = "30a621a6d48a0175e8047c062e618523a85f69c45a7c31918da2b888f7527fce1aca67fa132552222725d0f6cdcaed95be7f16c28488d9468c0fad00cb7450b9"

0 commit comments

Comments
 (0)