diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..7ede30e --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.aarch64-unknown-linux-musl] +linker = "aarch64-linux-musl-gcc" +rustflags = ["-C", "target-feature=-crt-static"] \ No newline at end of file diff --git a/.github/workflows/.CI.yml b/.github/workflows/.CI.yml new file mode 100644 index 0000000..dcaa27c --- /dev/null +++ b/.github/workflows/.CI.yml @@ -0,0 +1,500 @@ +name: CI +env: + DEBUG: napi:* + APP_NAME: minecraft-essentials + MACOSX_DEPLOYMENT_TARGET: '10.13' +permissions: + contents: write + id-token: write +'on': + push: + branches: + - main + tags-ignore: + - '**' + paths-ignore: + - '**/*.md' + - LICENSE + - '**/*.gitignore' + - .editorconfig + - docs/** + pull_request: null +jobs: + build: + strategy: + fail-fast: false + matrix: + settings: + - host: macos-latest + target: x86_64-apple-darwin + build: | + yarn build + strip -x *.node + - host: windows-latest + build: yarn build + target: x86_64-pc-windows-msvc + - host: windows-latest + build: | + yarn build --target i686-pc-windows-msvc + yarn test + target: i686-pc-windows-msvc + - host: ubuntu-latest + target: x86_64-unknown-linux-gnu + docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian + build: |- + set -e && + yarn build --target x86_64-unknown-linux-gnu && + strip *.node + - host: ubuntu-latest + target: x86_64-unknown-linux-musl + docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine + build: set -e && yarn build && strip *.node + - host: macos-latest + target: aarch64-apple-darwin + build: | + yarn build --target aarch64-apple-darwin + strip -x *.node + - host: ubuntu-latest + target: aarch64-unknown-linux-gnu + docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 + build: |- + set -e && + yarn build --target aarch64-unknown-linux-gnu && + aarch64-unknown-linux-gnu-strip *.node + - host: ubuntu-latest + target: armv7-unknown-linux-gnueabihf + setup: | + sudo apt-get update + sudo apt-get install gcc-arm-linux-gnueabihf -y + build: | + yarn build --target armv7-unknown-linux-gnueabihf + arm-linux-gnueabihf-strip *.node + - host: ubuntu-latest + target: aarch64-linux-android + build: | + yarn build --target aarch64-linux-android + ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node + - host: ubuntu-latest + target: armv7-linux-androideabi + build: | + yarn build --target armv7-linux-androideabi + ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node + - host: ubuntu-latest + target: aarch64-unknown-linux-musl + docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine + build: |- + set -e && + rustup target add aarch64-unknown-linux-musl && + yarn build --target aarch64-unknown-linux-musl && + /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node + - host: windows-latest + target: aarch64-pc-windows-msvc + build: yarn build --target aarch64-pc-windows-msvc + - host: ubuntu-latest + target: riscv64gc-unknown-linux-gnu + setup: | + sudo apt-get update + sudo apt-get install gcc-riscv64-linux-gnu -y + build: | + yarn build --target riscv64gc-unknown-linux-gnu + riscv64-linux-gnu-strip *.node + name: stable - ${{ matrix.settings.target }} - node@18 + runs-on: ${{ matrix.settings.host }} + steps: + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + if: ${{ !matrix.settings.docker }} + with: + node-version: 18 + cache: yarn + - name: Install + uses: dtolnay/rust-toolchain@stable + if: ${{ !matrix.settings.docker }} + with: + toolchain: stable + targets: ${{ matrix.settings.target }} + - name: Cache cargo + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + .cargo-cache + target/ + key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} + - uses: goto-bus-stop/setup-zig@v2 + if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} + with: + version: 0.11.0 + - name: Setup toolchain + run: ${{ matrix.settings.setup }} + if: ${{ matrix.settings.setup }} + shell: bash + - name: Setup node x86 + if: matrix.settings.target == 'i686-pc-windows-msvc' + run: yarn config set supportedArchitectures.cpu "ia32" + shell: bash + - name: Install dependencies + run: yarn install + - name: Setup node x86 + uses: actions/setup-node@v4 + if: matrix.settings.target == 'i686-pc-windows-msvc' + with: + node-version: 18 + cache: yarn + architecture: x86 + - name: Build in docker + uses: addnab/docker-run-action@v3 + if: ${{ matrix.settings.docker }} + with: + image: ${{ matrix.settings.docker }} + options: '--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build' + run: ${{ matrix.settings.build }} + - name: Build + run: ${{ matrix.settings.build }} + if: ${{ !matrix.settings.docker }} + shell: bash + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: bindings-${{ matrix.settings.target }} + path: ${{ env.APP_NAME }}.*.node + if-no-files-found: error + build-freebsd: + runs-on: macos-12 + name: Build FreeBSD + steps: + - uses: actions/checkout@v4 + - name: Build + id: build + uses: cross-platform-actions/action@v0.21.0 + env: + DEBUG: napi:* + RUSTUP_IO_THREADS: 1 + with: + operating_system: freebsd + version: '13.2' + memory: 13G + cpu_count: 3 + environment_variables: DEBUG RUSTUP_IO_THREADS + shell: bash + run: | + sudo pkg install -y -f curl node libnghttp2 npm + sudo npm install -g yarn --ignore-scripts + curl https://sh.rustup.rs -sSf --output rustup.sh + sh rustup.sh -y --profile minimal --default-toolchain stable + source "$HOME/.cargo/env" + echo "~~~~ rustc --version ~~~~" + rustc --version + echo "~~~~ node -v ~~~~" + node -v + echo "~~~~ yarn --version ~~~~" + yarn --version + pwd + ls -lah + whoami + env + freebsd-version + yarn install + yarn build + strip -x *.node + yarn test + rm -rf node_modules + rm -rf target + rm -rf .yarn/cache + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: bindings-freebsd + path: ${{ env.APP_NAME }}.*.node + if-no-files-found: error + test-macOS-windows-binding: + name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + settings: + - host: macos-latest + target: x86_64-apple-darwin + - host: windows-latest + target: x86_64-pc-windows-msvc + node: + - '18' + - '20' + runs-on: ${{ matrix.settings.host }} + steps: + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: yarn + - name: Install dependencies + run: yarn install + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: bindings-${{ matrix.settings.target }} + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Test bindings + run: yarn test + test-linux-x64-gnu-binding: + name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + node: + - '18' + - '20' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: yarn + - name: Install dependencies + run: yarn install + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: bindings-x86_64-unknown-linux-gnu + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Test bindings + run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test + test-linux-x64-musl-binding: + name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + node: + - '18' + - '20' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + cache: yarn + - name: Install dependencies + run: | + yarn config set supportedArchitectures.libc "musl" + yarn install + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: bindings-x86_64-unknown-linux-musl + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Test bindings + run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test + test-linux-aarch64-gnu-binding: + name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + node: + - '18' + - '20' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: bindings-aarch64-unknown-linux-gnu + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Install dependencies + run: | + yarn config set supportedArchitectures.cpu "arm64" + yarn config set supportedArchitectures.libc "glibc" + yarn install + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - name: Setup and run tests + uses: addnab/docker-run-action@v3 + with: + image: node:${{ matrix.node }}-slim + options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' + run: | + set -e + yarn test + ls -la + test-linux-aarch64-musl-binding: + name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }} + needs: + - build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: bindings-aarch64-unknown-linux-musl + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Install dependencies + run: | + yarn config set supportedArchitectures.cpu "arm64" + yarn config set supportedArchitectures.libc "musl" + yarn install + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - name: Setup and run tests + uses: addnab/docker-run-action@v3 + with: + image: node:lts-alpine + options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' + run: | + set -e + yarn test + test-linux-arm-gnueabihf-binding: + name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }} + needs: + - build + strategy: + fail-fast: false + matrix: + node: + - '18' + - '20' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: bindings-armv7-unknown-linux-gnueabihf + path: . + - name: List packages + run: ls -R . + shell: bash + - name: Install dependencies + run: | + yarn config set supportedArchitectures.cpu "arm" + yarn install + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm + - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - name: Setup and run tests + uses: addnab/docker-run-action@v3 + with: + image: node:${{ matrix.node }}-bullseye-slim + options: '--platform linux/arm/v7 -v ${{ github.workspace }}:/build -w /build' + run: | + set -e + yarn test + ls -la + universal-macOS: + name: Build universal macOS binary + needs: + - build + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + - name: Install dependencies + run: yarn install + - name: Download macOS x64 artifact + uses: actions/download-artifact@v3 + with: + name: bindings-x86_64-apple-darwin + path: artifacts + - name: Download macOS arm64 artifact + uses: actions/download-artifact@v3 + with: + name: bindings-aarch64-apple-darwin + path: artifacts + - name: Combine binaries + run: yarn universal + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: bindings-universal-apple-darwin + path: ${{ env.APP_NAME }}.*.node + if-no-files-found: error + publish: + name: Publish + runs-on: ubuntu-latest + needs: + - build-freebsd + - test-macOS-windows-binding + - test-linux-x64-gnu-binding + - test-linux-x64-musl-binding + - test-linux-aarch64-gnu-binding + - test-linux-aarch64-musl-binding + - test-linux-arm-gnueabihf-binding + - universal-macOS + steps: + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + - name: Install dependencies + run: yarn install + - name: Download all artifacts + uses: actions/download-artifact@v3 + with: + path: artifacts + - name: Move artifacts + run: yarn artifacts + - name: List packages + run: ls -R ./npm + shell: bash + - name: Publish + run: | + npm config set provenance true + if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; + then + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --access public + elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+"; + then + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --tag next --access public + else + echo "Not a release, skipping publish" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a7c950d --- /dev/null +++ b/.gitignore @@ -0,0 +1,205 @@ +# Created by https://www.toptal.com/developers/gitignore/api/node +# Edit at https://www.toptal.com/developers/gitignore?templates=node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# End of https://www.toptal.com/developers/gitignore/api/node + +# Created by https://www.toptal.com/developers/gitignore/api/macos +# Edit at https://www.toptal.com/developers/gitignore?templates=macos + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +# End of https://www.toptal.com/developers/gitignore/api/macos + +# Created by https://www.toptal.com/developers/gitignore/api/windows +# Edit at https://www.toptal.com/developers/gitignore?templates=windows + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/windows + +#Added by cargo + +/target +Cargo.lock + +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + +*.node + + + + +index.d.ts +index.js +/dist +/temp/* \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..ec144db --- /dev/null +++ b/.npmignore @@ -0,0 +1,13 @@ +target +Cargo.lock +.cargo +.github +npm +.eslintrc +.prettierignore +rustfmt.toml +yarn.lock +*.node +.yarn +__test__ +renovate.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3c9c6a8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "files.exclude": { + "npm": true, + ".yarn": true, + ".cargo": true + } +} \ No newline at end of file diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..59df12d --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,19 @@ +[package] +edition = "2021" +name = "minecraft-essentials" +version = "0.5.0" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix +napi = { version = "2.12.2", default-features = false, features = ["napi4"] } +napi-derive = "2.12.2" +# minecraft-essentials = {git = "https://github.com/minecraft-essentials/minecraft-essentials"} + +[build-dependencies] +napi-build = "2.0.1" + +[profile.release] +lto = true diff --git a/README.md b/README.md new file mode 100644 index 0000000..316de60 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Minecraft-Essentials NPM Bindings. + +Binding for a good package. \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..1f866b6 --- /dev/null +++ b/build.rs @@ -0,0 +1,5 @@ +extern crate napi_build; + +fn main() { + napi_build::setup(); +} diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000..041f748 Binary files /dev/null and b/bun.lockb differ diff --git a/npm/android-arm-eabi/README.md b/npm/android-arm-eabi/README.md new file mode 100644 index 0000000..d8cf179 --- /dev/null +++ b/npm/android-arm-eabi/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-android-arm-eabi` + +This is the **armv7-linux-androideabi** binary for `minecraft-essentials` diff --git a/npm/android-arm-eabi/package.json b/npm/android-arm-eabi/package.json new file mode 100644 index 0000000..aa940aa --- /dev/null +++ b/npm/android-arm-eabi/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-android-arm-eabi", + "version": "0.0.0", + "os": [ + "android" + ], + "cpu": [ + "arm" + ], + "main": "minecraft-essentials.android-arm-eabi.node", + "files": [ + "minecraft-essentials.android-arm-eabi.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/android-arm64/README.md b/npm/android-arm64/README.md new file mode 100644 index 0000000..233394e --- /dev/null +++ b/npm/android-arm64/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-android-arm64` + +This is the **aarch64-linux-android** binary for `minecraft-essentials` diff --git a/npm/android-arm64/package.json b/npm/android-arm64/package.json new file mode 100644 index 0000000..b0f74e6 --- /dev/null +++ b/npm/android-arm64/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-android-arm64", + "version": "0.0.0", + "os": [ + "android" + ], + "cpu": [ + "arm64" + ], + "main": "minecraft-essentials.android-arm64.node", + "files": [ + "minecraft-essentials.android-arm64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/darwin-arm64/README.md b/npm/darwin-arm64/README.md new file mode 100644 index 0000000..37e08ec --- /dev/null +++ b/npm/darwin-arm64/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-darwin-arm64` + +This is the **aarch64-apple-darwin** binary for `minecraft-essentials` diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json new file mode 100644 index 0000000..feff088 --- /dev/null +++ b/npm/darwin-arm64/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-darwin-arm64", + "version": "0.0.0", + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "main": "minecraft-essentials.darwin-arm64.node", + "files": [ + "minecraft-essentials.darwin-arm64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/darwin-universal/README.md b/npm/darwin-universal/README.md new file mode 100644 index 0000000..416e0c1 --- /dev/null +++ b/npm/darwin-universal/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-darwin-universal` + +This is the **universal-apple-darwin** binary for `minecraft-essentials` diff --git a/npm/darwin-universal/package.json b/npm/darwin-universal/package.json new file mode 100644 index 0000000..0a0b82c --- /dev/null +++ b/npm/darwin-universal/package.json @@ -0,0 +1,15 @@ +{ + "name": "minecraft-essentials-darwin-universal", + "version": "0.0.0", + "os": [ + "darwin" + ], + "main": "minecraft-essentials.darwin-universal.node", + "files": [ + "minecraft-essentials.darwin-universal.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/darwin-x64/README.md b/npm/darwin-x64/README.md new file mode 100644 index 0000000..73bfd0c --- /dev/null +++ b/npm/darwin-x64/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-darwin-x64` + +This is the **x86_64-apple-darwin** binary for `minecraft-essentials` diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json new file mode 100644 index 0000000..87e927e --- /dev/null +++ b/npm/darwin-x64/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-darwin-x64", + "version": "0.0.0", + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ], + "main": "minecraft-essentials.darwin-x64.node", + "files": [ + "minecraft-essentials.darwin-x64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/freebsd-x64/README.md b/npm/freebsd-x64/README.md new file mode 100644 index 0000000..8e2f635 --- /dev/null +++ b/npm/freebsd-x64/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-freebsd-x64` + +This is the **x86_64-unknown-freebsd** binary for `minecraft-essentials` diff --git a/npm/freebsd-x64/package.json b/npm/freebsd-x64/package.json new file mode 100644 index 0000000..81be1bf --- /dev/null +++ b/npm/freebsd-x64/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-freebsd-x64", + "version": "0.0.0", + "os": [ + "freebsd" + ], + "cpu": [ + "x64" + ], + "main": "minecraft-essentials.freebsd-x64.node", + "files": [ + "minecraft-essentials.freebsd-x64.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/linux-arm-gnueabihf/README.md b/npm/linux-arm-gnueabihf/README.md new file mode 100644 index 0000000..ba371ef --- /dev/null +++ b/npm/linux-arm-gnueabihf/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-linux-arm-gnueabihf` + +This is the **armv7-unknown-linux-gnueabihf** binary for `minecraft-essentials` diff --git a/npm/linux-arm-gnueabihf/package.json b/npm/linux-arm-gnueabihf/package.json new file mode 100644 index 0000000..b6a2e80 --- /dev/null +++ b/npm/linux-arm-gnueabihf/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-linux-arm-gnueabihf", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "arm" + ], + "main": "minecraft-essentials.linux-arm-gnueabihf.node", + "files": [ + "minecraft-essentials.linux-arm-gnueabihf.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/linux-arm64-gnu/README.md b/npm/linux-arm64-gnu/README.md new file mode 100644 index 0000000..fc7d304 --- /dev/null +++ b/npm/linux-arm64-gnu/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-linux-arm64-gnu` + +This is the **aarch64-unknown-linux-gnu** binary for `minecraft-essentials` diff --git a/npm/linux-arm64-gnu/package.json b/npm/linux-arm64-gnu/package.json new file mode 100644 index 0000000..8ba6b02 --- /dev/null +++ b/npm/linux-arm64-gnu/package.json @@ -0,0 +1,21 @@ +{ + "name": "minecraft-essentials-linux-arm64-gnu", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "main": "minecraft-essentials.linux-arm64-gnu.node", + "files": [ + "minecraft-essentials.linux-arm64-gnu.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "glibc" + ] +} \ No newline at end of file diff --git a/npm/linux-arm64-musl/README.md b/npm/linux-arm64-musl/README.md new file mode 100644 index 0000000..33b9fd3 --- /dev/null +++ b/npm/linux-arm64-musl/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-linux-arm64-musl` + +This is the **aarch64-unknown-linux-musl** binary for `minecraft-essentials` diff --git a/npm/linux-arm64-musl/package.json b/npm/linux-arm64-musl/package.json new file mode 100644 index 0000000..bc25d15 --- /dev/null +++ b/npm/linux-arm64-musl/package.json @@ -0,0 +1,21 @@ +{ + "name": "minecraft-essentials-linux-arm64-musl", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "main": "minecraft-essentials.linux-arm64-musl.node", + "files": [ + "minecraft-essentials.linux-arm64-musl.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "musl" + ] +} \ No newline at end of file diff --git a/npm/linux-riscv64-gnu/README.md b/npm/linux-riscv64-gnu/README.md new file mode 100644 index 0000000..c3e2ebb --- /dev/null +++ b/npm/linux-riscv64-gnu/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-linux-riscv64-gnu` + +This is the **riscv64gc-unknown-linux-gnu** binary for `minecraft-essentials` diff --git a/npm/linux-riscv64-gnu/package.json b/npm/linux-riscv64-gnu/package.json new file mode 100644 index 0000000..3559164 --- /dev/null +++ b/npm/linux-riscv64-gnu/package.json @@ -0,0 +1,21 @@ +{ + "name": "minecraft-essentials-linux-riscv64-gnu", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "riscv64" + ], + "main": "minecraft-essentials.linux-riscv64-gnu.node", + "files": [ + "minecraft-essentials.linux-riscv64-gnu.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "glibc" + ] +} \ No newline at end of file diff --git a/npm/linux-x64-gnu/README.md b/npm/linux-x64-gnu/README.md new file mode 100644 index 0000000..b0bca68 --- /dev/null +++ b/npm/linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `minecraft-essentials` diff --git a/npm/linux-x64-gnu/package.json b/npm/linux-x64-gnu/package.json new file mode 100644 index 0000000..37eb461 --- /dev/null +++ b/npm/linux-x64-gnu/package.json @@ -0,0 +1,21 @@ +{ + "name": "minecraft-essentials-linux-x64-gnu", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "minecraft-essentials.linux-x64-gnu.node", + "files": [ + "minecraft-essentials.linux-x64-gnu.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "glibc" + ] +} \ No newline at end of file diff --git a/npm/linux-x64-musl/README.md b/npm/linux-x64-musl/README.md new file mode 100644 index 0000000..76af9b6 --- /dev/null +++ b/npm/linux-x64-musl/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-linux-x64-musl` + +This is the **x86_64-unknown-linux-musl** binary for `minecraft-essentials` diff --git a/npm/linux-x64-musl/package.json b/npm/linux-x64-musl/package.json new file mode 100644 index 0000000..dd0f011 --- /dev/null +++ b/npm/linux-x64-musl/package.json @@ -0,0 +1,21 @@ +{ + "name": "minecraft-essentials-linux-x64-musl", + "version": "0.0.0", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "minecraft-essentials.linux-x64-musl.node", + "files": [ + "minecraft-essentials.linux-x64-musl.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "libc": [ + "musl" + ] +} \ No newline at end of file diff --git a/npm/win32-arm64-msvc/README.md b/npm/win32-arm64-msvc/README.md new file mode 100644 index 0000000..a6f360c --- /dev/null +++ b/npm/win32-arm64-msvc/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-win32-arm64-msvc` + +This is the **aarch64-pc-windows-msvc** binary for `minecraft-essentials` diff --git a/npm/win32-arm64-msvc/package.json b/npm/win32-arm64-msvc/package.json new file mode 100644 index 0000000..051f7fe --- /dev/null +++ b/npm/win32-arm64-msvc/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-win32-arm64-msvc", + "version": "0.0.0", + "os": [ + "win32" + ], + "cpu": [ + "arm64" + ], + "main": "minecraft-essentials.win32-arm64-msvc.node", + "files": [ + "minecraft-essentials.win32-arm64-msvc.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/win32-ia32-msvc/README.md b/npm/win32-ia32-msvc/README.md new file mode 100644 index 0000000..4c76380 --- /dev/null +++ b/npm/win32-ia32-msvc/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-win32-ia32-msvc` + +This is the **i686-pc-windows-msvc** binary for `minecraft-essentials` diff --git a/npm/win32-ia32-msvc/package.json b/npm/win32-ia32-msvc/package.json new file mode 100644 index 0000000..bdca28d --- /dev/null +++ b/npm/win32-ia32-msvc/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-win32-ia32-msvc", + "version": "0.0.0", + "os": [ + "win32" + ], + "cpu": [ + "ia32" + ], + "main": "minecraft-essentials.win32-ia32-msvc.node", + "files": [ + "minecraft-essentials.win32-ia32-msvc.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/npm/win32-x64-msvc/README.md b/npm/win32-x64-msvc/README.md new file mode 100644 index 0000000..e62ec3a --- /dev/null +++ b/npm/win32-x64-msvc/README.md @@ -0,0 +1,3 @@ +# `minecraft-essentials-win32-x64-msvc` + +This is the **x86_64-pc-windows-msvc** binary for `minecraft-essentials` diff --git a/npm/win32-x64-msvc/package.json b/npm/win32-x64-msvc/package.json new file mode 100644 index 0000000..4512add --- /dev/null +++ b/npm/win32-x64-msvc/package.json @@ -0,0 +1,18 @@ +{ + "name": "minecraft-essentials-win32-x64-msvc", + "version": "0.0.0", + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "main": "minecraft-essentials.win32-x64-msvc.node", + "files": [ + "minecraft-essentials.win32-x64-msvc.node" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..629373c --- /dev/null +++ b/package.json @@ -0,0 +1,63 @@ +{ + "name": "minecraft-essentials", + "version": "0.5.0", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "napi": { + "name": "minecraft-essentials", + "triples": { + "additional": [ + "aarch64-apple-darwin", + "aarch64-linux-android", + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl", + "aarch64-pc-windows-msvc", + "armv7-unknown-linux-gnueabihf", + "x86_64-unknown-linux-musl", + "x86_64-unknown-freebsd", + "i686-pc-windows-msvc", + "armv7-linux-androideabi", + "universal-apple-darwin", + "riscv64gc-unknown-linux-gnu" + ] + } + }, + "license": "GPL-3.0", + "devDependencies": { + "@napi-rs/cli": "^2.17.0", + "ava": "^5.1.1" + }, + "ava": { + "timeout": "3m" + }, + "engines": { + "node": ">= 10" + }, + "scripts": { + "artifacts": "napi artifacts --dir ./dist", + "build": "napi build --platform --release ./dist", + "build:debug": "napi build --platform ./dist", + "prepublishOnly": "napi prepublish -t npm ./dist", + "test": "ava", + "universal": "napi universal", + "version": "napi version" + }, + "packageManager": "yarn@4.0.2", + "optionalDependencies": { + "minecraft-essentials-win32-x64-msvc": "0.0.0", + "minecraft-essentials-darwin-x64": "0.0.0", + "minecraft-essentials-linux-x64-gnu": "0.0.0", + "minecraft-essentials-darwin-arm64": "0.0.0", + "minecraft-essentials-android-arm64": "0.0.0", + "minecraft-essentials-linux-arm64-gnu": "0.0.0", + "minecraft-essentials-linux-arm64-musl": "0.0.0", + "minecraft-essentials-win32-arm64-msvc": "0.0.0", + "minecraft-essentials-linux-arm-gnueabihf": "0.0.0", + "minecraft-essentials-linux-x64-musl": "0.0.0", + "minecraft-essentials-freebsd-x64": "0.0.0", + "minecraft-essentials-win32-ia32-msvc": "0.0.0", + "minecraft-essentials-android-arm-eabi": "0.0.0", + "minecraft-essentials-darwin-universal": "0.0.0", + "minecraft-essentials-linux-riscv64-gnu": "0.0.0" + } +} \ No newline at end of file diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..dda8fb7 --- /dev/null +++ b/renovate.json @@ -0,0 +1,20 @@ +{ + "extends": ["config:base"], + "automerge": true, + "prCreation": "not-pending", + "schedule": ["every weekend"], + "packageRules": [ + { + "matchDatasources": ["github"], + "matchPackageNames": ["*"], + "groupName": "npm dependencies", + "schedule": ["every weekend"] + }, + { + "matchDatasources": ["github"], + "matchManagers": ["cargo"], + "groupName": "rust dependencies", + "schedule": ["every weekend"] + } + ] + } \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..cab5731 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +tab_spaces = 2 +edition = "2021" diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..2fefb8d --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,10 @@ +#![deny(clippy::all)] +#![forbid(unsafe_code)] + +#[macro_use] +extern crate napi_derive; + +#[napi] +pub fn sum(a: i32, b: i32) -> i32 { + a + b +}