Add Makefile, package.json, and initial configuration for VitePress and Slidev integration
- Introduced a Makefile for streamlined commands related to building, running, and managing presentations. - Created package.json to define project metadata, dependencies, and scripts for development and testing. - Added .gitignore entries to exclude build artifacts and temporary files from version control. - Included playwright.config.mjs for end-to-end testing setup with Playwright. - Added README.md for project documentation, outlining setup instructions and development guidelines.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Intégration : sync-portal sur un dépôt minimal (TALKS_ROOT) sans toucher au vrai portail.
|
||||
*/
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert'
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { spawnSync } from 'node:child_process'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const repoRoot = path.resolve(__dirname, '..')
|
||||
|
||||
test('sync sur dépôt temporaire (TALKS_ROOT)', () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'talks-tmp-'))
|
||||
|
||||
fs.mkdirSync(path.join(tmp, 'portal'), { recursive: true })
|
||||
fs.writeFileSync(
|
||||
path.join(tmp, 'portal', 'index.md'),
|
||||
['---', 'layout: doc', '---', '', '<!-- FEATURED_START -->', '<!-- FEATURED_END -->', ''].join('\n'),
|
||||
)
|
||||
|
||||
const hello = path.join(tmp, 'slides', 'hello-world')
|
||||
fs.mkdirSync(hello, { recursive: true })
|
||||
fs.writeFileSync(
|
||||
path.join(hello, 'meta.json'),
|
||||
JSON.stringify({
|
||||
title: 'Hello World',
|
||||
description: 'Test tmp',
|
||||
order: 1,
|
||||
featured: true,
|
||||
}),
|
||||
)
|
||||
fs.writeFileSync(path.join(hello, 'slides.md'), '---\n---\n\n# Slide\n')
|
||||
|
||||
const r = spawnSync(process.execPath, [path.join(repoRoot, 'tools', 'sync-portal.mjs')], {
|
||||
cwd: repoRoot,
|
||||
env: { ...process.env, TALKS_ROOT: tmp },
|
||||
encoding: 'utf8',
|
||||
})
|
||||
assert.strictEqual(r.status, 0, r.stderr || r.stdout)
|
||||
|
||||
const detail = path.join(tmp, 'portal', 'presentations', 'hello-world', 'index.md')
|
||||
assert.ok(fs.existsSync(detail), 'fiche générée')
|
||||
const body = fs.readFileSync(detail, 'utf8')
|
||||
assert.ok(body.includes('Hello World'))
|
||||
assert.ok(body.includes('<QrEncode path="/slides/hello-world/1"'))
|
||||
|
||||
const list = path.join(tmp, 'portal', 'presentations', 'index.md')
|
||||
assert.ok(fs.readFileSync(list, 'utf8').includes('Hello World'))
|
||||
|
||||
const featured = fs.readFileSync(path.join(tmp, 'portal', 'index.md'), 'utf8')
|
||||
assert.ok(featured.includes('talk-card'))
|
||||
})
|
||||
Reference in New Issue
Block a user