Skip to content

Commit

Permalink
feat: 🎸 dotLottie v2 (#89)
Browse files Browse the repository at this point in the history
* feat: 🎸 dotLottie v2
---------

Co-authored-by: samuelOsborne <[email protected]>
  • Loading branch information
theashraf and samuelOsborne authored Jan 20, 2025
1 parent 2566abe commit 55f2a5c
Show file tree
Hide file tree
Showing 166 changed files with 14,212 additions and 11,124 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": ["node-example", "next-example", "react-example", "vue-example"]
}
5 changes: 0 additions & 5 deletions .changeset/many-emus-cough.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/shiny-cherries-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@dotlottie/dotlottie-js': major
---

added support for v2 dotLottie files. Added retro-compatibility for v1 dotLotties.
5 changes: 0 additions & 5 deletions .changeset/tricky-drinks-care.md

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: beta
on:
push:
branches:
- 'beta'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]

- name: ⬇️ Checkout repo
uses: actions/checkout@v2

- name: ⎔ Setup pnpm@9
uses: pnpm/action-setup@v2
with:
version: 9

- name: ⎔ Setup Node@18
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: 18

- name: 📥 Download deps
run: pnpm install

- name: 🏗 Build
run: pnpm build

- name: 🔍 Verify types
run: pnpm type-check

- name: 💅 Verify format (`pnpm format` committed?)
run: pnpm format --check --no-write

- name: 🕵️ Lint
run: pnpm lint

- name: 🛡️ Test
run: |
npx playwright install --with-deps
pnpm test
- name: 📏 Report bundle size
uses: andresz1/size-limit-action@v1
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

release:
needs: validate
runs-on: ubuntu-latest
if: ${{ github.repository == 'dotlottie/dotlottie-js' && github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v2
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}

- name: ⎔ Setup pnpm@9
uses: pnpm/action-setup@v2
with:
version: 9

- name: ⎔ Setup Node@18
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: 18

- name: 📥 Download deps
run: pnpm install

- name: 🏗 Build
run: pnpm build
working-directory: packages/dotlottie-js
14 changes: 8 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- 'main'
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -19,10 +18,10 @@ jobs:
- name: ⬇️ Checkout repo
uses: actions/checkout@v2

- name: ⎔ Setup pnpm@8
- name: ⎔ Setup pnpm@9
uses: pnpm/action-setup@v2
with:
version: 8
version: 9

- name: ⎔ Setup Node@18
uses: actions/setup-node@v3
Expand All @@ -46,7 +45,9 @@ jobs:
run: pnpm lint

- name: 🛡️ Test
run: pnpm test
run: |
npx playwright install --with-deps
pnpm test
- name: 📏 Report bundle size
uses: andresz1/size-limit-action@v1
Expand All @@ -64,10 +65,10 @@ jobs:
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}

- name: ⎔ Setup pnpm@8
- name: ⎔ Setup pnpm@9
uses: pnpm/action-setup@v2
with:
version: 8
version: 9

- name: ⎔ Setup Node@18
uses: actions/setup-node@v3
Expand All @@ -80,6 +81,7 @@ jobs:

- name: 🏗 Build
run: pnpm build
working-directory: packages/dotlottie-js

- name: 🚀 Release
uses: changesets/action@v1
Expand Down
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ releases/
.next/
.nuxt/

apps/node/
apps/node/

.changeset/
4 changes: 2 additions & 2 deletions apps/next/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "next",
"name": "next-example",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -9,7 +9,7 @@
"start": "next start"
},
"dependencies": {
"@dotlottie/dotlottie-js": "workspace:^",
"@dotlottie/dotlottie-js": "workspace:*",
"@dotlottie/player-component": "1.3.2",
"@types/node": "18.0.6",
"@types/react": "18.0.37",
Expand Down
6 changes: 1 addition & 5 deletions apps/next/src/pages/api/create-dotlottie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2023 Design Barn Inc.
*/

import { DotLottie } from '@dotlottie/dotlottie-js/node';
import { DotLottie } from '@dotlottie/dotlottie-js';
import type { NextApiRequest, NextApiResponse } from 'next';

interface Data {
Expand All @@ -14,18 +14,14 @@ export default async function handler(_req: NextApiRequest, res: NextApiResponse
let dotLottieAsBuffer = null;

await dotLottie
.setAuthor('Joe')
.setVersion('1.0')
.addAnimation({
id: 'animation_1',
// eslint-disable-next-line no-secrets/no-secrets
url: 'https://lottie.host/18b639d1-a200-4225-ba0e-3456d40f95a5/wlrsaqWa8r.json',
autoplay: true,
})
.addAnimation({
id: 'animation_2',
url: 'https://lottie.host/cf7b43d1-3d6b-407a-970b-6305b18bebfa/uB1Jboo1o1.json',
autoplay: true,
})
.build()
.then(async (value) => {
Expand Down
4 changes: 0 additions & 4 deletions apps/next/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ export default function Home(): JSX.Element {
const dotlottie = new Dotlottiejs();

await dotlottie
.setAuthor('Joe')
.setVersion('1.0')
.addAnimation({
id: 'animation_1',
// eslint-disable-next-line no-secrets/no-secrets
url: 'https://lottie.host/18b639d1-a200-4225-ba0e-3456d40f95a5/wlrsaqWa8r.json',
autoplay: true,
})
.addAnimation({
id: 'animation_2',
url: 'https://lottie.host/cf7b43d1-3d6b-407a-970b-6305b18bebfa/uB1Jboo1o1.json',
autoplay: true,
})
.build()
.then((value) => {
Expand Down
6 changes: 1 addition & 5 deletions apps/next/src/pages/ssProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright 2023 Design Barn Inc.
*/

import { DotLottie } from '@dotlottie/dotlottie-js/node';
import { DotLottie } from '@dotlottie/dotlottie-js';

import styles from '@/styles/Home.module.css';

Expand All @@ -18,18 +18,14 @@ export async function getServerSideProps(): Promise<{
const dotlottie = new DotLottie();

await dotlottie
.setAuthor('Joe')
.setVersion('1.0')
.addAnimation({
id: 'animation_1',
// eslint-disable-next-line no-secrets/no-secrets
url: 'https://lottie.host/18b639d1-a200-4225-ba0e-3456d40f95a5/wlrsaqWa8r.json',
autoplay: true,
})
.addAnimation({
id: 'animation_2',
url: 'https://lottie.host/cf7b43d1-3d6b-407a-970b-6305b18bebfa/uB1Jboo1o1.json',
autoplay: true,
})
.build();

Expand Down
4 changes: 0 additions & 4 deletions apps/node/audio_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import { getAnimation, getAudio, getAllAudio } from '@dotlottie/dotlottie-js/nod

// const dl = await
// dotLottie
// .setAuthor('Sam!')
// .setVersion('1.0')
// .addAnimation({
// id: 'audio',
// // url: 'https://assets10.lottiefiles.com/packages/lf20_tykuirhr.json',
Expand Down Expand Up @@ -64,8 +62,6 @@ import { getAnimation, getAudio, getAllAudio } from '@dotlottie/dotlottie-js/nod
const double = new DotLottie();

const doubleAnimation = await double
.setAuthor('Sam!')
.setVersion('1.0')
.addAnimation({
id: 'audio_0',
// url: 'https://assets10.lottiefiles.com/packages/lf20_tykuirhr.json',
Expand Down
4 changes: 0 additions & 4 deletions apps/node/lf-interactivity-page-generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ async function createDotLottie() {
// Can't change to a different animation
// TODO: MACROS!! START_FRAME / END_FRAME
const dl = await dotLottie
.setAuthor('Sam!')
.setVersion('1.0')
.addAnimation({
id: 'segments',
url: 'https://assets2.lottiefiles.com/packages/lf20_4fET62.json',
Expand Down Expand Up @@ -608,8 +606,6 @@ async function createSingles() {
const stateSegments = new DotLottie();

await stateSegments
.setAuthor('Sam!')
.setVersion('1.0')
.addAnimation({
id: 'segments',
url: 'https://assets2.lottiefiles.com/packages/lf20_4fET62.json',
Expand Down
5 changes: 3 additions & 2 deletions apps/node/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "node",
"name": "node-example",
"private": true,
"version": "1.0.0",
"description": "",
"author": "",
Expand All @@ -8,6 +9,6 @@
"keywords": [],
"scripts": {},
"dependencies": {
"@dotlottie/dotlottie-js": "workspace:^"
"@dotlottie/dotlottie-js": "workspace:*"
}
}
Loading

0 comments on commit 55f2a5c

Please sign in to comment.