From 1e51d3927cf948a4fa9be9d01fb465b677142c84 Mon Sep 17 00:00:00 2001 From: jeparlefrancais Date: Thu, 21 Dec 2023 18:00:24 -0500 Subject: [PATCH 1/5] Setup npm package --- .darklua-bundle-dev.json | 27 +++++ .darklua-bundle.json | 27 +++++ .darklua-dev.json | 29 ++++++ .darklua-wally.json | 24 +++++ .darklua.json | 29 ++++++ .github/workflows/release.yml | 179 +++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 45 +++++++++ .gitignore | 6 ++ .npmignore | 37 +++++++ .yarnrc.yml | 1 + default.project.json | 2 +- foreman.toml | 10 +- model.project.json | 9 ++ package.json | 26 +++++ scripts/build-assets.sh | 7 ++ scripts/build-roblox-model.sh | 31 ++++++ scripts/build-single-file.sh | 11 ++ scripts/build-wally-package.sh | 31 ++++++ scripts/npm-to-wally.js | 144 ++++++++++++++++++++++++++ scripts/remove-tests.sh | 11 ++ selene.toml | 2 +- selene_definitions.yml | 7 ++ src/Observable.lua | 7 +- src/init.lua | 2 +- yarn.lock | 149 +++++++++++++++++++++++++++ 25 files changed, 841 insertions(+), 12 deletions(-) create mode 100644 .darklua-bundle-dev.json create mode 100644 .darklua-bundle.json create mode 100644 .darklua-dev.json create mode 100644 .darklua-wally.json create mode 100644 .darklua.json create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml create mode 100644 .npmignore create mode 100644 .yarnrc.yml create mode 100644 model.project.json create mode 100644 package.json create mode 100755 scripts/build-assets.sh create mode 100755 scripts/build-roblox-model.sh create mode 100755 scripts/build-single-file.sh create mode 100755 scripts/build-wally-package.sh create mode 100755 scripts/npm-to-wally.js create mode 100755 scripts/remove-tests.sh create mode 100644 selene_definitions.yml create mode 100644 yarn.lock diff --git a/.darklua-bundle-dev.json b/.darklua-bundle-dev.json new file mode 100644 index 0000000..fb4fe3a --- /dev/null +++ b/.darklua-bundle-dev.json @@ -0,0 +1,27 @@ +{ + "bundle": { + "require_mode": { + "name": "path", + "sources": { + "@pkg": "node_modules/.luau-aliases" + } + } + }, + "generator": "dense", + "process": [ + { + "rule": "inject_global_value", + "identifier": "__DEV__", + "value": true + }, + "remove_types", + "remove_comments", + "remove_spaces", + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do" + ] +} diff --git a/.darklua-bundle.json b/.darklua-bundle.json new file mode 100644 index 0000000..a4a6e2c --- /dev/null +++ b/.darklua-bundle.json @@ -0,0 +1,27 @@ +{ + "bundle": { + "require_mode": { + "name": "path", + "sources": { + "@pkg": "node_modules/.luau-aliases" + } + } + }, + "generator": "dense", + "process": [ + { + "rule": "inject_global_value", + "identifier": "__DEV__", + "value": false + }, + "remove_types", + "remove_comments", + "remove_spaces", + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do" + ] +} diff --git a/.darklua-dev.json b/.darklua-dev.json new file mode 100644 index 0000000..319945e --- /dev/null +++ b/.darklua-dev.json @@ -0,0 +1,29 @@ +{ + "process": [ + { + "rule": "convert_require", + "current": { + "name": "path", + "sources": { + "@pkg": "node_modules/.luau-aliases" + } + }, + "target": { + "name": "roblox", + "indexing_style": "wait_for_child", + "rojo_sourcemap": "sourcemap.json" + } + }, + { + "rule": "inject_global_value", + "identifier": "__DEV__", + "value": true + }, + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do" + ] +} diff --git a/.darklua-wally.json b/.darklua-wally.json new file mode 100644 index 0000000..b6101b9 --- /dev/null +++ b/.darklua-wally.json @@ -0,0 +1,24 @@ +{ + "process": [ + { + "rule": "convert_require", + "current": { + "name": "path", + "sources": { + "@pkg": "." + } + }, + "target": { + "name": "roblox", + "indexing_style": "wait_for_child", + "rojo_sourcemap": "./sourcemap.json" + } + }, + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do" + ] +} diff --git a/.darklua.json b/.darklua.json new file mode 100644 index 0000000..a703a19 --- /dev/null +++ b/.darklua.json @@ -0,0 +1,29 @@ +{ + "process": [ + { + "rule": "convert_require", + "current": { + "name": "path", + "sources": { + "@pkg": "node_modules/.luau-aliases" + } + }, + "target": { + "name": "roblox", + "indexing_style": "wait_for_child", + "rojo_sourcemap": "sourcemap.json" + } + }, + { + "rule": "inject_global_value", + "identifier": "__DEV__", + "value": false + }, + "compute_expression", + "remove_unused_if_branch", + "remove_unused_while", + "filter_after_early_return", + "remove_nil_declaration", + "remove_empty_do" + ] +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..59d23f9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,179 @@ +name: Release + +on: + workflow_dispatch: + inputs: + release_tag: + description: "The version to release starting with `v`" + required: true + type: string + + release_ref: + description: "The branch, tag or SHA to checkout (default to latest)" + default: "" + type: string + +permissions: + contents: write + +jobs: + publish-package: + name: Publish package + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v3 + with: + node-version: "latest" + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Update yarn + run: yarn set version stable + + - name: Install packages + run: yarn install --immutable + + - name: Run npmluau + run: yarn run prepare + + - name: Authenticate yarn + run: | + yarn config set npmAlwaysAuth true + yarn config set npmScopes.jsdotlua.npmAuthToken $NPM_AUTH_TOKEN + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - run: yarn npm publish --access public + + publish-wally-package: + needs: publish-package + + name: Publish wally package + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: Roblox/setup-foreman@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-node@v3 + with: + node-version: "latest" + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Update yarn + run: yarn set version stable + + - name: Install packages + run: yarn install --immutable + + - name: Run npmluau + run: yarn run prepare + + - name: Build assets + run: yarn run build-assets + + - name: Login to wally + run: wally login --project-path build/wally --token ${{ secrets.WALLY_ACCESS_TOKEN }} + + - name: Publish to wally + run: wally publish --project-path build/wally + + create-release: + needs: publish-package + + name: Create release + runs-on: ubuntu-latest + + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + + steps: + - uses: actions/checkout@v4 + + - name: Create tag + run: | + git fetch --tags --no-recurse-submodules + if [ ! $(git tag -l ${{ inputs.release_tag }}) ]; then + git tag ${{ inputs.release_tag }} + git push origin ${{ inputs.release_tag }} + fi + + - name: Create release + id: create_release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ inputs.release_tag }} + name: ${{ inputs.release_tag }} + draft: false + + build-assets: + needs: create-release + + name: Add assets + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + include: + - artifact-name: zen-observable.rbxm + path: build/zen-observable.rbxm + asset-type: application/octet-stream + + - artifact-name: zen-observable-dev.rbxm + path: build/debug/zen-observable.rbxm + asset-type: application/octet-stream + + - artifact-name: zen-observable.lua + path: build/zen-observable.lua + asset-type: text/plain + + steps: + - uses: actions/checkout@v4 + + - uses: Roblox/setup-foreman@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-node@v3 + with: + node-version: "latest" + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Update yarn + run: yarn set version stable + + - name: Install packages + run: yarn install --immutable + + - name: Run npmluau + run: yarn run prepare + + - name: Build assets + run: yarn run build-assets + + - name: Upload asset + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.artifact-name }} + path: ${{ matrix.path }} + + - name: Add asset to Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ${{ matrix.path }} + asset_name: ${{ matrix.artifact-name }} + asset_content_type: ${{ matrix.asset-type }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..63a02c9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: Roblox/setup-foreman@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-node@v3 + with: + node-version: "latest" + cache: "yarn" + cache-dependency-path: "yarn.lock" + + - name: Update yarn + run: yarn set version stable + + - name: Install packages + run: yarn install --immutable + + - name: Run npmluau + run: yarn run prepare + + - name: Run linter + run: yarn run lint + + - name: Verify code style + run: yarn run style-check + + - name: Build assets + run: yarn run build-assets diff --git a/.gitignore b/.gitignore index 1a821af..00925c9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,9 @@ sourcemap.json rotriever.lock *.rbxmx *.rbxm + +**/sourcemap.json +**/node_modules +/build +/roblox +.yarn diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..de7b18c --- /dev/null +++ b/.npmignore @@ -0,0 +1,37 @@ +/.* +/bin +/Packages +**/.robloxrc +rotriever.toml + +/.github/ +/.vscode/ + +/roblox +/build + +/*.json +/*.toml +/*.yml +/*.md +/*.tgz + +/scripts +/globalTypes.d.lua +**/sourcemap.json +**/*.project.json + +/test + +**/__tests__ +**/tests +**/*.test.lua +**/*.spec.lua +**/jest.config.lua + +**/*.rbxl +**/*.rbxlx +**/*.rbxl.lock +**/*.rbxlx.lock +**/*.rbxm +**/*.rbxmx 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/default.project.json b/default.project.json index 5c871f2..dc4d890 100644 --- a/default.project.json +++ b/default.project.json @@ -1,5 +1,5 @@ { - "name": "ZenObservable", + "name": "zen-observable", "tree": { "$path": "src" } diff --git a/foreman.toml b/foreman.toml index 1fe958c..f71a8bf 100644 --- a/foreman.toml +++ b/foreman.toml @@ -1,5 +1,7 @@ [tools] -rotrieve = { source = "roblox/rotriever", version = "0.5.4" } -rojo = { source = "Roblox/rojo-rbx-rojo", version = "7.2.0" } -selene = { source = "Roblox/Kampfkarren-selene", version = "0.20.0" } -stylua = { source = "Roblox/JohnnyMorganz-StyLua", version = "0.14.2" } +rojo = { github = "rojo-rbx/rojo", version = "7.2.0" } +selene = { github = "Kampfkarren/selene", version = "0.20.0" } +stylua = { github = "JohnnyMorganz/StyLua", version = "=0.14.2" } +luau-lsp = { github = "johnnymorganz/luau-lsp", version = "=1.23.0"} +darklua = { github = "seaofvoices/darklua", version = "=0.12.1" } +wally = { github = "UpliftGames/wally", version = "=0.3.2" } diff --git a/model.project.json b/model.project.json new file mode 100644 index 0000000..c04e21c --- /dev/null +++ b/model.project.json @@ -0,0 +1,9 @@ +{ + "name": "ZenObservable", + "tree": { + "$path": "src", + "node_modules": { + "$path": "node_modules" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..633cdaa --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "@jsdotlua/zen-observable", + "version": "0.8.16", + "repository": { + "type": "git", + "url": "https://github.com/jsdotlua/zen-observable-lua.git" + }, + "license": "MIT", + "main": "src/init.lua", + "scripts": { + "prepare": "npmluau", + "build-assets": "sh ./scripts/build-assets.sh", + "lint": "selene src", + "format": "stylua src", + "style-check": "stylua --check src", + "clean": "rm -rf roblox build node_modules" + }, + "dependencies": { + "@jsdotlua/luau-polyfill": "^1.2.6", + "@jsdotlua/promise": "^3.5.0" + }, + "devDependencies": { + "npmluau": "^0.1.1" + }, + "packageManager": "yarn@4.0.2" +} diff --git a/scripts/build-assets.sh b/scripts/build-assets.sh new file mode 100755 index 0000000..625f8b4 --- /dev/null +++ b/scripts/build-assets.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +./scripts/build-roblox-model.sh +./scripts/build-single-file.sh +./scripts/build-wally-package.sh diff --git a/scripts/build-roblox-model.sh b/scripts/build-roblox-model.sh new file mode 100755 index 0000000..7a115a1 --- /dev/null +++ b/scripts/build-roblox-model.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +set -e + +build_with_darklua_config () { + DARKLUA_CONFIG=$1 + OUTPUT=build/$2 + + rm -rf roblox + + mkdir -p roblox + + cp -r src/ roblox/ + + rojo sourcemap model.project.json -o sourcemap.json + + darklua process --config $DARKLUA_CONFIG src roblox/src + darklua process --config $DARKLUA_CONFIG node_modules roblox/node_modules + + ./scripts/remove-tests.sh roblox + + cp model.project.json roblox/ + + mkdir -p build + mkdir -p $(dirname $OUTPUT) + + rojo build roblox/model.project.json -o $OUTPUT +} + +build_with_darklua_config .darklua.json zen-observable.rbxm +build_with_darklua_config .darklua-dev.json debug/zen-observable.rbxm diff --git a/scripts/build-single-file.sh b/scripts/build-single-file.sh new file mode 100755 index 0000000..e90a636 --- /dev/null +++ b/scripts/build-single-file.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +mkdir -p build +mkdir -p build/debug + +rm -f build/luau-requests.lua + +darklua process --config .darklua-bundle.json src/init.lua build/zen-observable.lua +darklua process --config .darklua-bundle-dev.json src/init.lua build/debug/zen-observable.lua diff --git a/scripts/build-wally-package.sh b/scripts/build-wally-package.sh new file mode 100755 index 0000000..9996020 --- /dev/null +++ b/scripts/build-wally-package.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +set -e + +rm -rf roblox + +mkdir -p roblox + +cp -r src roblox/src + +./scripts/remove-tests.sh roblox + +wally_package=build/wally +rm -rf $wally_package + +echo Process package + +mkdir -p $wally_package +cp LICENSE $wally_package/LICENSE + +node ./scripts/npm-to-wally.js package.json $wally_package/wally.toml roblox/wally-package.project.json + +cp .darklua-wally.json roblox +cp -r node_modules/.luau-aliases/* roblox + +rojo sourcemap roblox/wally-package.project.json --output roblox/sourcemap.json + +darklua process --config roblox/.darklua-wally.json roblox/src $wally_package/src + +cp default.project.json $wally_package +wally package --project-path $wally_package --list diff --git a/scripts/npm-to-wally.js b/scripts/npm-to-wally.js new file mode 100755 index 0000000..232e742 --- /dev/null +++ b/scripts/npm-to-wally.js @@ -0,0 +1,144 @@ +#!/usr/bin/env node + +const { Command } = require("commander"); + +const fs = require("fs").promises; +const path = require("path"); +const process = require("process"); + +const readPackageConfig = async (packagePath) => { + const packageContent = await fs.readFile(packagePath).catch((err) => { + console.error(`unable to read package.json at '${packagePath}': ${err}`); + return null; + }); + + if (packageContent !== null) { + try { + const packageData = JSON.parse(packageContent); + return packageData; + } catch (error) { + console.error(`unable to parse package.json at '${packagePath}': ${err}`); + } + } + + return null; +}; + +const main = async ( + packageJsonPath, + wallyOutputPath, + rojoConfigPath, + { workspacePath } +) => { + const packageData = await readPackageConfig(packageJsonPath); + + const { name: scopedName, version, license, dependencies = [] } = packageData; + + const tomlLines = [ + "[package]", + `name = "${scopedName.substring(1)}"`, + `version = "${version}"`, + 'registry = "https://github.com/UpliftGames/wally-index"', + 'realm = "shared"', + `license = "${license}"`, + "", + "[dependencies]", + ]; + + const rojoConfig = { + name: "WallyPackage", + tree: { + $className: "Folder", + Package: { + $path: "src", + }, + }, + }; + + for (const [dependencyName, specifiedVersion] of Object.entries( + dependencies + )) { + const name = dependencyName.startsWith("@") + ? dependencyName.substring(dependencyName.indexOf("/") + 1) + : dependencyName; + + rojoConfig.tree[name] = { + $path: dependencyName + ".luau", + }; + + const wallyPackageName = name.indexOf("-") !== -1 ? `"${name}"` : name; + + if (specifiedVersion == "workspace:^") { + const dependentPackage = + workspacePath && + (await readPackageConfig( + path.join(workspacePath, name, "package.json") + )); + + if (dependentPackage) { + tomlLines.push( + `${wallyPackageName} = "jsdotlua/${name}@${dependentPackage.version}"` + ); + } else { + console.error(`unable to find version for package '${name}'`); + } + } else { + tomlLines.push( + `${wallyPackageName} = "jsdotlua/${name}@${specifiedVersion}"` + ); + } + } + + tomlLines.push(""); + + await Promise.all([ + fs.writeFile(wallyOutputPath, tomlLines.join("\n")).catch((err) => { + console.error( + `unable to write wally config at '${wallyOutputPath}': ${err}` + ); + }), + fs + .writeFile(rojoConfigPath, JSON.stringify(rojoConfig, null, 2)) + .catch((err) => { + console.error( + `unable to write rojo config at '${rojoConfigPath}': ${err}` + ); + }), + ]); +}; + +const createCLI = () => { + const program = new Command(); + + program + .name("npm-to-wally") + .description("a utility to convert npm packages to wally packages") + .argument("") + .argument("") + .argument("") + .option( + "--workspace-path ", + "the path containing all workspace members" + ) + .action( + async (packageJson, wallyToml, rojoConfig, { workspacePath = null }) => { + const cwd = process.cwd(); + main( + path.join(cwd, packageJson), + path.join(cwd, wallyToml), + path.join(cwd, rojoConfig), + { + workspacePath: workspacePath && path.join(cwd, workspacePath), + } + ); + } + ); + + return (args) => { + program.parse(args); + }; +}; + +const run = createCLI(); + +run(process.argv); diff --git a/scripts/remove-tests.sh b/scripts/remove-tests.sh new file mode 100755 index 0000000..cdcc780 --- /dev/null +++ b/scripts/remove-tests.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +FOLDER=$1 + +find $FOLDER -name '__tests__' -type d -exec rm -r {} + +find $FOLDER -name 'tests' -type d -exec rm -r {} + +find $FOLDER -name '.robloxrc' -type f -exec rm -r {} + +find $FOLDER -name '*.spec.lua' -type f -exec rm -r {} + +find $FOLDER -name 'jest.config.lua' -type f -exec rm -r {} + diff --git a/selene.toml b/selene.toml index 4e7811a..162c35f 100644 --- a/selene.toml +++ b/selene.toml @@ -1,4 +1,4 @@ -std = "roblox+testez" +std = "selene_definitions" [config] empty_if = { comments_count = true } diff --git a/selene_definitions.yml b/selene_definitions.yml new file mode 100644 index 0000000..95cabdf --- /dev/null +++ b/selene_definitions.yml @@ -0,0 +1,7 @@ +base: roblox +name: selene_defs +globals: + # override Roblox require style with string requires + require: + args: + - type: string diff --git a/src/Observable.lua b/src/Observable.lua index 5dbf596..7d0cfe0 100644 --- a/src/Observable.lua +++ b/src/Observable.lua @@ -2,11 +2,8 @@ -- ROBLOX upstream for types: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/zen-observable/index.d.ts --!strict -local srcWorkspace = script.Parent -local rootWorkspace = srcWorkspace.Parent - -local LuauPolyfill = require(rootWorkspace.LuauPolyfill) -local Promise = require(rootWorkspace.Promise) +local LuauPolyfill = require("@pkg/@jsdotlua/luau-polyfill") +local Promise = require("@pkg/@jsdotlua/promise") local instanceOf = LuauPolyfill.instanceof local Boolean = LuauPolyfill.Boolean local Error = LuauPolyfill.Error diff --git a/src/init.lua b/src/init.lua index f4605d5..37d6f86 100644 --- a/src/init.lua +++ b/src/init.lua @@ -1,6 +1,6 @@ --!strict local exports = {} -local ObservableModule = require(script.Observable) +local ObservableModule = require("./Observable") local Observable = ObservableModule.Observable exports.Observable = Observable diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..4bd36d2 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,149 @@ +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! + +__metadata: + version: 8 + cacheKey: 10c0 + +"@jsdotlua/boolean@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/boolean@npm:1.2.6" + dependencies: + "@jsdotlua/number": "npm:^1.2.6" + checksum: 5f567e556bb7c56102327a97468571522ce939be6cdc1b51591afc3dfc1dff4b2c9ec5462e7809bd9a515b3bdfc1c3eaabb4f631892cb5f471b4fc8da188cb84 + languageName: node + linkType: hard + +"@jsdotlua/collections@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/collections@npm:1.2.6" + dependencies: + "@jsdotlua/es7-types": "npm:^1.2.6" + "@jsdotlua/instance-of": "npm:^1.2.6" + checksum: a4b3fe826358484528f10e8ca61a80d841a6515a22277a003117449da66ea1fb891c7b4103b952b01bd7d75666f26cb41c8efb852672aa8aaaaebbcd656dca79 + languageName: node + linkType: hard + +"@jsdotlua/console@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/console@npm:1.2.6" + dependencies: + "@jsdotlua/collections": "npm:^1.2.6" + checksum: eff658d9e8d23f932893facf18400a29ada54d1a24748b751aac1e4df48e92ff70b3b2ccd1ab6a4f2490dd709f826fe39427fb80f01a7574265fdd4e8af9187a + languageName: node + linkType: hard + +"@jsdotlua/es7-types@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/es7-types@npm:1.2.6" + checksum: e5710f5f6de0608aec22744845e3a24acc47e2bda6cfc0b1fe4040935039b73e8467da90c3a6c9d75b08c9f39d2b98e9d72d54f3f630012538a7d53ad828a0d6 + languageName: node + linkType: hard + +"@jsdotlua/instance-of@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/instance-of@npm:1.2.6" + checksum: 0958caf214bb0556c1dcf94096410c367f413af4b02ef3adbd733e47435d8734b583217804bed5aec8308d56ccfb39032bb12fd4337e01ec5ae2db690b2ca9ce + languageName: node + linkType: hard + +"@jsdotlua/luau-polyfill@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/luau-polyfill@npm:1.2.6" + dependencies: + "@jsdotlua/boolean": "npm:^1.2.6" + "@jsdotlua/collections": "npm:^1.2.6" + "@jsdotlua/console": "npm:^1.2.6" + "@jsdotlua/es7-types": "npm:^1.2.6" + "@jsdotlua/instance-of": "npm:^1.2.6" + "@jsdotlua/math": "npm:^1.2.6" + "@jsdotlua/number": "npm:^1.2.6" + "@jsdotlua/string": "npm:^1.2.6" + "@jsdotlua/timers": "npm:^1.2.6" + symbol-luau: "npm:^1.0.0" + checksum: 63265f9fde3b895400d12802929ddab5daed79efc4e2aa90325b2eea0e2b7addcf351d35ad8bb19955956e913c212408944d73b6f3126223893d17cecd24de61 + languageName: node + linkType: hard + +"@jsdotlua/math@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/math@npm:1.2.6" + checksum: 06137df2a6352d4f5c730a7cf9e2902509d36de08415a3c70d470a05669dfeaf48e4aff2d5b6885a92b8f4d19fd0294a40f147a3f39c8558e887a09eb3ccd9e0 + languageName: node + linkType: hard + +"@jsdotlua/number@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/number@npm:1.2.6" + checksum: 74541fce86f80c52f05e5d4ca774d94f08ed21619af7b575c2bb7284e24fc2b178626c9888e286459a344d662cafab74d839ec8b95dcdab551fd14754911a292 + languageName: node + linkType: hard + +"@jsdotlua/promise@npm:^3.5.0": + version: 3.5.0 + resolution: "@jsdotlua/promise@npm:3.5.0" + checksum: 8771dac525b8d608ad319040b742cdde8f4cbbd4a075ae02dad4d510c8ab739dabf7de40ae1b15211e3890331cf3e7d9454fdcb3ec9a08471663436c0e9ec977 + languageName: node + linkType: hard + +"@jsdotlua/string@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/string@npm:1.2.6" + dependencies: + "@jsdotlua/es7-types": "npm:^1.2.6" + "@jsdotlua/number": "npm:^1.2.6" + checksum: de51c662439110642b699e4196240aa45ec4b8814f99bc606acb84dbb3f1c6889099bb722b3370f5873e06bd65c76779b5d94694309c9bdc63d324f40add2b0f + languageName: node + linkType: hard + +"@jsdotlua/timers@npm:^1.2.6": + version: 1.2.6 + resolution: "@jsdotlua/timers@npm:1.2.6" + dependencies: + "@jsdotlua/collections": "npm:^1.2.6" + checksum: f3ec2753894e4939f7dfdf0072517f1e769e4009b4bd882c9c6878526372753ac4b08b531e1a32c96b7bccb5bf10bb8e2f5730cbc70534da7eddc620fbccaaca + languageName: node + linkType: hard + +"@jsdotlua/zen-observable@workspace:.": + version: 0.0.0-use.local + resolution: "@jsdotlua/zen-observable@workspace:." + dependencies: + "@jsdotlua/luau-polyfill": "npm:^1.2.6" + "@jsdotlua/promise": "npm:^3.5.0" + npmluau: "npm:^0.1.1" + languageName: unknown + linkType: soft + +"commander@npm:^11.0.0": + version: 11.1.0 + resolution: "commander@npm:11.1.0" + checksum: 13cc6ac875e48780250f723fb81c1c1178d35c5decb1abb1b628b3177af08a8554e76b2c0f29de72d69eef7c864d12613272a71fabef8047922bc622ab75a179 + languageName: node + linkType: hard + +"npmluau@npm:^0.1.1": + version: 0.1.1 + resolution: "npmluau@npm:0.1.1" + dependencies: + commander: "npm:^11.0.0" + walkdir: "npm:^0.4.1" + bin: + npmluau: main.js + checksum: 9ae22c0dcff9e85c90b4da4e8c17bc51e9b567b4a417c9767d355ff68faca4f99a2934b581743ebc8729f6851d1ba5b64597312151747252e040517d1794fbca + languageName: node + linkType: hard + +"symbol-luau@npm:^1.0.0": + version: 1.0.1 + resolution: "symbol-luau@npm:1.0.1" + checksum: ab51a77331b2d5e4666528bada17e67b26aea355257bba9e97351016cd1836bd19f372355a14cf5bef2f4d5bc6b32fe91aeb09698d7bdc079d2c61330bedf251 + languageName: node + linkType: hard + +"walkdir@npm:^0.4.1": + version: 0.4.1 + resolution: "walkdir@npm:0.4.1" + checksum: 88e635aa9303e9196e4dc15013d2bd4afca4c8c8b4bb27722ca042bad213bb882d3b9141b3b0cca6bfb274f7889b30cf58d6374844094abec0016f335c5414dc + languageName: node + linkType: hard From 91883d1212db072aa79ed58c1f7cb04a0da1f321 Mon Sep 17 00:00:00 2001 From: jeparlefrancais Date: Thu, 21 Dec 2023 18:00:38 -0500 Subject: [PATCH 2/5] Avoid full_moon stack-overflow issue --- src/Observable.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Observable.lua b/src/Observable.lua index 7d0cfe0..dd215a2 100644 --- a/src/Observable.lua +++ b/src/Observable.lua @@ -626,11 +626,9 @@ function Observable:concat(...: Observable): Observable subscription = nil observer:complete() else - startNext(C.from(sources[(function() - local result = index - index += 1 - return result - end)()])) + local current = index + index += 1 + startNext(C.from(sources[current])) end end, }) From d09adfd17e666834399561c40ca42677f3053f8d Mon Sep 17 00:00:00 2001 From: jeparlefrancais Date: Thu, 21 Dec 2023 18:06:19 -0500 Subject: [PATCH 3/5] remove package manager version from package.json --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 633cdaa..3f18ec6 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,5 @@ }, "devDependencies": { "npmluau": "^0.1.1" - }, - "packageManager": "yarn@4.0.2" + } } From 45f438ceb20133ff44eb6c13bbfd63047a7b2ba4 Mon Sep 17 00:00:00 2001 From: jeparlefrancais Date: Thu, 21 Dec 2023 18:11:15 -0500 Subject: [PATCH 4/5] fix build single file script --- scripts/build-single-file.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build-single-file.sh b/scripts/build-single-file.sh index e90a636..00dec36 100755 --- a/scripts/build-single-file.sh +++ b/scripts/build-single-file.sh @@ -5,7 +5,8 @@ set -e mkdir -p build mkdir -p build/debug -rm -f build/luau-requests.lua +rm -f build/zen-observable.lua +rm -f build/debug/zen-observable.lua darklua process --config .darklua-bundle.json src/init.lua build/zen-observable.lua darklua process --config .darklua-bundle-dev.json src/init.lua build/debug/zen-observable.lua From a316f09459fbd883c32a9f4b2b4075856a263083 Mon Sep 17 00:00:00 2001 From: jeparlefrancais Date: Sat, 23 Dec 2023 10:16:25 -0500 Subject: [PATCH 5/5] add bundled dev artifact to releases --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59d23f9..45b3e9b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -137,6 +137,10 @@ jobs: path: build/zen-observable.lua asset-type: text/plain + - artifact-name: zen-observable-dev.lua + path: build/debug/zen-observable.lua + asset-type: text/plain + steps: - uses: actions/checkout@v4