GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — website/scripts/prepare-examples.mjs at main · feathersdev/website

Expand file tree

/

prepare-examples.mjs

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
68 lines (56 loc) · 1.92 KB
/

prepare-examples.mjs

Copy path

File metadata and controls

68 lines (56 loc) · 1.92 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// scripts/prepare-examples.mjs
import fs from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { globby } from 'globby'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const PROJECT_ROOT = path.resolve(__dirname, '..')
const EXAMPLES_SRC = path.join(PROJECT_ROOT, 'examples')
const EXAMPLES_DEST = path.join(PROJECT_ROOT, 'app/code/examples')
// File extensions we want to include
const ALLOWED_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.jsx', '.vue', '.svelte', '.md'])
// Function to find all example files
async function findExampleFiles() {
const files = await globby([
'**/*.{ts,tsx,js,jsx,vue,svelte,md}',
'!node_modules/**',
'!**/code/**',
'!.nuxt/**',
'!dist/**'
], {
cwd: EXAMPLES_SRC,
onlyFiles: true
})
return files
}
async function copyExampleFiles(files) {
await fs.mkdir(EXAMPLES_DEST, { recursive: true })
for (const relPath of files) {
const srcPath = path.join(EXAMPLES_SRC, relPath)
const destPath = path.join(EXAMPLES_DEST, relPath)
try {
// Create destination directory if it doesn't exist
await fs.mkdir(path.dirname(destPath), { recursive: true })
// Copy file
await fs.copyFile(srcPath, destPath)
console.log(`✅ Copied: ${relPath}`)
} catch (error) {
console.error(`❌ Error copying ${relPath}:`, error.message)
}
}
}
async function main() {
try {
// Clean destination
await fs.rm(EXAMPLES_DEST, { recursive: true, force: true })
// Find and copy all example files
const exampleFiles = await findExampleFiles()
console.log(`Found ${exampleFiles.length} example files to copy`)
await copyExampleFiles(exampleFiles)
console.log(`✅ Successfully copied example files to ${path.relative(PROJECT_ROOT, EXAMPLES_DEST)}/`)
} catch (error) {
console.error('❌ Error:', error)
process.exit(1)
}
}
main()
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.