Skip to content

Commit bbe75a0

Browse files
authored
dev watch (#820)
- **add SessionTimeLimit as a userConfig setting** - **add settings hooks** - **apply dark mode** - **add SessionTimeLimit as a userConfig setting** - **fix: supply _rev for adding attachments** - **wrap viewLookup fcn** - **add dev-watch script** - **exclude some packages** - **exclude tui, cli. fix name truncation.** - **add a build:lib script** - **add init build to setup script, add build:pui, sui**
2 parents b74e052 + 3130d35 commit bbe75a0

File tree

3 files changed

+78
-9
lines changed

3 files changed

+78
-9
lines changed

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
22
"name": "vue-skuilder",
33
"scripts": {
4-
"setup": "yarn && git submodule update --init --recursive",
4+
"setup": "yarn && git submodule update --init --recursive && yarn build:lib",
55
"dev": "yarn workspace @vue-skuilder/common build && yarn workspace @vue-skuilder/db build && yarn workspace @vue-skuilder/common-ui build && yarn workspace @vue-skuilder/courses build && yarn workspace @vue-skuilder/edit-ui build && node scripts/dev-couchdb.js start && concurrently \"yarn dev:platform-ui\" \"yarn dev:express\"",
6-
"dev:platform-ui": "yarn workspace @vue-skuilder/platform-ui dev",
7-
"dev:express": "yarn workspace @vue-skuilder/express dev",
8-
"dev:couchdb": "node scripts/dev-couchdb.js start",
6+
"dev:watch": "node scripts/dev-watch.js",
7+
"dev:platform": "yarn couchdb:start && yarn workspace @vue-skuilder/express dev && yarn workspace @vue-skuilder/platform-ui dev",
98
"couchdb:start": "node scripts/dev-couchdb.js start",
109
"couchdb:stop": "node scripts/dev-couchdb.js stop",
1110
"couchdb:status": "node scripts/dev-couchdb.js status",
1211
"couchdb:remove": "node scripts/dev-couchdb.js remove",
1312
"postdev": "node scripts/dev-couchdb.js stop",
1413
"build": "yarn workspace @vue-skuilder/common build && yarn workspace @vue-skuilder/db build && yarn workspace @vue-skuilder/common-ui build && yarn workspace @vue-skuilder/courses build && yarn workspace @vue-skuilder/edit-ui build && yarn workspace @vue-skuilder/platform-ui build && yarn workspace @vue-skuilder/express build",
14+
"build:lib": "yarn workspace @vue-skuilder/common build && yarn workspace @vue-skuilder/db build && yarn workspace @vue-skuilder/common-ui build && yarn workspace @vue-skuilder/courses build && yarn workspace @vue-skuilder/edit-ui build",
15+
"build:pui": "yarn build:lib && yarn workspace @vue-skuilder/platform-ui build && yarn workspace @vue-skuilder/express build",
16+
"build:sui": "yarn build:lib && yarn workspace @vue-skuilder/standalone-ui build",
1517
"clean": "yarn clean:dist && yarn clean:node_modules",
1618
"clean:dist": "find packages -name 'dist' -type d -exec rm -rf {} +",
1719
"clean:node_modules": "find . -name 'node_modules' -type d -exec rm -rf {} +",

readme.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ Modular toolkit for the construction of interactive tutoring systems, with exper
1111

1212
Think: the FOSS lovechild of Anki, Duolingo, Wikipedia, and MathAcademy, with a more generalized surface area for the types of content and skills that can be exercised.
1313

14+
Also: friendly with local-first and static-deployments.
15+
1416
## Quick Start
1517

16-
### For Course Creators (building *with* `vue-skuilder`) (start here!)
18+
### For Course Creators (building *with* `vue-skuilder`) (recommmended start point!)
1719

18-
Install the Skuilder CLI to create your first course:
20+
Use the Skuilder CLI to create your first course:
1921

2022
```bash
21-
npm install -g skuilder # npx ok too!
23+
npm install -g skuilder
2224
skuilder init my-course --data-layer=static
25+
# Or:
26+
# npx skuilder init my-course --data-layer=static
2327
cd my-course
2428
npm run dev # serve your course locally
2529
npm run studio # edit your course content via web UI
@@ -33,10 +37,20 @@ Clone and develop the full platform:
3337
git clone https://github.com/patched-network/vue-skuilder.git
3438
cd vue-skuilder
3539
yarn install
36-
yarn setup # makes git submodule available - test database
37-
yarn dev # runs platform-ui, express API, and CouchDB
40+
yarn setup # makes git submodule available - test database, builds library packages
41+
```
42+
43+
After the setup, workflows will differdepending on what you are working on. To explore, I recommend:
44+
45+
```
46+
yarn dev:platform
3847
```
3948

49+
Which will build the components of the platform version of the software and serve locally.
50+
- database: `http://localhost:5984`, with admin accound `admin:password`.
51+
- express backend: `http://localhost:3000`
52+
- platform UI: `http://localhost:5173`
53+
4054
## Project Architecture
4155

4256
This monorepo is structured to support both **platform development** and **course creation**.

scripts/dev-watch.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const { exec } = require('child_process');
2+
const fs = require('fs');
3+
const path = require('path');
4+
5+
const packagesDir = path.join(__dirname, '../packages');
6+
const packages = fs.readdirSync(packagesDir);
7+
const excludedPackages = [
8+
// legacy / unused pkgs
9+
'client',
10+
'e2e-db',
11+
// application packages - only used one at a time, manually started / watched by dev
12+
'platform-ui',
13+
'standalone-ui',
14+
'studio-ui',
15+
'express',
16+
'tuilder',
17+
// cli tool - depends on app packages
18+
'cli',
19+
];
20+
21+
const commands = [];
22+
const names = [];
23+
24+
for (const pkg of packages) {
25+
if (excludedPackages.includes(pkg)) {
26+
continue;
27+
}
28+
const pkgPath = path.join(packagesDir, pkg, 'package.json');
29+
if (fs.existsSync(pkgPath)) {
30+
const pkgJson = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
31+
if (pkgJson.scripts && pkgJson.scripts.dev) {
32+
commands.push(`"yarn workspace ${pkgJson.name} dev"`);
33+
names.push(pkg);
34+
}
35+
}
36+
}
37+
38+
if (commands.length > 0) {
39+
const concurrentlyCommand = `concurrently -n "${names.join(',')}" ${commands.join(' ')}`;
40+
console.log('Running command:', concurrentlyCommand);
41+
const child = exec(concurrentlyCommand, (error, stdout, stderr) => {
42+
if (error) {
43+
console.error(`exec error: ${error}`);
44+
return;
45+
}
46+
console.log(`stdout: ${stdout}`);
47+
console.error(`stderr: ${stderr}`);
48+
});
49+
child.stdout.pipe(process.stdout);
50+
child.stderr.pipe(process.stderr);
51+
} else {
52+
console.log('No packages with a "dev" script found.');
53+
}

0 commit comments

Comments
 (0)