From a67753e32ad809c758cfa7759af61f547494ed1e Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 21 Mar 2023 17:36:36 +0000 Subject: [PATCH] Fix publish and the JS based tools --- .github/workflows/publish.yml | 86 +++++++++++++------ .gitignore | 1 + Cargo.lock | 104 +++++++++++++---------- Cargo.toml | 2 +- src/js-based-plugin/package-lock.json | 30 +++---- src/js-based-plugin/package.json | 12 ++- src/js-cli-and-library/cli.js | 2 + src/js-cli-and-library/package-lock.json | 20 +++++ src/js-cli-and-library/package.json | 14 ++- 9 files changed, 174 insertions(+), 97 deletions(-) create mode 100644 src/js-cli-and-library/package-lock.json diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1730bcb1..4e8556b2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,7 +26,7 @@ jobs: crates-publish: runs-on: ubuntu-latest outputs: - new-ezno-version: ${{ steps.push.outputs.new-ezno-version }} + new-ezno-version: ${{ steps.get-version.outputs.new-ezno-version }} steps: - uses: actions/checkout@v3 @@ -37,56 +37,78 @@ jobs: - id: set-arguments run: | - ARGS="ezno=${{ github.event.inputs.ezno-version }},ezno-parser=${{ github.event.inputs.ezno-parser-version }},ezno-checker=${{ github.event.inputs.ezno-checker-version }},${{ github.event.inputs.other-versions }}" - echo "::debug::$ARGS" - - VALUE=$(echo $ARGS | jq --raw-input --compact-output 'split(",") | map(select(length > 0 and . != "none")) | map_values(split("=") | { (.[0]): .[1] }) | reduce .[] as $o ({}; . + $o)') - echo "::debug::$VALUE" + KEY_PAIR_ARGS="ezno=${{ github.event.inputs.ezno-version }},ezno-parser=${{ github.event.inputs.ezno-parser-version }},ezno-checker=${{ github.event.inputs.ezno-checker-version }},${{ github.event.inputs.other-versions }}" + + echo "::debug::$KEY_PAIR_ARGS" + + KEY_PAIR_ARGS_JSON=$(echo $KEY_PAIR_ARGS | jq --raw-input --compact-output 'split(",") | map(select(length > 0 and . != "none")) | map_values(split("=") | { (.[0]): .[1] }) | reduce .[] as $o ({}; . + $o)') + + echo "::debug::$KEY_PAIR_ARGS_JSON" - echo "publish-args=$VALUE" >> $GITHUB_OUTPUT + echo "publish-json-args=$KEY_PAIR_ARGS_JSON" >> $GITHUB_OUTPUT shell: bash - name: Crates publish uses: kaleidawave/crates-release-gh-action@main id: release with: - version: ${{ steps.set-arguments.outputs.publish-args }} + version: ${{ steps.set-arguments.outputs.publish-json-args }} crates-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} + - name: Get new Ezno version + id: get-version + run: | + echo "new-ezno-version=$(echo '${{ steps.release.outputs.new-versions-json-object }}' | jq ".ezno" )" >> $GITHUB_OUTPUT + - name: Install WASM build dependencies run: | + # Make sure Rust can target WASM rustup target add wasm32-unknown-unknown + # Install WASM bindgen + mkdir private + cd private mkdir wasm-bindgen cd wasm-bindgen + gh release download 0.2.84 -R rustwasm/wasm-bindgen -p '*x86_64-unknown-linux-musl.tar.gz' -O wasm-bindgen.tar.gz tar -xf wasm-bindgen.tar.gz mv wasm-bindgen-0.2.84-x86_64-unknown-linux-musl/wasm-bindgen wasm-bindgen + pwd >> $GITHUB_PATH env: GH_TOKEN: ${{ github.token }} - - name: Node build & NPM publish - run: | - # Update version. Note done in two steps as breaks writing to something reading to & to keep tabs - cat package.json <(echo '${{ steps.release.outputs.new-versions-json-object }}') | jq --slurp '.[0].version = .[1].ezno | .[0]' > package2.json - cat package2.json | unexpand -t2 > package.json - rm package2.json + - name: Set NPM package version & build + run: | + npm ci + npm version ${{ steps.get-version.outputs.new-ezno-version }} + npm run build-release + working-directory: src/js-cli-and-library - # not in root but still works - cargo build --release --lib --target wasm32-unknown-unknown - wasm-bindgen --out-dir . --target nodejs ../../target/wasm32-unknown-unknown/release/ezno_lib.wasm + - name: NPM publish (cli and library) + uses: rxfork/npm-publish@v1 + with: + token: ${{ secrets.NPM_REGISTRY_TOKEN }} + package: src/js-cli-and-library/package.json + + - name: Update plugin version and dependencies + run: | + # Hopefully propagated in 30 seconds + sleep 30 + npm ci + npm install ezno@${{ steps.get-version.outputs.new-ezno-version }} + npm version ${{ steps.get-version.outputs.new-ezno-version }} + working-directory: src/js-based-plugin - npm run build - npm publish - working-directory: src/js-cli-and-library - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }} + - name: NPM publish (plugin) + uses: rxfork/npm-publish@v1 + with: + token: ${{ secrets.NPM_REGISTRY_TOKEN }} + package: src/js-based-plugin/package.json - - name: Push updated Cargo.toml - id: push + - name: Push updated manifests run: | - echo "new-ezno-version=$(echo '${{ steps.release.outputs.new-versions-json-object }}' | jq ".ezno" )" >> $GITHUB_OUTPUT # Create tags echo '${{ steps.release.outputs.new-versions }}' | jq -r '.[]' | while read -r update; do git tag "release/$update" @@ -105,6 +127,7 @@ jobs: build: if: ${{ github.event.inputs.ezno-version != 'none' }} needs: crates-publish + strategy: matrix: os: [ubuntu-latest, windows-latest] @@ -114,16 +137,20 @@ jobs: platform_name: x86_64-pc-windows - os: ubuntu-latest platform_name: x86_64-unknown-linux + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - name: Build binary run: cargo build --release + - name: Rename and move release assets run: | mkdir artifacts mv target/release/ezno${{ matrix.executable-extension }} artifacts/ezno-${{ needs.crates-publish.outputs.new-ezno-version }}-${{ matrix.platform_name }}${{ matrix.executable-extension }} + - uses: actions/upload-artifact@v3 with: name: build-artifacts @@ -136,11 +163,18 @@ jobs: needs: [crates-publish, build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 with: name: build-artifacts path: build-artifacts + + - name: Print artifacts + run: | + echo "::group::Print Artifacts" + ls -R build-artifacts + echo "::endgroup::" - name: GitHub release uses: softprops/action-gh-release@v1 diff --git a/.gitignore b/.gitignore index 742920ad..f219ed99 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ src/js-cli-and-library/**.wasm src/js-cli-and-library/**.d.ts src/js-cli-and-library/ezno_lib.js +node_modules \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index db7e8cb2..f59ce197 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,7 @@ dependencies = [ "argh_shared", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -56,9 +56,9 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bytemuck" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" [[package]] name = "cfg-if" @@ -114,7 +114,7 @@ checksum = "adc2a1b7c0031fb651e9bc1fa4255da82747c187b9ac1dc36b3783d71fadd9d5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -133,7 +133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1f1f1ef49cdc13ee8c642c6afa3e56fb3a082a48c89e3f75006cc00da6cce51" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -142,7 +142,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98494f2b89f1fa56b5cff4c1a4beb84441d51b5042fb74a403a7d01ab5fd4a19" dependencies = [ - "syn", + "syn 1.0.109", "syn-helpers", ] @@ -176,7 +176,7 @@ dependencies = [ "either_n", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -188,12 +188,12 @@ dependencies = [ "proc-macro2", "proc_macro_roids", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "ezno" -version = "0.0.5" +version = "0.0.7" dependencies = [ "argh", "base64", @@ -365,9 +365,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" [[package]] name = "log" @@ -386,7 +386,7 @@ checksum = "30dd27efba9ccf9069f76ff0b7b65eb293a844d9918e15a36098de609c9aacd7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -478,9 +478,9 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" dependencies = [ "unicode-ident", ] @@ -493,14 +493,14 @@ checksum = "06675fa2c577f52bcf77fbb511123927547d154faa08097cc012c66ec3c9611a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -564,15 +564,15 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e075556adeec065f185a7811a9808f8523c1299aa7e318b3dd7d1eb72417f6b" dependencies = [ - "syn", + "syn 1.0.109", "syn-helpers", ] [[package]] name = "serde" -version = "1.0.152" +version = "1.0.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9" dependencies = [ "serde_derive", ] @@ -590,13 +590,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.4", ] [[package]] @@ -636,6 +636,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c622ae390c9302e214c31013517c2061ecb2699935882c60a9b37f82f8625ae" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn-helpers" version = "0.4.3" @@ -645,7 +656,7 @@ dependencies = [ "either_n", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -681,9 +692,9 @@ checksum = "921ae88b4cdbf7aa5bc708c9d02d37c194c3fc4189c9698320ef19968354d36a" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-width" @@ -693,12 +704,11 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" dependencies = [ "same-file", - "winapi 0.3.9", "winapi-util", ] @@ -723,7 +733,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -745,7 +755,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -821,9 +831,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -836,45 +846,45 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "ws2_32-sys" diff --git a/Cargo.toml b/Cargo.toml index 5cf91238..1be440aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = ["parser", "parser/visitable-derive", "parser/generator", "checker"] name = "ezno" description = "A JavaScript checker and compiler. For use as a library or cli" authors = ["Ben "] -version = "0.0.5" +version = "0.0.7" edition = "2021" license = "MIT" homepage = "https://kaleidawave.github.io/posts/introducing-ezno/" diff --git a/src/js-based-plugin/package-lock.json b/src/js-based-plugin/package-lock.json index fca25c3b..b5e9c7ef 100644 --- a/src/js-based-plugin/package-lock.json +++ b/src/js-based-plugin/package-lock.json @@ -1,15 +1,15 @@ { - "name": "unplugin-ezno-plugin", + "name": "unplugin-ezno", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "unplugin-ezno-plugin", + "name": "unplugin-ezno", "version": "0.0.0", "license": "MIT", "dependencies": { - "ezno": "file:../js-cli-and-library", + "ezno": "^0.0.1", "unplugin": "^1.3.1" }, "funding": { @@ -29,18 +29,6 @@ "url": "https://github.com/sponsors/kaleidawave" } }, - "../js-cli-and-library": { - "name": "ezno", - "version": "0.0.0", - "license": "MIT", - "bin": { - "ezno": "bin.js" - }, - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/kaleidawave" - } - }, "node_modules/acorn": { "version": "8.8.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", @@ -110,8 +98,16 @@ } }, "node_modules/ezno": { - "resolved": "../js-cli-and-library", - "link": true + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/ezno/-/ezno-0.0.1.tgz", + "integrity": "sha512-rhIPiCKFsVudpSaQ9yNOjS1QjCeCpPBK4Nk+TlbuUmIePJzAQ0Qosugn9lOe5xBRkVaeuvH0621y2L0Rt5VNUg==", + "bin": { + "ezno": "cli.js" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/kaleidawave" + } }, "node_modules/fill-range": { "version": "7.0.1", diff --git a/src/js-based-plugin/package.json b/src/js-based-plugin/package.json index f0649122..d656b962 100644 --- a/src/js-based-plugin/package.json +++ b/src/js-based-plugin/package.json @@ -5,16 +5,22 @@ "main": "index.mjs", "license": "MIT", "dependencies": { - "ezno": "file:../js-cli-and-library", + "ezno": "^0.0.1", "unplugin": "^1.3.1" }, + "keywords": [ + "type-checker", + "vite", + "webpack", + "ezno" + ], "author": { "name": "Ben", "email": "kaleidawave@gmail.com", "url": "https://kaleidawave.github.io/" }, "funding": { - "type" : "individual", - "url" : "https://github.com/sponsors/kaleidawave" + "type": "individual", + "url": "https://github.com/sponsors/kaleidawave" } } diff --git a/src/js-cli-and-library/cli.js b/src/js-cli-and-library/cli.js index c8087b9c..d9a5d3c1 100644 --- a/src/js-cli-and-library/cli.js +++ b/src/js-cli-and-library/cli.js @@ -1 +1,3 @@ +#!/usr/bin/env node + require("./ezno_lib").run_cli() \ No newline at end of file diff --git a/src/js-cli-and-library/package-lock.json b/src/js-cli-and-library/package-lock.json new file mode 100644 index 00000000..a4ae03d0 --- /dev/null +++ b/src/js-cli-and-library/package-lock.json @@ -0,0 +1,20 @@ +{ + "name": "ezno", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ezno", + "version": "0.0.1", + "license": "MIT", + "bin": { + "ezno": "cli.js" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/kaleidawave" + } + } + } +} diff --git a/src/js-cli-and-library/package.json b/src/js-cli-and-library/package.json index 5db29218..f8999e64 100644 --- a/src/js-cli-and-library/package.json +++ b/src/js-cli-and-library/package.json @@ -1,6 +1,6 @@ { "name": "ezno", - "version": "0.0.0", + "version": "0.0.1", "description": "A JavaScript compiler and TypeScript checker written in Rust with a focus on static analysis and runtime performance", "license": "MIT", "repository": "https://github.com/kaleidawave/ezno", @@ -9,8 +9,16 @@ "scripts": { "clean": "rm ezno_lib.* && rm ezno_lib_bg.*", "build": "cargo build --lib --target wasm32-unknown-unknown && npm run bind", - "bind": "wasm-bindgen --out-dir . --target nodejs ../../target/wasm32-unknown-unknown/debug/ezno_lib.wasm" + "bind": "wasm-bindgen --out-dir . --target nodejs ../../target/wasm32-unknown-unknown/debug/ezno_lib.wasm", + "build-release": "cargo build --lib --release --target wasm32-unknown-unknown && npm run bind-release", + "bind-release": "wasm-bindgen --out-dir . --target nodejs ../../target/wasm32-unknown-unknown/release/ezno_lib.wasm" }, + "keywords": [ + "typescript", + "checker", + "type-checker", + "compiler" + ], "bin": { "ezno": "./cli.js" }, @@ -23,4 +31,4 @@ "type": "individual", "url": "https://github.com/sponsors/kaleidawave" } -} +} \ No newline at end of file