-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
50 lines (43 loc) · 1.34 KB
/
build.js
File metadata and controls
50 lines (43 loc) · 1.34 KB
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
#!/usr/bin/env node
/**
* Build a "dist" folder for upload
*/
import { cpSync, mkdirSync, rmSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = dirname(fileURLToPath(import.meta.url))
// Remove and recreate js/lib directory
const distDir = join(__dirname, 'dist')
rmSync(distDir, { recursive: true, force: true })
mkdirSync(distDir, { recursive: true })
/**
* Copy a file from node_modules to js/lib directory
* @param {string} source - Source path relative to project root
*/
function distribute (source) {
const sourcePath = join(__dirname, source)
const destPath = join(distDir, source)
cpSync(sourcePath, destPath, { recursive: true })
console.log(`Copied ${source} -> ${distDir}/${source}`)
}
distribute('animated-dialog')
distribute('audio')
distribute('controllers')
distribute('css')
distribute('font')
distribute('gltf')
distribute('img')
distribute('lib')
distribute('nav-header')
distribute('page-fade')
distribute('project-display')
distribute('trek')
distribute('3d-showcase.html')
distribute('home-ala-homestar.html')
distribute('home-console.html')
distribute('home-lcars.html')
distribute('icon.png')
distribute('index.html')
distribute('project-list-view.html')
distribute('ssarette-portfolio.webmanifest')
console.log('All distribution files copied successfully!')