From 53ba27bd1171d7b8bcd06599f974ae1ab7bb263c Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Sun, 7 Aug 2022 16:53:21 +0000 Subject: [PATCH] wasm-pack fixes --- .editorconfig | 12 ++++++++++++ .woodpecker/wasm-o-x-rust.yml | 3 ++- tools/wasm-pack-plugin/README.md | 5 +++-- tools/wasm-pack-plugin/plugin.sh | 12 +++++++----- wasm/o-x-rust/Cargo.lock | 2 +- wasm/o-x-rust/Cargo.toml | 3 +-- 6 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6ac775d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.yml] +indent_style=space diff --git a/.woodpecker/wasm-o-x-rust.yml b/.woodpecker/wasm-o-x-rust.yml index dd4b2a9..fd0eb3d 100644 --- a/.woodpecker/wasm-o-x-rust.yml +++ b/.woodpecker/wasm-o-x-rust.yml @@ -19,6 +19,7 @@ pipeline: settings: actions: build,publish folder: wasm/o-x-rust + target: web scope: game-algorithms username: cyclane token: @@ -31,4 +32,4 @@ pipeline: - wasm/o-x-rust/* - .woodpecker/wasm-o-x-rust.yml depends_on: - - tools-wasm-pack-plugin \ No newline at end of file + - tools-wasm-pack-plugin diff --git a/tools/wasm-pack-plugin/README.md b/tools/wasm-pack-plugin/README.md index 51827cf..0f93a15 100644 --- a/tools/wasm-pack-plugin/README.md +++ b/tools/wasm-pack-plugin/README.md @@ -13,7 +13,8 @@ When using this plugin it is best to pull every time since it can be updated oft ### Build -- `build_profile` (default=`release`): Build profile to use for `wasm-pack build` +- `profile` (default=`release`): Build profile to use for `wasm-pack build` +- `target` (default=`bundler`): Target to build for - `make`: Optionally run a make target building ### Publish @@ -37,4 +38,4 @@ pipeline: token: from_secret: DEPLOY_TOKEN registry: https://git.koval.net/api/packages/cyclane/npm/ -``` \ No newline at end of file +``` diff --git a/tools/wasm-pack-plugin/plugin.sh b/tools/wasm-pack-plugin/plugin.sh index d6cbc7d..1e84076 100755 --- a/tools/wasm-pack-plugin/plugin.sh +++ b/tools/wasm-pack-plugin/plugin.sh @@ -2,7 +2,7 @@ # Properties: actions # username, token, registry=https://registry.npmjs.org, scope, folder=. -# build_profile=release, make +# profile=release, target=bundler, make # publish: username, token # build: @@ -14,7 +14,8 @@ echo username: ${PLUGIN_USERNAME} echo registry: ${PLUGIN_REGISTRY:-https://registry.npmjs.org/} echo scope: ${PLUGIN_SCOPE} echo folder: ${PLUGIN_FOLDER:-.} -echo build_profile: ${PLUGIN_BUILD_PROFILE:-release} +echo profile: ${PLUGIN_PROFILE:-release} +echo target: ${PLUGIN_TARGET:-bundler} echo make: ${PLUGIN_MAKE} set -eu @@ -23,9 +24,9 @@ cd ${PLUGIN_FOLDER:-.} if [[ "${PLUGIN_ACTIONS}" =~ '(^|,)build(,|$)' ]]; then if [ "${PLUGIN_SCOPE:-}" = "" ]; then - wasm-pack build --${PLUGIN_BUILD_PROFILE:-release} + wasm-pack build --${PLUGIN_PROFILE:-release} --target ${PLUGIN_TARGET:-bundler} else - wasm-pack build --${PLUGIN_BUILD_PROFILE:-release} --scope ${PLUGIN_SCOPE} + wasm-pack build --${PLUGIN_PROFILE:-release} --target ${PLUGIN_TARGET:-bundler} --scope ${PLUGIN_SCOPE} fi if [ "${PLUGIN_MAKE:-}" != "" ]; then @@ -35,6 +36,7 @@ fi if [[ "${PLUGIN_ACTIONS}" =~ '(^|,)publish(,|$)' ]]; then cd pkg + npm pkg set type=module REGISTRY=${PLUGIN_REGISTRY:-https://registry.npmjs.org/} if [ "${PLUGIN_SCOPE:-}" = "" ]; then @@ -45,4 +47,4 @@ if [[ "${PLUGIN_ACTIONS}" =~ '(^|,)publish(,|$)' ]]; then npm config set -- $(echo ${REGISTRY} | sed -Ee "s/^https?://"):_authToken "${PLUGIN_TOKEN}" npm publish -fi \ No newline at end of file +fi diff --git a/wasm/o-x-rust/Cargo.lock b/wasm/o-x-rust/Cargo.lock index a34741c..ff1f126 100644 --- a/wasm/o-x-rust/Cargo.lock +++ b/wasm/o-x-rust/Cargo.lock @@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "o-x-rust" -version = "0.0.1" +version = "0.0.2" dependencies = [ "wasm-bindgen", ] diff --git a/wasm/o-x-rust/Cargo.toml b/wasm/o-x-rust/Cargo.toml index 9163ee4..daca615 100644 --- a/wasm/o-x-rust/Cargo.toml +++ b/wasm/o-x-rust/Cargo.toml @@ -3,9 +3,8 @@ name = "o-x-rust" description = "Naughts and crosses WASM algorithms" repository = "https://git.koval.net/cyclane/game-algorithms/src/branch/main/wasm/o-x-rust" license = "GNU GPLv3" -license-file = "LICENSE" readme = "README.md" -version = "0.0.1" +version = "0.0.2" edition = "2021" [lib]