1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Tools: Fixed build

This commit is contained in:
Laurent Cozic
2021-09-04 15:15:25 +01:00
parent 736bbbd8ed
commit f5891dfae8
9 changed files with 18 additions and 10 deletions

View File

@ -1,7 +1,6 @@
const utils = require('../utils');
const glob = require('glob');
const rootDir = utils.rootDir();
const pathUtils = require('@joplin/lib/path-utils');
async function processDirectory(dir) {
const tsFiles = glob.sync('{**/*.ts,**/*.tsx}', {
@ -11,7 +10,7 @@ async function processDirectory(dir) {
const fileContent = [];
for (const tsFile of tsFiles) {
const f = pathUtils.filename(tsFile);
const f = utils.getFilename(tsFile);
fileContent.push(`import * as ${f} from './${f}';`);
}
@ -20,7 +19,7 @@ async function processDirectory(dir) {
fileContent.push('const index:any[] = [');
for (const tsFile of tsFiles) {
const f = pathUtils.filename(tsFile);
const f = utils.getFilename(tsFile);
fileContent.push(`\t${f},`);
}

View File

@ -182,4 +182,13 @@ utils.insertContentIntoFile = async (filePath, marker, contentToInsert, createIf
}
};
utils.getFilename = (path) => {
const lastPart = path.split('/').pop();
if (lastPart.indexOf('.') < 0) return lastPart;
const splitted = lastPart.split('.');
splitted.pop();
return splitted.join('.');
};
module.exports = utils;