cspell-dict-latex
Advanced tools
Comparing version 1.0.15 to 1.0.19
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
## [1.0.19](https://github.com/streetsidesoftware/cspell-dicts/compare/cspell-dict-latex@1.0.18...cspell-dict-latex@1.0.19) (2020-11-08) | ||
### Bug Fixes | ||
* do not include Configstore if not necessary ([#270](https://github.com/streetsidesoftware/cspell-dicts/issues/270)) ([d8b625f](https://github.com/streetsidesoftware/cspell-dicts/commit/d8b625f2f42d5cc6c4a9390216ac1e5037886e44)) | ||
## [1.0.18](https://github.com/streetsidesoftware/cspell-dicts/compare/cspell-dict-latex@1.0.17...cspell-dict-latex@1.0.18) (2020-10-21) | ||
**Note:** Version bump only for package cspell-dict-latex | ||
# Change Log | ||
## 1.0.1 | ||
@@ -7,2 +31,2 @@ - make sure `text` macros are spell checked. | ||
## 1.0.0 | ||
- Initial Release | ||
- Initial Release |
'use strict'; | ||
var util = require('./util'); | ||
const configLocation = require.resolve('./cspell-ext.json'); | ||
function getConfigLocation() { | ||
return util.configLocation; | ||
return configLocation; | ||
} | ||
module.exports = { | ||
getConfigLocation, | ||
getConfigLocation, | ||
}; |
@@ -5,5 +5,4 @@ #!/usr/bin/env node | ||
var util = require('./util'); | ||
const util = require('./util'); | ||
util.install(); | ||
{ | ||
"name": "cspell-dict-latex", | ||
"version": "1.0.15", | ||
"version": "1.0.19", | ||
"description": "LaTeX cspell dictionary", | ||
@@ -9,2 +9,6 @@ "bin": { | ||
}, | ||
"exports": { | ||
".": "./index.js", | ||
"./cspell-ext.json": "./cspell-ext.json" | ||
}, | ||
"scripts": { | ||
@@ -15,2 +19,3 @@ "build": "cspell-tools compile \"latex.txt\" -o .", | ||
"cspell-unlink": "node unlink.js", | ||
"prepublishOnly": "npm t", | ||
"prepare": "cp ../../util/* . && npm run build" | ||
@@ -45,3 +50,3 @@ }, | ||
], | ||
"gitHead": "db792bac41932d29b8efff0c9d18da6111df9417" | ||
"gitHead": "e82d9495948fd89166c1d26b4d0d7355c8f5343d" | ||
} |
@@ -5,4 +5,4 @@ #!/usr/bin/env node | ||
var util = require('./util'); | ||
const util = require('./util'); | ||
util.uninstall(); |
62
util.js
'use strict'; | ||
// Cspell:word configstore | ||
var Configstore = require('configstore'); | ||
var Path = require('path'); | ||
const Configstore = require('configstore'); | ||
var packageName = 'cspell'; | ||
var importPath = 'import'; | ||
var configLocation = Path.join(__dirname, 'cspell-ext.json'); | ||
const packageName = 'cspell'; | ||
const importPath = 'import'; | ||
const configLocation = require.resolve('./cspell-ext.json'); | ||
/** | ||
* | ||
* @param {Configstore} conf | ||
* @returns {string[]} | ||
*/ | ||
function getImports(conf) { | ||
var imports = conf.get(importPath); | ||
const imports = conf.get(importPath) || []; | ||
imports = imports || []; | ||
if (typeof imports === 'string') { | ||
imports = [imports]; | ||
} | ||
if (typeof imports === 'string') { | ||
return [imports]; | ||
} | ||
return imports; | ||
return imports; | ||
} | ||
function install() { | ||
var conf = new Configstore(packageName); | ||
/** @type {string[]|string|undefined} */ | ||
var imports = getImports(conf); | ||
if (imports.indexOf(configLocation) < 0) { | ||
imports.push(configLocation); | ||
conf.set(importPath, imports); | ||
} | ||
const conf = new Configstore(packageName); | ||
const imports = getImports(conf); | ||
if (imports.indexOf(configLocation) < 0) { | ||
imports.push(configLocation); | ||
conf.set(importPath, imports); | ||
} | ||
} | ||
function uninstall() { | ||
var conf = new Configstore(packageName); | ||
/** @type {string[]|string|undefined} */ | ||
var imports = getImports(conf); | ||
var index = imports.indexOf(configLocation); | ||
if (index >= 0) { | ||
imports.splice(index, 1); | ||
conf.set(importPath, imports); | ||
} | ||
const conf = new Configstore(packageName); | ||
const imports = getImports(conf); | ||
const index = imports.indexOf(configLocation); | ||
if (index >= 0) { | ||
imports.splice(index, 1); | ||
conf.set(importPath, imports); | ||
} | ||
} | ||
module.exports = { | ||
install, | ||
uninstall, | ||
configLocation, | ||
install, | ||
uninstall, | ||
configLocation, | ||
}; |
10460
115