Skip to content

Commit

Permalink
Change platform to Bun.js
Browse files Browse the repository at this point in the history
  • Loading branch information
PKief committed Jul 1, 2024
1 parent 80001fb commit b76b878
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 5,489 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js ⚙️
uses: actions/setup-node@v3

- name: Setup Platform 🛠
uses: oven-sh/setup-bun@v2
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Install node_modules 📦
run: npm ci
- name: Test + Build ⚒️
bun-version: 1.1.17

- name: Install dependencies 📦
run: |
bun install --frozen-lockfile
- name: Lint and Build ⚒️
run: |
# npm test
npm run lint
npm run build
bun run lint
bun run build
36 changes: 22 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
type: choice
description: Select the version change
required: true
default: 'minor'
options:
- major
- minor
Expand All @@ -22,39 +23,46 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js ⚙️
uses: actions/setup-node@v3

- name: Setup Platform 🛠
uses: oven-sh/setup-bun@v2
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Install node_modules 📦
bun-version: 1.1.13

- name: Install dependencies 📦
run: |
npm ci
bun install --frozen-lockfile
bun add -g npm
- name: Update version ↗
run: |
git config --global user.name 'Philipp Kief'
git config --global user.email '[email protected]'
git config --global push.followTags true
npm version ${{ env.VERSION_CHANGE }} -m "Release %s"
- name: Get meta data 🔍
run: |
NODE_VERSION=$(node -p -e "require('./package.json').version")
echo VERSION=$NODE_VERSION >> $GITHUB_ENV
NODE_NAME=$(node -p -e "require('./package.json').name")
echo NAME=$NODE_NAME >> $GITHUB_ENV
NODE_DISPLAY_NAME=$(node -p -e "require('./package.json').displayName")
echo DISPLAY_NAME=$NODE_DISPLAY_NAME >> $GITHUB_ENV
VERSION=$(bun --print "(await import('./package.json')).version")
NAME=$(bun --print "(await import('./package.json')).name")
DISPLAY_NAME=$(bun --print "(await import('./package.json')).displayName")
echo VERSION=$VERSION >> $GITHUB_ENV
echo NAME=$NAME >> $GITHUB_ENV
echo DISPLAY_NAME=$DISPLAY_NAME >> $GITHUB_ENV
- name: Build ⚒️
run: npm run build
run: bun run build

- name: Push tags 📌
run: git push

- name: Release ${{ env.VERSION }} 🔆
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.VERSION }}
name: ${{ env.DISPLAY_NAME }} v${{ env.VERSION }}
generate_release_notes: true

- name: Publish to NPM Registry 🚀
run: npm publish
env:
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
}
},
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2022 Philipp Kief
Copyright (c) 2023 Philipp Kief

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
The tool can be executed with this command:

```
npx svg-icon-review file1.svg file2.svg
bunx svg-icon-review file1.svg file2.svg
```

It also supports glob file patterns to check multiple files matching the pattern like this:

```
npx svg-icon-review ./images/**/*.svg
bunx svg-icon-review ./images/**/*.svg
```

The output is a preview of how the icons look in either dark or light backgrounds:
Expand All @@ -32,7 +32,7 @@ The output is a preview of how the icons look in either dark or light background
Optionally, an additional bigger icon (in size of 32x32px) will be shown in front of the preview. This is useful to see the icon in more detail. This can be done by adding the `--bigIcon` option like this:

```bash
npx svg-icon-review --bigIcon file1.svg file2.svg
bunx --bun svg-icon-review --bigIcon file1.svg file2.svg
```

The preview will look like this:
Expand All @@ -42,5 +42,37 @@ The preview will look like this:
If further help is needed, the `--help` option can be used:

```bash
npx svg-icon-review --help
bunx --bun svg-icon-review --help
```

> Instead of "bunx" you can use "npx" if you prefer Node.js.
## Development

For the development of this tool, Bun.js is used. First you have to install the dependencies:

```bash
bun install
```

Then you can run the tool with:

```bash
bun run start
```

It is going to create a preview image of the logo.svg file in the root directory.

### Formatting and Linting

To format the code, run:

```bash
bun run format
```

To lint the code, run:

```bash
bun run lint
```
1 change: 0 additions & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#!/usr/bin/env node
require('../lib/cli/index.js');
Binary file added bun.lockb
Binary file not shown.
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

Loading

0 comments on commit b76b878

Please sign in to comment.