Contributing to Core

Stay organized with collections Save and categorize content based on your preferences.

The Blockly core repository contains the code that is needed to run any Blockly-based application.

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 develop and all PRs should be made against develop.
  • 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.js file 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 2022 Google LLC
     * SPDX-License-Identifier: Apache-2.0
     */
    

Making and Verifying a Change

  1. Run npm install to install dependencies.
  2. Run npm run start to start up a server running the playground. You can use this page to test the existing behavior. See the playground page for more information.
  3. Make any necessary changes to the code.
  4. 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.
  5. Run npm run build and ensure there are no build errors.
  6. Write automated tests. Usually, these will be mocha tests in the tests/mocha directory, but we may ask you for other types of tests.
  7. Run npm run test to run the automated tests.
  8. Run npm run format to format the code and automatically fix some lint problems.
  9. Run npm run lint and ensure there are no warnings or errors.
  10. If all tests pass, you are ready to open a PR against develop with your changes.