Skip to content

Commit 11e1bb4

Browse files
feat(container): Make it easier to run Kitten Science
Moving to `docker-compose` as single solution to run environment. Replacing `podman` with `docker`.
1 parent 3f7f2dd commit 11e1bb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+233
-668
lines changed

.github/workflows/nightly.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ jobs:
111111
RELEASE_VERSION: ${{ needs.versions.outputs.RELEASE_VERSION }}
112112
run: |
113113
yarn build:all
114-
yarn kitten-analysts:release
115-
yarn kitten-engineers:release
116-
yarn kitten-scientists:release
114+
yarn ka:release
115+
yarn ke:release
116+
yarn ks:release
117117
118118
- name: Generate GitHub release
119119
uses: oliversalzburg/action-automatic-semantic-releases@fed219c196922f5a95d2b168b10c43bbd9644763 # v0.0.19

.github/workflows/pre-release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ jobs:
9696
RELEASE_VERSION: ${{ needs.versions.outputs.RELEASE_VERSION }}
9797
run: |
9898
yarn build:all
99-
yarn kitten-analysts:release
100-
yarn kitten-engineers:release
101-
yarn kitten-scientists:release
99+
yarn ka:release
100+
yarn ke:release
101+
yarn ks:release
102102
103103
- name: Generate GitHub release
104104
if: success() && inputs.wants-github-release

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"lint:prettier": "prettier --check packages",
2727
"test": "yarn run test:all",
2828
"test:all": "yarn workspaces foreach --all --exclude kitten-scientists --parallel --verbose run test",
29-
"test:coverage:all": "yarn workspaces foreach --all --exclude kitten-scientists --parallel --verbose run test:coverage",
3029
"typecheck:all": "tsc --noEmit --incremental false"
3130
},
3231
"workspaces": [

package.json-scripts.json

+75-60
Original file line numberDiff line numberDiff line change
@@ -118,82 +118,115 @@
118118
"isGlobal": true,
119119
"isRootManifest": false
120120
},
121+
{
122+
"manifestPath": "packages/documentation/package.json",
123+
"projectName": "@kitten-science/documentation",
124+
"scriptName": "docs:nsd",
125+
"scriptCode": "make nsd",
126+
"isGlobal": true,
127+
"isRootManifest": false,
128+
"description": "Update the scripts reference that you are looking at right now."
129+
},
121130
{
122131
"manifestPath": "packages/kitten-analysts/package.json",
123132
"projectName": "@kitten-science/kitten-analysts",
124-
"scriptName": "kitten-analysts:build",
133+
"scriptName": "ka:build",
125134
"scriptCode": "node build.js && vite --config vite.config.inject.js build",
126135
"isGlobal": true,
127136
"isRootManifest": false
128137
},
129138
{
130139
"manifestPath": "packages/kitten-analysts/package.json",
131140
"projectName": "@kitten-science/kitten-analysts",
132-
"scriptName": "kitten-analysts:preview",
141+
"scriptName": "ka:compose:build",
142+
"scriptCode": "docker-compose build",
143+
"isGlobal": true,
144+
"isRootManifest": false
145+
},
146+
{
147+
"manifestPath": "packages/kitten-analysts/package.json",
148+
"projectName": "@kitten-science/kitten-analysts",
149+
"scriptName": "ka:compose:down",
150+
"scriptCode": "docker-compose down",
151+
"isGlobal": true,
152+
"isRootManifest": false
153+
},
154+
{
155+
"manifestPath": "packages/kitten-analysts/package.json",
156+
"projectName": "@kitten-science/kitten-analysts",
157+
"scriptName": "ka:compose:up",
158+
"scriptCode": "docker-compose up",
159+
"isGlobal": true,
160+
"isRootManifest": false
161+
},
162+
{
163+
"manifestPath": "packages/kitten-analysts/package.json",
164+
"projectName": "@kitten-science/kitten-analysts",
165+
"scriptName": "ka:preview",
133166
"scriptCode": "DEV_BUILD=true vite --config vite.config.userscript.js build",
134167
"isGlobal": true,
135168
"isRootManifest": false
136169
},
137170
{
138171
"manifestPath": "packages/kitten-analysts/package.json",
139172
"projectName": "@kitten-science/kitten-analysts",
140-
"scriptName": "kitten-analysts:release",
173+
"scriptName": "ka:release",
141174
"scriptCode": "MINIFY=true vite --config vite.config.userscript.js build; vite --config vite.config.userscript.js build",
142175
"isGlobal": true,
143176
"isRootManifest": false
144177
},
145178
{
146179
"manifestPath": "packages/kitten-analysts/package.json",
147180
"projectName": "@kitten-science/kitten-analysts",
148-
"scriptName": "kitten-analysts:start",
181+
"scriptName": "ka:start",
149182
"scriptCode": "node output/entrypoint-backend.js",
150183
"isGlobal": true,
151184
"isRootManifest": false
152185
},
153186
{
154187
"manifestPath": "packages/kitten-engineers/package.json",
155188
"projectName": "@kitten-science/kitten-engineers",
156-
"scriptName": "kitten-engineers:build",
189+
"scriptName": "ke:build",
157190
"scriptCode": "vite --config vite.config.inject.js build",
158191
"isGlobal": true,
159192
"isRootManifest": false
160193
},
161194
{
162195
"manifestPath": "packages/kitten-engineers/package.json",
163196
"projectName": "@kitten-science/kitten-engineers",
164-
"scriptName": "kitten-engineers:preview",
197+
"scriptName": "ke:preview",
165198
"scriptCode": "DEV_BUILD=true vite --config vite.config.userscript.js build",
166199
"isGlobal": true,
167200
"isRootManifest": false
168201
},
169202
{
170203
"manifestPath": "packages/kitten-engineers/package.json",
171204
"projectName": "@kitten-science/kitten-engineers",
172-
"scriptName": "kitten-engineers:release",
205+
"scriptName": "ke:release",
173206
"scriptCode": "MINIFY=true vite --config vite.config.userscript.js build; vite --config vite.config.userscript.js build",
174207
"isGlobal": true,
175208
"isRootManifest": false
176209
},
177210
{
178211
"manifestPath": "packages/kitten-engineers/package.json",
179212
"projectName": "@kitten-science/kitten-engineers",
180-
"scriptName": "kitten-engineers:version",
213+
"scriptName": "ke:version",
181214
"scriptCode": "node version.cjs",
182215
"isGlobal": true,
183216
"isRootManifest": false
184217
},
185218
{
186219
"manifestPath": "packages/kitten-engineers/package.json",
187220
"projectName": "@kitten-science/kitten-engineers",
188-
"scriptName": "kitten-engineers:watch",
221+
"scriptName": "ke:watch",
189222
"scriptCode": "vite --config vite.config.inject.js build --watch",
190223
"isGlobal": true,
191224
"isRootManifest": false
192225
},
193226
{
194227
"manifestPath": "packages/kitten-scientists/package.json",
195228
"projectName": "@kitten-science/kitten-scientists",
196-
"scriptName": "kitten-scientists:build",
229+
"scriptName": "ks:build",
197230
"scriptCode": "vite --config vite.config.inject.js build",
198231
"isGlobal": true,
199232
"isRootManifest": false,
@@ -202,7 +235,7 @@
202235
{
203236
"manifestPath": "packages/kitten-scientists/package.json",
204237
"projectName": "@kitten-science/kitten-scientists",
205-
"scriptName": "kitten-scientists:preview",
238+
"scriptName": "ks:preview",
206239
"scriptCode": "DEV_BUILD=true vite --config vite.config.userscript.js build",
207240
"isGlobal": true,
208241
"isRootManifest": false,
@@ -211,7 +244,7 @@
211244
{
212245
"manifestPath": "packages/kitten-scientists/package.json",
213246
"projectName": "@kitten-science/kitten-scientists",
214-
"scriptName": "kitten-scientists:release",
247+
"scriptName": "ks:release",
215248
"scriptCode": "MINIFY=true vite --config vite.config.userscript.js build; vite --config vite.config.userscript.js build",
216249
"isGlobal": true,
217250
"isRootManifest": false,
@@ -220,7 +253,7 @@
220253
{
221254
"manifestPath": "packages/kitten-scientists/package.json",
222255
"projectName": "@kitten-science/kitten-scientists",
223-
"scriptName": "kitten-scientists:version",
256+
"scriptName": "ks:version",
224257
"scriptCode": "node version.cjs",
225258
"isGlobal": true,
226259
"isRootManifest": false,
@@ -229,55 +262,39 @@
229262
{
230263
"manifestPath": "packages/kitten-scientists/package.json",
231264
"projectName": "@kitten-science/kitten-scientists",
232-
"scriptName": "kitten-scientists:watch",
265+
"scriptName": "ks:watch",
233266
"scriptCode": "vite --config vite.config.inject.js build --watch",
234267
"isGlobal": true,
235268
"isRootManifest": false,
236269
"description": "Builds the Kitten Scientists userscript and watches all files for changes. If changes are detected, the script is rebuilt.\n\n!!! warning\n\n This watcher has caused problems in the past, generating broken output. Use at your own risk."
237270
},
238271
{
239-
"manifestPath": "packages/kitten-analysts/package.json",
240-
"projectName": "@kitten-science/kitten-analysts",
241-
"scriptName": "kittenscience:build",
242-
"scriptCode": "bash ./scripts/build-container.sh",
243-
"isGlobal": true,
244-
"isRootManifest": false
245-
},
246-
{
247-
"manifestPath": "packages/kitten-analysts/package.json",
248-
"projectName": "@kitten-science/kitten-analysts",
249-
"scriptName": "kittenscience:rebuild",
250-
"scriptCode": "bash ./scripts/rebuild-container.sh",
251-
"isGlobal": true,
252-
"isRootManifest": false
253-
},
254-
{
255-
"manifestPath": "packages/kitten-analysts/package.json",
256-
"projectName": "@kitten-science/kitten-analysts",
257-
"scriptName": "kittenscience:run",
258-
"scriptCode": "bash ./scripts/run-container.sh",
259-
"isGlobal": true,
272+
"manifestPath": "packages/devcontainer/package.json",
273+
"projectName": "@kitten-science/devcontainer",
274+
"scriptName": "lint",
275+
"scriptCode": "yarn run lint:all",
276+
"isGlobal": false,
260277
"isRootManifest": false
261278
},
262279
{
263280
"manifestPath": "packages/kitten-analysts/package.json",
264281
"projectName": "@kitten-science/kitten-analysts",
265-
"scriptName": "kittenscience:stop",
266-
"scriptCode": "bash ./scripts/stop-container.sh",
267-
"isGlobal": true,
282+
"scriptName": "lint",
283+
"scriptCode": "yarn run lint:all",
284+
"isGlobal": false,
268285
"isRootManifest": false
269286
},
270287
{
271-
"manifestPath": "packages/devcontainer/package.json",
272-
"projectName": "@kitten-science/devcontainer",
288+
"manifestPath": "packages/kitten-engineers/package.json",
289+
"projectName": "@kitten-science/kitten-engineers",
273290
"scriptName": "lint",
274291
"scriptCode": "yarn run lint:all",
275292
"isGlobal": false,
276293
"isRootManifest": false
277294
},
278295
{
279-
"manifestPath": "packages/kitten-analysts/package.json",
280-
"projectName": "@kitten-science/kitten-analysts",
296+
"manifestPath": "packages/kitten-scientists/package.json",
297+
"projectName": "@kitten-science/kitten-scientists",
281298
"scriptName": "lint",
282299
"scriptCode": "yarn run lint:all",
283300
"isGlobal": false,
@@ -340,6 +357,22 @@
340357
"isGlobal": false,
341358
"isRootManifest": false
342359
},
360+
{
361+
"manifestPath": "packages/kitten-engineers/package.json",
362+
"projectName": "@kitten-science/kitten-engineers",
363+
"scriptName": "test",
364+
"scriptCode": "echo This project has no tests.",
365+
"isGlobal": false,
366+
"isRootManifest": false
367+
},
368+
{
369+
"manifestPath": "packages/kitten-scientists/package.json",
370+
"projectName": "@kitten-science/kitten-scientists",
371+
"scriptName": "test",
372+
"scriptCode": "echo This project has no tests.",
373+
"isGlobal": false,
374+
"isRootManifest": false
375+
},
343376
{
344377
"manifestPath": "package.json",
345378
"projectName": "kitten-scientists",
@@ -357,24 +390,6 @@
357390
"isRootManifest": true,
358391
"description": "Runs unit tests in all workspaces."
359392
},
360-
{
361-
"manifestPath": "packages/action-release-info/package.json",
362-
"projectName": "@kitten-science/action-release-info",
363-
"scriptName": "test:coverage",
364-
"scriptCode": "c8 --reporter html-spa --reporter text node --enable-source-maps $(yarn bin mocha) ./build/*.test.js",
365-
"isGlobal": true,
366-
"isRootManifest": false,
367-
"description": "Runs unit tests in all workspaces and collects code coverage information."
368-
},
369-
{
370-
"manifestPath": "package.json",
371-
"projectName": "kitten-scientists",
372-
"scriptName": "test:coverage:all",
373-
"scriptCode": "yarn workspaces foreach --all --exclude kitten-scientists --parallel --verbose run test:coverage",
374-
"isGlobal": true,
375-
"isRootManifest": true,
376-
"description": "Runs the `test:coverage` script in all workspaces."
377-
},
378393
{
379394
"manifestPath": "packages/action-release-info/package.json",
380395
"projectName": "@kitten-science/action-release-info",

packages/action-release-info/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"build": "yarn tsc",
2323
"clean": "rm -rf ./build ./tsconfig.tsbuildinfo",
2424
"test": "node --enable-source-maps $(yarn bin mocha) ./build/*.test.js",
25-
"test:coverage": "c8 --reporter html-spa --reporter text node --enable-source-maps $(yarn bin mocha) ./build/*.test.js",
2625
"test:inspect": "node $(yarn bin mocha) --inspect ./build/*.test.js"
2726
},
2827
"types": "./build/index.d.ts",
@@ -37,7 +36,6 @@
3736
"@types/chai": "5.0.0",
3837
"@types/mocha": "10.0.8",
3938
"@types/node": "22.7.4",
40-
"c8": "10.1.2",
4139
"chai": "5.1.1",
4240
"mocha": "10.7.3",
4341
"typescript": "5.6.2"

packages/devcontainer/scripts/build-container.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ main() {
1616
REPO=${2:-https://github.com/nuclear-unicorn/kittensgame.git}
1717

1818
echo "Building development container on $BRANCH branch of $REPO..."
19-
buildah bud \
19+
docker build \
2020
--build-arg BRANCH="$BRANCH" \
2121
--build-arg REPO="$REPO" \
2222
--file ./Containerfile \

packages/devcontainer/scripts/rebuild-container.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ main() {
1616
REPO=${2:-https://github.com/nuclear-unicorn/kittensgame.git}
1717

1818
echo "Re-Building development container on $BRANCH branch of $REPO..."
19-
buildah bud \
19+
docker build \
2020
--build-arg BRANCH="$BRANCH" \
2121
--build-arg REPO="$REPO" \
2222
--file ./Containerfile \

packages/devcontainer/scripts/run-container.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ main() {
2323
echo "Done building Devcontainer."
2424

2525
echo "Removing previous container..."
26-
podman kill devcontainer || true
27-
podman rm devcontainer || true
26+
docker kill devcontainer || true
27+
docker rm devcontainer || true
2828
echo "Previous container removed or non-existent."
2929

3030
echo ""
3131

3232
echo "Starting new container..."
3333
# 8086 Live-Reload Websocket from Development HTTP Server
3434
# 8100 Kittens Game Browser UI
35-
podman run \
35+
docker run \
3636
--detach \
3737
--mount type=bind,source="${BASEDIR}/../../kitten-analysts/output",target=/kittensgame/kitten-analysts \
3838
--mount type=bind,source="${BASEDIR}/../../kitten-engineers/output",target=/kittensgame/kitten-engineers \
@@ -44,7 +44,7 @@ main() {
4444
echo "Container started."
4545

4646
echo ""
47-
echo "Kitten game should be running at http://127.0.0.1:8100"
47+
echo "Kittens Game should be running at http://127.0.0.1:8100"
4848
}
4949

5050
main "$@"

packages/devcontainer/scripts/stop-container.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ cd "$(dirname "$0")"
1111

1212
main() {
1313
echo "Removing container..."
14-
podman kill devcontainer || true
15-
podman rm devcontainer || true
14+
docker kill devcontainer || true
15+
docker rm devcontainer || true
1616
echo "Previous container removed or non-existent."
1717
}
1818

packages/documentation/Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
python3 -m venv .venv
33
. .venv/bin/activate; pip install -r requirements.txt
44

5-
public: .venv
5+
.PHONY: nsd
6+
nsd:
67
yarn nsd --cwd=../.. --docs-location="packages/documentation/docs/reference/Repository Scripts/"
8+
9+
public: .venv nsd
710
. .venv/bin/activate; mkdocs build --config-file mkdocs.yml --site-dir public
811

912
serve: .venv

0 commit comments

Comments
 (0)