mirror of
https://github.com/motion-canvas/motion-canvas.git
synced 2026-04-22 03:00:03 -04:00
feat: switch to monorepo
This PR merges the core and ui packages into one monorepo for easier maintenance. Husky has been added to automate eslint, prettier and jest execution. Commit messages are now validated both by the pre-commit hook and GitHub Actions. Closes: #23 Closes: #86 Closes: #49
This commit is contained in:
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -1,9 +1,13 @@
|
|||||||
name: Release Package to GitHub
|
name: Publish Packages to GitHub
|
||||||
|
|
||||||
on: workflow_dispatch
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
env:
|
||||||
|
HUSKY: 0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
|
name: Publish
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@@ -11,10 +15,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
registry-url: https://npm.pkg.github.com/
|
registry-url: https://npm.pkg.github.com/
|
||||||
|
cache: npm
|
||||||
|
- run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
- run: git config --global user.name "github-actions[bot]"
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npx lerna run build
|
||||||
- run: npm run docs
|
- run: npx lerna publish --yes
|
||||||
- run: npm run release
|
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
|||||||
25
.github/workflows/verify.yml
vendored
25
.github/workflows/verify.yml
vendored
@@ -1,18 +1,31 @@
|
|||||||
name: Test and Build the Package
|
name: Verify Pull Request
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request: {}
|
pull_request: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
HUSKY: 0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
verification:
|
||||||
|
name: Verification
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
|
cache: npm
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run lint
|
- name: Commit name
|
||||||
- run: npm run prettier
|
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --verbose
|
||||||
- run: npm run test
|
- name: ESLint
|
||||||
- run: npm run build
|
run: npx lerna run lint
|
||||||
|
- name: Prettier
|
||||||
|
run: npx lerna run prettier
|
||||||
|
- name: Tests
|
||||||
|
run: npx lerna run test
|
||||||
|
- name: Build
|
||||||
|
run: npx lerna run build
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
lib
|
lib
|
||||||
api
|
api
|
||||||
|
dist
|
||||||
test
|
test
|
||||||
.idea
|
.idea
|
||||||
|
|||||||
4
.husky/commit-msg
Normal file
4
.husky/commit-msg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npx --no -- commitlint --edit $1
|
||||||
5
.husky/pre-commit
Normal file
5
.husky/pre-commit
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npx lint-staged
|
||||||
|
npx --no -- jest --onlyChanged --config=packages/core/jest.config.js
|
||||||
22
.releaserc
22
.releaserc
@@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"branches": [{ "name": "master" }],
|
|
||||||
"plugins": [
|
|
||||||
"@semantic-release/commit-analyzer",
|
|
||||||
"@semantic-release/release-notes-generator",
|
|
||||||
"@semantic-release/npm",
|
|
||||||
"@semantic-release/github",
|
|
||||||
[
|
|
||||||
"@semantic-release/changelog",
|
|
||||||
{
|
|
||||||
"changelogFile": "docs/CHANGELOG.md"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"@semantic-release/git",
|
|
||||||
{
|
|
||||||
"assets": ["docs/CHANGELOG.md", "package.json"],
|
|
||||||
"message": "ci(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -48,6 +48,8 @@ yield* slideTranstion();
|
|||||||
|
|
||||||
Any transitions must be rewritten to utilize `useTransition`.
|
Any transitions must be rewritten to utilize `useTransition`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [7.0.0](https://github.com/motion-canvas/core/compare/v6.0.1...v7.0.0) (2022-07-14)
|
# [7.0.0](https://github.com/motion-canvas/core/compare/v6.0.1...v7.0.0) (2022-07-14)
|
||||||
|
|
||||||
|
|
||||||
@@ -73,6 +75,8 @@ bootstrap(...);
|
|||||||
import {getset} from '@motion-canvas/core/lib/decorators/getset';
|
import {getset} from '@motion-canvas/core/lib/decorators/getset';
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [6.0.1](https://github.com/motion-canvas/core/compare/v6.0.0...v6.0.1) (2022-07-01)
|
## [6.0.1](https://github.com/motion-canvas/core/compare/v6.0.0...v6.0.1) (2022-07-01)
|
||||||
|
|
||||||
|
|
||||||
@@ -80,6 +84,8 @@ import {getset} from '@motion-canvas/core/lib/decorators/getset';
|
|||||||
|
|
||||||
* re-render the scene when canvas changes ([#55](https://github.com/motion-canvas/core/issues/55)) ([191f96d](https://github.com/motion-canvas/core/commit/191f96da1441bc37d6e61e1acdcfde6994a7f9f3))
|
* re-render the scene when canvas changes ([#55](https://github.com/motion-canvas/core/issues/55)) ([191f96d](https://github.com/motion-canvas/core/commit/191f96da1441bc37d6e61e1acdcfde6994a7f9f3))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0](https://github.com/motion-canvas/core/compare/v5.0.0...v6.0.0) (2022-07-01)
|
# [6.0.0](https://github.com/motion-canvas/core/compare/v5.0.0...v6.0.0) (2022-07-01)
|
||||||
|
|
||||||
|
|
||||||
@@ -94,6 +100,8 @@ import {getset} from '@motion-canvas/core/lib/decorators/getset';
|
|||||||
|
|
||||||
Scene files need to export a special `SceneDescription` object instead of a simple generator function.
|
Scene files need to export a special `SceneDescription` object instead of a simple generator function.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0](https://github.com/motion-canvas/core/compare/v4.1.0...v5.0.0) (2022-06-29)
|
# [5.0.0](https://github.com/motion-canvas/core/compare/v4.1.0...v5.0.0) (2022-06-29)
|
||||||
|
|
||||||
|
|
||||||
@@ -114,6 +122,8 @@ Scene files need to export a special `SceneDescription` object instead of a simp
|
|||||||
The names of all public events now use the following pattern: "on[WhatHappened]".
|
The names of all public events now use the following pattern: "on[WhatHappened]".
|
||||||
Example: "onValueChanged".
|
Example: "onValueChanged".
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.1.0](https://github.com/motion-canvas/core/compare/v4.0.1...v4.1.0) (2022-06-22)
|
# [4.1.0](https://github.com/motion-canvas/core/compare/v4.0.1...v4.1.0) (2022-06-22)
|
||||||
|
|
||||||
|
|
||||||
@@ -122,6 +132,8 @@ Example: "onValueChanged".
|
|||||||
* improve surface clipping ([#41](https://github.com/motion-canvas/core/issues/41)) ([003b7d5](https://github.com/motion-canvas/core/commit/003b7d58d6490170cea81b2d1b37cf59b4d698cf))
|
* improve surface clipping ([#41](https://github.com/motion-canvas/core/issues/41)) ([003b7d5](https://github.com/motion-canvas/core/commit/003b7d58d6490170cea81b2d1b37cf59b4d698cf))
|
||||||
* make surfaces transparent by default ([#42](https://github.com/motion-canvas/core/issues/42)) ([cd71285](https://github.com/motion-canvas/core/commit/cd712857579ec45b3e6f40d0e48fce80fefed5b9)), closes [#25](https://github.com/motion-canvas/core/issues/25)
|
* make surfaces transparent by default ([#42](https://github.com/motion-canvas/core/issues/42)) ([cd71285](https://github.com/motion-canvas/core/commit/cd712857579ec45b3e6f40d0e48fce80fefed5b9)), closes [#25](https://github.com/motion-canvas/core/issues/25)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [4.0.1](https://github.com/motion-canvas/core/compare/v4.0.0...v4.0.1) (2022-06-22)
|
## [4.0.1](https://github.com/motion-canvas/core/compare/v4.0.0...v4.0.1) (2022-06-22)
|
||||||
|
|
||||||
|
|
||||||
@@ -129,6 +141,8 @@ Example: "onValueChanged".
|
|||||||
|
|
||||||
* add missing public path ([#40](https://github.com/motion-canvas/core/issues/40)) ([48213de](https://github.com/motion-canvas/core/commit/48213de087d6bb35f29919f5588e3a4517e080b6))
|
* add missing public path ([#40](https://github.com/motion-canvas/core/issues/40)) ([48213de](https://github.com/motion-canvas/core/commit/48213de087d6bb35f29919f5588e3a4517e080b6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [4.0.0](https://github.com/motion-canvas/core/compare/v3.0.3...v4.0.0) (2022-06-22)
|
# [4.0.0](https://github.com/motion-canvas/core/compare/v3.0.3...v4.0.0) (2022-06-22)
|
||||||
|
|
||||||
|
|
||||||
@@ -144,6 +158,8 @@ Example: "onValueChanged".
|
|||||||
By default, importing images will now return their urls instead of a SpriteData object.
|
By default, importing images will now return their urls instead of a SpriteData object.
|
||||||
This behavior can be adjusted using the `?img` and `?anim` queries.
|
This behavior can be adjusted using the `?img` and `?anim` queries.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.0.3](https://github.com/motion-canvas/core/compare/v3.0.2...v3.0.3) (2022-06-21)
|
## [3.0.3](https://github.com/motion-canvas/core/compare/v3.0.2...v3.0.3) (2022-06-21)
|
||||||
|
|
||||||
|
|
||||||
@@ -151,6 +167,8 @@ This behavior can be adjusted using the `?img` and `?anim` queries.
|
|||||||
|
|
||||||
* display newlines in Code correctly ([#38](https://github.com/motion-canvas/core/issues/38)) ([df8f390](https://github.com/motion-canvas/core/commit/df8f390848d7a8e03193d64e460142e00ed95031))
|
* display newlines in Code correctly ([#38](https://github.com/motion-canvas/core/issues/38)) ([df8f390](https://github.com/motion-canvas/core/commit/df8f390848d7a8e03193d64e460142e00ed95031))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.0.2](https://github.com/motion-canvas/core/compare/v3.0.1...v3.0.2) (2022-06-17)
|
## [3.0.2](https://github.com/motion-canvas/core/compare/v3.0.1...v3.0.2) (2022-06-17)
|
||||||
|
|
||||||
|
|
||||||
@@ -158,6 +176,8 @@ This behavior can be adjusted using the `?img` and `?anim` queries.
|
|||||||
|
|
||||||
* save time events only if they're actively used ([#35](https://github.com/motion-canvas/core/issues/35)) ([bd78c89](https://github.com/motion-canvas/core/commit/bd78c8967ba395beeb352006b5f33768b4a4c498)), closes [#33](https://github.com/motion-canvas/core/issues/33) [#34](https://github.com/motion-canvas/core/issues/34)
|
* save time events only if they're actively used ([#35](https://github.com/motion-canvas/core/issues/35)) ([bd78c89](https://github.com/motion-canvas/core/commit/bd78c8967ba395beeb352006b5f33768b4a4c498)), closes [#33](https://github.com/motion-canvas/core/issues/33) [#34](https://github.com/motion-canvas/core/issues/34)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.0.1](https://github.com/motion-canvas/core/compare/v3.0.0...v3.0.1) (2022-06-16)
|
## [3.0.1](https://github.com/motion-canvas/core/compare/v3.0.0...v3.0.1) (2022-06-16)
|
||||||
|
|
||||||
|
|
||||||
@@ -165,6 +185,8 @@ This behavior can be adjusted using the `?img` and `?anim` queries.
|
|||||||
|
|
||||||
* fix meta file version and timing ([#32](https://github.com/motion-canvas/core/issues/32)) ([a369610](https://github.com/motion-canvas/core/commit/a36961007eb7ac238b87ade3a03da101a1940800))
|
* fix meta file version and timing ([#32](https://github.com/motion-canvas/core/issues/32)) ([a369610](https://github.com/motion-canvas/core/commit/a36961007eb7ac238b87ade3a03da101a1940800))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [3.0.0](https://github.com/motion-canvas/core/compare/v2.2.0...v3.0.0) (2022-06-16)
|
# [3.0.0](https://github.com/motion-canvas/core/compare/v2.2.0...v3.0.0) (2022-06-16)
|
||||||
|
|
||||||
|
|
||||||
@@ -177,6 +199,8 @@ This behavior can be adjusted using the `?img` and `?anim` queries.
|
|||||||
|
|
||||||
* change time events API
|
* change time events API
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.2.0](https://github.com/motion-canvas/core/compare/v2.1.1...v2.2.0) (2022-06-16)
|
# [2.2.0](https://github.com/motion-canvas/core/compare/v2.1.1...v2.2.0) (2022-06-16)
|
||||||
|
|
||||||
|
|
||||||
@@ -189,6 +213,8 @@ This behavior can be adjusted using the `?img` and `?anim` queries.
|
|||||||
|
|
||||||
* add ease back interp functions ([#30](https://github.com/motion-canvas/core/issues/30)) ([c11046d](https://github.com/motion-canvas/core/commit/c11046d939bf5a29e28bda0ef97feabe2f985a0f))
|
* add ease back interp functions ([#30](https://github.com/motion-canvas/core/issues/30)) ([c11046d](https://github.com/motion-canvas/core/commit/c11046d939bf5a29e28bda0ef97feabe2f985a0f))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.1.1](https://github.com/motion-canvas/core/compare/v2.1.0...v2.1.1) (2022-06-15)
|
## [2.1.1](https://github.com/motion-canvas/core/compare/v2.1.0...v2.1.1) (2022-06-15)
|
||||||
|
|
||||||
|
|
||||||
@@ -198,6 +224,8 @@ This behavior can be adjusted using the `?img` and `?anim` queries.
|
|||||||
* code will trigger PrismJS such that JSX is correctly highlighted ([#20](https://github.com/motion-canvas/core/issues/20)) ([b323231](https://github.com/motion-canvas/core/commit/b32323184b5f479bc09950fdf9c570b5276ea600)), closes [#17](https://github.com/motion-canvas/core/issues/17)
|
* code will trigger PrismJS such that JSX is correctly highlighted ([#20](https://github.com/motion-canvas/core/issues/20)) ([b323231](https://github.com/motion-canvas/core/commit/b32323184b5f479bc09950fdf9c570b5276ea600)), closes [#17](https://github.com/motion-canvas/core/issues/17)
|
||||||
* fix hot reload ([#26](https://github.com/motion-canvas/core/issues/26)) ([2ad746e](https://github.com/motion-canvas/core/commit/2ad746e1eff705c2eb29ea9c83ad9810eeb54b05))
|
* fix hot reload ([#26](https://github.com/motion-canvas/core/issues/26)) ([2ad746e](https://github.com/motion-canvas/core/commit/2ad746e1eff705c2eb29ea9c83ad9810eeb54b05))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.1.0](https://github.com/motion-canvas/core/compare/v2.0.0...v2.1.0) (2022-06-14)
|
# [2.1.0](https://github.com/motion-canvas/core/compare/v2.0.0...v2.1.0) (2022-06-14)
|
||||||
|
|
||||||
|
|
||||||
@@ -211,6 +239,8 @@ This behavior can be adjusted using the `?img` and `?anim` queries.
|
|||||||
* force rendering to restart seek time ([#14](https://github.com/motion-canvas/core/issues/14)) ([e94027a](https://github.com/motion-canvas/core/commit/e94027a36fe2a0b11f3aa42bb3fa869c10fbe1ea)), closes [#6](https://github.com/motion-canvas/core/issues/6)
|
* force rendering to restart seek time ([#14](https://github.com/motion-canvas/core/issues/14)) ([e94027a](https://github.com/motion-canvas/core/commit/e94027a36fe2a0b11f3aa42bb3fa869c10fbe1ea)), closes [#6](https://github.com/motion-canvas/core/issues/6)
|
||||||
* move back playhead by a frame ([#18](https://github.com/motion-canvas/core/issues/18)) ([b944cd7](https://github.com/motion-canvas/core/commit/b944cd71c075e10622bd7bc81de90024c73438b7))
|
* move back playhead by a frame ([#18](https://github.com/motion-canvas/core/issues/18)) ([b944cd7](https://github.com/motion-canvas/core/commit/b944cd71c075e10622bd7bc81de90024c73438b7))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0](https://github.com/motion-canvas/core/compare/v1.1.0...v2.0.0) (2022-06-12)
|
# [2.0.0](https://github.com/motion-canvas/core/compare/v1.1.0...v2.0.0) (2022-06-12)
|
||||||
|
|
||||||
|
|
||||||
@@ -231,6 +261,8 @@ This behavior can be adjusted using the `?img` and `?anim` queries.
|
|||||||
|
|
||||||
They should be imported from `@motion-canvas/core/lib/flow`.
|
They should be imported from `@motion-canvas/core/lib/flow`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [1.1.0](https://github.com/motion-canvas/core/compare/v1.0.0...v1.1.0) (2022-06-08)
|
# [1.1.0](https://github.com/motion-canvas/core/compare/v1.0.0...v1.1.0) (2022-06-08)
|
||||||
|
|
||||||
|
|
||||||
@@ -243,7 +275,9 @@ They should be imported from `@motion-canvas/core/lib/flow`.
|
|||||||
|
|
||||||
* add support for npm workspaces ([741567f](https://github.com/motion-canvas/core/commit/741567f8af4185a2b1bc5284064514d96e75f5f2))
|
* add support for npm workspaces ([741567f](https://github.com/motion-canvas/core/commit/741567f8af4185a2b1bc5284064514d96e75f5f2))
|
||||||
|
|
||||||
# 1.0.0 (2022-06-08)
|
|
||||||
|
|
||||||
|
# [1.0.0](https://github.com/motion-canvas/core/compare/49254fc36cc03c8f8557c14ff86ab38f56229b04...v1.0.0) (2022-06-08)
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
@@ -301,3 +335,6 @@ They should be imported from `@motion-canvas/core/lib/flow`.
|
|||||||
* use Web Audio API for waveform generation ([817e244](https://github.com/motion-canvas/core/commit/817e244bb2187532df7142199917412ccfe8d218))
|
* use Web Audio API for waveform generation ([817e244](https://github.com/motion-canvas/core/commit/817e244bb2187532df7142199917412ccfe8d218))
|
||||||
* useAnimator utility ([ad32e8a](https://github.com/motion-canvas/core/commit/ad32e8a0add494021d4c5c9fe5b3915189f00a08))
|
* useAnimator utility ([ad32e8a](https://github.com/motion-canvas/core/commit/ad32e8a0add494021d4c5c9fe5b3915189f00a08))
|
||||||
* waveform data ([400a756](https://github.com/motion-canvas/core/commit/400a756ebf7ee174d8cbaf03f1f74eddd1b75925))
|
* waveform data ([400a756](https://github.com/motion-canvas/core/commit/400a756ebf7ee174d8cbaf03f1f74eddd1b75925))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -53,18 +53,16 @@ the public release to npm, the version will be reset back to `1.0.0`.
|
|||||||
git checkout -b my-fix-branch master
|
git checkout -b my-fix-branch master
|
||||||
```
|
```
|
||||||
3. Update the code.
|
3. Update the code.
|
||||||
4. Format your code with prettier (`npm run prettier:fix`).
|
4. Commit your changes using a **descriptive commit message** that follows
|
||||||
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].
|
[Angular Commit Message Conventions][commit-format].
|
||||||
```shell
|
```shell
|
||||||
git commit --all
|
git commit --all
|
||||||
```
|
```
|
||||||
7. Push your branch to GitHub:
|
5. Push your branch to GitHub:
|
||||||
```shell
|
```shell
|
||||||
git push origin my-fix-branch
|
git push origin my-fix-branch
|
||||||
```
|
```
|
||||||
8. In GitHub, send a pull request to [the master branch][master]
|
6. In GitHub, send a pull request to [the master branch][master]
|
||||||
and **request a review** from [aarthificial](https://github.com/aarthificial).
|
and **request a review** from [aarthificial](https://github.com/aarthificial).
|
||||||
|
|
||||||
### Addressing review feedback
|
### Addressing review feedback
|
||||||
|
|||||||
108
README.md
108
README.md
@@ -1,17 +1,19 @@
|
|||||||
# Motion Canvas Core
|
# Motion Canvas Core
|
||||||
|
|
||||||
[](https://github.com/semantic-release/semantic-release)
|
[](https://lernajs.io/)
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
The API is a subject to change and may vary drastically in newer versions.
|
The API is a subject to change and may vary drastically in newer versions.
|
||||||
|
|
||||||
Documentation is still lacking and will be expanded in the following weeks.
|
[The current documentation][docs] is still lacking and will be expanded in
|
||||||
|
the following weeks.
|
||||||
|
|
||||||
## Using Motion Canvas
|
## Using Motion Canvas
|
||||||
|
|
||||||
Make sure that [Node.js](https://nodejs.org/) is installed on your machine.
|
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:
|
The recommended version is 16. You can check the currently installed version
|
||||||
|
using:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
node -v
|
node -v
|
||||||
@@ -19,10 +21,11 @@ node -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).
|
[Detailed information on how to authenticate][authenticate].
|
||||||
|
|
||||||
1. Generate a PAT (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`.
|
1. On [github.com](https://github.com),
|
||||||
|
go to `Settings` > `Developer settings` > `Personal access tokens`.
|
||||||
2. Click `Generate new token`.
|
2. Click `Generate new token`.
|
||||||
3. Enter the note for your token, for instance `npm`.
|
3. Enter the note for your token, for instance `npm`.
|
||||||
4. Choose `read:packages` from the available scopes.
|
4. Choose `read:packages` from the available scopes.
|
||||||
@@ -46,8 +49,8 @@ node -v
|
|||||||
|
|
||||||
### Set up a project
|
### Set up a project
|
||||||
|
|
||||||
You can use [the project template](https://github.com/motion-canvas/project-template#using-the-template) to quickly bootstrap your project.
|
You can use [the project template][template] to quickly bootstrap your
|
||||||
Otherwise, below are the steps to set it up manually:
|
project. Otherwise, below are the steps to set it up manually:
|
||||||
|
|
||||||
1. Create a directory for your project and open it in a terminal.
|
1. Create a directory for your project and open it in a terminal.
|
||||||
2. Initialize a new npm package inside:
|
2. Initialize a new npm package inside:
|
||||||
@@ -79,7 +82,7 @@ Otherwise, below are the steps to set it up manually:
|
|||||||
|
|
||||||
export default makeKonvaScene(function* example(view) {
|
export default makeKonvaScene(function* example(view) {
|
||||||
// animation code goes here
|
// animation code goes here
|
||||||
|
|
||||||
yield* waitFor(5);
|
yield* waitFor(5);
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@@ -129,84 +132,47 @@ Start your project using the `serve` script:
|
|||||||
npm run serve
|
npm run serve
|
||||||
```
|
```
|
||||||
|
|
||||||
You can now open Motion Canvas in your browser by visiting [http://localhost:9000/](http://localhost:9000/).
|
You can now open Motion Canvas in your browser by visiting
|
||||||
|
[http://localhost:9000/](http://localhost:9000/).
|
||||||
|
|
||||||
The API documentation is available at [http://localhost:9000/api/](http://localhost:9000/api/).
|
In case of any problems, please visit [our discord server][discord].
|
||||||
|
|
||||||
In case of any problems, please visit [our discord server](https://www.patreon.com/posts/53003221).
|
|
||||||
|
|
||||||
## Developing Motion Canvas locally
|
## Developing Motion Canvas locally
|
||||||
|
|
||||||
I recommend using [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) for local development.
|
The project is maintained as one monorepo containing the following packages:
|
||||||
|
|
||||||
1. Set up the following directory structure:
|
| Name | Description |
|
||||||
```text
|
| ---------- | -------------------------------------------------------- |
|
||||||
motion-canvas/
|
| `core` | All logic related to running and rendering animations. |
|
||||||
├─ packages/
|
| `ui` | The user interface used for editing. |
|
||||||
│ ├─ core/ <- Cloned from GitHub
|
| `template` | A template project included for developer's convenience. |
|
||||||
│ ├─ ui/ <- Cloned from GitHub
|
|
||||||
│ └─ example/ <- Set up like a normal project but don't install anything
|
After cloning the repo, run `npm install` in the root of the project to install
|
||||||
├─ .npmrc
|
all necessary dependencies.
|
||||||
└─ package.json
|
|
||||||
```
|
|
||||||
2. Configure workspaces in the root `package.json`:
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "motion-canvas",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"build:core": "npm run build -w packages/core",
|
|
||||||
"watch:core": "npm run watch -w packages/core",
|
|
||||||
"build:ui": "npm run build -w packages/ui",
|
|
||||||
"serve:ui": "npm run serve -w packages/ui",
|
|
||||||
"serve:example": "npm run serve -w packages/example"
|
|
||||||
},
|
|
||||||
"workspaces": ["packages/*"]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
3. Run `npm install` in the root of your project to configure the symlinks.
|
|
||||||
4. Install Motion Canvas in the `example` project using workspaces:
|
|
||||||
```shell
|
|
||||||
npm i @motion-canvas/core @motion-canvas/ui -w packages/example
|
|
||||||
```
|
|
||||||
5. Run `build:core` and `build:ui` to generate the necessary files.
|
|
||||||
|
|
||||||
### Developing Core
|
### Developing Core
|
||||||
|
|
||||||
When developing the core, start both `watch:core` and `serve:example`.
|
When developing the core, start both `core:watch` and `template:serve`.
|
||||||
|
|
||||||
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.
|
automatically rebuild the `template` project and refresh the page.
|
||||||
|
|
||||||
### Developing UI
|
### Developing UI
|
||||||
|
|
||||||
If you want to develop the UI, create a new npm script in the `example` project:
|
If you want to develop the UI, start both `ui:serve` and `template:ui`.
|
||||||
|
|
||||||
```json
|
`ui:serve` will start another webpack dev server specifically for the UI.
|
||||||
{
|
Meanwhile, `template:ui` will start the template project with a `--ui-server`
|
||||||
"scripts": {
|
flag that will load the UI from said server instead of a static file.
|
||||||
"ui": "motion-canvas src/project.ts --ui-server"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
And add it in your root `package.json`:
|
You can combine it with `core:ui` to develop everything at once.
|
||||||
|
|
||||||
```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.
|
|
||||||
|
|
||||||
You can combine it with `watch:core` to develop everything at once.
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Read through our [Contribution Guide](./CONTRIBUTING.md) to learn how you can help make Motion Canvas better.
|
Read through our [Contribution Guide](./CONTRIBUTING.md) to learn how you can
|
||||||
|
help make Motion Canvas better.
|
||||||
|
|
||||||
|
[authenticate]: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token
|
||||||
|
[template]: https://github.com/motion-canvas/project-template#using-the-template
|
||||||
|
[discord]: https://www.patreon.com/posts/53003221
|
||||||
|
[docs]: https://motion-canvas.github.io/api
|
||||||
|
|||||||
6
commitlint.config.js
Normal file
6
commitlint.config.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ['@commitlint/config-conventional'],
|
||||||
|
rules: {
|
||||||
|
'scope-enum': [2, 'always', ['core', 'ui']],
|
||||||
|
},
|
||||||
|
};
|
||||||
11
lerna.json
Normal file
11
lerna.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||||
|
"useNx": true,
|
||||||
|
"useWorkspaces": true,
|
||||||
|
"private": false,
|
||||||
|
"version": "9.0.0",
|
||||||
|
"ignoreChanges": ["**/*.test.ts", "**/*.md"],
|
||||||
|
"message": "ci(release): %v [skip ci]",
|
||||||
|
"conventionalCommits": true,
|
||||||
|
"createRelease": "github"
|
||||||
|
}
|
||||||
26438
package-lock.json
generated
26438
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
97
package.json
97
package.json
@@ -1,77 +1,32 @@
|
|||||||
{
|
{
|
||||||
"name": "@motion-canvas/core",
|
"name": "motion-canvas",
|
||||||
"version": "9.0.0",
|
"private": true,
|
||||||
"description": "Web-based tool for creating animations programmatically",
|
"workspaces": [
|
||||||
"main": "lib/bootstrap.js",
|
"packages/*"
|
||||||
"author": "motion-canvas",
|
|
||||||
"license": "MIT",
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsc -p tsconfig.build.json",
|
|
||||||
"watch": "tsc -p tsconfig.build.json -w",
|
|
||||||
"test": "jest",
|
|
||||||
"lint": "eslint \"src/**/*.ts?(x)\"",
|
|
||||||
"lint:fix": "eslint --fix \"src/**/*.ts?(x)\"",
|
|
||||||
"prettier": "prettier --check \"src/**/*\"",
|
|
||||||
"prettier:fix": "prettier --write \"src/**/*\"",
|
|
||||||
"docs": "typedoc",
|
|
||||||
"docs:watch": "typedoc --watch",
|
|
||||||
"release": "semantic-release"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
|
||||||
"registry": "https://npm.pkg.github.com/motion-canvas"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/motion-canvas/core.git"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"motion-canvas": "bin/index.mjs"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib",
|
|
||||||
"bin",
|
|
||||||
"api",
|
|
||||||
"tsconfig.project.json"
|
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"scripts": {
|
||||||
"@types/prismjs": "^1.26.0",
|
"prepare": "husky install",
|
||||||
"@types/three": "^0.141.0",
|
"core:build": "npm run build -w packages/core",
|
||||||
"@types/webpack-env": "^1.17.0",
|
"core:watch": "npm run watch -w packages/core",
|
||||||
"colorjs.io": "^0.3.0",
|
"core:test": "npm run test -w packages/core",
|
||||||
"html-webpack-plugin": "^5.5.0",
|
"ui:build": "npm run build -w packages/ui",
|
||||||
"image-size": "^1.0.1",
|
"ui:serve": "npm run serve -w packages/ui",
|
||||||
"konva": "^8.3.9",
|
"template:serve": "npm run serve -w packages/template",
|
||||||
"meow": "^10.1.2",
|
"template:ui": "npm run ui -w packages/template"
|
||||||
"mix-color": "^1.1.2",
|
|
||||||
"mp4box": "^0.5.2",
|
|
||||||
"prismjs": "^1.28.0",
|
|
||||||
"source-map": "^0.7.4",
|
|
||||||
"three": "^0.141.0",
|
|
||||||
"ts-loader": "^9.3.0",
|
|
||||||
"typescript": "^4.7.3",
|
|
||||||
"webpack": "^5.73.0",
|
|
||||||
"webpack-cli": "^4.9.2",
|
|
||||||
"webpack-dev-server": "^4.9.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@semantic-release/changelog": "^6.0.1",
|
"@commitlint/cli": "^17.0.3",
|
||||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
"@commitlint/config-conventional": "^17.0.3",
|
||||||
"@semantic-release/git": "^10.0.1",
|
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
||||||
"@semantic-release/github": "^8.0.4",
|
"@typescript-eslint/parser": "^5.32.0",
|
||||||
"@semantic-release/npm": "^9.0.1",
|
"eslint": "^8.21.0",
|
||||||
"@semantic-release/release-notes-generator": "^10.0.3",
|
"husky": "^8.0.0",
|
||||||
"@types/dom-webcodecs": "^0.1.4",
|
"lerna": "^5.3.0",
|
||||||
"@types/jest": "^28.1.4",
|
"lint-staged": "^13.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
"prettier": "^2.7.1"
|
||||||
"@typescript-eslint/parser": "^5.27.1",
|
},
|
||||||
"canvas-5-polyfill": "^0.1.5",
|
"lint-staged": {
|
||||||
"eslint": "^8.17.0",
|
"*.{ts,tsx}": "eslint --fix",
|
||||||
"jest": "^28.1.2",
|
"*.{ts,tsx,md,scss}": "prettier --write"
|
||||||
"jest-canvas-mock": "^2.4.0",
|
|
||||||
"jest-environment-jsdom": "^28.1.2",
|
|
||||||
"prettier": "^2.6.2",
|
|
||||||
"semantic-release": "^19.0.2",
|
|
||||||
"ts-jest": "^28.0.5",
|
|
||||||
"typedoc": "^0.23.10"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
0
bin/index.mjs → packages/core/bin/index.mjs
Executable file → Normal file
0
bin/index.mjs → packages/core/bin/index.mjs
Executable file → Normal file
61
packages/core/package.json
Normal file
61
packages/core/package.json
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"name": "@motion-canvas/core",
|
||||||
|
"version": "9.0.0",
|
||||||
|
"description": "Web-based tool for creating animations programmatically",
|
||||||
|
"main": "lib/bootstrap.js",
|
||||||
|
"author": "motion-canvas",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -p tsconfig.build.json",
|
||||||
|
"watch": "tsc -p tsconfig.build.json -w",
|
||||||
|
"test": "jest",
|
||||||
|
"lint": "eslint \"src/**/*.ts?(x)\"",
|
||||||
|
"lint:fix": "eslint --fix \"src/**/*.ts?(x)\"",
|
||||||
|
"prettier": "prettier --check \"src/**/*\"",
|
||||||
|
"prettier:fix": "prettier --write \"src/**/*\""
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "https://npm.pkg.github.com/aarthificial"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/aarthificial/motion-canvas.git"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"motion-canvas": "bin/index.mjs"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"bin",
|
||||||
|
"tsconfig.project.json"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@types/prismjs": "^1.26.0",
|
||||||
|
"@types/three": "^0.141.0",
|
||||||
|
"@types/webpack-env": "^1.17.0",
|
||||||
|
"colorjs.io": "^0.3.0",
|
||||||
|
"html-webpack-plugin": "^5.5.0",
|
||||||
|
"image-size": "^1.0.1",
|
||||||
|
"konva": "^8.3.9",
|
||||||
|
"meow": "^10.1.2",
|
||||||
|
"mix-color": "^1.1.2",
|
||||||
|
"mp4box": "^0.5.2",
|
||||||
|
"prismjs": "^1.28.0",
|
||||||
|
"source-map": "^0.7.4",
|
||||||
|
"three": "^0.141.0",
|
||||||
|
"ts-loader": "^9.3.0",
|
||||||
|
"typescript": "^4.7.3",
|
||||||
|
"webpack": "^5.73.0",
|
||||||
|
"webpack-cli": "^4.9.2",
|
||||||
|
"webpack-dev-server": "^4.9.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/dom-webcodecs": "^0.1.4",
|
||||||
|
"@types/jest": "^28.1.4",
|
||||||
|
"canvas-5-polyfill": "^0.1.5",
|
||||||
|
"jest": "^28.1.2",
|
||||||
|
"jest-canvas-mock": "^2.4.0",
|
||||||
|
"jest-environment-jsdom": "^28.1.2",
|
||||||
|
"ts-jest": "^28.0.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user