-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathindex.js
44 lines (40 loc) · 1.1 KB
/
index.js
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
const {join} = require('path');
const {readdir} = require('fs').promises;
const files = new Map;
const getFiles = folder => {
const path = join(__dirname, folder);
if (files.has(path))
return files.get('path');
const promise = readdir(path);
files.set('path', promise);
return promise;
};
const test = folder => getFiles(folder).then(files => {
for (const file of files) {
if (/\.js$/.test(file)) {
const module = join(__dirname, folder, file);
require(module);
delete require.cache[module];
}
}
});
console.log(`\x1b[7m\x1b[1m ${'LinkeDOM'.padEnd(74)}\x1b[0m`);
test('xml')
.then(() => test('svg'))
.then(() => test('html'))
.then(() => test('interface'))
.then(() => test('shared'))
.then(() => {
setTimeout(() => {
console.log(`\x1b[7m\x1b[1m ${'LinkeDOM - Cached'.padEnd(74)}\x1b[0m`);
global[Symbol.for('linkedom')] = require('../cjs/cached.js');
test('xml')
.then(() => test('svg'))
.then(() => test('html'))
.then(() => test('interface'))
.then(() => test('shared'))
.then(() => {
require('./issue-256.js');
});
}, 500);
});