Fix line lengths

Including by using the node_modules/.bin/closure2ts wrapper provided by
typescript-closure-tools instead of running the source .js directly.
This commit is contained in:
Christopher Allen
2021-07-10 12:54:49 +01:00
committed by Christopher Allen
parent 6136d93cdf
commit 6ccff4431d

View File

@@ -82,7 +82,7 @@ function typings() {
if (file.indexOf('core/msg.js') > -1) {
return;
}
const cmd = `node ./node_modules/typescript-closure-tools/definition-generator/src/main.js ${file} ${typescriptFileName}`;
const cmd = `closure2ts ${file} ${typescriptFileName}`;
console.log(`Generating typings for ${file}`);
execSync(cmd, { stdio: 'inherit' });
});
@@ -106,7 +106,8 @@ function typings() {
// Generates the TypeScript definition files (d.ts) for Blockly locales.
function msgTypings(cb) {
const template = fs.readFileSync(path.join('typings/templates/msg.template'), 'utf-8');
const template =
fs.readFileSync(path.join('typings/templates/msg.template'), 'utf-8');
const msgFiles = fs.readdirSync(path.join('msg', 'json'));
const msgDir = path.join(TYPINGS_BUILD_DIR, 'msg');
if (!fs.existsSync(msgDir)) {
@@ -115,8 +116,9 @@ function msgTypings(cb) {
msgFiles.forEach(msg => {
const localeName = msg.substring(0, msg.indexOf('.json'));
const msgTypings = template.slice().replace(/<%= locale %>/gi, localeName);
fs.writeFileSync(path.join(TYPINGS_BUILD_DIR, 'msg', localeName + '.d.ts'), msgTypings, 'utf-8');
})
fs.writeFileSync(path.join(TYPINGS_BUILD_DIR, 'msg', localeName + '.d.ts'),
msgTypings, 'utf-8');
});
cb();
}