File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050 inherit version ;
5151
5252 buildFeatures =
53- [ ]
54- ++ pkgs . lib . optional enableRustEditor "rust-editor"
53+ pkgs . lib . optional enableRustEditor "rust-editor"
5554 ++ pkgs . lib . optional enableSourceMap "source-map"
5655 ++ pkgs . lib . optional enableAquascope "aquascope" ;
5756
6968
7069 cargoHash = "sha256-pDWTvJKz1W41Y/ck+GBE6vaBc45l2Ut7nPwl/oYAknw=" ;
7170
72- pnpmRoot = "js" ;
73- pnpmWorkspaces = [
74- "@wcrichto/quiz"
75- "@wcrichto/quiz-embed"
76- ] ;
77-
7871 pnpmDeps = pnpm . fetchDeps {
79- inherit
80- pname
81- version
82- src
83- pnpmWorkspaces
84- ;
72+ inherit pname version ;
73+ src = pkgs . lib . cleanSource ./js ;
8574 fetcherVersion = 2 ;
8675 hash = "sha256-xbctcU8vXWeYF/50iDRpa6SGST9fttL1yGJrkbf9NuI=" ;
87- sourceRoot = "js" ;
8876 } ;
8977
9078 preBuild = ''
79+ export NPM_CONFIG_OFFLINE=true
9180 export PNPM_WRITABLE_STORE=$(mktemp -d)
81+
9282 # Copy pnpm deps to writable store
93- cp -r ${ pnpmDeps } /. * $PNPM_WRITABLE_STORE/ || true
83+ cp -LR ${ pnpmDeps } /* $PNPM_WRITABLE_STORE/ || true
9484 export npm_config_store_dir=$PNPM_WRITABLE_STORE
9585
96- # Run the JS build
86+ # Generate TS bindings
9787 cargo test -p mdbook-quiz-schema --locked export_bindings --features ts
9888 mkdir -p js/packages/quiz/src/bindings
9989 cp crates/mdbook-quiz-schema/bindings/* js/packages/quiz/src/bindings
90+
91+ # Build JS so that the build.rs won't
92+ cd js
93+ pnpm install --offline --frozen-lockfile --ignore-scripts
94+ chmod -R +w node_modules
95+ ${ pkgs . lib . optionalString enableRustEditor "export RUST_EDITOR=yes" }
96+ depot build --release
97+ cd ..
10098 '' ;
10199 } ;
102-
103100 in
104101 {
105102 packages . default = pkgs . lib . makeOverridable buildQuiz { } ;
Original file line number Diff line number Diff line change 1+ supported-architectures = os=linux,darwin cpu=x64 ,arm64
You can’t perform that action at this time.
0 commit comments