create-slidev 0.36.5 → 0.36.7

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/build.mjs ADDED
@@ -0,0 +1,33 @@
1
+ import { copyFileSync, existsSync, mkdirSync, rmSync } from 'node:fs'
2
+ import * as url from 'node:url'
3
+ import { resolve } from 'node:path'
4
+
5
+ const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
6
+ const __templateDir = resolve(__dirname, 'template')
7
+ const __pagesDir = resolve(__templateDir, 'pages')
8
+
9
+ const shouldCreatePagesDict = () => !existsSync(__pagesDir)
10
+
11
+ // key: copy to (relative ./)
12
+ // value: origin (relative ./template)
13
+ const needCopyFiles = {
14
+ 'slides.md': '../../../demo/starter/slides.md',
15
+ 'pages/multiple-entries.md': '../../../demo/starter/pages/multiple-entries.md',
16
+ }
17
+
18
+ function main() {
19
+ if (shouldCreatePagesDict())
20
+ mkdirSync(__pagesDir)
21
+ Object.keys(needCopyFiles).forEach((relativeTargetPath) => {
22
+ const sourcePath = resolve(__templateDir, needCopyFiles[relativeTargetPath])
23
+ const targetPath = resolve(__templateDir, relativeTargetPath)
24
+ const exist = existsSync(targetPath)
25
+ if (exist)
26
+ rmSync(targetPath)
27
+ copyFileSync(sourcePath, targetPath)
28
+ })
29
+ // eslint-disable-next-line no-console
30
+ console.log('done...')
31
+ }
32
+
33
+ main()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-slidev",
3
- "version": "0.36.5",
3
+ "version": "0.36.7",
4
4
  "description": "Create starter template for Slidev",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -21,10 +21,10 @@
21
21
  "dependencies": {
22
22
  "execa": "^5.1.1",
23
23
  "kolorist": "^1.6.0",
24
- "minimist": "^1.2.6",
24
+ "minimist": "^1.2.7",
25
25
  "prompts": "^2.4.2"
26
26
  },
27
27
  "scripts": {
28
- "build": "cp ../../demo/starter/slides.md template/slides.md"
28
+ "build": "node build.mjs"
29
29
  }
30
30
  }
@@ -7,7 +7,7 @@
7
7
  "export": "slidev export"
8
8
  },
9
9
  "dependencies": {
10
- "@slidev/cli": "^0.36.5",
10
+ "@slidev/cli": "^0.36.7",
11
11
  "@slidev/theme-default": "*",
12
12
  "@slidev/theme-seriph": "*"
13
13
  }
@@ -0,0 +1,27 @@
1
+ # Multiple Entries
2
+
3
+ You can split your slides.md into multiple files and organize them as you want using the `src` attribute.
4
+
5
+ #### `slides.md`
6
+
7
+ ```markdown
8
+ # Page 1
9
+
10
+ Page 2 from main entry.
11
+
12
+ ---
13
+ src: ./subpage.md
14
+ ---
15
+ ```
16
+
17
+ <br>
18
+
19
+ #### `subpage.md`
20
+
21
+ ```markdown
22
+ # Page 2
23
+
24
+ Page 2 from another file.
25
+ ```
26
+
27
+ [Learn more](https://sli.dev/guide/syntax.html#multiple-entries)
@@ -374,6 +374,10 @@ database "MySql" {
374
374
 
375
375
  [Learn More](https://sli.dev/guide/syntax.html#diagrams)
376
376
 
377
+ ---
378
+ src: ./pages/multiple-entries.md
379
+ hide: false
380
+ ---
377
381
 
378
382
  ---
379
383
  layout: center
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "rewrites": [
3
3
  { "source": "/(.*)", "destination": "/index.html" }
4
- ]
4
+ ],
5
+ "buildCommand": "npm run build",
6
+ "outputDirectory": "dist"
5
7
  }