cspell-action icon indicating copy to clipboard operation
cspell-action copied to clipboard

Document How To Install Additional Dictionaries

Open Kurt-von-Laven opened this issue 3 years ago • 6 comments

This action is especially convenient for spell checking projects where installing a first Node.js package solely for the purpose of spell checking is difficult to justify. It would be ideal if it supported all of the official cspell dictionaries. I think the workaround for us is to install the medical dictionary in our workflow, and configure caching of yarn dependencies.

Kurt-von-Laven avatar May 29 '21 09:05 Kurt-von-Laven

Trying to support all dictionaries would make this action huge. Maybe a way of downloading them on the fly might work.

Jason3S avatar Jun 02 '21 12:06 Jason3S

Yeah, I have come to agree with you since filing this issue as I have realized that pulling actions down is itself one of the most expensive operations we do. I think even just showing an example of a yarn add @cspell/[email protected] or npm install @cspell/[email protected] as the preceding step in the README would actually be all that is needed?

Kurt-von-Laven avatar Jun 02 '21 19:06 Kurt-von-Laven

@Kurt-von-Laven can you please provide such an example? Cos I want to use https://www.npmjs.com/package/cspell-dict-uk-ua and I can't fully understand how to do it using this GitHub action.

csd-oss avatar Oct 18 '21 22:10 csd-oss

@csd-oss,

It is better to use @cspell/dict-uk-ua - npm

Two steps are needed.

  1. Make sure the dictionary is installed: In your workflow add the following step before

    - name: Install dictionaries 
       run: npm install @cspell/dict-uk-ua
    
  2. Have a cspell.json file in your repo:

    {
      "import": ["@cspell/dict-uk-ua/cspell-ext.json"],
      "language": "en,uk"
    }
    

Jason3S avatar Oct 19 '21 11:10 Jason3S

@Jason3S Thanks! But I cspell.json file is like this in order for this to work:

{
    "import": ["@cspell/dict-uk-ua/cspell-ext.json"],
    "language":"en,uk"
}

csd-oss avatar Oct 19 '21 14:10 csd-oss

Hi @Jason3S , I'm facing an issue with making additional dictionaries to work with GH action and in search of documentation I came across this issue. Can you please point out what I may be doing wrong here? Thanks in advance!

My workflow looks like this:

    - name: Install Node
      uses: actions/setup-node@v3
      with:
        node-version: 18
    
    - run: npm install -g @cspell/dict-es-es
    
    - name: Validate spelling
      uses: streetsidesoftware/[email protected]
      with:
        config: 'cspell.json'
        files: '**/*.md'
        inline: 'error'
        strict: true        
        incremental_files_only: true

cspell.json looks like this:

{
    "version": "0.2",
    "import": ["@cspell/dict-es-es/cspell-ext.json"],
    "language": "en,es",
----------  OMITTED ---------
}

I'm getting the following error when executing with this configuration:

Run streetsidesoftware/[email protected]
  with:
    config: cspell.json
    files: **/*.md
    inline: error
    strict: true
    incremental_files_only: true
    github_token: ***
    verbose: false
    check_dot_files: explicit
cspell-action
Pull Request
Fetch file names in commits: 6.242s
Error: Configuration
        name: Error
        msg: Failed to resolve file: "@cspell/dict-es-es/cspell-ext.json"
        stack:
Error: Failed to resolve file: "@cspell/dict-es-es/cspell-ext.json"
    at ConfigLoaderInternal.resolveFilename (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:67131:33)
    at async Promise.all (index 0)
    at async ConfigLoaderInternal._mergeConfigFileWithImports (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:67044:23)
    at async onReadyFixUp (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:67002:24)
    at async readConfig (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:75548:21)
    at async run2 (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:76329:24)
    at async runLint (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:76100:22)
    at async lint2 (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:76701:3)
    at async checkSpelling (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:76739:3)
    at async action (/home/runner/work/_actions/streetsidesoftware/cspell-action/v5.4.0/action/lib/main_root.js:76807:18)
        
Files checked: 0, Issues found: 0 in 0 files.
Done.

guidemetothemoon avatar Feb 25 '24 15:02 guidemetothemoon