👍🎉 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
.
yarn start --main=[entry id]
to view a certain entry with WDS in a fake WebExtension environment.
Entry ids are generally directory names in src
.
index.[html/js(x)/ts[x]]
in [entry id]/__fake__
has higher priority.
yarn test
to run Jest.
Toggle:
--coverage
: Show coverage instead of watching.
yarn devbuild
to start a quick build without compression.
yarn build
to start a full build.
Toggle:
--notypecheck
: Skip TypeScript full check.--analyze
: Show detailed Webpack bundle analyzer.
yarn release
to bump version and generate CHANGELOG.
yarn zip
to pack zibballs to ./dist/
.
Check out style-extractor.js and helpers.ts for useful tools to extract information from a webpage.
- Register the dictionary in app config so that TypeScript generates the correct typings. Dict ID should follow alphabetical order.
- Create a directory at
src/components/dictionaries/
, with the name of the dict ID. - Use Bing as guidance. Copy the files to the new directory.
- Replace the favicon with a new 32x32 png.
- Update
_locales.json
with the new dictionary name. Add locales for options, if any. engine.ts
exports two functionsgetSrcPage
function 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.search
function is responsible for fetching, parsing and returning dictionary results. See the typings for more detail.- If the dictionary supports pronunciation:
- Register the ID at
config.autopron
. - Include an
audio
field in the object which search engine returns.
- Register the ID at
- If the dictionary supports pronunciation:
- Search result will ultimately be passed to a React PureComponent in
View.tsx
, which renders the result accordingly. - Scope the styles in
_style.scss
following ECSS-ish naming convention.
Add Testing
- Add response samples at
test/specs/components/dictionaries/[dictID]/response
. - Add
engine.spec.ts
to test the engine.
Develop the dictionary UI live
- Intercept ajax calls in
config/fake-env/fake-ajax.js
. Use the testing response samples. - Edit
src/components/__fake__/index.tsx
. - Run
yarn start --main=components
.
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.