Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 18 additions & 27 deletions .github/workflows/build-test-publish-superscript-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Setup Rust
uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -53,27 +55,16 @@ jobs:
- name: Install dependencies for Node example
run: |
set -e
cd wasm/example/node
npm install
npm install ../../target/node

- name: Build TypeScript example
run: |
set -e
cd wasm/example/node
npm run build
if [ ! -f dist/test_node.js ]; then
echo "TypeScript build failed - dist/test_node.js not found"
exit 1
fi

cd examples/node
bun install
bun install ../../wasm/target/node
- name: Run JavaScript example
run: |
set -e
cd wasm/example/node
cd examples/node
# Run the original JavaScript example
echo "Running JavaScript example (test_node_javascript.js)..."
node test_node_javascript.js
bun run test_node_javascript.js
if [ $? -ne 0 ]; then
echo "JavaScript example execution failed"
exit 1
Expand All @@ -83,10 +74,10 @@ jobs:
- name: Run TypeScript compiled example
run: |
set -e
cd wasm/example/node
cd examples/node
# Run the compiled TypeScript example
echo "Running compiled TypeScript example (dist/test_node.js)..."
node dist/test_node.js
bun run test_node.ts
if [ $? -ne 0 ]; then
echo "TypeScript compiled example execution failed"
exit 1
Expand All @@ -97,9 +88,9 @@ jobs:
- name: Run Superscript tests
run: |
set -e
cd wasm/example/node
cd examples/node
echo "Running Superscript tests..."
npm run test
bun run test
if [ $? -ne 0 ]; then
echo "Superscript tests failed"
exit 1
Expand All @@ -110,16 +101,16 @@ jobs:
- name: Install dependencies for Browser example
run: |
set -e
cd wasm/example/browser
npm install
npm install ../../target/browser
cd examples/browser
bun install
bun install ../../wasm/target/browser

- name: Build Browser example
run: |
set -e
cd wasm/example/browser
CI=false npm run build
if [ ! -d build ]; then
cd examples/browser
CI=false bun run build
if [ ! -d dist ]; then
echo "Browser example build failed - build directory not found"
exit 1
fi
Expand Down
6 changes: 3 additions & 3 deletions build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ echo "50% - WASM wrapper build successful ✅"
echo "50% - Building JS bundles"
mkdir -p ./target/browser
mkdir -p ./target/node
npm run build
bun run build

echo "75% - Build done - ✅"
echo "75% - Installing to example project"
cd example/browser/
npm install ../../target/browser
cd ../examples/browser/
bun install ../../wasm/target/browser

echo "100% - Done - ✅"
24 changes: 24 additions & 0 deletions examples/browser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions examples/browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Example Browser using Superscript
426 changes: 426 additions & 0 deletions examples/browser/bun.lock

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions examples/browser/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
13 changes: 13 additions & 0 deletions examples/browser/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading