Contribute to core
The Blockly core repository contains the code that is needed to run any Blackly-based application. It also contains the documentation, including codelabs.
Need to Know
Here is a quick overview of facts about Blockly core you need to know in order to create a PR.
-
The working branch is main and all PRs should be made against main.
-
You must fill out the pull request template with the requested information.
-
Code must conform to Google's TypeScript Style Guide.
-
Use conventional commits in your commit messages and pull request titles.
-
User-visible strings must be in the
/msg/messages.jsfile so they may be translated. Less than 6% of the world speaks English natively. -
Text on blocks should generally be all lowercase (just like the keywords in most programming languages).
-
Maintain backwards compatibility. There are a lot of Blockly apps out there, don't break everyone else.
-
Any new code files must be prefixed with the Apache License v2.0:
/**
* @license
* Copyright <Current YYYY> Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
Make and Verify a Change
- Run
npm installto install dependencies. - Run
npm run startto start up a server running the playground. You can use this page to test the existing behavior. See the playground page for more information. - Make any necessary changes to the code.
- If you've left the server running, refresh to see your changes. Otherwise, restart the server and verify the code behaves as expected and there are no errors or warnings in the console.
- Run
npm run buildand ensure there are no build errors. - Write automated tests. Usually, these will be mocha tests in the
tests/mochadirectory, but we may ask you for other types of tests. - Run
npm run formatto format the code and automatically fix some lint problems. - Run
npm testto run the automated tests. This also runseslint. - If there are lint errors, run
npm run lint:fixto fix the problems that are autofixable. Address any remaining lint warnings or errors. - If all tests pass, you are ready to open a PR against main with your changes.