From 7351b9aec307e89655969fa04e1ed17fe9434699 Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Fri, 10 Jan 2025 20:49:21 +0900 Subject: [PATCH 1/6] Move mountable to browser simply --- packages/{mountable => browser}/.eslintrc.cjs | 0 packages/{mountable => browser}/.gitignore | 0 packages/{mountable => browser}/.lintstagedrc.json | 0 packages/{mountable => browser}/.prettierignore | 0 packages/{mountable => browser}/README.md | 0 packages/{mountable => browser}/dev-files/bar.txt | 0 packages/{mountable => browser}/dev-files/foo.zip | Bin packages/{mountable => browser}/index.html | 0 packages/{mountable => browser}/package.json | 0 .../{mountable => browser}/src/StreamlitApp.tsx | 0 packages/{mountable => browser}/src/codedent.d.ts | 0 .../{mountable => browser}/src/custom-element.css | 0 .../src/custom-element.spec.ts | 0 .../{mountable => browser}/src/custom-element.ts | 0 packages/{mountable => browser}/src/index.ts | 0 packages/{mountable => browser}/src/mount.tsx | 0 packages/{mountable => browser}/src/options.spec.ts | 0 packages/{mountable => browser}/src/options.ts | 0 packages/{mountable => browser}/tsconfig.json | 0 packages/{mountable => browser}/vite.config.ts | 0 20 files changed, 0 insertions(+), 0 deletions(-) rename packages/{mountable => browser}/.eslintrc.cjs (100%) rename packages/{mountable => browser}/.gitignore (100%) rename packages/{mountable => browser}/.lintstagedrc.json (100%) rename packages/{mountable => browser}/.prettierignore (100%) rename packages/{mountable => browser}/README.md (100%) rename packages/{mountable => browser}/dev-files/bar.txt (100%) rename packages/{mountable => browser}/dev-files/foo.zip (100%) rename packages/{mountable => browser}/index.html (100%) rename packages/{mountable => browser}/package.json (100%) rename packages/{mountable => browser}/src/StreamlitApp.tsx (100%) rename packages/{mountable => browser}/src/codedent.d.ts (100%) rename packages/{mountable => browser}/src/custom-element.css (100%) rename packages/{mountable => browser}/src/custom-element.spec.ts (100%) rename packages/{mountable => browser}/src/custom-element.ts (100%) rename packages/{mountable => browser}/src/index.ts (100%) rename packages/{mountable => browser}/src/mount.tsx (100%) rename packages/{mountable => browser}/src/options.spec.ts (100%) rename packages/{mountable => browser}/src/options.ts (100%) rename packages/{mountable => browser}/tsconfig.json (100%) rename packages/{mountable => browser}/vite.config.ts (100%) diff --git a/packages/mountable/.eslintrc.cjs b/packages/browser/.eslintrc.cjs similarity index 100% rename from packages/mountable/.eslintrc.cjs rename to packages/browser/.eslintrc.cjs diff --git a/packages/mountable/.gitignore b/packages/browser/.gitignore similarity index 100% rename from packages/mountable/.gitignore rename to packages/browser/.gitignore diff --git a/packages/mountable/.lintstagedrc.json b/packages/browser/.lintstagedrc.json similarity index 100% rename from packages/mountable/.lintstagedrc.json rename to packages/browser/.lintstagedrc.json diff --git a/packages/mountable/.prettierignore b/packages/browser/.prettierignore similarity index 100% rename from packages/mountable/.prettierignore rename to packages/browser/.prettierignore diff --git a/packages/mountable/README.md b/packages/browser/README.md similarity index 100% rename from packages/mountable/README.md rename to packages/browser/README.md diff --git a/packages/mountable/dev-files/bar.txt b/packages/browser/dev-files/bar.txt similarity index 100% rename from packages/mountable/dev-files/bar.txt rename to packages/browser/dev-files/bar.txt diff --git a/packages/mountable/dev-files/foo.zip b/packages/browser/dev-files/foo.zip similarity index 100% rename from packages/mountable/dev-files/foo.zip rename to packages/browser/dev-files/foo.zip diff --git a/packages/mountable/index.html b/packages/browser/index.html similarity index 100% rename from packages/mountable/index.html rename to packages/browser/index.html diff --git a/packages/mountable/package.json b/packages/browser/package.json similarity index 100% rename from packages/mountable/package.json rename to packages/browser/package.json diff --git a/packages/mountable/src/StreamlitApp.tsx b/packages/browser/src/StreamlitApp.tsx similarity index 100% rename from packages/mountable/src/StreamlitApp.tsx rename to packages/browser/src/StreamlitApp.tsx diff --git a/packages/mountable/src/codedent.d.ts b/packages/browser/src/codedent.d.ts similarity index 100% rename from packages/mountable/src/codedent.d.ts rename to packages/browser/src/codedent.d.ts diff --git a/packages/mountable/src/custom-element.css b/packages/browser/src/custom-element.css similarity index 100% rename from packages/mountable/src/custom-element.css rename to packages/browser/src/custom-element.css diff --git a/packages/mountable/src/custom-element.spec.ts b/packages/browser/src/custom-element.spec.ts similarity index 100% rename from packages/mountable/src/custom-element.spec.ts rename to packages/browser/src/custom-element.spec.ts diff --git a/packages/mountable/src/custom-element.ts b/packages/browser/src/custom-element.ts similarity index 100% rename from packages/mountable/src/custom-element.ts rename to packages/browser/src/custom-element.ts diff --git a/packages/mountable/src/index.ts b/packages/browser/src/index.ts similarity index 100% rename from packages/mountable/src/index.ts rename to packages/browser/src/index.ts diff --git a/packages/mountable/src/mount.tsx b/packages/browser/src/mount.tsx similarity index 100% rename from packages/mountable/src/mount.tsx rename to packages/browser/src/mount.tsx diff --git a/packages/mountable/src/options.spec.ts b/packages/browser/src/options.spec.ts similarity index 100% rename from packages/mountable/src/options.spec.ts rename to packages/browser/src/options.spec.ts diff --git a/packages/mountable/src/options.ts b/packages/browser/src/options.ts similarity index 100% rename from packages/mountable/src/options.ts rename to packages/browser/src/options.ts diff --git a/packages/mountable/tsconfig.json b/packages/browser/tsconfig.json similarity index 100% rename from packages/mountable/tsconfig.json rename to packages/browser/tsconfig.json diff --git a/packages/mountable/vite.config.ts b/packages/browser/vite.config.ts similarity index 100% rename from packages/mountable/vite.config.ts rename to packages/browser/vite.config.ts From 68d5aa5df55c9fa3277441a8f0dfe4e7690775bc Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Fri, 10 Jan 2025 21:14:32 +0900 Subject: [PATCH 2/6] Update Makefile --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1243ab062..48ca791bb 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ node_modules := $(BUILD_STATE_DIR)/node_modules/.built venv := $(BUILD_STATE_DIR)/venv/.built common := $(BUILD_STATE_DIR)/common/.built common-react := $(BUILD_STATE_DIR)/common-react/.built -mountable := $(BUILD_STATE_DIR)/mountable/.built +browser := $(BUILD_STATE_DIR)/browser/.built sharing := $(BUILD_STATE_DIR)/sharing/.built sharing-common := $(BUILD_STATE_DIR)/sharing-common/.built sharing-editor := $(BUILD_STATE_DIR)/sharing-editor/.built @@ -50,7 +50,7 @@ streamlit_frontend_lib_prod := streamlit/frontend/lib/dist/* export USE_CONSTRAINTS_FILE := false # https://github.com/streamlit/streamlit/blob/1.27.0/.github/workflows/release.yml#L67-L68 .PHONY: all -all: init $(mountable) $(sharing) $(sharing-editor) $(desktop) +all: init $(browser) $(sharing) $(sharing-editor) $(desktop) .PHONY: init @@ -99,10 +99,10 @@ $(common-react): $(shell find packages/common-react/src -type f \( -name "*.ts" @mkdir -p $(dir $@) @touch $@ -.PHONY: mountable -mountable: $(mountable) -$(mountable): $(shell find packages/mountable/src -type f \( -name "*.ts" -o -name "*.tsx" \) ) $(node_modules) $(kernel) $(common) $(common-react) - cd packages/mountable && yarn build +.PHONY: browser +browser: $(browser) +$(browser): $(shell find packages/browser/src -type f \( -name "*.ts" -o -name "*.tsx" \) ) $(node_modules) $(kernel) $(common) $(common-react) + cd packages/browser && yarn build @mkdir -p $(dir $@) @touch $@ From dc0516f3ac935ed2530c50059666f97006688c44 Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Fri, 10 Jan 2025 21:16:58 +0900 Subject: [PATCH 3/6] Update CI workflows --- .github/workflows/gh-pages.yml | 28 ++++++++-------- .github/workflows/main.yml | 58 +++++++++++++++++----------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 0dddf123d..3be4c03d8 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -12,13 +12,13 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} env: - GITHUB_PAGES_SUBDIR_MOUNTABLE: lib/mountable + GITHUB_PAGES_SUBDIR_BROWSER: lib/browser jobs: build: strategy: matrix: - target: ["mountable"] + target: ["browser"] env: # To avoid an error like "FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory". @@ -72,23 +72,23 @@ jobs: - name: Set up run: make init - ## Build and deploy @stlite/mountable + ## Build and deploy @stlite/browser # PUBLIC_URL here is set as a relative path, which is possible to the trick introduced at https://github.com/whitphx/stlite/pull/143. - - if: matrix.target == 'mountable' + - if: matrix.target == 'browser' name: Set PUBLIC_URL run: echo "PUBLIC_URL=." >> $GITHUB_ENV - - if: matrix.target == 'mountable' - name: Build @stlite/mountable + - if: matrix.target == 'browser' + name: Build @stlite/browser run: | . .venv/bin/activate - make mountable + make browser - - if: matrix.target == 'mountable' + - if: matrix.target == 'browser' name: Upload the built files as an artifact uses: actions/upload-artifact@v4 with: - name: stlite-mountable - path: packages/mountable/build + name: stlite-browser + path: packages/browser/build deploy: needs: build @@ -102,8 +102,8 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: stlite-mountable - path: mountable + name: stlite-browser + path: browser - name: Configure redirect run: | @@ -124,8 +124,8 @@ jobs: - name: Set the build artifact paths run: | - mkdir -p /tmp/website/${GITHUB_PAGES_SUBDIR_MOUNTABLE} - cp -r ./mountable/* /tmp/website/${GITHUB_PAGES_SUBDIR_MOUNTABLE}/. + mkdir -p /tmp/website/${GITHUB_PAGES_SUBDIR_BROWSER} + cp -r ./browser/* /tmp/website/${GITHUB_PAGES_SUBDIR_BROWSER}/. - name: Upload the website files as an artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a11c86be..a6ff3da68 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: kernel: ${{ steps.filter.outputs.kernel == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }} # stlite-lib: ${{ steps.filter.outputs.stlite-lib == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }} stlite-lib: true # This step does not detect changes in the `streamlit` submodule that is needed to trigger the test-stlite-lib job (https://github.com/dorny/paths-filter/issues/143), so skip checking and make it always return true as a workaround. - mountable: ${{ steps.filter.outputs.mountable == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }} + browser: ${{ steps.filter.outputs.browser == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }} sharing-editor: ${{ steps.filter.outputs.sharing-editor == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }} sharing-common: ${{ steps.filter.outputs.sharing-common == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }} desktop: ${{ steps.filter.outputs.desktop == 'true' || steps.filter.outputs.gha == 'true' || env.RUN_ALL_TESTS == 'true' }} @@ -52,8 +52,8 @@ jobs: # stlite-lib: # We run this job anytime. See above. # - 'packages/kernel/py/stlite-lib/**/*' # - 'streamlit/**/*' - mountable: - - 'packages/mountable/**/*' + browser: + - 'packages/browser/**/*' sharing-editor: - 'packages/sharing-editor/**/*' sharing-common: @@ -165,15 +165,15 @@ jobs: cd packages/kernel/py/stlite-lib uv run pytest -v - test-mountable: + test-browser: needs: changes - if: ${{ needs.changes.outputs.mountable == 'true' }} + if: ${{ needs.changes.outputs.browser == 'true' }} runs-on: ubuntu-latest defaults: run: - working-directory: packages/mountable + working-directory: packages/browser steps: - uses: actions/checkout@v4 @@ -282,9 +282,9 @@ jobs: - run: yarn typecheck - run: yarn test - build-mountable: + build-browser: if: ${{ ! failure() }} # This job should run even if the depending jobs are skipped, but not when those jobs failed: https://qiita.com/abetomo/items/d9ede7dbeeb24f723fc5#%E8%A8%AD%E5%AE%9A%E4%BE%8B4 - needs: [test-kernel, test-stlite-lib, test-mountable] + needs: [test-kernel, test-stlite-lib, test-browser] runs-on: ubuntu-latest @@ -301,43 +301,43 @@ jobs: python-version-file: ${{ env.python-version-file }} node-version-file: ${{ env.node-version-file }} - ## Build and deploy @stlite/mountable + ## Build and deploy @stlite/browser # PUBLIC_URL here is set as a relative path, which is possible to the trick introduced at https://github.com/whitphx/stlite/pull/143. - name: Set PUBLIC_URL run: echo "PUBLIC_URL=." >> $GITHUB_ENV - - name: Build @stlite/mountable + - name: Build @stlite/browser run: | . .venv/bin/activate - make mountable + make browser - name: Package - working-directory: packages/mountable + working-directory: packages/browser run: yarn pack - name: Get the built package file path id: get-package-file-path - working-directory: packages/mountable - run: echo "PACKAGE_FILE_PATH=$(find $(pwd) -name "stlite-mountable-*.tgz" -print -quit)" >> $GITHUB_OUTPUT + working-directory: packages/browser + run: echo "PACKAGE_FILE_PATH=$(find $(pwd) -name "stlite-browser-*.tgz" -print -quit)" >> $GITHUB_OUTPUT - name: Upload the built tar ball as an artifact uses: actions/upload-artifact@v4 if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} with: path: ${{ steps.get-package-file-path.outputs.PACKAGE_FILE_PATH }} - name: stlite-mountable-${{ github.sha }}.tgz + name: stlite-browser-${{ github.sha }}.tgz - name: Upload the built tar ball as an artifact (when pushed with a version tag) uses: actions/upload-artifact@v4 if: startsWith(github.ref, 'refs/tags/v') with: path: ${{ steps.get-package-file-path.outputs.PACKAGE_FILE_PATH }} - name: stlite-mountable-${{ github.ref_name }}.tgz + name: stlite-browser-${{ github.ref_name }}.tgz - - name: "Inform the package stats of @stlite/mountable" + - name: "Inform the package stats of @stlite/browser" uses: ./.github/actions/inform-package-stats with: - key: mountable - name: "@stlite/mountable" + key: browser + name: "@stlite/browser" input-path: ${{ steps.get-package-file-path.outputs.PACKAGE_FILE_PATH }} # Also get stats of the built wheel files of stlite-lib and streamlit in this job. @@ -356,18 +356,18 @@ jobs: uses: ./.github/actions/inform-package-stats with: key: stlite-lib-wheel - name: "stlite-lib wheel (built as a part of @stlite/mountable)" + name: "stlite-lib wheel (built as a part of @stlite/browser)" input-path: ${{ steps.get-wheel-file-path.outputs.STLITE_LIB_WHEEL_FILEPATH }} - name: "Inform the package stats of streamlit wheel" uses: ./.github/actions/inform-package-stats with: key: streamlit-wheel - name: "streamlit wheel (built as a part of @stlite/mountable)" + name: "streamlit wheel (built as a part of @stlite/browser)" input-path: ${{ steps.get-wheel-file-path.outputs.STREAMLIT_WHEEL_FILEPATH }} - publish-mountable: + publish-browser: if: ${{ !failure() && startsWith(github.ref, 'refs/tags/v') }} # `!failure()` is necessary to avoid skipping this job after successful build: https://github.com/actions/runner/issues/491 - needs: [build-mountable] + needs: [build-browser] permissions: contents: write # Necessary for creating releases: https://github.com/softprops/action-gh-release#permissions @@ -385,18 +385,18 @@ jobs: - uses: actions/download-artifact@v4 with: - name: stlite-mountable-${{ github.ref_name }}.tgz - path: packages/mountable + name: stlite-browser-${{ github.ref_name }}.tgz + path: packages/browser - - run: yarn publish stlite-mountable-v*.tgz --access public + - run: yarn publish stlite-browser-v*.tgz --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - working-directory: packages/mountable + working-directory: packages/browser - name: Create a new release uses: softprops/action-gh-release@v2 with: - files: packages/mountable/stlite-mountable-v*.tgz + files: packages/browser/stlite-browser-v*.tgz generate_release_notes: true build-sharing: @@ -728,7 +728,7 @@ jobs: if: ${{ !failure() && startsWith(github.ref, 'refs/tags/v') }} # `!failure()` is necessary to avoid skipping this job after successful build: https://github.com/actions/runner/issues/491 needs: - test-build-vscode-extension - - publish-mountable # The VSC extension uses the same version of published @stlite/mountable, so it must be released in order. + - publish-browser # The VSC extension uses the same version of published @stlite/browser, so it must be released in order. permissions: contents: write # Necessary for creating releases: https://github.com/softprops/action-gh-release#permissions From 8a09a7284813f1f361a02e7ccf9945b4ff83bfb9 Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Fri, 10 Jan 2025 21:21:23 +0900 Subject: [PATCH 4/6] Fix files in the browser package --- packages/browser/README.md | 4 ++-- packages/browser/index.html | 2 +- packages/browser/package.json | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/browser/README.md b/packages/browser/README.md index 32e316961..ac1a1ffe1 100644 --- a/packages/browser/README.md +++ b/packages/browser/README.md @@ -1,5 +1,5 @@ -# `@stlite/mountable` +# `@stlite/browser` -Mount stlite on a static page. +Mount Stlite on a static page. See https://github.com/whitphx/stlite#readme diff --git a/packages/browser/index.html b/packages/browser/index.html index 6ea249291..c88bf83e1 100644 --- a/packages/browser/index.html +++ b/packages/browser/index.html @@ -3,7 +3,7 @@ - Stlite Mountable dev page + Stlite Browser dev page diff --git a/packages/browser/package.json b/packages/browser/package.json index 30bea548e..0e70e3f37 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -1,8 +1,8 @@ { - "name": "@stlite/mountable", + "name": "@stlite/browser", "version": "0.75.0", "type": "module", - "description": "Mountable Stlite application", + "description": "Browser Stlite", "keywords": [ "stlite", "streamlit", @@ -25,7 +25,7 @@ "repository": { "type": "git", "url": "https://github.com/whitphx/stlite.git", - "directory": "packages/mountable" + "directory": "packages/browser" }, "dependencies": { "@stlite/common": "^0.75.0", From 065962ebac1df186b79913b48624eda636d075b6 Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Fri, 10 Jan 2025 21:21:35 +0900 Subject: [PATCH 5/6] Update DEVELOPMENT.md --- DEVELOPMENT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 6c6d29704..438ea407d 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -22,10 +22,10 @@ cd packages/kernel yarn start ``` -#### `@stlite/mountable` +#### `@stlite/browser` ```shell -cd packages/mountable +cd packages/browser yarn start ``` From da19aee35af0aa720b8e4aca21340a6c28d7ea8b Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Fri, 10 Jan 2025 21:51:36 +0900 Subject: [PATCH 6/6] Update browser/README.md --- packages/browser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/browser/README.md b/packages/browser/README.md index ac1a1ffe1..347393512 100644 --- a/packages/browser/README.md +++ b/packages/browser/README.md @@ -1,5 +1,5 @@ # `@stlite/browser` -Mount Stlite on a static page. +Mount a Streamlit app on a static web page. See https://github.com/whitphx/stlite#readme