forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy-assets.js
More file actions
46 lines (41 loc) · 1.08 KB
/
copy-assets.js
File metadata and controls
46 lines (41 loc) · 1.08 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
/* eslint-disable no-console */
const fs = require('fs-extra');
const path = require('path');
const { staticAssets } = require('../config/build');
const { SANDBOX_ONLY } = process.env;
const assets = [
...staticAssets,
{
from: 'packages/app/www',
to: '',
},
!SANDBOX_ONLY && {
from: 'packages/homepage/public',
to: '',
},
!SANDBOX_ONLY && {
from: 'standalone-packages/monaco-editor/release/min/vs',
to: 'public/14/vs',
},
{
from: 'standalone-packages/codesandbox-browserfs/dist',
to: 'static/browserfs2',
},
!SANDBOX_ONLY && {
from: 'standalone-packages/vscode-editor/release/min/vs',
to: 'public/vscode25/vs',
},
{
from: 'packages/app/public',
to: '',
},
].filter(Boolean);
const rootPath = path.resolve(__dirname, '../../..');
const buildPath = path.resolve(rootPath, 'www');
console.log('Copying assets...');
assets.forEach(({ from, to }) => {
const srcPath = path.resolve(rootPath, from);
const dstPath = path.resolve(buildPath, to);
console.log(`${srcPath} => ${dstPath}`);
fs.copySync(srcPath, dstPath);
});