File tree Expand file tree Collapse file tree 9 files changed +49
-18
lines changed
Expand file tree Collapse file tree 9 files changed +49
-18
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,13 @@ NODE_OPTIONS=--openssl-legacy-provider vercel build
6262vercel deploy --prebuilt
6363```
6464
65+ > ℹ️ Git Large File Storage (LFS) must be enabled in your Vercel project settings.
66+
6567### NodeJS
6668
6769The ` build ` directory in the project root directory after running ` yarn build ` will contain an optimized production React application that can be served using your preferred NodeJS hosting method.
6870
69- > ℹ️ Node v18.x is required.
71+ > ℹ️ Node v18.x is required.
7072
7173For example:
7274
@@ -84,12 +86,17 @@ Run `yarn install` in the _root_ project directory.
8486
8587## Updating wasm dependencies
8688
87- The project contains prebuilt WASM files for versions of both SpiceDB and zed. To update the versions, edit the following script files with the appropriate tag/commit hash and then run from the project root:
89+ The project contains prebuilt WASM files for versions of both SpiceDB and zed. To update the versions, edit the [ wasm-config.json ] file with the desired tag/commit hash and then run from the project root:
8890
8991` yarn run update:spicedb `
9092
9193` yarn run update:zed `
9294
95+ > ℹ️ [ jq] is required and must be installed.
96+
97+ [ wasm-config.json ] : https://github.com/authzed/playground/blob/wasm-caching/spicedb-common/wasm-config.json
98+ [ jq ] : https://jqlang.github.io/jq/
99+
93100## Developing your own schema
94101
95102You can try both [ SpiceDB] ( https://github.com/authzed/spicedb ) and [ zed] ( https://github.com/authzed/zed ) entirely in your browser on a SpiceDB Playground deployment thanks to the power of [ WebAssembly] ( https://authzed.com/blog/some-assembly-required ) .
Original file line number Diff line number Diff line change @@ -9,12 +9,7 @@ const resolvePackage = (relativePath) => {
99
1010module . exports = {
1111 webpack : {
12- plugins : [
13- new DefinePlugin ( {
14- // Use build timestamp as version id
15- 'process.env.WASM_VERSION' : DefinePlugin . runtimeValue ( Date . now , true ) ,
16- } ) ,
17- ] ,
12+ plugins : [ ] ,
1813 configure : ( webpackConfig , { env, paths } ) => {
1914 return webpackConfig ;
2015 } ,
Original file line number Diff line number Diff line change 11#! /usr/bin/env sh
22
33set -e
4+
5+ VERSION=$( jq -r ' .spicedb' ./spicedb-common/wasm-config.json)
6+ if [ -z ${VERSION} ] ; then
7+ echo " SpiceDB version not defined in wasm config" >&2
8+ exit 1
9+ fi
10+ echo " Updating SpiceDB wasm to version: ${VERSION} "
11+
12+
413if [ ! -d " spicedb" ] ; then
514 git clone https://github.com/authzed/spicedb.git
615fi
716cd spicedb
8- git checkout 3b37d794c689d635f62d94b868abe3cb66e109f0
17+ git fetch
18+ git checkout ${VERSION}
919cd pkg/development/wasm
1020GOOS=js GOARCH=wasm go build -o main.wasm
1121mv main.wasm ../../../../wasm
Original file line number Diff line number Diff line change 11#! /usr/bin/env sh
22
33set -e
4+
5+ VERSION=$( jq -r ' .zed' ./spicedb-common/wasm-config.json)
6+ if [ -z ${VERSION} ] ; then
7+ echo " zed version not defined in wasm config" >&2
8+ exit 1
9+ fi
10+ echo " Updating zed wasm to version: ${VERSION} "
11+
412if [ ! -d " zed" ] ; then
513 git clone https://github.com/authzed/zed.git
614fi
715cd zed
8- git checkout e4815f1475e320c0b008f7d016db59ee158a965c
16+ git fetch
17+ git checkout ${VERSION}
918cd pkg/wasm
1019GOOS=js GOARCH=wasm go build -o zed.wasm
1120mv zed.wasm ../../../wasm
Original file line number Diff line number Diff line change @@ -15,9 +15,10 @@ import {
1515 RunValidationParameters ,
1616 RunValidationResult ,
1717} from '../protodevdefs/developer/v1/developer' ;
18+ import wasmConfig from '../../wasm-config.json' ;
1819
1920const WASM_FILE = `${ process . env . PUBLIC_URL } /static/main.wasm` ;
20- const ESTIMATED_WASM_BINARY_SIZE = 31161196 ; // bytes
21+ const ESTIMATED_WASM_BINARY_SIZE = 46376012 ; // bytes
2122const ENTRYPOINT_FUNCTION = 'runSpiceDBDeveloperRequest' ;
2223
2324/**
@@ -210,7 +211,9 @@ class DeveloperServiceRequest {
210211 }
211212}
212213
213- const wasmVersion : number | string = Math . random ( ) ;
214+ const wasmVersion : number | string = wasmConfig ?. spicedb
215+ ? encodeURIComponent ( wasmConfig . spicedb )
216+ : Math . random ( ) ;
214217
215218/**
216219 * useDeveloperService returns a reference to the developer service for invoking calls against the WASM-based
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ import { RelationTuple as Relationship } from '@code/spicedb-common/src/protodev
22import { useCallback , useEffect , useState } from 'react' ;
33import { parseRelationships } from '../parsing' ;
44import { RequestContext } from '../protodevdefs/developer/v1/developer' ;
5+ import wasmConfig from '../../wasm-config.json' ;
56
67const WASM_FILE = `${ process . env . PUBLIC_URL } /static/zed.wasm` ;
7- const ESTIMATED_WASM_BINARY_SIZE = 49262480 ; // bytes
8+ const ESTIMATED_WASM_BINARY_SIZE = 55126053 ; // bytes
89const ENTRYPOINT_FUNCTION = 'runZedCommand' ;
910
1011/**
@@ -59,7 +60,9 @@ export type ZedServiceState =
5960 progress : number ;
6061 } ;
6162
62- const wasmVersion : number | string = Math . random ( ) ;
63+ const wasmVersion : number | string = wasmConfig ?. zed
64+ ? encodeURIComponent ( wasmConfig . zed )
65+ : Math . random ( ) ;
6366
6467export function useZedService ( ) : ZedService {
6568 const [ state , setState ] = useState < ZedServiceState > ( {
Original file line number Diff line number Diff line change 1+ {
2+ "spicedb" : " v1.29.5" ,
3+ "zed" : " v0.17.1"
4+ }
Original file line number Diff line number Diff line change 11version https://git-lfs.github.com/spec/v1
2- oid sha256:af26f81fd57ac5d5573368fa2cf7a1be097a88f1155fae53cfd8b5e8801af1d7
3- size 45260507
2+ oid sha256:ae5a38d52353841c6b82c373ab8b1a7ce5f80169d4c682e462b3a2e704d037ec
3+ size 46376012
Original file line number Diff line number Diff line change 11version https://git-lfs.github.com/spec/v1
2- oid sha256:927d0bd5f6c6d2f2d4962dcde7580c0438f584a5f4f35e7fb471891c4ba598b0
3- size 52643236
2+ oid sha256:61829b42380be0aefd67068d9ee95b77147002ad843e920d410f9883745f1a05
3+ size 55126053
You can’t perform that action at this time.
0 commit comments