Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveKeehl committed Jan 4, 2023
2 parents 431523d + 8174293 commit f90eedd
Show file tree
Hide file tree
Showing 19 changed files with 7,575 additions and 1,782 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI/CD

on:
push:
branches:
- main
- develop

jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Instal dependencies
run: npm install

- name: Build
run: npm run build

- name: Upload build artifact
uses: actions/upload-artifact@master
with:
name: build-artifact
path: ./fonts-jar.tgz
retention-days: 1

CD:
needs: [CI]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download artifact
uses: actions/download-artifact@master
with:
name: build-artifact
path: ./fonts-jar.tgz

# - name: Upload to Chrome Web Store
# uses: mnao305/[email protected]
# with:
# file-path: ./fonts-jar.tgz
# extension-id: fonts-jar
# client-id: ${{ secrets.CLIENT_ID }}
# refresh-token: ${{ secrets.REFRESH_TOKEN }}
# publish-target: trustedTesters
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2.0] - 2023-01-04
### Added
- Created utility function `isUrlLegal` and refactored parts of the codebase to use it
### Changed
- Website ignore regex is now optional
- Improved website types
- Fixed typos
- Strengthened regex to ignore websites
- Refactored code to increase code quality
- Updated selectors to match the updated Google Fonts website
- Updated github workflow

## [0.1.1] - 2022-05-31
### Changed
Expand All @@ -19,4 +27,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Initial beta release

[0.1.0]: https://github.com/DaveKeehl/fonts-jar/releases/tag/0.1.0
[0.1.1]: https://github.com/DaveKeehl/fonts-jar/compare/0.1.0...0.1.1
[0.1.1]: https://github.com/DaveKeehl/fonts-jar/compare/0.1.0...0.1.1
[0.2.0]: https://github.com/DaveKeehl/fonts-jar/compare/0.1.1...0.2.0
7 changes: 4 additions & 3 deletions lib/chrome.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { websites } from '../src/content_script/constants';
import { isUrlLegal } from '../src/content_script/utils';
import type { TypefaceTuple } from 'types';

/**
Expand Down Expand Up @@ -60,7 +61,7 @@ export const getCollections = (favorites: TypefaceTuple[]) => {

/**
* Function that checks whether a property key exists within a given object.
* @param object - The object that might have the key in.
* @param arg - The object that might have the key in.
* @param key - The key to check in the object.
* @returns It returns the key value if the key exists, else either undefined (if it's not an object in the first place) or false (if the object doesn't have that key).
*/
Expand Down Expand Up @@ -147,9 +148,9 @@ export const hasLegalOrigin = (favorite: unknown) => {
const websitesRegex = websites.map((website) => website.regex);

const isValidName = websiteNames.some((websiteName) => websiteName === name);
const isValidUrl = websitesRegex.some((websiteRegex) => new RegExp(websiteRegex).test(url));
const hasValidUrl = websitesRegex.some((websiteRegex) => isUrlLegal(url, websiteRegex));

return origin && isValidName && isValidUrl;
return origin && isValidName && hasValidUrl;
};

/**
Expand Down
Loading

0 comments on commit f90eedd

Please sign in to comment.