-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfill_files.js
More file actions
44 lines (41 loc) · 1.06 KB
/
Copy pathfill_files.js
File metadata and controls
44 lines (41 loc) · 1.06 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
const fs = require('fs')
const path = require('path')
const srcFolder = path.join(__dirname, 'src', 'blocks')
const str = (c,i) => `module.exports = (ctx) => {
// wow is this an empty file space>
// you should add some code here
// or even a PR (wowie)
}`
/**
ctx.rect(0,0,64,64);
ctx.fillStyle = "${c ? 'red' : 'blue'}";
ctx.fill();
// write text int
ctx.fillStyle = "white";
ctx.font = "20px Arial";
ctx.fillText("${i}", 10, 30);
*/
function doIt(i) {
return new Promise((res) => {
const theI = i;
if(!fs.existsSync(path.join(srcFolder, `${theI}.js`))) {
fs.writeFile(path.join(srcFolder, `${theI}.js`), str(theI%2 == 0,theI), (err,r) => {
res(r)
})
}
})
}
;(async () => {
let max = 100;
let i = 0;
function r() {
console.log(i,max)
if(i >= max) return;
doIt(i).then(() => {
i++;
console.log(i,max)
r()
})
}
setTimeout(() => r(),1000)
})()