mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-18 09:35:20 +02:00
47f95cb294
Co-authored-by: Helmut K. C. Tessarek <tessarek@evermeet.cx> Co-authored-by: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com>
37 lines
812 B
TypeScript
37 lines
812 B
TypeScript
import yargs = require('yargs');
|
|
import { chdir } from 'process';
|
|
import { rootDir } from './tool-utils';
|
|
import { execCommand } from '@joplin/utils';
|
|
|
|
const main = async () => {
|
|
const argv = await yargs.argv;
|
|
const filePaths = argv._ as string[];
|
|
const processAll = !!argv.all;
|
|
if (!filePaths || !filePaths.length) return;
|
|
|
|
chdir(rootDir);
|
|
|
|
let cmd = ['yarn', 'spellcheck-base'];
|
|
|
|
if (processAll) {
|
|
cmd.push('**/*.{ts,tsx}');
|
|
} else {
|
|
cmd = cmd.concat(filePaths);
|
|
}
|
|
|
|
try {
|
|
await execCommand(cmd, { showStderr: false, showStdout: false });
|
|
} catch (error) {
|
|
if (!error.stdout.trim()) return;
|
|
|
|
console.error(`Some spelling mistakes were found:\n${error.stdout}`);
|
|
process.exit(1);
|
|
}
|
|
};
|
|
|
|
main().catch((error) => {
|
|
console.error('Fatal error');
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|