-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-prism.js
More file actions
118 lines (110 loc) · 3.17 KB
/
build-prism.js
File metadata and controls
118 lines (110 loc) · 3.17 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
* Build script: copies Prism theme CSS files from node_modules into includes/assets/.
*
* Run via: npm run build:prism
*/
const fs = require( 'fs' );
const path = require( 'path' );
const root = __dirname;
const themes = [
{
src: 'node_modules/prism-themes/themes/prism-a11y-dark.css',
dest: 'includes/assets/prism-a11y-dark.css',
},
{
src: 'node_modules/prism-themes/themes/prism-coldark-cold.css',
dest: 'includes/assets/prism-coldark-cold.css',
},
{
src: 'node_modules/prism-themes/themes/prism-coldark-dark.css',
dest: 'includes/assets/prism-coldark-dark.css',
},
{
src: 'node_modules/prism-themes/themes/prism-dracula.css',
dest: 'includes/assets/prism-dracula.css',
},
{
src: 'node_modules/prism-themes/themes/prism-ghcolors.css',
dest: 'includes/assets/prism-ghcolors.css',
},
{
src: 'node_modules/prism-themes/themes/prism-gruvbox-dark.css',
dest: 'includes/assets/prism-gruvbox-dark.css',
},
{
src: 'node_modules/prism-themes/themes/prism-gruvbox-light.css',
dest: 'includes/assets/prism-gruvbox-light.css',
},
{
src: 'node_modules/prism-themes/themes/prism-material-dark.css',
dest: 'includes/assets/prism-material-dark.css',
},
{
src: 'node_modules/prism-themes/themes/prism-lucario.css',
dest: 'includes/assets/prism-lucario.css',
},
{
src: 'node_modules/prism-themes/themes/prism-night-owl.css',
dest: 'includes/assets/prism-night-owl.css',
},
{
src: 'node_modules/prism-themes/themes/prism-nord.css',
dest: 'includes/assets/prism-nord.css',
},
{
src: 'node_modules/prism-themes/themes/prism-one-dark.css',
dest: 'includes/assets/prism-onedark.css',
},
{
src: 'node_modules/prism-themes/themes/prism-one-light.css',
dest: 'includes/assets/prism-one-light.css',
},
{
src: 'node_modules/prism-themes/themes/prism-shades-of-purple.css',
dest: 'includes/assets/prism-shades-of-purple.css',
},
{
src: 'node_modules/prism-themes/themes/prism-solarized-dark-atom.css',
dest: 'includes/assets/prism-solarized-dark-atom.css',
},
{
src: 'node_modules/prism-themes/themes/prism-synthwave84.css',
dest: 'includes/assets/prism-synthwave84.css',
},
{
src: 'node_modules/prism-themes/themes/prism-duotone-dark.css',
dest: 'includes/assets/prism-duotone-dark.css',
},
{
src: 'node_modules/prism-themes/themes/prism-duotone-light.css',
dest: 'includes/assets/prism-duotone-light.css',
},
{
src: 'node_modules/prism-themes/themes/prism-material-light.css',
dest: 'includes/assets/prism-material-light.css',
},
{
src: 'node_modules/prism-themes/themes/prism-xonokai.css',
dest: 'includes/assets/prism-xonokai.css',
},
{
src: 'node_modules/prism-themes/themes/prism-vsc-dark-plus.css',
dest: 'includes/assets/prism-vsc-dark-plus.css',
},
];
let success = true;
themes.forEach( ( { src, dest } ) => {
const srcPath = path.resolve( root, src );
const destPath = path.resolve( root, dest );
if ( ! fs.existsSync( srcPath ) ) {
console.error( `✖ Source not found: ${ src }` );
success = false;
return;
}
fs.mkdirSync( path.dirname( destPath ), { recursive: true } );
fs.copyFileSync( srcPath, destPath );
console.log( `✔ ${ src } → ${ dest }` );
} );
if ( ! success ) {
process.exit( 1 );
}