Skip to content

Commit

Permalink
Obtain WASM/JS files from emscripten-forge
Browse files Browse the repository at this point in the history
Co-authored-by: Thorsten Beier <[email protected]>
  • Loading branch information
ianthomas23 and DerThorsten committed Aug 8, 2024
1 parent 2fdbefc commit 534609f
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 16,272 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ tsconfig.tsbuildinfo
.eslintcache
playwright-report/
test-results/
test/package-lock.json
*.js
*.wasm
cockle_wasm_env/
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ In-browser bash-like shell implemented in a combination of TypeScript and WebAss

Used in the [JupyterLite terminal extension](https://github.com/jupyterlite/terminal).

The commands used here are either built-in commands implemented in TypeScript, or WebAssembly
commands compiled into .js and .wasm files. The latter are built by
[Emscripten-forge](https://emscripten-forge.org/) and are added to the `cockle` NPM package using
a `micromamba` environment as part of the `npm prepack` process.

To build:

```bash
micromamba env create -f environment-dev.yml -y
micromamba activate cockle
npm install
npm run fetch:wasm
npm run build
npm run lint:check
```
Expand Down
6 changes: 6 additions & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: cockle
channels:
- conda-forge
dependencies:
- micromamba
- nodejs =20
730 changes: 257 additions & 473 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"fetch:wasm:create-env": "micromamba create -p $(pwd)/cockle_wasm_env -y cockle_fs grep coreutils --platform=emscripten-wasm32 -c https://repo.mamba.pm/emscripten-forge -c https://repo.mamba.pm/conda-forge",
"fetch:wasm:copy": "mkdir -p src/wasm && cp -r $(pwd)/cockle_wasm_env/bin/*.js src/wasm",
"fetch:wasm": "npm run fetch:wasm:create-env && npm run fetch:wasm:copy",
"build": "tsc",
"eslint": "npm run eslint:check -- --fix",
"eslint:check": "eslint . --cache --ext .ts,.tsx",
"lint": "npm run prettier && npm run eslint",
"lint:check": "npm run prettier:check && npm run eslint:check",
"prepack": "npm install && npm run build",
"prepack": "npm install && npm run fetch:wasm && npm run build",
"prettier": "prettier --list-different --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}\"",
"prettier:check": "prettier --list-different \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md,.yml}\""
},
"dependencies": {
"@jupyterlab/services": "^7.1.6",
"@jupyterlab/services": "^7.2.4",
"@jupyterlite/contents": "^0.4.0"
},
"devDependencies": {
Expand Down
5,763 changes: 0 additions & 5,763 deletions src/wasm/coreutils.js

This file was deleted.

Loading

0 comments on commit 534609f

Please sign in to comment.