👍🎉 First off, thanks for taking the time to contribute! 🎉👍
- Read How to get started.
- Follow code style and commit style.
- Before submit, run test and build locally. Or leave it to CI.
Clone the repo and run yarn install.
Run yarn storybook to view all the components.
Run yarn start --wextentry [entry id] to view a certain entry with WDS in a fake WebExtension environment.
Run yarn test to run Jest. Supports all the Jest options.
Run yarn build to start a full build.
Toggle:
--analyze: Show detailed Webpack bundle analyzer.
Run yarn release to bump version and generate CHANGELOG.
Run yarn zip to pack zibballs to ./dist/.
- Create a directory at
src/components/dictionaries/, with the name of the dict ID.- Use any existing dictionary as guidance, e.g. Bing. Copy files to the new directory.
- Replace the favicon with a new LOGO.
- Edit
config.tsto change default options. See theDictItemtype and explanation for more details. Register the dictionary in app config so that TypeScript generates the correct typings. Dict ID MUST follow alphabetical order. - Update
_locales.jsonwith the new dictionary name. Add locales for options, if any. engine.tsMUST export at least two functions:getSrcPagefunction which is responsible for generating source page url base on search text and app config. Source page url is opened when user clicks the dictionary title.searchfunction which is responsible for fetching, parsing and returning dictionary results. See the typings for more detail.- Extracting information from a webpage MUST use helper functions in ../helpers.ts for data cleansing.
- If the dictionary supports pronunciation:
- Register the ID at
config.autopron. - Include an
audiofield in the object which search engine returns.
- Other exported functions can be called from
View.tsxviaDictEngineMethodmessage channel, seesrc/typings/messagefor typing details (also don't use the nativesendMessagefunction, import{ message }from'@/_helpers/browser-api').
- Search result will ultimately be passed to a React PureComponent in
View.tsx, which SHOULD be a dumb component that renders the result accordingly. - Scope the styles in
_style.scssfollowing ECSS-ish naming convention.
Add Testing
- Add response samples at
test/specs/components/dictionaries/[dictID]/response. - Add
engine.spec.tsto test the engine.
Develop the dictionary UI live
- Edit
test/specs/components/dictionaries/[dictID]/request.mock.ts. - Run
yarn storybook.
This project follows the TypeScript variation of Standard JavaScript code style.
If you are using IDEs like VSCode, make sure TSLint related plugins are installed. Or you can just run building command to perform a TypeScript full check.
This project follows conventional commit style.
You can run yarn commit and follow the instructions, or use vscode-commitizen extension in VSCode.