Skip to content

Commit 91f80f0

Browse files
committed
starting work on project runner sea
1 parent adc4d91 commit 91f80f0

File tree

4 files changed

+116
-6
lines changed

4 files changed

+116
-6
lines changed

src/packages/lite/bin/build-lite.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# This does a clean build from source of a clone
44
# of the cocalc repo where it is run from, deletes
55
# a lot that isn't needed for cocalc-lite, then
6-
# tars it all up. The result should be about 150MB.
6+
# tars it all up.
7+
# **The result should be well under 50 MB.**
78

89
set -ev
910

@@ -25,11 +26,11 @@ BIN=`dirname "$(realpath $0)"`
2526
git clone --depth=1 $BIN/../../../.. $TARGET
2627

2728
cd "$SRC"/packages
28-
rm -rf database hub next server file-server
29+
rm -rf database hub next server file-server project-runner
2930

3031
cd "$SRC"
31-
./workspaces.py install --exclude=database,hub,next,server,file-server
32-
./workspaces.py build --exclude=database,hub,next,server,file-server
32+
./workspaces.py install --exclude=database,hub,next,server,file-server,project-runner
33+
./workspaces.py build --exclude=database,hub,next,server,file-server,project-runner
3334

3435
# Delete packages that were only needed for the build.
3536
# Deleting node_modules and installing is the recommended approach by pnpm.
@@ -52,7 +53,7 @@ rm -rf rxjs*
5253
rm -rf @zxcvbn* zod*
5354
# jsdom -- used for testing and next
5455
rm -rf jsdom*
55-
# note: cytoscape-fcose is a mermaid dep so alraedy bundled up
56+
# note: cytoscape-fcose is a mermaid dep so already bundled up
5657
# this is aa bunch of frontend only stuff
5758
rm -rf d3* @icons+material* katex* slate* react-highlight-words* codemirror* plotly* @plotly* mermaid* cytoscape-fcose* antd* pdfjs* maplibre* mapbox* three* @lumino* @mermaid* sass* webpack* @icons+material '@napi-rs+canvas'*
5859
rm -rf typescript* @tsd+typescript

src/packages/project-runner/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"tsc": "pnpm exec tsc --pretty --preserveWatchOutput",
1212
"depcheck": "pnpx depcheck",
1313
"clean": "rm -rf node_modules dist",
14-
"start": "pnpm exec cocalc-project-runner"
14+
"start": "pnpm exec cocalc-project-runner",
15+
"build-tarball": "cd sea && ./build-tarball.sh",
16+
"build-sea": "cd sea && ./build-sea.sh"
1517
},
1618
"bin": {
1719
"cocalc-project-runner": "./bin/start.js"
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/usr/bin/env bash
2+
3+
# This does a clean build from source of a clone
4+
# of the cocalc repo where it is run from, deletes
5+
# a lot that isn't needed for cocalc-project-runner, then
6+
# tars it all up.
7+
# **The result should be well under 50 MB.**
8+
# See similar script in lite/bin/build-lite.sh
9+
10+
set -ev
11+
12+
VERSION="$npm_package_version"
13+
MACHINE="$(uname -m)"
14+
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
15+
16+
NAME=cocalc-project-runner-$VERSION-$MACHINE-$OS
17+
TMP=/tmp/$NAME
18+
rm -rf "$TMP"
19+
mkdir "$TMP"
20+
TARGET="$TMP/$NAME"
21+
SRC="$TARGET/src"
22+
23+
echo "Creating $TARGET"
24+
25+
BIN=`dirname "$(realpath $0)"`
26+
27+
git clone --depth=1 $BIN/../../../.. $TARGET
28+
29+
cd "$SRC"/packages
30+
rm -rf database hub next server file-server lite
31+
32+
cd "$SRC"
33+
./workspaces.py install --exclude=database,hub,next,server,file-server,lite
34+
./workspaces.py build --exclude=database,hub,next,server,file-server,lite
35+
36+
cd "$SRC"/packages
37+
rm -rf node_modules && pnpm install --prod --package-import-method=copy
38+
39+
rm -rf cdn frontend
40+
rm -rf static/dist/*.map static/dist/embed-*.js
41+
42+
cd node_modules/.pnpm
43+
rm -rf @next* next*
44+
rm -rf googleapis* @google*
45+
rm -rf zeromq*/node_modules/zeromq/prebuilds/*win*
46+
rm -rf @types*
47+
rm -rf @img*
48+
rm -rf @rspack*
49+
rm -rf rxjs*
50+
rm -rf @zxcvbn* zod*
51+
rm -rf jsdom*
52+
rm -rf d3* @icons+material* katex* slate* react-highlight-words* codemirror* plotly* @plotly* mermaid* cytoscape-fcose* antd* pdfjs* maplibre* mapbox* three* @lumino* @mermaid* sass* webpack* @icons+material '@napi-rs+canvas'*
53+
rm -rf typescript* @tsd+typescript
54+
rm -rf @cocalc+gcloud-pricing-calculator
55+
rm -rf @maplibre* @orama*
56+
rm -rf caniuse-lite@* cytoscape@* cytoscape-cose-bilkent@*
57+
rm -rf refractor@* rc-picker@* @uiw+react-textarea-code-editor@* ajv@*
58+
rm -rf langium@* moment@* react-dom@* @sinclair+typebox@* @xterm+addon-fit@* @xterm+addon-webgl@* @xterm+addon-web-links@* @xterm+xterm@* yjs@* zlibjs@* lodash-es@* @swc+helpers@*
59+
rm -rf @jupyter*
60+
rm -rf @asamuzakjp+css-color@* csv-parse@* elementary-circuits-directed-graph@* jquery@* [email protected]_react@* *webpack*
61+
rm -rf @stripe*
62+
rm -rf @dnd-kit*
63+
rm -rf uglify-js*
64+
rm -rf y-protocols*
65+
rm -rf @nteract*
66+
rm -rf dropzone@*
67+
mkdir x
68+
mv @ant-design* x
69+
mv x/@ant-design+colors* .
70+
rm -rf x
71+
72+
rm -rf js-tiktoken* gpt3-tokenizer* openai* @mistralai* @anthropic* @langchain*
73+
74+
if [ `uname` == "Linux" ]; then
75+
rm -rf zeromq*/node_modules/zeromq/build/darwin/
76+
rm -rf zeromq*/node_modules/zeromq/build/win32/
77+
fi
78+
79+
if [ `uname` == "Darwin" ]; then
80+
rm -rf zeromq*/node_modules/zeromq/build/linux/
81+
rm -rf zeromq*/node_modules/zeromq/build/win32/
82+
fi
83+
84+
if [ `uname` == 'x86_64']; then
85+
rm -rf zeromq*/node_modules/zeromq/build/*/arm64
86+
fi
87+
if [ `uname` == 'arm64']; then
88+
rm -rf zeromq*/node_modules/zeromq/build/*/x*64
89+
fi
90+
91+
# Upstream sqlite sources are ~10MB:
92+
rm -rf better-sqlite3@*/node_modules/better-sqlite3/deps/sqlite3
93+
94+
cd "$SRC"/..
95+
rm -rf *.md .github .git docs
96+
mv src/packages/* .
97+
rm -rf src
98+
# remove rustic -- only needed for file server
99+
rm -f backend/node_modules/.bin/rustic
100+
101+
cd $TMP
102+
mkdir -p $BIN/../build/tarball
103+
tar Jcvf $BIN/../build/tarball/$NAME.tar.xz $NAME
104+
105+
rm -rf "$TARGET"

src/packages/project/conat/api/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ export const projectApi: ProjectApi = {
154154
editor,
155155
jupyter,
156156
sync,
157+
isReady: async () => true,
158+
waitUntilReady: async () => {},
157159
};
158160

159161
async function getResponse({ name, args }) {

0 commit comments

Comments
 (0)