You've already forked joplin
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:
@ -1,7 +1,6 @@
|
|||||||
const utils = require('../utils');
|
const utils = require('../utils');
|
||||||
const glob = require('glob');
|
const glob = require('glob');
|
||||||
const rootDir = utils.rootDir();
|
const rootDir = utils.rootDir();
|
||||||
const pathUtils = require('@joplin/lib/path-utils');
|
|
||||||
|
|
||||||
async function processDirectory(dir) {
|
async function processDirectory(dir) {
|
||||||
const tsFiles = glob.sync('{**/*.ts,**/*.tsx}', {
|
const tsFiles = glob.sync('{**/*.ts,**/*.tsx}', {
|
||||||
@ -11,7 +10,7 @@ async function processDirectory(dir) {
|
|||||||
const fileContent = [];
|
const fileContent = [];
|
||||||
|
|
||||||
for (const tsFile of tsFiles) {
|
for (const tsFile of tsFiles) {
|
||||||
const f = pathUtils.filename(tsFile);
|
const f = utils.getFilename(tsFile);
|
||||||
fileContent.push(`import * as ${f} from './${f}';`);
|
fileContent.push(`import * as ${f} from './${f}';`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ async function processDirectory(dir) {
|
|||||||
fileContent.push('const index:any[] = [');
|
fileContent.push('const index:any[] = [');
|
||||||
|
|
||||||
for (const tsFile of tsFiles) {
|
for (const tsFile of tsFiles) {
|
||||||
const f = pathUtils.filename(tsFile);
|
const f = utils.getFilename(tsFile);
|
||||||
fileContent.push(`\t${f},`);
|
fileContent.push(`\t${f},`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
module.exports = utils;
|
||||||
|
Reference in New Issue
Block a user