create-supaslidev 0.1.4 → 0.2.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/dist/cli.js CHANGED
@@ -158,11 +158,7 @@ async function renderTemplatesRecursively(sourceDir, targetDir, data) {
158
158
  }
159
159
  }
160
160
  function createDirectoryStructure(targetDir) {
161
- for (const dir of [
162
- "presentations",
163
- "packages",
164
- "scripts"
165
- ]) {
161
+ for (const dir of ["presentations", "packages"]) {
166
162
  const fullPath = join(targetDir, dir);
167
163
  mkdirSync(fullPath, { recursive: true });
168
164
  trackPath(fullPath);
@@ -221,90 +217,7 @@ Add your content here
221
217
  [Slidev Documentation](https://sli.dev/)
222
218
  `;
223
219
  writeFileSync(join(presentationDir, "slides.md"), slidesContent, "utf-8");
224
- writeFileSync(join(presentationDir, ".gitignore"), "node_modules\ndist\n.slidev\n", "utf-8");
225
- writeFileSync(join(presentationDir, ".npmrc"), "shamefully-hoist=true\n", "utf-8");
226
- }
227
- function createScripts(targetDir) {
228
- writeFileSync(join(join(targetDir, "scripts"), "dev-presentation.mjs"), `#!/usr/bin/env node
229
-
230
- import { existsSync, readdirSync, statSync } from 'node:fs';
231
- import { join, dirname } from 'node:path';
232
- import { fileURLToPath } from 'node:url';
233
- import { spawn } from 'node:child_process';
234
-
235
- const __dirname = dirname(fileURLToPath(import.meta.url));
236
- const rootDir = join(__dirname, '..');
237
- const presentationsDir = join(rootDir, 'presentations');
238
-
239
- function getPresentations() {
240
- if (!existsSync(presentationsDir)) {
241
- return [];
242
- }
243
-
244
- return readdirSync(presentationsDir)
245
- .filter((name) => {
246
- const fullPath = join(presentationsDir, name);
247
- return statSync(fullPath).isDirectory() && existsSync(join(fullPath, 'slides.md'));
248
- })
249
- .sort();
250
- }
251
-
252
- function printUsage(presentations) {
253
- console.error('Usage: pnpm dev <presentation-name>');
254
- console.error('\\nAvailable presentations:');
255
-
256
- if (presentations.length === 0) {
257
- console.error(' No presentations found');
258
- } else {
259
- presentations.forEach((name) => {
260
- console.error(\` \${name}\`);
261
- });
262
- }
263
- }
264
-
265
- function runDev(name) {
266
- const packageName = \`@supaslidev/\${name}\`;
267
-
268
- console.log(\`\\nStarting dev server for \${name}...\\n\`);
269
-
270
- const pnpm = spawn('pnpm', ['--filter', packageName, 'dev'], {
271
- cwd: rootDir,
272
- stdio: 'inherit',
273
- shell: true,
274
- });
275
-
276
- pnpm.on('error', (err) => {
277
- console.error(\`Failed to start dev server: \${err.message}\`);
278
- process.exit(1);
279
- });
280
-
281
- pnpm.on('close', (code) => {
282
- process.exit(code ?? 0);
283
- });
284
- }
285
-
286
- function main() {
287
- const args = process.argv.slice(2);
288
- const name = args[0];
289
- const presentations = getPresentations();
290
-
291
- if (!name) {
292
- console.error('Error: Presentation name is required');
293
- printUsage(presentations);
294
- process.exit(1);
295
- }
296
-
297
- if (!presentations.includes(name)) {
298
- console.error(\`Error: Presentation "\${name}" not found\`);
299
- printUsage(presentations);
300
- process.exit(1);
301
- }
302
-
303
- runDev(name);
304
- }
305
-
306
- main();
307
- `, "utf-8");
220
+ writeFileSync(join(presentationDir, ".gitignore"), "node_modules\n.DS_Store\ndist\n*.local\n.vite-inspect\n.remote-assets\ncomponents.d.ts\n", "utf-8");
308
221
  }
309
222
  function createSharedPackage(targetDir) {
310
223
  const sharedDir = join(targetDir, "packages", "shared");
@@ -326,49 +239,99 @@ function createSharedPackage(targetDir) {
326
239
  keywords: ["slidev-addon", "slidev"],
327
240
  dependencies: { vue: "catalog:" }
328
241
  }, null, 2) + "\n", "utf-8");
329
- writeFileSync(join(sharedDir, "components", "SharedBadge.vue"), `<template>
330
- <span class="shared-badge">
331
- <slot />
332
- </span>
242
+ writeFileSync(join(sharedDir, "components", "SharedBadge.vue"), `<script setup lang="ts">
243
+ defineProps<{
244
+ text?: string;
245
+ }>();
246
+ <\/script>
247
+
248
+ <template>
249
+ <span class="shared-badge">{{ text ?? 'Shared' }}</span>
333
250
  </template>
334
251
 
335
252
  <style scoped>
336
253
  .shared-badge {
337
254
  display: inline-block;
338
- padding: 0.25rem 0.5rem;
339
- border-radius: 0.25rem;
340
- background-color: var(--slidev-theme-primary, #3b82f6);
341
- color: white;
342
- font-size: 0.875rem;
343
- font-weight: 500;
255
+ padding: 0.25rem 0.75rem;
256
+ font-size: 0.75rem;
257
+ font-weight: 600;
258
+ line-height: 1;
259
+ text-transform: uppercase;
260
+ letter-spacing: 0.05em;
261
+ color: #fff;
262
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
263
+ border-radius: 9999px;
344
264
  }
345
265
  </style>
346
266
  `, "utf-8");
347
267
  writeFileSync(join(sharedDir, "README.md"), `# @supaslidev/shared
348
268
 
349
- Shared components, layouts, and styles for your Slidev presentations.
269
+ A local Slidev addon for sharing components, layouts, and styles across all presentations in your workspace.
350
270
 
351
- ## Usage
271
+ ## How It Works
352
272
 
353
- This package is configured as a Slidev addon. Components in the \`components\` directory are automatically available in all presentations that include this addon.
273
+ This package follows the [Slidev addon pattern](https://sli.dev/guide/write-addon). Slidev automatically discovers and imports resources from the following directories:
354
274
 
355
- ## Structure
275
+ - **components/** - Vue components available in all slides
276
+ - **layouts/** - Custom slide layouts
277
+ - **styles/** - Shared CSS/SCSS styles
356
278
 
357
- - \`components/\` - Shared Vue components
358
- - \`layouts/\` - Custom slide layouts
359
- - \`styles/\` - Global styles
279
+ ## Using This Addon
280
+
281
+ Add the addon to your presentation's frontmatter:
282
+
283
+ \`\`\`yaml
284
+ ---
285
+ addons:
286
+ - '@supaslidev/shared'
287
+ ---
288
+ \`\`\`
289
+
290
+ ## Example: Using SharedBadge
291
+
292
+ The \`SharedBadge\` component is available globally once the addon is configured:
293
+
294
+ \`\`\`md
295
+ ---
296
+ addons:
297
+ - '@supaslidev/shared'
298
+ ---
299
+
300
+ # My Slide
301
+
302
+ <SharedBadge text="New" />
303
+ \`\`\`
304
+
305
+ ## Directory Structure
306
+
307
+ \`\`\`
308
+ shared/
309
+ ├── components/ # Vue components (auto-imported)
310
+ │ └── SharedBadge.vue
311
+ ├── layouts/ # Custom layouts
312
+ ├── styles/ # Shared styles
313
+ ├── package.json
314
+ └── README.md
315
+ \`\`\`
316
+
317
+ ## Adding New Components
318
+
319
+ Create a \`.vue\` file in \`components/\`:
320
+
321
+ \`\`\`vue
322
+ <script setup lang="ts">
323
+ defineProps<{
324
+ label: string;
325
+ }>();
326
+ <\/script>
327
+
328
+ <template>
329
+ <div class="my-component">{{ label }}</div>
330
+ </template>
331
+ \`\`\`
332
+
333
+ The component is immediately available in all presentations using this addon.
360
334
  `, "utf-8");
361
- writeFileSync(join(sharedDir, "tsconfig.json"), JSON.stringify({
362
- compilerOptions: {
363
- target: "ESNext",
364
- module: "ESNext",
365
- moduleResolution: "bundler",
366
- strict: true,
367
- jsx: "preserve",
368
- skipLibCheck: true
369
- },
370
- include: ["**/*.ts", "**/*.vue"]
371
- }, null, 2) + "\n", "utf-8");
372
335
  }
373
336
  async function create(options = {}) {
374
337
  const spinner = createSafeSpinner();
@@ -471,8 +434,6 @@ async function create(options = {}) {
471
434
  await createPresentation(targetDir, presentationName);
472
435
  spinner.message("Creating shared package...");
473
436
  createSharedPackage(targetDir);
474
- spinner.message("Creating scripts...");
475
- createScripts(targetDir);
476
437
  spinner.stop("Workspace structure created");
477
438
  if (initGit) {
478
439
  spinner.start("Initializing git repository...");
package/dist/index.js CHANGED
@@ -158,11 +158,7 @@ async function renderTemplatesRecursively(sourceDir, targetDir, data) {
158
158
  }
159
159
  }
160
160
  function createDirectoryStructure(targetDir) {
161
- for (const dir of [
162
- "presentations",
163
- "packages",
164
- "scripts"
165
- ]) {
161
+ for (const dir of ["presentations", "packages"]) {
166
162
  const fullPath = join(targetDir, dir);
167
163
  mkdirSync(fullPath, { recursive: true });
168
164
  trackPath(fullPath);
@@ -221,90 +217,7 @@ Add your content here
221
217
  [Slidev Documentation](https://sli.dev/)
222
218
  `;
223
219
  writeFileSync(join(presentationDir, "slides.md"), slidesContent, "utf-8");
224
- writeFileSync(join(presentationDir, ".gitignore"), "node_modules\ndist\n.slidev\n", "utf-8");
225
- writeFileSync(join(presentationDir, ".npmrc"), "shamefully-hoist=true\n", "utf-8");
226
- }
227
- function createScripts(targetDir) {
228
- writeFileSync(join(join(targetDir, "scripts"), "dev-presentation.mjs"), `#!/usr/bin/env node
229
-
230
- import { existsSync, readdirSync, statSync } from 'node:fs';
231
- import { join, dirname } from 'node:path';
232
- import { fileURLToPath } from 'node:url';
233
- import { spawn } from 'node:child_process';
234
-
235
- const __dirname = dirname(fileURLToPath(import.meta.url));
236
- const rootDir = join(__dirname, '..');
237
- const presentationsDir = join(rootDir, 'presentations');
238
-
239
- function getPresentations() {
240
- if (!existsSync(presentationsDir)) {
241
- return [];
242
- }
243
-
244
- return readdirSync(presentationsDir)
245
- .filter((name) => {
246
- const fullPath = join(presentationsDir, name);
247
- return statSync(fullPath).isDirectory() && existsSync(join(fullPath, 'slides.md'));
248
- })
249
- .sort();
250
- }
251
-
252
- function printUsage(presentations) {
253
- console.error('Usage: pnpm dev <presentation-name>');
254
- console.error('\\nAvailable presentations:');
255
-
256
- if (presentations.length === 0) {
257
- console.error(' No presentations found');
258
- } else {
259
- presentations.forEach((name) => {
260
- console.error(\` \${name}\`);
261
- });
262
- }
263
- }
264
-
265
- function runDev(name) {
266
- const packageName = \`@supaslidev/\${name}\`;
267
-
268
- console.log(\`\\nStarting dev server for \${name}...\\n\`);
269
-
270
- const pnpm = spawn('pnpm', ['--filter', packageName, 'dev'], {
271
- cwd: rootDir,
272
- stdio: 'inherit',
273
- shell: true,
274
- });
275
-
276
- pnpm.on('error', (err) => {
277
- console.error(\`Failed to start dev server: \${err.message}\`);
278
- process.exit(1);
279
- });
280
-
281
- pnpm.on('close', (code) => {
282
- process.exit(code ?? 0);
283
- });
284
- }
285
-
286
- function main() {
287
- const args = process.argv.slice(2);
288
- const name = args[0];
289
- const presentations = getPresentations();
290
-
291
- if (!name) {
292
- console.error('Error: Presentation name is required');
293
- printUsage(presentations);
294
- process.exit(1);
295
- }
296
-
297
- if (!presentations.includes(name)) {
298
- console.error(\`Error: Presentation "\${name}" not found\`);
299
- printUsage(presentations);
300
- process.exit(1);
301
- }
302
-
303
- runDev(name);
304
- }
305
-
306
- main();
307
- `, "utf-8");
220
+ writeFileSync(join(presentationDir, ".gitignore"), "node_modules\n.DS_Store\ndist\n*.local\n.vite-inspect\n.remote-assets\ncomponents.d.ts\n", "utf-8");
308
221
  }
309
222
  function createSharedPackage(targetDir) {
310
223
  const sharedDir = join(targetDir, "packages", "shared");
@@ -326,49 +239,99 @@ function createSharedPackage(targetDir) {
326
239
  keywords: ["slidev-addon", "slidev"],
327
240
  dependencies: { vue: "catalog:" }
328
241
  }, null, 2) + "\n", "utf-8");
329
- writeFileSync(join(sharedDir, "components", "SharedBadge.vue"), `<template>
330
- <span class="shared-badge">
331
- <slot />
332
- </span>
242
+ writeFileSync(join(sharedDir, "components", "SharedBadge.vue"), `<script setup lang="ts">
243
+ defineProps<{
244
+ text?: string;
245
+ }>();
246
+ <\/script>
247
+
248
+ <template>
249
+ <span class="shared-badge">{{ text ?? 'Shared' }}</span>
333
250
  </template>
334
251
 
335
252
  <style scoped>
336
253
  .shared-badge {
337
254
  display: inline-block;
338
- padding: 0.25rem 0.5rem;
339
- border-radius: 0.25rem;
340
- background-color: var(--slidev-theme-primary, #3b82f6);
341
- color: white;
342
- font-size: 0.875rem;
343
- font-weight: 500;
255
+ padding: 0.25rem 0.75rem;
256
+ font-size: 0.75rem;
257
+ font-weight: 600;
258
+ line-height: 1;
259
+ text-transform: uppercase;
260
+ letter-spacing: 0.05em;
261
+ color: #fff;
262
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
263
+ border-radius: 9999px;
344
264
  }
345
265
  </style>
346
266
  `, "utf-8");
347
267
  writeFileSync(join(sharedDir, "README.md"), `# @supaslidev/shared
348
268
 
349
- Shared components, layouts, and styles for your Slidev presentations.
269
+ A local Slidev addon for sharing components, layouts, and styles across all presentations in your workspace.
350
270
 
351
- ## Usage
271
+ ## How It Works
352
272
 
353
- This package is configured as a Slidev addon. Components in the \`components\` directory are automatically available in all presentations that include this addon.
273
+ This package follows the [Slidev addon pattern](https://sli.dev/guide/write-addon). Slidev automatically discovers and imports resources from the following directories:
354
274
 
355
- ## Structure
275
+ - **components/** - Vue components available in all slides
276
+ - **layouts/** - Custom slide layouts
277
+ - **styles/** - Shared CSS/SCSS styles
356
278
 
357
- - \`components/\` - Shared Vue components
358
- - \`layouts/\` - Custom slide layouts
359
- - \`styles/\` - Global styles
279
+ ## Using This Addon
280
+
281
+ Add the addon to your presentation's frontmatter:
282
+
283
+ \`\`\`yaml
284
+ ---
285
+ addons:
286
+ - '@supaslidev/shared'
287
+ ---
288
+ \`\`\`
289
+
290
+ ## Example: Using SharedBadge
291
+
292
+ The \`SharedBadge\` component is available globally once the addon is configured:
293
+
294
+ \`\`\`md
295
+ ---
296
+ addons:
297
+ - '@supaslidev/shared'
298
+ ---
299
+
300
+ # My Slide
301
+
302
+ <SharedBadge text="New" />
303
+ \`\`\`
304
+
305
+ ## Directory Structure
306
+
307
+ \`\`\`
308
+ shared/
309
+ ├── components/ # Vue components (auto-imported)
310
+ │ └── SharedBadge.vue
311
+ ├── layouts/ # Custom layouts
312
+ ├── styles/ # Shared styles
313
+ ├── package.json
314
+ └── README.md
315
+ \`\`\`
316
+
317
+ ## Adding New Components
318
+
319
+ Create a \`.vue\` file in \`components/\`:
320
+
321
+ \`\`\`vue
322
+ <script setup lang="ts">
323
+ defineProps<{
324
+ label: string;
325
+ }>();
326
+ <\/script>
327
+
328
+ <template>
329
+ <div class="my-component">{{ label }}</div>
330
+ </template>
331
+ \`\`\`
332
+
333
+ The component is immediately available in all presentations using this addon.
360
334
  `, "utf-8");
361
- writeFileSync(join(sharedDir, "tsconfig.json"), JSON.stringify({
362
- compilerOptions: {
363
- target: "ESNext",
364
- module: "ESNext",
365
- moduleResolution: "bundler",
366
- strict: true,
367
- jsx: "preserve",
368
- skipLibCheck: true
369
- },
370
- include: ["**/*.ts", "**/*.vue"]
371
- }, null, 2) + "\n", "utf-8");
372
335
  }
373
336
  async function create(options = {}) {
374
337
  const spinner = createSafeSpinner();
@@ -471,8 +434,6 @@ async function create(options = {}) {
471
434
  await createPresentation(targetDir, presentationName);
472
435
  spinner.message("Creating shared package...");
473
436
  createSharedPackage(targetDir);
474
- spinner.message("Creating scripts...");
475
- createScripts(targetDir);
476
437
  spinner.stop("Workspace structure created");
477
438
  if (initGit) {
478
439
  spinner.start("Initializing git repository...");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-supaslidev",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "CLI tool for scaffolding Supaslidev presentations",
5
5
  "keywords": [
6
6
  "slidev",
@@ -50,7 +50,7 @@
50
50
  "tsdown": "^0.12.5",
51
51
  "tsx": "^4.19.0",
52
52
  "typescript": "^5.3.3",
53
- "vitest": "^3.0.0"
53
+ "vitest": "^4.0.0"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsdown",
@@ -4,4 +4,3 @@ deploy
4
4
  .DS_Store
5
5
  *.log
6
6
  .slidev
7
- .turbo
@@ -0,0 +1,3 @@
1
+ import { defineSupaslidevConfig } from 'supaslidev';
2
+
3
+ export default defineNuxtConfig(defineSupaslidevConfig({}));
@@ -9,9 +9,11 @@
9
9
  "new": "supaslidev new",
10
10
  "present": "supaslidev present",
11
11
  "export": "supaslidev export",
12
- "deploy": "supaslidev deploy"
12
+ "deploy": "supaslidev deploy",
13
+ "build": "pnpm --filter @supaslidev/* run build"
13
14
  },
14
15
  "devDependencies": {
16
+ "nuxt": "catalog:core",
15
17
  "playwright-chromium": "catalog:",
16
18
  "supaslidev": "<%= supaslidevVersion %>"
17
19
  },
@@ -8,7 +8,27 @@ catalog:
8
8
  '@slidev/theme-seriph': latest
9
9
  '@slidev/theme-apple-basic': latest
10
10
  vue: ^3.5.26
11
- '@vue/compiler-sfc': ^3.5.27
12
- typescript: ^5.3.3
13
- vue-tsc: ^2.0.0
14
11
  playwright-chromium: ^1.58.2
12
+
13
+ catalogs:
14
+ core:
15
+ nuxt: ^4.4.2
16
+ '@vue/compiler-sfc': ^3.5.27
17
+ typescript: ^5.3.3
18
+ vue-tsc: ^2.0.0
19
+
20
+ catalogMode: prefer
21
+
22
+ linkWorkspacePackages: true
23
+
24
+ shellEmulator: true
25
+
26
+ trustPolicy: no-downgrade
27
+
28
+ trustPolicyExclude:
29
+ - axios
30
+ - chokidar
31
+ - semver
32
+ - undici
33
+ - undici-types
34
+ - vite
@@ -1 +0,0 @@
1
- shamefully-hoist=true
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "moduleResolution": "bundler",
6
- "strict": true,
7
- "jsx": "preserve",
8
- "resolveJsonModule": true,
9
- "isolatedModules": true,
10
- "esModuleInterop": true,
11
- "lib": ["ESNext", "DOM"],
12
- "skipLibCheck": true,
13
- "noEmit": true
14
- },
15
- "include": ["packages/**/*.ts", "packages/**/*.vue"],
16
- "exclude": ["node_modules", "**/dist"]
17
- }
@@ -1,24 +0,0 @@
1
- {
2
- "$schema": "https://turbo.build/schema.json",
3
- "tasks": {
4
- "typecheck": {
5
- "dependsOn": ["^typecheck"],
6
- "inputs": ["**/*.ts", "**/*.tsx", "**/*.vue", "tsconfig.json"],
7
- "outputs": []
8
- },
9
- "lint": {
10
- "dependsOn": ["^lint"],
11
- "inputs": ["**/*.ts", "**/*.tsx", "**/*.vue", "**/*.js", "**/*.mjs"],
12
- "outputs": []
13
- },
14
- "build": {
15
- "dependsOn": ["^build"],
16
- "inputs": ["src/**", "**/*.ts", "**/*.vue", "package.json"],
17
- "outputs": ["dist/**"]
18
- },
19
- "dev": {
20
- "cache": false,
21
- "persistent": true
22
- }
23
- }
24
- }