@textlint/browser-run
Run textlint rule on browser for testing.
Purpose
If you want to know whether your textlint rule work or not, This Command line tool help you.
This tools did following steps:
- Bundle your textlint rule and @textlint/kernel by Browserify
- Run the bundle code on Electron browser by browser-run
- Output results
Install
Install with npm:
npm install @textlint/browser-run --global
Usage
Usage
$ npx @textlint/browser-run <input-file-path>
Options
--ruleId rule id. Default: test-rule
--rule file path to rule module entry
--preset file path to rule preset module entry
Examples
$ npx @textlint/browser-run --rule ./lib/rule.js ./README.md
$ npx @textlint/browser-run --preset ./lib/rule-preset.js ./README.md
Notes
You should specify rule file that is build by textlint-scripts.
Node Module
import * as fs from "fs"
import * as path from "path"
import { browserRun } from "@textlint/browser-run";
const ruleFile = require.resolve("./fixtures/rule.js");
browserRun({
input: fs.readFileSync(path.join(__dirname, "fixtures/README.md"), "utf-8"),
inputFilePath: path.join(__dirname, "fixtures/README.md"),
ruleFilePath: ruleFile,
ruleId: "test-rule",
cwd: __dirname
}).then(() => {
console.log("Work");
}).catch(error => {
console.log("Does not work")
});
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.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
License
MIT © azu