From e6040b0484d78f2e24907ca9681413718d69d608 Mon Sep 17 00:00:00 2001 From: Ludwig Stecher Date: Tue, 21 Mar 2023 23:48:28 +0100 Subject: [PATCH] chore: make a separate README for node module --- .github/workflows/release.yml | 2 +- pomsky-wasm/README-node.md | 22 ++++++++++++++++++++++ pomsky-wasm/{README.md => README-web.md} | 6 +++--- pomsky-wasm/justfile | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 pomsky-wasm/README-node.md rename pomsky-wasm/{README.md => README-web.md} (88%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34322cc..1c87beb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/pomsky-wasm/README-node.md b/pomsky-wasm/README-node.md new file mode 100644 index 0000000..df4e654 --- /dev/null +++ b/pomsky-wasm/README-node.md @@ -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 diff --git a/pomsky-wasm/README.md b/pomsky-wasm/README-web.md similarity index 88% rename from pomsky-wasm/README.md rename to pomsky-wasm/README-web.md index 840cac0..d8c4552 100644 --- a/pomsky-wasm/README.md +++ b/pomsky-wasm/README-web.md @@ -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') ``` diff --git a/pomsky-wasm/justfile b/pomsky-wasm/justfile index 90c3ef5..e1e5c71 100644 --- a/pomsky-wasm/justfile +++ b/pomsky-wasm/justfile @@ -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