File tree 9 files changed +49
-18
lines changed
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
62
62
vercel deploy --prebuilt
63
63
```
64
64
65
+ > ℹ️ Git Large File Storage (LFS) must be enabled in your Vercel project settings.
66
+
65
67
### NodeJS
66
68
67
69
The ` 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.
68
70
69
- > ℹ️ Node v18.x is required.
71
+ > ℹ️ Node v18.x is required.
70
72
71
73
For example:
72
74
@@ -84,12 +86,17 @@ Run `yarn install` in the _root_ project directory.
84
86
85
87
## Updating wasm dependencies
86
88
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:
88
90
89
91
` yarn run update:spicedb `
90
92
91
93
` yarn run update:zed `
92
94
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
+
93
100
## Developing your own schema
94
101
95
102
You 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) => {
9
9
10
10
module . exports = {
11
11
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 : [ ] ,
18
13
configure : ( webpackConfig , { env, paths } ) => {
19
14
return webpackConfig ;
20
15
} ,
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env sh
2
2
3
3
set -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
+
4
13
if [ ! -d " spicedb" ] ; then
5
14
git clone https://github.com/authzed/spicedb.git
6
15
fi
7
16
cd spicedb
8
- git checkout 3b37d794c689d635f62d94b868abe3cb66e109f0
17
+ git fetch
18
+ git checkout ${VERSION}
9
19
cd pkg/development/wasm
10
20
GOOS=js GOARCH=wasm go build -o main.wasm
11
21
mv main.wasm ../../../../wasm
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env sh
2
2
3
3
set -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
+
4
12
if [ ! -d " zed" ] ; then
5
13
git clone https://github.com/authzed/zed.git
6
14
fi
7
15
cd zed
8
- git checkout e4815f1475e320c0b008f7d016db59ee158a965c
16
+ git fetch
17
+ git checkout ${VERSION}
9
18
cd pkg/wasm
10
19
GOOS=js GOARCH=wasm go build -o zed.wasm
11
20
mv zed.wasm ../../../wasm
Original file line number Diff line number Diff line change @@ -15,9 +15,10 @@ import {
15
15
RunValidationParameters ,
16
16
RunValidationResult ,
17
17
} from '../protodevdefs/developer/v1/developer' ;
18
+ import wasmConfig from '../../wasm-config.json' ;
18
19
19
20
const 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
21
22
const ENTRYPOINT_FUNCTION = 'runSpiceDBDeveloperRequest' ;
22
23
23
24
/**
@@ -210,7 +211,9 @@ class DeveloperServiceRequest {
210
211
}
211
212
}
212
213
213
- const wasmVersion : number | string = Math . random ( ) ;
214
+ const wasmVersion : number | string = wasmConfig ?. spicedb
215
+ ? encodeURIComponent ( wasmConfig . spicedb )
216
+ : Math . random ( ) ;
214
217
215
218
/**
216
219
* 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
2
2
import { useCallback , useEffect , useState } from 'react' ;
3
3
import { parseRelationships } from '../parsing' ;
4
4
import { RequestContext } from '../protodevdefs/developer/v1/developer' ;
5
+ import wasmConfig from '../../wasm-config.json' ;
5
6
6
7
const 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
8
9
const ENTRYPOINT_FUNCTION = 'runZedCommand' ;
9
10
10
11
/**
@@ -59,7 +60,9 @@ export type ZedServiceState =
59
60
progress : number ;
60
61
} ;
61
62
62
- const wasmVersion : number | string = Math . random ( ) ;
63
+ const wasmVersion : number | string = wasmConfig ?. zed
64
+ ? encodeURIComponent ( wasmConfig . zed )
65
+ : Math . random ( ) ;
63
66
64
67
export function useZedService ( ) : ZedService {
65
68
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 1
1
version 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 1
1
version 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