From 165956a803adecc1b28a80307d4a1981b2a59dfa Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Wed, 17 Jul 2024 15:45:55 -0400 Subject: [PATCH] Removed the GitHub Actions workflow for Node.js CI and updated the release workflow to use the R2 upload action. --- .github/workflows/node.js.yml | 30 --------------------------- .github/workflows/release.yml | 15 ++++++++------ docs/pages/components/icon.md | 15 ++++++++++++++ scripts/make-icons.js | 4 ++-- src/components/icon/library.custom.ts | 6 +++--- src/components/icon/library.ts | 3 ++- src/shoelace-autoloader.ts | 6 ------ 7 files changed, 31 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index c74c047..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Node.js CI - -on: - push: - branches: [next] - pull_request: - branches: [next] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npx playwright install --with-deps - - run: npm ci - - run: npm run verify diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7449ea9..6becbd5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,15 +3,18 @@ name: Create GitHub Release on: push: - tags: - - "v2.*" - - "v3.*" + branches: + - "master" jobs: release: runs-on: ubuntu-latest steps: - - uses: "marvinpinto/action-automatic-releases@v1.2.1" + - uses: ryand56/r2-upload-action@latest with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false + r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} + r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} + r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} + r2-bucket: cdn-sonr-id + source-dir: cdn + destination-dir: ./ diff --git a/docs/pages/components/icon.md b/docs/pages/components/icon.md index 9a8b8bd..f22439b 100644 --- a/docs/pages/components/icon.md +++ b/docs/pages/components/icon.md @@ -224,6 +224,21 @@ If an icon is used before registration occurs, it will be empty initially but sh The following examples demonstrate how to register a number of popular, open source icon libraries via CDN. Feel free to adapt the code as you see fit to use your own origin or naming conventions. +### OxyIcons + +Custom Sonr Icons. + +```html:preview +
+ + + + + + +
+``` + ### Boxicons This will register the [Boxicons](https://boxicons.com/) library using the jsDelivr CDN. This library has three variations: regular (`bx-*`), solid (`bxs-*`), and logos (`bxl-*`). A mutator function is required to set the SVG's `fill` to `currentColor`. diff --git a/scripts/make-icons.js b/scripts/make-icons.js index 30fff1b..b305709 100644 --- a/scripts/make-icons.js +++ b/scripts/make-icons.js @@ -12,7 +12,7 @@ import { globby } from 'globby'; import path from 'path'; const { outdir } = commandLineArgs({ name: 'outdir', type: String }); -const customIconDir = path.join(outdir, '/icons'); +const customIconDir = path.join(outdir, '/assets/oxyicons'); const iconDir = path.join(outdir, '/assets/icons'); const iconPackageData = JSON.parse(await fs.readFile('./node_modules/bootstrap-icons/package.json', 'utf8')); @@ -37,7 +37,7 @@ await Promise.all([ ]); await fs.mkdir(customIconDir, { recursive: true }); -await Promise.all([copy('./icons', iconDir)]); +await Promise.all([copy('./icons', customIconDir)]); // Generate metadata const files = await globby(`${srcPath}/docs/content/icons/**/*.md`); diff --git a/src/components/icon/library.custom.ts b/src/components/icon/library.custom.ts index 2b7e1c6..59b34a4 100644 --- a/src/components/icon/library.custom.ts +++ b/src/components/icon/library.custom.ts @@ -1,9 +1,9 @@ import { getBasePath } from '../../utilities/base-path.js'; import type { IconLibrary } from './library.js'; -const customLibrary: IconLibrary = { +const library: IconLibrary = { name: 'oxy', - resolver: name => getBasePath(`icons/${name}.svg`) + resolver: name => getBasePath(`assets/oxyicons/${name}.svg`) }; -export default customLibrary; +export default library; diff --git a/src/components/icon/library.ts b/src/components/icon/library.ts index 202f54a..7fde094 100644 --- a/src/components/icon/library.ts +++ b/src/components/icon/library.ts @@ -1,3 +1,4 @@ +import customLibrary from './library.custom.js'; import defaultLibrary from './library.default.js'; import systemLibrary from './library.system.js'; import type SlIcon from '../icon/icon.js'; @@ -11,7 +12,7 @@ export interface IconLibrary { spriteSheet?: boolean; } -let registry: IconLibrary[] = [defaultLibrary, systemLibrary]; +let registry: IconLibrary[] = [defaultLibrary, systemLibrary, customLibrary]; let watchedIcons: SlIcon[] = []; /** Adds an icon to the list of watched icons. */ diff --git a/src/shoelace-autoloader.ts b/src/shoelace-autoloader.ts index 3310c27..4b42c45 100644 --- a/src/shoelace-autoloader.ts +++ b/src/shoelace-autoloader.ts @@ -1,10 +1,4 @@ import { getBasePath } from './utilities/base-path.js'; -import { registerIconLibrary } from './utilities/icon-library.js'; - -registerIconLibrary('oxy', { - resolver: name => `https://cdn.sonr.id/icons/${name}.svg`, - mutator: svg => svg.setAttribute('fill', 'currentColor') -}); const observer = new MutationObserver(mutations => { for (const { addedNodes } of mutations) {