diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f624242..2898186 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,17 +11,13 @@ jobs: permissions: contents: read - strategy: - matrix: - node-version: [14.x] - steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Cache NPM - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-npm with: @@ -29,10 +25,10 @@ jobs: key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn-lock.json') }} restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + - name: Setup Node.js 20 + uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 registry-url: https://registry.npmjs.org/ - name: Install dependencies run: yarn @@ -40,16 +36,16 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} - name: Build project run: yarn build - - name: Serve example app - continue-on-error: false - run: yarn run serve - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} - - name: Build project and run tests - continue-on-error: false - run: yarn run run-tests - env: - NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} + # - name: Serve example app + # continue-on-error: false + # run: yarn run serve + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} + # - name: Build project and run tests + # continue-on-error: false + # run: yarn run run-tests + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }} release-npm: needs: build @@ -61,15 +57,11 @@ jobs: id-token: write # Required for provenance packages: write # Required for publishing - strategy: - matrix: - node-version: [14.x] - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 registry-url: https://registry.npmjs.org/ - run: yarn install env: @@ -95,15 +87,16 @@ jobs: name: Release gpr runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] + permissions: + contents: read + id-token: write # Required for provenance + packages: write # Required for publishing steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 registry-url: https://npm.pkg.github.com/ - run: yarn install env: diff --git a/package.json b/package.json index d1d8712..b2be4f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lottiefiles/lottie-player", - "version": "2.0.11", + "version": "2.0.12", "description": "Lottie animation and Telegram Sticker player web components.", "main": "dist/lottie-player.js", "module": "dist/lottie-player.esm.js", @@ -11,9 +11,7 @@ "author": "Jawish Hameed ", "license": "MIT", "scripts": { - "prestart": "node -p \"'export const LOTTIE_PLAYER_VERSION = ' + JSON.stringify(require('./package.json').version) + '; \\n' + 'export const LOTTIE_WEB_VERSION = ' + JSON.stringify(require('./package.json').dependencies['lottie-web']) + ';'\" > src/versions.ts", "start": "npm run cleanup && rollup -c --watch", - "prebuild": "node -p \"'export const LOTTIE_PLAYER_VERSION = ' + JSON.stringify(require('./package.json').version) + '; \\n' + 'export const LOTTIE_WEB_VERSION = ' + JSON.stringify(require('./package.json').dependencies['lottie-web']) + ';'\" > src/versions.ts", "build": "npm run cleanup && npm run build-lottie && npm run build-tgs", "build-with-coverage": "npm run cleanup && CODE_COVERAGE=true npm run build-lottie && CODE_COVERAGE=true npm run build-tgs", "build-lottie": "rollup -c ", @@ -46,9 +44,9 @@ "@commitlint/config-conventional": "^16.0.0", "@cypress/code-coverage": "^3.9.12", "@istanbuljs/nyc-config-typescript": "^1.0.2", - "@lottiefiles/eslint-plugin": "^3.0.0", "@rollup/plugin-babel": "^5.1.0", "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^13.1.3", "@semantic-release/changelog": "^6.0.1", "@semantic-release/commit-analyzer": "^9.0.2", diff --git a/rollup-tgs.config.js b/rollup-tgs.config.js index 09a2c88..ee99a06 100644 --- a/rollup-tgs.config.js +++ b/rollup-tgs.config.js @@ -10,6 +10,7 @@ import resolve from "@rollup/plugin-node-resolve"; import serve from "rollup-plugin-serve"; import { terser } from "rollup-plugin-terser"; import typescript2 from "rollup-plugin-typescript2"; +import json from "@rollup/plugin-json"; const production = !process.env.ROLLUP_WATCH; const extensions = [".js", ".jsx", ".ts", ".tsx", ".mjs"]; @@ -43,29 +44,30 @@ export default { exclude: ["./node_modules/@babel/**/*", "./node_modules/core-js/**/*"], }), !production && - copy({ - targets: [ - { src: "./src/index.html", dest: outputDir }, - { src: "./src/sticker.tgs", dest: outputDir }, - { - src: "./node_modules/@webcomponents/webcomponentsjs/bundles/", - dest: outputDir, - }, - { - src: "./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js", - dest: outputDir, - }, - ], - }), + copy({ + targets: [ + { src: "./src/index.html", dest: outputDir }, + { src: "./src/sticker.tgs", dest: outputDir }, + { + src: "./node_modules/@webcomponents/webcomponentsjs/bundles/", + dest: outputDir, + }, + { + src: "./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js", + dest: outputDir, + }, + ], + }), filesize(), !production && - serve({ - contentBase: [outputDir], - open: true, - host: "localhost", - port: 10001, - }), + serve({ + contentBase: [outputDir], + open: true, + host: "localhost", + port: 10001, + }), production && terser(), + json(), ], }; diff --git a/rollup.config.js b/rollup.config.js index 845255c..afb55b4 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -10,6 +10,7 @@ import resolve from "@rollup/plugin-node-resolve"; import serve from "rollup-plugin-serve"; import { terser } from "rollup-plugin-terser"; import typescript2 from "rollup-plugin-typescript2"; +import json from "@rollup/plugin-json"; const production = !process.env.ROLLUP_WATCH; const extensions = [".js", ".jsx", ".ts", ".tsx", ".mjs"]; @@ -44,37 +45,38 @@ export default { exclude: ["./node_modules/@babel/**/*", "./node_modules/core-js/**/*"], }), !production && - copy({ - targets: [ - { src: "./src/index.html", dest: outputDir }, - { src: "./src/worker.js", dest: outputDir }, - { src: "./src/sticker.tgs", dest: outputDir }, - { - src: "./node_modules/@webcomponents/webcomponentsjs/bundles/", - dest: outputDir, - }, - { - src: "./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js", - dest: outputDir, - }, - ], - }), + copy({ + targets: [ + { src: "./src/index.html", dest: outputDir }, + { src: "./src/worker.js", dest: outputDir }, + { src: "./src/sticker.tgs", dest: outputDir }, + { + src: "./node_modules/@webcomponents/webcomponentsjs/bundles/", + dest: outputDir, + }, + { + src: "./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js", + dest: outputDir, + }, + ], + }), filesize(), !production && - serve({ - contentBase: [outputDir], - open: true, - host: "localhost", - port: 10001, - }), + serve({ + contentBase: [outputDir], + open: true, + host: "localhost", + port: 10001, + }), production && - // uglify({ mangle: false }), - terser({ - compress: {}, - mangle: { - reserved: ["_workerSelf"], - }, - }), + // uglify({ mangle: false }), + terser({ + compress: {}, + mangle: { + reserved: ["_workerSelf"], + }, + }), + json(), ], }; diff --git a/src/lottie-player.ts b/src/lottie-player.ts index e6c59f7..ffd77d9 100644 --- a/src/lottie-player.ts +++ b/src/lottie-player.ts @@ -5,7 +5,8 @@ import { TemplateResult } from "lit/html.js"; import * as lottie from "lottie-web/build/player/lottie"; import styles from "./lottie-player.styles"; -import { LOTTIE_PLAYER_VERSION, LOTTIE_WEB_VERSION } from "./versions"; +import { version } from "../package.json"; +import { dependencies } from "../package.json"; // import ResizeObserver from "resize-observer-polyfill"; @@ -316,8 +317,8 @@ export class LottiePlayer extends LitElement { */ public getVersions(): Versions { return { - lottieWebVersion: LOTTIE_WEB_VERSION, - lottiePlayerVersion: LOTTIE_PLAYER_VERSION, + lottieWebVersion: dependencies["lottie-web"], + lottiePlayerVersion: version, }; } diff --git a/src/versions.ts b/src/versions.ts deleted file mode 100644 index 5383809..0000000 --- a/src/versions.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const LOTTIE_PLAYER_VERSION = "1.7.0"; -export const LOTTIE_WEB_VERSION = "^5.10.0";