Skip to content

Commit

Permalink
chore: make a separate README for node module
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloso committed Mar 21, 2023
1 parent a1cc813 commit e6040b0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ jobs:
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: pomsky_${{ matrix.platform }}_${{ steps.vars.outputs.tag }}${{ matrix.file_ending }}
asset_path: target/release/pomsky${{ matrix.file_ending }}
asset_path: target/dist/pomsky${{ matrix.file_ending }}
asset_content_type: application/octet-stream
22 changes: 22 additions & 0 deletions pomsky-wasm/README-node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Pomsky WASM module for node

WASM module of [Pomsky](https://pomsky-lang.org).

## Usage

```js
import { compile } from '@pomsky-lang/compiler-web'

const { output, diagnostics } = compile(`^ C* '.' C* $`, 'js')
```

This _should_ just work in Node.js. To use Pomsky in the browser, use [unplugin](https://www.npmjs.com/package/@pomsky-lang/unplugin) if you're using a bundler, or [compiler-web](https://www.npmjs.com/package/@pomsky-lang/compiler-web) if you want to compile Pomsky expressions on the client.

Don't forget to check if `output === null`, which means that compilation failed, and you have to look at the diagnostics. Even when the expression compiled successfully, `diagnostics` may contain useful warnings.

## License

Dual-licensed under the [MIT license][mit-license] or the [Apache 2.0 license][apache-2-license].

[mit-license]: https://opensource.org/licenses/MIT
[apache-2-license]: https://opensource.org/licenses/Apache-2.0
6 changes: 3 additions & 3 deletions pomsky-wasm/README.md → pomsky-wasm/README-web.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# pomsky-wasm
# Pomsky WASM module for web

Node.js/WASM module of [pomsky](..).
WASM module of [Pomsky](https://pomsky-lang.org).

## Usage

```js
import { compile } from 'pomsky-wasm'
import { compile } from '@pomsky-lang/compiler-web'

const { output, diagnostics } = compile(`^ C* '.' C* $`, 'js')
```
Expand Down
2 changes: 1 addition & 1 deletion pomsky-wasm/justfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set export

just_msg := "\nDone. Make sure to add 'snippets' to the 'files' array in package.json!\nCheck if you set to package name correctly!\nDon't forget to publish with --access=public!\n"
just_msg := "\nDone. Make sure to add 'snippets' to the 'files' array in package.json!\nCheck if you set to package name correctly!\nNow copy the appropriate README to the pkg/ directory.\nDon't forget to publish with --access=public!\n"

build-web:
wasm-pack build --target=web --scope=pomsky-lang -- --features suggestions
Expand Down

0 comments on commit e6040b0

Please sign in to comment.