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
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ jobs:
run: pnpm exec playwright install --with-deps
- name: Format check
run: pnpm run format:check
- name: Lint check
run: pnpm run lint
- name: Test creating CLI packages
run: pnpm --filter wokwi-cli run package
- name: Test Packing the packages
run: pnpm -r pack
- name: Run vitest tests
run: pnpm run test:vitest
- name: Run Playwright embed tests
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ playwright-report/
test-results/
test-project/
wokwi-part-tests/

# Ignore packed tarballs
wokwi-cli-*.tgz
wokwi-client-js-*.tgz
97 changes: 97 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,100 @@ If you fork the repository, you must enable GitHub Actions for your fork and add
Set the `WOKWI_CLI_TOKEN` secret in your fork under `Settings` > `Secrets and variables` > `Actions` > `New repository secret`.

Instructions for obtaining the `WOKWI_CLI_TOKEN` are in the `README.md` (see the Usage section).


## Deployment

Packages are published manually using `pnpm` tools. Before publishing, ensure you have:
- Updated the version number in the package's `package.json`
- Committed all changes
- Built and tested the packages

### Publishing wokwi-cli

The `wokwi-cli` package includes binary executables for multiple platforms. To publish:

1. Navigate to the package directory:
```bash
cd packages/wokwi-cli
```

2. Clean previous builds:
```bash
pnpm clean
```

3. Build the package:
```bash
pnpm build
```

4. Package binaries for all platforms (optional, for verification):
This is used only in CI to produce platform-specific binaries, those are not published to npm.
```bash
pnpm package
```
This creates platform-specific binaries in `dist/bin/` using `pkg`.

5. Create the tarball (optional, for verification):
```bash
pnpm pack
```

6. Publish to npm:
```bash
pnpm publish
```

### Publishing wokwi-client-js

The `wokwi-client-js` package is a JavaScript library without binaries. To publish:

1. Navigate to the package directory:
```bash
cd packages/wokwi-client-js
```

2. Clean previous builds:
```bash
pnpm clean
```

3. Build the package:
```bash
pnpm build
```

4. Create the tarball (optional, for verification):
```bash
pnpm pack
```

5. Publish to npm:
```bash
pnpm publish
```

### Publishing both packages

To publish both packages in sequence:

```bash
# Publish wokwi-client-js first (it's a dependency of wokwi-cli)
cd packages/wokwi-client-js
pnpm clean && pnpm build && pnpm publish

# Then publish wokwi-cli
cd ../wokwi-cli
pnpm clean && pnpm build && pnpm publish
```

### Test GitHub Actions publishing (optional)
GitHub Actions are set up to publish CLI tool compiled for multiple platforms. To test the publishing commands locally, you can run:

```bash
pnpm run build && pnpm --filter wokwi-cli run package
```

It should produce the platform-specific binaries in `packages/wokwi-cli/dist/bin/`.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"test:embed:playwright": "playwright test test/wokwi-embed",
"test:embed:playwright:ui": "playwright test test/wokwi-embed --ui",
"test:cli:integration": "pnpm exec tsx scripts/test-cli-integration.ts",
"package": "pnpm --filter wokwi-cli run package",
"cli": "tsx packages/wokwi-cli/src/main.ts",
"prepare": "husky install"
},
Expand All @@ -36,6 +35,7 @@
"lint-staged": "^15.4.3",
"prettier": "^3.6.2",
"rimraf": "^5.0.0",
"shx": "^0.4.0",
"tsx": "^4.19.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.3",
Expand Down
16 changes: 13 additions & 3 deletions packages/wokwi-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
"name": "wokwi-cli",
"version": "0.18.3",
"description": "Wokwi Simulator CLI (for CI and local development)",
"main": "index.js",
"main": "dist/cli.cjs",
"type": "module",
"bin": {
"wokwi-cli": "dist/cli.cjs"
},
"files": [
"dist/bin/version.json",
"dist/cli.cjs",
"README.md",
"LICENSE"
],
"scripts": {
"prebuild": "pnpm run clean",
"build": "tsc && pnpm run bundle",
"prepack": "shx cp ../../README.md . && shx cp ../../LICENSE .",
"postpack": "shx rm README.md LICENSE",
"build": "tsc --noEmit && pnpm run bundle",
"bundle": "node tools/bundle.js",
"package": "pnpm run build && pkg --public -o dist/bin/wokwi-cli -t node20-linuxstatic-arm64,node20-linuxstatic-x64,node20-macos-arm64,node20-macos-x64,node20-win-x64 dist/cli.cjs",
"clean": "rimraf dist",
Expand Down
7 changes: 5 additions & 2 deletions packages/wokwi-client-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@
}
},
"files": [
"dist"
"dist",
"README.md",
"LICENSE"
],
"scripts": {
"prebuild": "pnpm run clean",
"prepack": "shx cp ../../README.md . && shx cp ../../LICENSE .",
"postpack": "shx rm README.md LICENSE",
"build": "tsc && pnpm run build:browser",
"build:browser": "node tools/bundle-browser.js",
"clean": "rimraf dist",
Expand Down
Loading
Loading