Visualize Your Ideas With Code
docs: add contribution guide
aarthificialf17372d985cb
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.mdnew file mode 100644index 00000000..e8402bd6--- /dev/null+++ b/CODE_OF_CONDUCT.md@@ -0,0 +1,132 @@+# Contributor Covenant Code of Conduct++## Our Pledge++We as members, contributors, and leaders pledge to make participation in our+community a harassment-free experience for everyone, regardless of age, body+size, visible or invisible disability, ethnicity, sex characteristics, gender+identity and expression, level of experience, education, socio-economic status,+nationality, personal appearance, race, caste, color, religion, or sexual+identity and orientation.++We pledge to act and interact in ways that contribute to an open, welcoming,+diverse, inclusive, and healthy community.++## Our Standards++Examples of behavior that contributes to a positive environment for our+community include:++* Demonstrating empathy and kindness toward other people+* Being respectful of differing opinions, viewpoints, and experiences+* Giving and gracefully accepting constructive feedback+* Accepting responsibility and apologizing to those affected by our mistakes,+ and learning from the experience+* Focusing on what is best not just for us as individuals, but for the overall+ community++Examples of unacceptable behavior include:++* The use of sexualized language or imagery, and sexual attention or advances of+ any kind+* Trolling, insulting or derogatory comments, and personal or political attacks+* Public or private harassment+* Publishing others' private information, such as a physical or email address,+ without their explicit permission+* Other conduct which could reasonably be considered inappropriate in a+ professional setting++## Enforcement Responsibilities++Community leaders are responsible for clarifying and enforcing our standards of+acceptable behavior and will take appropriate and fair corrective action in+response to any behavior that they deem inappropriate, threatening, offensive,+or harmful.++Community leaders have the right and responsibility to remove, edit, or reject+comments, commits, code, wiki edits, issues, and other contributions that are+not aligned to this Code of Conduct, and will communicate reasons for moderation+decisions when appropriate.++## Scope++This Code of Conduct applies within all community spaces, and also applies when+an individual is officially representing the community in public spaces.+Examples of representing our community include using an official e-mail address,+posting via an official social media account, or acting as an appointed+representative at an online or offline event.++## Enforcement++Instances of abusive, harassing, or otherwise unacceptable behavior may be+reported to the community leaders responsible for enforcement at+[[email protected]](mailto:[email protected]).+All complaints will be reviewed and investigated promptly and fairly.++All community leaders are obligated to respect the privacy and security of the+reporter of any incident.++## Enforcement Guidelines++Community leaders will follow these Community Impact Guidelines in determining+the consequences for any action they deem in violation of this Code of Conduct:++### 1. Correction++**Community Impact**: Use of inappropriate language or other behavior deemed+unprofessional or unwelcome in the community.++**Consequence**: A private, written warning from community leaders, providing+clarity around the nature of the violation and an explanation of why the+behavior was inappropriate. A public apology may be requested.++### 2. Warning++**Community Impact**: A violation through a single incident or series of+actions.++**Consequence**: A warning with consequences for continued behavior. No+interaction with the people involved, including unsolicited interaction with+those enforcing the Code of Conduct, for a specified period of time. This+includes avoiding interactions in community spaces as well as external channels+like social media. Violating these terms may lead to a temporary or permanent+ban.++### 3. Temporary Ban++**Community Impact**: A serious violation of community standards, including+sustained inappropriate behavior.++**Consequence**: A temporary ban from any sort of interaction or public+communication with the community for a specified period of time. No public or+private interaction with the people involved, including unsolicited interaction+with those enforcing the Code of Conduct, is allowed during this period.+Violating these terms may lead to a permanent ban.++### 4. Permanent Ban++**Community Impact**: Demonstrating a pattern of violation of community+standards, including sustained inappropriate behavior, harassment of an+individual, or aggression toward or disparagement of classes of individuals.++**Consequence**: A permanent ban from any sort of public interaction within the+community.++## Attribution++This Code of Conduct is adapted from the [Contributor Covenant][homepage],+version 2.1, available at+[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].++Community Impact Guidelines were inspired by+[Mozilla's code of conduct enforcement ladder][Mozilla CoC].++For answers to common questions about this code of conduct, see the FAQ at+[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at+[https://www.contributor-covenant.org/translations][translations].++[homepage]: https://www.contributor-covenant.org+[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html+[Mozilla CoC]: https://github.com/mozilla/diversity+[FAQ]: https://www.contributor-covenant.org/faq+[translations]: https://www.contributor-covenant.org/translations\ No newline at end of filediff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdnew file mode 100644index 00000000..b418f12f--- /dev/null+++ b/CONTRIBUTING.md@@ -0,0 +1,82 @@+# Contributing to Motion Canvas++This is an initial version of the Contribution Guide.+Feel free to discuss it and suggest any changes on [our discord server][discord].++## Code of Conduct++Before contributing to the project, please read our+[Code of Conduct](./CODE_OF_CONDUCT.md).++## Reporting a bug++Before you submit an issue, please search [the issue tracker][issues].+An issue for your problem might already exist and the discussion might inform+you of workarounds readily available.++You can file new issues by [selecting an issue template][new-issue] and+filling out the necessary information.++## Proposing a Change++If you intend to change the public API, or make any non-trivial changes to+the implementation, make sure to [create an issue][new-feature] first. This+will let us discuss a proposal before you put significant effort into it.++If you're only fixing a bug, it's fine to submit a pull request right away but+make sure it contains a clear and concise description of said bug.++## Semantic Versioning++Motion Canvas follows [semantic versioning][semver].+Due to [the limitations of `semantic-release`][semantic-release] the major+version is not set to zero. Nevertheless, Motion Canvas is still in early+development and breaking changes are very much expected and welcome. Before+the public release to npm, the version will be reset back to `1.0.0`.++## Making a Pull Request++1. Fork the motion-canvas/core repo.+2. In your forked repo, create a new branch for your changes:+ ```shell+ git checkout -b my-fix-branch master+ ```+3. Update the code.+4. Format your code with prettier (`npm run prettier:fix`).+5. Make sure your code lints (`npm run lint:fix`)+6. Commit your changes using a descriptive commit message that follows+ [Angular Commit Message Conventions][commit-format].+ ```shell+ git commit --all+ ```+7. Push your branch to GitHub:+ ```shell+ git push origin my-fix-branch+ ```+8. In GitHub, send a pull request to [the master branch][master].++### Addressing review feedback++1. Make required updates to the code.+2. Rerun prettier and eslint.+3. Create a fixup commit and push it to your GitHub repo:+ ```shell+ git commit --all --fixup HEAD+ git push+ ```++## Attribution++This Contribution Guide was partially inspired by [React][react] and+[Angular][angular].++[semver]: https://semver.org/+[discord]: https://www.patreon.com/posts/53003221+[semantic-release]: https://semantic-release.gitbook.io/semantic-release/support/faq#can-i-set-the-initial-release-version-of-my-package-to-0.0.1+[master]: https://github.com/aarthificial/motion-canvas/tree/master+[issues]: https://github.com/motion-canvas/core/issues+[new-issue]: https://github.com/motion-canvas/core/issues/new/choose+[new-feature]: https://github.com/motion-canvas/core/issues/new?template=feature_request.md+[commit-format]: https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit+[angular]: https://github.com/angular/angular/blob/main/CONTRIBUTING.md+[react]: https://reactjs.org/docs/how-to-contribute.htmldiff --git a/README.md b/README.mdindex 25376593..a5c69f4b 100644--- a/README.md+++ b/README.md@@ -12,35 +12,37 @@ Documentation is still lacking and will be expanded in the following weeks.Make sure that [Node.js](https://nodejs.org/) is installed on your machine.The recommended version is 16. You can check the currently installed version using:+```shellnode -v```-### Authenticate to GitHub Packages+### Authenticate to GitHub Packages+[Detailed information on how to authenticate](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token).-+1. Generate a PAT (Personal Access Token).- 1. On [github.com](https://github.com), go to `Settings` > `Developer settings` > `Personal access tokens`.- 2. Click `Generate new token`.- 3. Enter the note for your token, for instance `npm`.- 4. Choose `read:packages` from the available scopes.- 5. Click `Generate token`- 6. Copy the generated token.+ 1. On [github.com](https://github.com), go to `Settings` > `Developer settings` > `Personal access tokens`.+ 2. Click `Generate new token`.+ 3. Enter the note for your token, for instance `npm`.+ 4. Choose `read:packages` from the available scopes.+ 5. Click `Generate token`+ 6. Copy the generated token.2. Log in using npm- 1. In your terminal, enter the following command:- ```shell- npm login --scope=@motion-canvas --registry=https://npm.pkg.github.com- ```- 2. Answer the prompt.- `Username` is your GitHub username,- `Password` is the token you just generated.- `Email` is your GitHub email address.- For instace:- ```text- > Username: Jacob- > Password: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx- > Email: [email protected]- ```+ 1. In your terminal, enter the following command:+ ```shell+ npm login --scope=@motion-canvas --registry=https://npm.pkg.github.com+ ```+ 2. Answer the prompt.+ `Username` is your GitHub username,+ `Password` is the token you just generated.+ `Email` is your GitHub email address.+ For instace:+ ```text+ > Username: Jacob+ > Password: ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+ > Email: [email protected]+ ```### Set up a project@@ -70,29 +72,33 @@ Otherwise, below are the steps to set it up manually:}```6. Create a simple scene in `src/scenes/example.scene.tsx`:+```tsimport type {Scene} from '@motion-canvas/core/lib/Scene';import {ThreadGenerator} from '@motion-canvas/core/lib/threading';import {waitFor} from '@motion-canvas/core/lib/animations';-+export default function* example(scene: Scene): ThreadGenerator {yield* scene.transition();-+yield* waitFor(5);scene.canFinish();}```+7. Initialize the project with your scene in `src/project.ts`:+```tsimport {bootstrap} from '@motion-canvas/core/lib/bootstrap';-+import example from './scenes/example.scene';-+bootstrap({name: 'my-project',scenes: [example],});```+8. So far, your project structure should look like this:```textmy-project/@@ -114,18 +120,22 @@ Otherwise, below are the steps to set it up manually:"serve": "motion-canvas src/project.ts"}}- ```+ ```### Run Motion Canvas+Start your project using the `serve` script:+```shellnpm run serve```+You can now open Motion Canvas in your browser by visiting [http://localhost:9000/](http://localhost:9000/).In case of any problems, please visit [our discord server](https://www.patreon.com/posts/53003221).## Developing Motion Canvas locally+I recommend using [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) for local development.1. Set up the following directory structure:@@ -161,31 +171,41 @@ I recommend using [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/works5. Run `build:core` and `build:ui` to generate the necessary files.### Developing Core+When developing the core, start both `watch:core` and `serve:example`.-This will pick up any changes you make to the core package,+This will pick up any changes you make to the core package,automatically rebuild the `example` project and refresh the page.### Developing UI-If you want to develop the UI, create a new npm script in the `example` project:- ```json- {- "scripts": {- "ui": "motion-canvas src/project.ts --ui-server"- }- }- ```++If you want to develop the UI, create a new npm script in the `example` project:++```json+{+ "scripts": {+ "ui": "motion-canvas src/project.ts --ui-server"+ }+}+```+And add it in your root `package.json`:- ```json- {- "scripts": {- "ui:example": "npm run ui -w packages/example"- }- }- ```++```json+{+ "scripts": {+ "ui:example": "npm run ui -w packages/example"+ }+}+```+You can now start both `serve:ui` and `ui:example`.`serve:ui` will start another webpack dev server specifically for the UI.-Meanwhile, the `--ui-server` flag will instruct your project to load the UI from said server instead of a static file.+Meanwhile, the `--ui-server` flag will instruct your project to load the UI from said server instead of a static file.You can combine it with `watch:core` to develop everything at once.++## Contributing++Read through our [Contribution Guide](./CONTRIBUTING.md) to learn how you can help make Motion Canvas better.