Skip to content

Commit

Permalink
chore: get build working under pnpm. (#2321)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Jul 12, 2023
1 parent 0ec61ee commit 1388158
Show file tree
Hide file tree
Showing 54 changed files with 666 additions and 255 deletions.
21 changes: 8 additions & 13 deletions dictionaries/ar/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,34 @@

## [1.0.3](https://github.com/streetsidesoftware/cspell-dicts/compare/@cspell/dict-ar@1.0.2...@cspell/dict-ar@1.0.3) (2022-12-17)


### Miscellaneous

* clarify where files should be stored. ([#1698](https://github.com/streetsidesoftware/cspell-dicts/issues/1698)) ([6567bc6](https://github.com/streetsidesoftware/cspell-dicts/commit/6567bc62130404cb32945bdcc3bf07316c839396))
- clarify where files should be stored. ([#1698](https://github.com/streetsidesoftware/cspell-dicts/issues/1698)) ([6567bc6](https://github.com/streetsidesoftware/cspell-dicts/commit/6567bc62130404cb32945bdcc3bf07316c839396))

## [1.0.2](https://github.com/streetsidesoftware/cspell-dicts/compare/@cspell/dict-ar@1.0.1...@cspell/dict-ar@1.0.2) (2022-08-19)


### Miscellaneous

* do not store `.trie.gz` files. ([#1361](https://github.com/streetsidesoftware/cspell-dicts/issues/1361)) ([2de0b0d](https://github.com/streetsidesoftware/cspell-dicts/commit/2de0b0df4b8addfd69e2e6899c05f8b502799b7c))
* force overwrite in prepare ([#1364](https://github.com/streetsidesoftware/cspell-dicts/issues/1364)) ([5eec47e](https://github.com/streetsidesoftware/cspell-dicts/commit/5eec47e223f1dd6370fcbc3c1b6b0361c92bbddf))
- do not store `.trie.gz` files. ([#1361](https://github.com/streetsidesoftware/cspell-dicts/issues/1361)) ([2de0b0d](https://github.com/streetsidesoftware/cspell-dicts/commit/2de0b0df4b8addfd69e2e6899c05f8b502799b7c))
- force overwrite in prepare ([#1364](https://github.com/streetsidesoftware/cspell-dicts/issues/1364)) ([5eec47e](https://github.com/streetsidesoftware/cspell-dicts/commit/5eec47e223f1dd6370fcbc3c1b6b0361c92bbddf))

## [1.0.1](https://github.com/streetsidesoftware/cspell-dicts/compare/@cspell/dict-ar@1.0.0...@cspell/dict-ar@1.0.1) (2022-07-29)


### Updates and Bug Fixes

* [#1314](https://github.com/streetsidesoftware/cspell-dicts/issues/1314) ([8237697](https://github.com/streetsidesoftware/cspell-dicts/commit/8237697eb8c782fe46303c306882e1cee148959b))
* Arabic - Ignore certain accents ([#1317](https://github.com/streetsidesoftware/cspell-dicts/issues/1317)) ([8237697](https://github.com/streetsidesoftware/cspell-dicts/commit/8237697eb8c782fe46303c306882e1cee148959b)), closes [#1314](https://github.com/streetsidesoftware/cspell-dicts/issues/1314)
* Improve the Arabic dictionary ([#1315](https://github.com/streetsidesoftware/cspell-dicts/issues/1315)) ([2c5e32a](https://github.com/streetsidesoftware/cspell-dicts/commit/2c5e32a01d877507f856d3aebef4cdba08ff83dc))
- [#1314](https://github.com/streetsidesoftware/cspell-dicts/issues/1314) ([8237697](https://github.com/streetsidesoftware/cspell-dicts/commit/8237697eb8c782fe46303c306882e1cee148959b))
- Arabic - Ignore certain accents ([#1317](https://github.com/streetsidesoftware/cspell-dicts/issues/1317)) ([8237697](https://github.com/streetsidesoftware/cspell-dicts/commit/8237697eb8c782fe46303c306882e1cee148959b)), closes [#1314](https://github.com/streetsidesoftware/cspell-dicts/issues/1314)
- Improve the Arabic dictionary ([#1315](https://github.com/streetsidesoftware/cspell-dicts/issues/1315)) ([2c5e32a](https://github.com/streetsidesoftware/cspell-dicts/commit/2c5e32a01d877507f856d3aebef4cdba08ff83dc))

## 1.0.0 (2022-07-25)


### Updates and Bug Fixes

* Add Arabic Dictionary ([#1293](https://github.com/streetsidesoftware/cspell-dicts/issues/1293)) ([aa18193](https://github.com/streetsidesoftware/cspell-dicts/commit/aa181931e3f511dcf19c532d05ef48293a25302b))

- Add Arabic Dictionary ([#1293](https://github.com/streetsidesoftware/cspell-dicts/issues/1293)) ([aa18193](https://github.com/streetsidesoftware/cspell-dicts/commit/aa181931e3f511dcf19c532d05ef48293a25302b))

### Miscellaneous

* prepare to publish Arabic ([#1297](https://github.com/streetsidesoftware/cspell-dicts/issues/1297)) ([212e0ab](https://github.com/streetsidesoftware/cspell-dicts/commit/212e0aba5f3d92987763eea6c4ed30931754f263))
- prepare to publish Arabic ([#1297](https://github.com/streetsidesoftware/cspell-dicts/issues/1297)) ([212e0ab](https://github.com/streetsidesoftware/cspell-dicts/commit/212e0aba5f3d92987763eea6c4ed30931754f263))

## 1.0.0

Expand Down
6 changes: 3 additions & 3 deletions dictionaries/ar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
},
"scripts": {
"build": "cat source-files.txt | xargs cross-env NODE_OPTIONS=--max_old_space_size=12288 cspell-tools-cli compile --trie3 -x compound -o . -M ar -m 5 --no-compress && pnpm run gen-checksum",
"checksum": "shasum -c checksum.txt",
"checksum": "cspell-tools-cli shasum -c checksum.txt",
"conditional-build": "pnpm run --silent checksum || pnpm run build",
"lint": "pnpm prettier -w \"**/*.{md,json}\"",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs shasum > checksum.txt",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs cspell-tools-cli shasum > checksum.txt",
"test-ar": "hunspell-reader words -m 0 -n 1000 \"src/ar.dic\" | cspell -v -c ./cspell-ext.json \"--local=ar\" \"--languageId=*\" stdin",
"test-samples": "cspell -v -c ./cspell-ext.json --local=ar,en \"samples/**\"",
"test": "pnpm run test-ar && pnpm run test-samples",
"sync": "./scripts/sync.sh && pnpm lint",
"sync": "bash ./scripts/sync.sh && pnpm lint",
"prepare": "gzip -f -k *.trie",
"prepublishOnly": "pnpm run conditional-build && pnpm test"
},
Expand Down
6 changes: 3 additions & 3 deletions dictionaries/da_DK/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
},
"scripts": {
"build": "cross-env NODE_OPTIONS=--max_old_space_size=12288 cspell-tools-cli build && pnpm run gen-checksum",
"sync": "pnpm cpy \"../../node_modules/dictionary-da/**\" src/hunspell",
"checksum": "shasum -c checksum.txt",
"sync": "pnpm cpy \"node_modules/dictionary-da/**\" src/hunspell",
"checksum": "cspell-tools-cli shasum -c checksum.txt",
"conditional-build": "pnpm run --silent checksum || pnpm run build",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs shasum > checksum.txt",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs cspell-tools-cli shasum > checksum.txt",
"test-de": "hunspell-reader words -n 1000 \"src/hunspell/index.dic\" | cspell -v -c ./cspell-ext.json --local=da-DK --languageId=* stdin",
"test-samples": "cspell -c ./cspell-ext.json --local=da-dk,en \"samples/**\"",
"test": "pnpm run test-de && pnpm run test-samples",
Expand Down
6 changes: 3 additions & 3 deletions dictionaries/de_AT/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
},
"scripts": {
"build": "cross-env NODE_OPTIONS=--max_old_space_size=12288 cspell-tools-cli build && pnpm run gen-checksum",
"sync": "pnpm cpy \"../../node_modules/dictionary-de-at/**\" src/hunspell",
"checksum": "shasum -c checksum.txt",
"sync": "pnpm cpy \"node_modules/dictionary-de-at/**\" src/hunspell",
"checksum": "cspell-tools-cli shasum -c checksum.txt",
"conditional-build": "pnpm run --silent checksum || pnpm run build",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs shasum > checksum.txt",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs cspell-tools-cli shasum > checksum.txt",
"test-de": "hunspell-reader words -n 1000 \"src/hunspell/index.dic\" | cspell -v -c ./cspell-ext.json --local=de-AT --languageId=* stdin",
"test-samples": "cspell -v -c ./cspell-ext.json --local=de-at,en \"samples/**\"",
"test": "pnpm run test-de && pnpm run test-samples",
Expand Down
6 changes: 3 additions & 3 deletions dictionaries/de_CH/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
},
"scripts": {
"build": "cross-env NODE_OPTIONS=--max_old_space_size=12288 cspell-tools-cli build && pnpm run gen-checksum",
"sync": "pnpm cpy \"../../node_modules/dictionary-de-ch/**\" src/hunspell",
"checksum": "shasum -c checksum.txt",
"sync": "pnpm cpy \"node_modules/dictionary-de-ch/**\" src/hunspell",
"checksum": "cspell-tools-cli shasum -c checksum.txt",
"conditional-build": "pnpm run --silent checksum || pnpm run build",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs shasum > checksum.txt",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs cspell-tools-cli shasum > checksum.txt",
"test-de": "hunspell-reader words -n 1000 \"src/hunspell/index.dic\" | cspell -v -c ./cspell-ext.json --local=de --languageId=* stdin",
"test-samples": "cspell -v -c ./cspell-ext.json --local=de,en \"samples/**\"",
"test": "pnpm run test-de && pnpm run test-samples",
Expand Down
6 changes: 3 additions & 3 deletions dictionaries/de_DE/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
},
"scripts": {
"build": "cross-env NODE_OPTIONS=--max_old_space_size=12288 cspell-tools-cli build && pnpm run gen-checksum",
"sync": "pnpm cpy \"../../node_modules/dictionary-de/**\" src/hunspell",
"checksum": "shasum -c checksum.txt",
"sync": "pnpm cpy \"node_modules/dictionary-de/**\" src/hunspell",
"checksum": "cspell-tools-cli shasum -c checksum.txt",
"conditional-build": "pnpm run --silent checksum || pnpm run build",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs shasum > checksum.txt",
"gen-checksum": "cat source-files.txt source-dependencies.txt | xargs cspell-tools-cli shasum > checksum.txt",
"test-de": "hunspell-reader words -n 1000 \"src/hunspell/index.dic\" | cspell -v -c ./cspell-ext.json --local=de --languageId=* stdin",
"test-de-old": "hunspell-reader words -n 1000 \"src/German_de_DE.dic\" | cspell -v -c ./cspell-ext.json --local=de --languageId=* stdin",
"test-samples": "cspell -v -c ./cspell-ext.json --local=de,en \"samples/**\"",
Expand Down
28 changes: 28 additions & 0 deletions dictionaries/de_DE/src/hunspell/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
declare namespace load {
/**
* Object representing a hunspell dictionary, with `aff` and `dic` fields.
*/
interface Dictionary {
/**
* Buffer in UTF-8 for the affix file (defines the language, keyboard, flags, and more).
*/
aff: Buffer

/**
* Buffer in UTF-8 for the dictionary file (contains words and flags applying to those words).
*/
dic: Buffer
}

/**
* Callback called when dictionary is loaded.
*/
type Callback = (
error: NodeJS.ErrnoException | undefined,
result: Dictionary
) => void
}

declare const load: (callback: load.Callback) => void

export = load
20 changes: 10 additions & 10 deletions dictionaries/de_DE/src/hunspell/index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
var read = require('fs').readFile
var join = require('path').join
const fs = require('fs')
const path = require('path')

module.exports = load

function load(callback) {
var pos = -1
var exception = null
var result = {}
let result = {}
let pos = -1
let exception

one('aff')
one('dic')

function one(name) {
read(join(__dirname, 'index.' + name), function (err, doc) {
fs.readFile(path.join(__dirname, 'index.' + name), (error, doc) => {
pos++
exception = exception || err
exception = exception || error
result[name] = doc

if (pos) {
callback(exception, exception ? null : result)
exception = null
result = null
callback(exception, exception ? undefined : result)
exception = undefined
result = undefined
}
})
}
Expand Down
7 changes: 4 additions & 3 deletions dictionaries/de_DE/src/hunspell/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dictionary-de",
"version": "2.0.4",
"description": "German spelling dictionary in UTF-8",
"version": "2.1.0",
"description": "German spelling dictionary",
"license": "(GPL-2.0 OR GPL-3.0)",
"keywords": [
"spelling",
Expand All @@ -25,6 +25,7 @@
"files": [
"index.js",
"index.aff",
"index.dic"
"index.dic",
"index.d.ts"
]
}
55 changes: 35 additions & 20 deletions dictionaries/de_DE/src/hunspell/readme.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
# dictionary-de

German spelling dictionary in UTF-8.
German spelling dictionary.

Useful with [hunspell][], [`nodehun`][nodehun], [`nspell`][nspell],
Open Office, LibreOffice, Firefox and Thunderbird, or [macOS][].
## What is this?

Generated by [`dictionaries`][dictionaries] from
[`j3e.de`][source].
This is a German dictionary,
generated by [`wooorm/dictionaries`][dictionaries] from
[`j3e.de`][source],
normalized and packaged so that it can be installed and used like other
dictionaries.

## When should I use this?

You can use this package when integrating with tools that perform spell checking
(such as [`nodehun`][nodehun], [`nspell`][nspell]) or when making such tools.

## Install

[npm][]:
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:

```sh
npm install dictionary-de
Expand All @@ -19,10 +26,12 @@ npm install dictionary-de
## Use

```js
var de = require('dictionary-de')
import dictionaryDe from 'dictionary-de'

de(function (err, result) {
console.log(err || result)
dictionaryDe(function (error, de) {
if (error) throw error
console.log(de)
// To do: use `de` somehow
})
```

Expand All @@ -32,19 +41,23 @@ Yields:
{dic: <Buffer>, aff: <Buffer>}
```

Where `dic` is a [`Buffer`][buffer] for the dictionary file at `index.dic` (in
UTF-8) and `aff` is a [`Buffer`][buffer] for the affix file at `index.aff` (in
UTF-8).
Where `dic` and `aff` are [`Buffer`][buffer]s for `index.dic` and `index.aff`
respectively.

Or directly load the files, using something like:
## Examples

```js
var path = require('path')
var base = require.resolve('dictionary-de')
See the [monorepo readme][dictionaries] for examples.

fs.readFileSync(path.join(base, 'index.dic'), 'utf-8')
fs.readFileSync(path.join(base, 'index.aff'), 'utf-8')
```
## Types

This package is typed with [TypeScript][].

## Contribute

See the [monorepo readme][dictionaries] for how to contribute.

> 👉 **Note**: dictionaries are not maintained here.
> Report spelling problems upstream ([`j3e.de`][source]).
## License

Expand All @@ -57,7 +70,7 @@ Rest: [MIT][] © [Titus Wormer][home].

[nspell]: https://github.com/wooorm/nspell

[macos]: https://github.com/wooorm/dictionaries#macos
[macos]: https://github.com/wooorm/dictionaries#example-use-with-macos

[source]: https://www.j3e.de/ispell/igerman98/index_en.html

Expand All @@ -70,3 +83,5 @@ Rest: [MIT][] © [Titus Wormer][home].
[buffer]: https://nodejs.org/api/buffer.html#buffer_buffer

[home]: https://wooorm.com

[typescript]: https://www.typescriptlang.org
4 changes: 2 additions & 2 deletions dictionaries/en_AU/checksum.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
87a3ecd9c3aad91d14f924020f1935b96ef7d827 ./en_AU.trie
8377a01ab4c2c14830d500113fc827563f593ab9 ./node_modules/@cspell/dict-en-shared/src/shared-additional-words.txt
354217d27720ae7d76db72a626a0e68d20fe9747 ./source-dependencies.txt
8b330ba6b7b6530bb8db47f92bfc8af74ad8dc35 ./source-files.txt
6faca7cc75a0372205cb95afcd21cef47b38ac4d ./source-files.txt
b18dfb4f67e28a7e5ef1850dd1aceef880ac3331 ./src/additional_words.txt
e22be4b305584c419dbfdad2f69bfa1bb181d239 ./src/aoo-mozilla-en-dict/en_AU.aff
21191f1108e608d1b96076d141586fccd6c79a1c ./src/aoo-mozilla-en-dict/en_AU.dic
e22be4b305584c419dbfdad2f69bfa1bb181d239 ./src/hunspell-en_AU-large/en_AU-large.aff
d81a3ca0b48c0653a48de7b76a68c8a2d40f2de5 ./src/hunspell-en_AU-large/en_AU-large.dic
8377a01ab4c2c14830d500113fc827563f593ab9 ./src/shared-additional-words.txt
8 changes: 4 additions & 4 deletions dictionaries/en_AU/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"scripts": {
"build": "pnpm run compile",
"sync": "pnpm cpy \"../../node_modules/aoo-mozilla-en-dict/en_AU*/**\" \"src/aoo-mozilla-en-dict\" --flat && pnpm sync-clean",
"sync": "pnpm cpy \"node_modules/aoo-mozilla-en-dict/en_AU*/**\" \"src/aoo-mozilla-en-dict\" --flat && pnpm sync-clean",
"sync-clean": "shx rm -rf \"src/*/wordlist*.txt\" \"src/*/*speller*.txt\"",
"checksum": "shasum -c checksum.txt",
"checksum": "cspell-tools-cli shasum -c checksum.txt",
"compile": "cspell-tools-cli build && pnpm run gen-checksum",
"conditional-build": "pnpm run sync && pnpm run --silent checksum || pnpm run build",
"gen-checksum": "cat source-files.txt source-dependencies.txt | sort -u | xargs shasum > checksum.txt",
"gen-checksum": "cat source-files.txt source-dependencies.txt | sort -u | xargs cspell-tools-cli shasum > checksum.txt",
"prepare": "gzip -f -k *.trie",
"prepublishOnly": "echo pre-publish",
"test-text": "cspell -v -c ./cspell-ext.json --local=en-au --languageId=* \"tests/*.txt\"",
Expand Down Expand Up @@ -50,7 +50,7 @@
"test": "tests"
},
"devDependencies": {
"@cspell/dict-en-shared": "*",
"@cspell/dict-en-shared": "workspace:*",
"aoo-mozilla-en-dict": "https://github.com/marcoagpinto/aoo-mozilla-en-dict"
}
}
2 changes: 1 addition & 1 deletion dictionaries/en_AU/source-files.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./src/additional_words.txt
./src/aoo-mozilla-en-dict/en_AU.dic
./src/hunspell-en_AU-large/en_AU-large.dic
./src/shared-additional-words.txt
./node_modules/@cspell/dict-en-shared/src/shared-additional-words.txt
4 changes: 2 additions & 2 deletions dictionaries/en_CA/checksum.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
0a195047e8a4cfdb59f810ea1ed647c152e454c9 ./en_CA.trie
8377a01ab4c2c14830d500113fc827563f593ab9 ./node_modules/@cspell/dict-en-shared/src/shared-additional-words.txt
bcbd0578ba621fc42f85dbc5ebbe19dd0ca06558 ./source-dependencies.txt
a8673b6f0fe7b06c54cd679f013f17f1a06bc31f ./source-files.txt
40f65c083372129fbbafabc8a9d232e039da0ab4 ./source-files.txt
b18dfb4f67e28a7e5ef1850dd1aceef880ac3331 ./src/additional_words.txt
e22be4b305584c419dbfdad2f69bfa1bb181d239 ./src/aoo-mozilla-en-dict/en_CA.aff
8bcb82e787d390561c0ac4416a811a7323b1ef97 ./src/aoo-mozilla-en-dict/en_CA.dic
e22be4b305584c419dbfdad2f69bfa1bb181d239 ./src/hunspell-en_CA-large/en_CA-large.aff
c36c7cb4f498bc5c23443434a7bc31a4db802894 ./src/hunspell-en_CA-large/en_CA-large.dic
8377a01ab4c2c14830d500113fc827563f593ab9 ./src/shared-additional-words.txt
8 changes: 4 additions & 4 deletions dictionaries/en_CA/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"scripts": {
"build": "pnpm run compile",
"sync": "pnpm cpy \"../../node_modules/aoo-mozilla-en-dict/en_CA*/**\" \"src/aoo-mozilla-en-dict\" --flat && pnpm sync-clean",
"sync": "pnpm cpy \"node_modules/aoo-mozilla-en-dict/en_CA*/**\" \"src/aoo-mozilla-en-dict\" --flat && pnpm sync-clean",
"sync-clean": "shx rm -rf \"src/*/wordlist*.txt\" \"src/*/*speller*.txt\"",
"checksum": "shasum -c checksum.txt",
"checksum": "cspell-tools-cli shasum -c checksum.txt",
"compile": "cspell-tools-cli build && pnpm run gen-checksum",
"conditional-build": "pnpm run sync && pnpm run --silent checksum || pnpm run build",
"gen-checksum": "cat source-files.txt source-dependencies.txt | sort -u | xargs shasum > checksum.txt",
"gen-checksum": "cat source-files.txt source-dependencies.txt | sort -u | xargs cspell-tools-cli shasum > checksum.txt",
"prepare": "gzip -f -k *.trie",
"prepublishOnly": "echo pre-publish",
"test-text": "cspell -v -c ./cspell-ext.json --local=en-ca --languageId=* \"tests/*.txt\"",
Expand Down Expand Up @@ -50,7 +50,7 @@
"test": "tests"
},
"devDependencies": {
"@cspell/dict-en-shared": "*",
"@cspell/dict-en-shared": "workspace:*",
"aoo-mozilla-en-dict": "https://github.com/marcoagpinto/aoo-mozilla-en-dict"
}
}
2 changes: 1 addition & 1 deletion dictionaries/en_CA/source-files.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./src/additional_words.txt
./src/aoo-mozilla-en-dict/en_CA.dic
./src/hunspell-en_CA-large/en_CA-large.dic
./src/shared-additional-words.txt
./node_modules/@cspell/dict-en-shared/src/shared-additional-words.txt
Loading

0 comments on commit 1388158

Please sign in to comment.