forked from ioBroker/ioBroker.javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateBlockly.js
More file actions
67 lines (57 loc) · 1.71 KB
/
updateBlockly.js
File metadata and controls
67 lines (57 loc) · 1.71 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
// this script updates blockly
const cp = require('node:child_process');
const fs = require('node:fs');
function copyFile(fileName, newName) {
if (fileName.endsWith('/')) {
fileName = fileName.substring(0, fileName.length - 1);
}
const srcName = `${__dirname}/blockly/${fileName}`;
const dstName = `${__dirname}/public/google-blockly/${newName || fileName}`;
const stat = fs.lstatSync(srcName);
if (stat.isDirectory()) {
const files = fs.readdirSync(srcName);
files.forEach(file => copyFile(`${fileName}/${file}`));
} else {
fs.writeFileSync(dstName, fs.readFileSync(srcName));
}
}
/*function deleteFolder(path) {
let files = [];
if (fs.existsSync(path)) {
files = fs.readdirSync(path);
files.forEach(file => {
const curPath = `${path}/${file}`;
if (fs.lstatSync(curPath).isDirectory()) {
// recurse
deleteFolder(curPath);
} else {
// delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
}
*/
try {
cp.execSync('git clone https://github.com/google/blockly.git');
} catch {
console.log('Blockly yet cloned');
}
copyFile('blockly_compressed.js');
copyFile('blocks_compressed.js');
copyFile('javascript_compressed.js');
copyFile('LICENSE');
copyFile('media');
copyFile('msg/messages.js');
copyFile('msg/js/de.js');
copyFile('msg/js/en.js');
copyFile('msg/js/es.js');
copyFile('msg/js/fr.js');
copyFile('msg/js/it.js');
copyFile('msg/js/nl.js');
copyFile('msg/js/pl.js');
copyFile('msg/js/pt.js');
copyFile('msg/js/ru.js');
copyFile('msg/js/zh-hans.js', 'zh-cn.js');
//deleteFolder(__dirname + '/blockly');