👍🎉 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 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.
Run yarn test
to run Jest. Supports all the Jest options.
Run yarn devbuild
to start a quick build without compression.
Run yarn build
to start a full build.
Toggle:
--notypecheck
: Skip TypeScript full check.--analyze
: Show detailed Webpack bundle analyzer.
Run yarn release
to bump version and generate CHANGELOG.
Run yarn zip
to pack zibballs to ./dist/
.
- Register the dictionary in app config so that TypeScript generates the correct typings. Dict ID MUST follow alphabetical order.
- 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.
- Update
_locales.json
with the new dictionary name. Add locales for options, if any. engine.ts
MUST export at least two functions:getSrcPage
function 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.search
function 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
audio
field in the object which search engine returns.
- Register the ID at
- Other exported functions can be called from
View.tsx
viaDictEngineMethod
message channel, seesrc/typings/message
for typing details (also don't use the nativesendMessage
function, 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.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.