@tinyvolt/pie 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,20 @@
7
7
 
8
8
  A Markdown-based SSG for interactive science explainers
9
9
 
10
- See the [roadmap](ROADMAP.md) for planned features and [documentation](DOCS.md) for existing features.
10
+ [![pie demo](https://img.youtube.com/vi/NAX6A_9NIvA/hqdefault.jpg)](https://youtu.be/NAX6A_9NIvA)
11
+
12
+ Website: [pie.tinyvolt.com](https://pie.tinyvolt.com/)
13
+
14
+ See the [documentation](DOCS.md) for existing features.
15
+
16
+ Features:
17
+ - Python editor with scientific computing toolkit (`numpy`, `scipy`, `matplotlib` etc)
18
+ - Canvas for visualizations
19
+ - Autodiff
20
+ - Navigation tools like auto-generated toc, sidebar, glossary and hashtags.
21
+ - Generative UI
22
+
23
+ ---
11
24
 
12
25
  ## Create a site
13
26
 
@@ -41,7 +54,7 @@ With pnpm:
41
54
  pnpm add @tinyvolt/pie@latest
42
55
  ```
43
56
 
44
- Updating also refreshes the site's `AGENTS.md` and `vite.config.ts`. If either differs from the new version, the old one is saved as `AGENTS.old.md` or `vite.config.old.ts`. Copy back anything you want to keep.
57
+ Updating doesn't change the site's `AGENTS.md` or `vite.config.ts`. To get the new versions, copy `node_modules/@tinyvolt/pie/init/site-agents.md` to `AGENTS.md` and `node_modules/@tinyvolt/pie/init/site-vite.config.ts` to `vite.config.ts`. Keep any edits of your own.
45
58
 
46
59
  Requires Node 24. Package: [@tinyvolt/pie](https://www.npmjs.com/package/@tinyvolt/pie).
47
60
 
package/init/index.js CHANGED
@@ -75,12 +75,8 @@ const pkg = {
75
75
  dependencies: { [app.name]: app.version, ...app.peerDependencies },
76
76
  devDependencies: { '@types/node': app.devDependencies['@types/node'], typescript: app.devDependencies.typescript },
77
77
  engines: app.engines,
78
- // npm blocks dependencies' install scripts unless allowed. This lets `init/postinstall.js` refresh files on upgrade.
79
- allowScripts: { [app.name]: true },
80
78
  };
81
79
  fs.writeFileSync(path.join(target, 'package.json'), JSON.stringify(pkg, null, 2) + '\n');
82
- // The same for pnpm.
83
- fs.writeFileSync(path.join(target, 'pnpm-workspace.yaml'), `allowBuilds:\n "${app.name}": true\n`);
84
80
 
85
81
  const usesPnpm = (process.env.npm_config_user_agent ?? '').startsWith('pnpm');
86
82
  console.log(`
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@tinyvolt/pie",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "A Markdown-based SSG for interactive science explainers. Create a site with: npx @tinyvolt/pie init my-site",
5
5
  "type": "module",
6
+ "homepage": "https://pie.tinyvolt.com/",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/TinyVolt/pie-ssg.git"
@@ -31,8 +32,7 @@
31
32
  "dev": "vite dev",
32
33
  "build": "vite build",
33
34
  "start": "node .output/server/index.mjs",
34
- "preview": "vite preview",
35
- "postinstall": "node init/postinstall.js"
35
+ "preview": "vite preview"
36
36
  },
37
37
  "dependencies": {
38
38
  "@codemirror/lang-python": "6.2.1",
@@ -1,38 +0,0 @@
1
- // Runs after a site installs or upgrades `@tinyvolt/pie`: refreshes the files below from this version.
2
- // A changed file is first backed up, so a user's edits are kept.
3
- import fs from 'node:fs';
4
- import path from 'node:path';
5
-
6
- const root = path.resolve(import.meta.dirname, '..');
7
-
8
- // Package path -> [path in the site, backup path in the site].
9
- const FILES = {
10
- 'init/site-agents.md': ['AGENTS.md', 'AGENTS.old.md'],
11
- 'init/site-vite.config.ts': ['vite.config.ts', 'vite.config.old.ts'],
12
- };
13
-
14
- /** The folder of the nearest `package.json` at or above `dir`, or null. */
15
- function findProject(dir) {
16
- for (let d = dir; ; d = path.dirname(d)) {
17
- if (fs.existsSync(path.join(d, 'package.json'))) return d;
18
- if (d === path.dirname(d)) return null;
19
- }
20
- }
21
-
22
- // `INIT_CWD` is where the install command was run. Skip anything that isn't a site depending on this package,
23
- // such as this repo's own `pnpm install` or a one-off `npx @tinyvolt/pie init`.
24
- const app = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
25
- const site = process.env.INIT_CWD && findProject(process.env.INIT_CWD);
26
- const sitePkg = site && JSON.parse(fs.readFileSync(path.join(site, 'package.json'), 'utf8'));
27
- if (!sitePkg?.dependencies?.[app.name] && !sitePkg?.devDependencies?.[app.name]) process.exit(0);
28
-
29
- for (const [from, [to, backup]] of Object.entries(FILES)) {
30
- const target = path.join(site, to);
31
- // A file the user removed stays removed.
32
- if (!fs.existsSync(target)) continue;
33
- const fresh = fs.readFileSync(path.join(root, from));
34
- if (fresh.equals(fs.readFileSync(target))) continue;
35
- fs.copyFileSync(target, path.join(site, backup));
36
- fs.writeFileSync(target, fresh);
37
- console.log(`@tinyvolt/pie: updated ${to}; the old one is in ${backup}.`);
38
- }