From 761d733a91e3fdb50ad2efcf56eb0e0ac60f75f7 Mon Sep 17 00:00:00 2001 From: Jason Dent Date: Tue, 24 May 2022 23:00:44 +0200 Subject: [PATCH] dev: Adjust Docker dictionary conf (#1118) * dev: Adjust Docker dictionary conf * Add a sample Dockerfile --- dictionaries/docker/CHANGELOG.md | 5 ++++ dictionaries/docker/README.md | 16 +++++++----- dictionaries/docker/cspell-ext.json | 26 ++++++------------- dictionaries/docker/cspell.json | 15 +++-------- dictionaries/docker/package.json | 11 +++++--- dictionaries/docker/source/Dockerfile | 8 ++++++ .../docker/{ => src}/docker-words.txt | 0 .../generators/app/templates/package.json | 2 +- 8 files changed, 43 insertions(+), 40 deletions(-) create mode 100644 dictionaries/docker/source/Dockerfile rename dictionaries/docker/{ => src}/docker-words.txt (100%) diff --git a/dictionaries/docker/CHANGELOG.md b/dictionaries/docker/CHANGELOG.md index e69de29bb2d..6762832021b 100644 --- a/dictionaries/docker/CHANGELOG.md +++ b/dictionaries/docker/CHANGELOG.md @@ -0,0 +1,5 @@ +# Change Log + +## 1.0.0 + +- Initial Release diff --git a/dictionaries/docker/README.md b/dictionaries/docker/README.md index fb31be9320f..39561a6cb9e 100644 --- a/dictionaries/docker/README.md +++ b/dictionaries/docker/README.md @@ -21,7 +21,13 @@ cspell link remove @cspell/dict-docker ## Manual Installation -The `cspell-ext.json` file in this package should be added to the import section in your cspell.json file. +Manual installation is useful if you want to include this dictionary as part of your CI/CD lint process. + +``` +npm i @cspell/dict-docker +``` + +The `cspell-ext.json` file in this package should be added to the import section in your `cspell.json` file. ```javascript { @@ -31,13 +37,9 @@ The `cspell-ext.json` file in this package should be added to the import section } ``` -## Building +# Dictionary Development -Building is only necessary if you want to modify the contents of the dictionary. Note: Building will take a few minutes for large files. - -```sh -npm run build -``` +See: [How to Create a New Dictionary](https://github.com/streetsidesoftware/cspell-dicts#how-to-create-a-new-dictionary) ## License diff --git a/dictionaries/docker/cspell-ext.json b/dictionaries/docker/cspell-ext.json index b729d46d730..02de402e368 100644 --- a/dictionaries/docker/cspell-ext.json +++ b/dictionaries/docker/cspell-ext.json @@ -1,10 +1,9 @@ -// cSpell Settings { "id": "docker", + "version": "0.2", "name": "Docker Dictionary", "description": "Docker dictionary for cspell.", "readonly": true, - // List of dictionary files to add to the global list of dictionaries "dictionaryDefinitions": [ { "name": "docker", @@ -12,32 +11,23 @@ "description": "Docker dictionary for cspell." } ], - // Dictionaries to always be used. - // Generally left empty "dictionaries": [], - // Language Rules to apply to matching files. - // Files are matched on `languageId` and `local` "languageSettings": [ { - // VSCode languageId. i.e. typescript, java, go, cpp, javascript, markdown, latex - // * will match against any file type. "languageId": "dockerfile", - // Language local. i.e. en-US, de-AT, or ru. * will match all locals. - // Multiple locals can be specified like: "en, en-US" to match both English and English US. "locale": "*", - // By default the whole text of a file is included for spell checking - // Adding patterns to the "includeRegExpList" to only include matching patterns "includeRegExpList": [], - // To exclude patterns, add them to "ignoreRegExpList" "ignoreRegExpList": [], - // regex patterns than can be used with ignoreRegExpList or includeRegExpList - // Example: "pattern": [{ "name": "mdash", "pattern": "—" }] - // This could be included in "ignoreRegExpList": ["mdash"] "patterns": [], - // List of dictionaries to enable by name in `dictionaryDefinitions` "dictionaries": ["docker"], - // Dictionary definitions can also be supplied here. They are only used iff "languageId" and "locale" match. "dictionaryDefinitions": [] } + ], + "globRoot": "${cwd}", + "overrides": [ + { + "filename": "**/Dockerfile", + "languageId": "dockerfile" + } ] } diff --git a/dictionaries/docker/cspell.json b/dictionaries/docker/cspell.json index 73306ee69e2..ddd26520f75 100644 --- a/dictionaries/docker/cspell.json +++ b/dictionaries/docker/cspell.json @@ -1,14 +1,7 @@ { "version": "0.2", - "files": [ - "**/*.{md,txt}" - ], - "dictionaries": [ - "docker" - ], - "import": [ - "./cspell-ext.json" - ], - "words": [ - ] + "files": ["**/*.{md,txt}", "**/Dockerfile"], + "ignorePaths": ["src"], + "dictionaries": [], + "import": ["./cspell-ext.json"] } diff --git a/dictionaries/docker/package.json b/dictionaries/docker/package.json index a91f495b523..88792b93913 100644 --- a/dictionaries/docker/package.json +++ b/dictionaries/docker/package.json @@ -11,8 +11,8 @@ "./cspell-ext.json": "./cspell-ext.json" }, "scripts": { - "build": "cspell-tools-cli compile \"docker-words.txt\" -o .", - "test": "head -n 100 \"docker-words.txt\" | cspell -v -c ./cspell-ext.json \"--local=*\" \"--languageId=dockerfile\" stdin", + "build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 cspell-tools-cli compile \"src/docker-words.txt\" -o .", + "test": "head -n 1000 \"src/docker-words.txt\" | cspell -v -c ./cspell-ext.json \"--local=*\" \"--languageId=dockerfile\" stdin", "prepublishOnly": "echo pre-publish", "prepare": "yarn run build" }, @@ -22,6 +22,7 @@ }, "keywords": [ "cspell", + "cspell-ext", "docker", "dictionary", "spelling" @@ -32,8 +33,12 @@ "url": "https://github.com/streetsidesoftware/cspell-dicts/issues" }, "homepage": "https://github.com/streetsidesoftware/cspell-dicts/blob/main/dictionaries/docker#readme", + "devDependencies": {}, + "dependencies": {}, "files": [ "docker-words.txt.gz", - "cspell-ext.json" + "cspell-ext.json", + "*.js", + "*.d.ts" ] } diff --git a/dictionaries/docker/source/Dockerfile b/dictionaries/docker/source/Dockerfile new file mode 100644 index 00000000000..59904e83acc --- /dev/null +++ b/dictionaries/docker/source/Dockerfile @@ -0,0 +1,8 @@ +# syntax=docker/dockerfile:1 +FROM node:12-alpine +RUN apk add --no-cache python2 g++ make +WORKDIR /app +COPY . . +RUN yarn install --production +CMD ["node", "src/index.js"] +EXPOSE 3000 diff --git a/dictionaries/docker/docker-words.txt b/dictionaries/docker/src/docker-words.txt similarity index 100% rename from dictionaries/docker/docker-words.txt rename to dictionaries/docker/src/docker-words.txt diff --git a/generator-cspell-dicts/generators/app/templates/package.json b/generator-cspell-dicts/generators/app/templates/package.json index b21a733c26e..a86ef9ff99d 100644 --- a/generator-cspell-dicts/generators/app/templates/package.json +++ b/generator-cspell-dicts/generators/app/templates/package.json @@ -34,7 +34,7 @@ "bugs": { "url": "https://github.com/streetsidesoftware/cspell-dicts/issues" }, - "homepage": "https://github.com/streetsidesoftware/cspell-dicts/blob/main/packages/<%= name %>#readme", + "homepage": "https://github.com/streetsidesoftware/cspell-dicts/blob/main/dictionaries/<%= name %>#readme", "devDependencies": {}, "dependencies": {}, "files": [