@textlint/script-compiler

textlint script compiler tool

Usage no npm install needed!

<script type="module">
  import textlintScriptCompiler from 'https://cdn.skypack.dev/@textlint/script-compiler';
</script>

README

@textlint/script-compiler

textlint compiler tool

Install

Install with npm:

npm install @textlint/script-compiler

Usage

Usage
  $ textlint-script-compiler 

Options
  --cwd                       [path:String] current working directory
  --textlintrc                [path:String] path to .textlintrc file.
                              Default: .textlintrc.{json,yaml,js}
  --output-dir                [path:String] output file path that is written of reported result.
  --mode                      [String] build mode: "production" or "development"
  --metadataName              [String] generated script name
  --metadataNamespace         [String] generated script namespace

Examples
  $ textlint-script-compiler --output-dir ./dist --metadataName "test" --metadataNamespace "https://example.com"

Demo

yarn run compile:textlint
yarn dev

Command

const worker = new Worker('textlint.js');
worker.addEventListener('message', function (event) {
    if (event.data.command === "init") {
        // override user config
        worker.postMessage({
            command: "merge-config",
            textlintrc: {
                "rules": {
                    "preset-ja-technical-writing": {
                        "sentence-length": {
                            "max": 5
                        }
                    }
                }
            },
        });
        setTimeout(() => {
            // lint
            worker.postMessage({
                command: "lint",
                text: "お刺身が食べれない",
                ext: ".md"
            })
        })
    } else if (event.data.command === "lint:result") {
        // receive lint result
        console.log(event.data.result);
        console.timeEnd("lint")
    }
});

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu