mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 04:02:08 +08:00

* Removed the space in 'Mark Text' (#2763) Literally just replaced all occurances of 'Mark Text' with 'MarkText' using sed. This is directly related to #2763. * Revert changes to .github directory Reverted changelog etc. * Added `cs` alias for `csharp` in code blocks (Fixes #2760) * Added error handler in the renderer process (should fix #2758) The `src/muya/lib/contentState/clickCtrl.js` file will now return if `document.querySelector` fails to find an element.
77 lines
1.9 KiB
JavaScript
77 lines
1.9 KiB
JavaScript
'use strict'
|
|
|
|
const path = require('path')
|
|
const fs = require('fs')
|
|
const thirdPartyChecker = require('../.electron-vue/thirdPartyChecker.js')
|
|
const rootDir = path.resolve(__dirname, '..')
|
|
|
|
const additionalPackages = {
|
|
hunspell: {
|
|
packageName: 'Hunspell',
|
|
licenses: 'LGPL 2.1',
|
|
licenseText: fs.readFileSync(path.join(rootDir, 'resources/hunspell_dictionaries/LICENSE-hunspell.txt'))
|
|
}
|
|
}
|
|
|
|
thirdPartyChecker.getLicenses(rootDir, (err, packages, checker) => {
|
|
if (err) {
|
|
console.log(`[ERROR] ${err}`)
|
|
return
|
|
}
|
|
|
|
Object.assign(packages, additionalPackages)
|
|
|
|
let summary = ''
|
|
let licenseList = ''
|
|
let index = 1
|
|
const addedKeys = {}
|
|
Object.keys(packages).forEach(key => {
|
|
if (/^babel-helper-vue-jsx-merge-props/.test(key) ||
|
|
/^marktext/.test(key)) {
|
|
// babel-helper-vue-jsx-merge-props: MIT licensed used by element-ui
|
|
return
|
|
}
|
|
|
|
let packageName = key
|
|
const nameRegex = /(^.+)(?:@)/.exec(key)
|
|
if (nameRegex && nameRegex[1]) {
|
|
packageName = nameRegex[1]
|
|
}
|
|
|
|
// Check if we already added this package
|
|
if (addedKeys.hasOwnProperty(packageName)) {
|
|
return
|
|
}
|
|
addedKeys[packageName] = 1
|
|
|
|
const { licenses, licenseText } = packages[key]
|
|
summary += `${index++}. ${packageName} (${licenses})\n`
|
|
licenseList += `# ${packageName} (${licenses})
|
|
-------------------------------------------------\
|
|
|
|
${licenseText}
|
|
\n\n
|
|
`
|
|
})
|
|
|
|
|
|
const output = `# Third Party Notices
|
|
-------------------------------------------------
|
|
|
|
This file contains all third-party packages that are bundled and shipped with MarkText.
|
|
|
|
-------------------------------------------------
|
|
# Summary
|
|
-------------------------------------------------
|
|
|
|
${summary}
|
|
|
|
-------------------------------------------------
|
|
# Licenses
|
|
-------------------------------------------------
|
|
|
|
${licenseList}
|
|
`
|
|
fs.writeFileSync(path.resolve(rootDir, 'resources', 'THIRD-PARTY-LICENSES.txt'), output)
|
|
})
|