forked from REditorSupport/vscode-R
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenableWebpack.ts
More file actions
29 lines (23 loc) · 859 Bytes
/
Copy pathenableWebpack.ts
File metadata and controls
29 lines (23 loc) · 859 Bytes
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
import * as fs from 'fs';
// adjust .vscodeignore
const fileVscodeignore = './.vscodeignore';
let vscodeignore = fs.readFileSync(fileVscodeignore, 'utf-8');
vscodeignore = vscodeignore.replace(/^#(.*)#\s*withWebpack\s*$/gm, '$1');
vscodeignore = vscodeignore.replace(/^\s*#\s*withoutWebpack(?:.|\r|\n)*?^\s*#\s*\/withoutWebpack/gm, '');
fs.writeFileSync(fileVscodeignore, vscodeignore);
// adjust package.json
const filePkgJson = './package.json';
interface PkgJson {
withWebpack?: {
[k: string]: any;
}
[k: string]: any;
}
const pkgJson = JSON.parse(fs.readFileSync(filePkgJson, 'utf-8')) as PkgJson;
if('withWebpack' in pkgJson){
for(const k in pkgJson.withWebpack){
pkgJson[k] = pkgJson.withWebpack[k];
}
pkgJson.withWebpack = undefined;
}
fs.writeFileSync(filePkgJson, JSON.stringify(pkgJson, undefined, 2));