@miragon/create-slidev-deck 1.0.2 → 1.1.0

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/bin/index.mjs CHANGED
@@ -143,19 +143,22 @@ function buildPackageJson(scratch, deckName, toolkitVersion) {
143
143
  const readManifest = (rel) => JSON.parse(readFileSync(join(scratch, rel), 'utf8'))
144
144
  const deckPkg = readManifest('deck/package.json')
145
145
  const rootPkg = readManifest('package.json')
146
+ const portlessVersion = deckPkg.devDependencies?.portless
147
+ if (!portlessVersion) throw new Error('Reference deck/package.json is missing devDependency portless')
146
148
  const pkg = {
147
149
  name: deckName,
148
150
  type: 'module',
149
151
  private: true,
150
152
  scripts: {
151
- dev: 'slidev deck/slides.md --open',
153
+ dev: 'portless',
154
+ 'dev:app': 'slidev deck/slides.md --port ${PORT:-3030} --remote --bind 127.0.0.1',
152
155
  build: 'slidev build deck/slides.md --out ../dist',
153
156
  export: 'slidev export deck/slides.md',
154
157
  verify: rootPkg.scripts.verify,
155
158
  'verify:source': rootPkg.scripts['verify:source'],
156
159
  },
157
160
  dependencies: { '@miragon/slidev-toolkit': toolkitVersion, ...deckPkg.dependencies },
158
- devDependencies: verifyDevDeps(rootPkg),
161
+ devDependencies: { ...verifyDevDeps(rootPkg), portless: portlessVersion },
159
162
  }
160
163
  return JSON.stringify(pkg, null, 2) + '\n'
161
164
  }
@@ -200,6 +203,8 @@ async function layDownDeck({ scratch, target, deckName, toolkitVersion, ref, pre
200
203
 
201
204
  const packageJson = buildPackageJson(scratch, deckName, toolkitVersion)
202
205
  await writeFile(join(target, 'package.json'), packageJson)
206
+ const portlessJson = JSON.stringify({ name: deckName, script: 'dev:app' }, null, 2) + '\n'
207
+ await writeFile(join(target, 'portless.json'), portlessJson)
203
208
  await cp(join(HERE, '..', 'templates', 'README.md'), join(target, 'README.md'))
204
209
  } catch (err) {
205
210
  await rollback(target, preexisting)
@@ -215,7 +220,8 @@ Done. Your deck is ready in ${dir}
215
220
  Next steps:
216
221
  cd ${dir}
217
222
  ${pm} install
218
- ${pm} run dev
223
+ npx portless service install # one-time per machine: HTTPS proxy for the .localhost dev URL
224
+ ${pm} run dev # serves at https://${deckNameFrom(dir)}.localhost
219
225
 
220
226
  Build with '${pm} run build', check brand guardrails with '${pm} run verify'.`)
221
227
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miragon/create-slidev-deck",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Scaffold a lean Miragon Slidev deck: only the files a deck needs, with @miragon/slidev-toolkit pulled from npm. Run via `npm create @miragon/slidev-deck`.",
6
6
  "keywords": [
@@ -31,7 +31,7 @@
31
31
  "giget": "3.3.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@miragon/slidev-toolkit": "1.4.0"
34
+ "@miragon/slidev-toolkit": "1.5.1"
35
35
  },
36
36
  "files": [
37
37
  "bin",
@@ -7,13 +7,15 @@ npm package — you fill in the content, the theme is fixed.
7
7
 
8
8
  ## Quick start
9
9
 
10
- Needs **Node 20+** and a modern browser (WebGL2 for the animated background, with a CSS-gradient fallback).
10
+ Needs **Node 20+** (**Node 24+** for `npm run dev`) and a modern browser (WebGL2 for the animated background, with a CSS-gradient fallback).
11
11
 
12
12
  ```bash
13
13
  npm install
14
- npm run dev # opens the deck on http://localhost:3030 with live reload
14
+ npm run dev # serves the deck at https://<this-deck>.localhost with live reload
15
15
  ```
16
16
 
17
+ `npm run dev` runs through [portless](https://portless.sh): a stable `.localhost` URL instead of a `:3030` port, so several decks run at once without colliding. The proxy auto-starts on first run (one-time `sudo`); `npx portless service install` makes it permanent. Use `npm run dev:app` to run the raw server without portless.
18
+
17
19
  Edit files under `deck/` and save — the preview updates instantly. Every demo slide carries a
18
20
  `REQUIRED / OPTIONAL / LIMIT / HOW TO USE` comment block: your in-place authoring guide.
19
21
 
@@ -32,7 +34,7 @@ The deck consumes the toolkit by name (`theme: '@miragon/slidev-toolkit'`); you
32
34
 
33
35
  | Command | Result |
34
36
  |---|---|
35
- | `npm run dev` | Live preview on `:3030`; `p` for presenter mode, `o` for overview |
37
+ | `npm run dev` | Live preview at `https://<this-deck>.localhost` (portless); `p` for presenter mode, `o` for overview |
36
38
  | `npm run build` | Static `dist/` you can host anywhere |
37
39
  | `npm run export` | `slidev-exported.pdf` locally (needs Chromium) |
38
40
  | `npm run verify` | Full screenshot + checklist per slide against the design rules (local; needs a browser) |