Contribute to samples
Stay organized with collections
Save and categorize content based on your preferences.
Blockly samples contains extra
content related to Blockly that isn't part of the core repository, including
plugins, codelabs, and example code. For more details about each of these, see
the Repository
Structure page.
Need to Know
Here is a quick overview of facts about blockly-samples you need to know in
order to create a PR.
Make and Verify a Change
- Run
npm install
at the root level of blockly-samples to install
dependencies.
- Run
npm run start
in a plugin's directory to build and start up a server
running the plugin's test page. You can use this page to see the existing
behavior of a plugin, or if you're adding a new plugin you will need to make
this a useful test page so that others can see what your plugin does. See
the playground page for
more information.
- Make any necessary changes to the plugin's code.
- If you've left the server running, your changes will load automatically.
Otherwise, restart the server and verify the plugin behaves as expected and
there are no errors or warnings in the console.
- Run
npm run build
and ensure there are no build errors.
- Write automated mocha tests in the
test/
directory.
- Run
npm run test
to run the automated tests.
- Run
npm run lint:fix
to fix lint errors. Address any remaining warnings or
errors.
- Run
npm run format
to run the autoformatter.
- If all tests pass, you are ready to open a PR against master with your
changes.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-23 UTC."],[[["\u003cp\u003e\u003ccode\u003eblockly-samples\u003c/code\u003e houses plugins, codelabs, and example code extending Blockly's core functionality.\u003c/p\u003e\n"],["\u003cp\u003eThis repository uses the \u003ccode\u003emaster\u003c/code\u003e branch for development and requires running \u003ccode\u003enpm install\u003c/code\u003e at the root level due to its monorepo structure.\u003c/p\u003e\n"],["\u003cp\u003eContributions should adhere to Google's JavaScript/TypeScript Style Guides and utilize conventional commits for messages and PR titles.\u003c/p\u003e\n"],["\u003cp\u003eBefore submitting a PR, ensure code is formatted, linted, and passes all tests using the provided npm scripts.\u003c/p\u003e\n"],["\u003cp\u003eAll new code files must include the Apache License v2.0 header.\u003c/p\u003e\n"]]],["Blockly-samples, a monorepo, requires contributions via pull requests (PRs) against the `master` branch. Contributors must install dependencies at the root level using `npm install`. Code must adhere to Google's JavaScript or TypeScript style guides and use conventional commits. New files need an Apache License header. Changes involve building, testing, and verifying plugins using `npm run start`, followed by comprehensive tests using `npm run test`, `npm run lint:fix` and `npm run format`.\n"],null,["# Contribute to samples\n\n[Blockly samples](https://github.com/google/blockly-samples) contains extra\ncontent related to Blockly that isn't part of the core repository, including\nplugins, codelabs, and example code. For more details about each of these, see\nthe [Repository\nStructure](/blockly/guides/contribute/samples/repository_structure) page.\n\nNeed to Know\n------------\n\nHere is a quick overview of facts about blockly-samples you need to know in\norder to create a PR.\n\n- The working branch is **master** and all PRs should be made against master.\n- **Run `npm install` at the root level of blockly-samples,** not at the individual plugin level. Blockly-samples is a monorepo, meaning it contains multiple packages in the same repository, and installing at the root level is part of the workflow for managing the monorepo with Lerna.\n- Code must conform to either Google's [JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html) or [TypeScript Style\n Guide](https://google.github.io/styleguide/tsguide.html) depending on the language used.\n- Use [conventional commits](/blockly/guides/contribute/get-started/commits) in your commit messages and pull request titles.\n- Any new code files must be prefixed with the Apache License v2.0:\n\n /**\n * @license\n * Copyright \u003cCurrent YYYY\u003e Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\nMake and Verify a Change\n------------------------\n\n1. Run `npm install` at the root level of blockly-samples to install dependencies.\n2. Run `npm run start` in a plugin's directory to build and start up a server running the plugin's test page. You can use this page to see the existing behavior of a plugin, or if you're adding a new plugin you will need to make this a useful test page so that others can see what your plugin does. See the [playground](/blockly/guides/contribute/get-started/playground) page for more information.\n3. Make any necessary changes to the plugin's code.\n4. If you've left the server running, your changes will load automatically. Otherwise, restart the server and verify the plugin behaves as expected and there are no errors or warnings in the console.\n5. Run `npm run build` and ensure there are no build errors.\n6. Write automated mocha tests in the `test/` directory.\n7. Run `npm run test` to run the automated tests.\n8. Run `npm run lint:fix` to fix lint errors. Address any remaining warnings or errors.\n9. Run `npm run format` to run the autoformatter.\n10. If all tests pass, you are ready to open a PR against **master** with your changes."]]