mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 15:21:33 +08:00

* Experimental spellchecker for testing purpose * Fix 'apache' license validation * Use local electron-spellchecker for development * Add settings and bug fixes * Fix Hunspell switchLanguage bug and improvements * Fix attach to editor when enabling spell check again * Add Hunspell license * Copy default Huspell dictionary on first start * Fix full language name * Some code improvements * Allow to add words to user dict and bug fixes * Allow to change Muya's spellcheck container attribute * feat: Don't underline misspelled words * Allow to set Hunspell on macOS * Fix spellchecker changed value * Refactor switchLanguage, init and enableSpellchecker * Refactor and some fixes * Code improvements * electron-spellchecker cleanup and optimization * Disable automatic language detection for Hunspell * Fix init on macOS and update JSDoc * Fix macOS issues and some improvements * Load single settings value only * Fix rebase * Remove debug code * Move electron-spellchecker to scoped npm repo * Fix dictionary of ignored words on macOS * Move replaceWordInline to core API * Remove comment block * Fix upstream lint error
38 lines
972 B
JavaScript
38 lines
972 B
JavaScript
'use strict'
|
|
|
|
const checker = require('license-checker')
|
|
|
|
const getLicenses = (rootDir, callback) => {
|
|
checker.init({
|
|
start: rootDir,
|
|
production: true,
|
|
development: false,
|
|
direct: true,
|
|
excludePackages: 'xmldom@0.1.27', // xmldom@0.1.27 is under MIT License, but license-checker show it's under LGPL License.
|
|
json: true,
|
|
onlyAllow: 'Unlicense;WTFPL;ISC;MIT;BSD;ISC;Apache-2.0;MIT*;Apache;Apache*;BSD*;CC0-1.0;CC-BY-4.0;CC-BY-3.0',
|
|
customPath: {
|
|
licenses: '',
|
|
licenseText: 'none'
|
|
}
|
|
}, function (err, packages) {
|
|
callback(err, packages, checker)
|
|
})
|
|
}
|
|
|
|
// Check that all production dependencies are allowed.
|
|
const validateLicenses = rootDir => {
|
|
getLicenses(rootDir, (err, packages, checker) => {
|
|
if (err) {
|
|
console.log(`[ERROR] ${err}`)
|
|
process.exit(1)
|
|
}
|
|
console.log(checker.asSummary(packages))
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
getLicenses: getLicenses,
|
|
validateLicenses: validateLicenses
|
|
}
|