Skip to content

Commit

Permalink
Add Prettier and run it against the project
Browse files Browse the repository at this point in the history
  • Loading branch information
reinink committed Mar 30, 2023
1 parent 20c6123 commit af8933a
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
jobs:
build:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
contents: write # for softprops/action-gh-release to create GitHub release

runs-on: ubuntu-latest

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-insiders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ jobs:
run: |
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: "Version `heroicons` based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}"
- name: 'Version `heroicons` based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}'
run: npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version

- name: "Version `@heroicons/react` based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}"
- name: 'Version `@heroicons/react` based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}'
run: npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version --prefix react

- name: "Version `@heroicons/vue` based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}"
- name: 'Version `@heroicons/vue` based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}'
run: npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version --prefix vue

- name: Publish `heroicons`
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ jobs:
echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
- name: Publish `heroicons`
run: npm publish --tag ${{ env.RELEASE_CHANNEL }}
run: npm publish --tag ${{ env.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish `@heroicons/react`
run: npm publish ./react --tag ${{ env.RELEASE_CHANNEL }}
run: npm publish ./react --tag ${{ env.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish `@heroicons/vue`
run: npm publish ./vue --tag ${{ env.RELEASE_CHANNEL }}
run: npm publish ./vue --tag ${{ env.RELEASE_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@
<a href="https://heroicons.com"><strong>Browse at Heroicons.com &rarr;</strong></a>
</p>


<p align="center">
<a href="https://github.com/tailwindlabs/heroicons/releases"><img src="https://img.shields.io/npm/v/heroicons" alt="Latest Release"></a>
<a href="https://github.com/tailwindlabs/heroicons/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/heroicons.svg" alt="License"></a>
</p>


## Basic Usage

The quickest way to use these icons is to simply copy the source for the icon you need from [heroicons.com](https://heroicons.com) and inline it directly into your HTML:

```html
<svg class="h-6 w-6 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<svg
class="h-6 w-6 text-gray-500"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="2"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
Expand All @@ -54,7 +58,7 @@ import { BeakerIcon } from '@heroicons/react/24/solid'
function MyComponent() {
return (
<div>
<BeakerIcon className="h-6 w-6 text-blue-500"/>
<BeakerIcon className="h-6 w-6 text-blue-500" />
<p>...</p>
</div>
)
Expand All @@ -67,10 +71,9 @@ Icons use an upper camel case naming convention and are always suffixed with the

[Browse the full list of icon names on UNPKG &rarr;](https://unpkg.com/browse/@heroicons/react/24/outline/)


## Vue

*Note that this library currently only supports Vue 3.*
_Note that this library currently only supports Vue 3._

First, install `@heroicons/vue` from npm:

Expand All @@ -83,7 +86,7 @@ Now each icon can be imported individually as a Vue component:
```vue
<template>
<div>
<BeakerIcon class="h-6 w-6 text-blue-500"/>
<BeakerIcon class="h-6 w-6 text-blue-500" />
<p>...</p>
</div>
</template>
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@svgr/core": "^5.5.0",
"@vue/compiler-dom": "^3.0.5",
"camelcase": "^6.0.0",
"prettier": "^2.8.7",
"rimraf": "^3.0.2",
"svgo": "^1.3.2"
}
Expand Down
2 changes: 1 addition & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module.exports = {
singleQuote: true,
semi: false,
printWidth: 100,
};
}
46 changes: 21 additions & 25 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,43 +121,43 @@ async function buildExports(styles) {
}

// For those that want to read the version from package.json
pkg[`./package.json`] = { "default": "./package.json" }
pkg[`./package.json`] = { default: './package.json' }

// Backwards compatibility with v1 imports (points to proxy that prints an error message):
pkg["./outline"] = { "default": "./outline/index.js" }
pkg["./outline/index"] = { "default": "./outline/index.js" }
pkg["./outline/index.js"] = { "default": "./outline/index.js" }
pkg["./solid"] = { "default": "./solid/index.js" }
pkg["./solid/index"] = { "default": "./solid/index.js" }
pkg["./solid/index.js"] = { "default": "./solid/index.js" }
pkg['./outline'] = { default: './outline/index.js' }
pkg['./outline/index'] = { default: './outline/index.js' }
pkg['./outline/index.js'] = { default: './outline/index.js' }
pkg['./solid'] = { default: './solid/index.js' }
pkg['./solid/index'] = { default: './solid/index.js' }
pkg['./solid/index.js'] = { default: './solid/index.js' }

// Explicit exports for each style:
for (let style of styles) {
pkg[`./${style}`] = {
"types": `./${style}/index.d.ts`,
"import": `./${style}/index.js`,
"require": `./${style}/index.js`
types: `./${style}/index.d.ts`,
import: `./${style}/index.js`,
require: `./${style}/index.js`,
}
pkg[`./${style}/*`] = {
"types": `./${style}/*.d.ts`,
"import": `./${style}/esm/*.js`,
"require": `./${style}/*.js`
types: `./${style}/*.d.ts`,
import: `./${style}/esm/*.js`,
require: `./${style}/*.js`,
}
pkg[`./${style}/*.js`] = {
"types": `./${style}/*.d.ts`,
"import": `./${style}/esm/*.js`,
"require": `./${style}/*.js`
types: `./${style}/*.d.ts`,
import: `./${style}/esm/*.js`,
require: `./${style}/*.js`,
}

// This dir is basically an implementation detail, but it's needed for
// backwards compatibility in case people were importing from it directly.
pkg[`./${style}/esm/*`] = {
"types": `./${style}/*.d.ts`,
"import": `./${style}/esm/*.js`
types: `./${style}/*.d.ts`,
import: `./${style}/esm/*.js`,
}
pkg[`./${style}/esm/*.js`] = {
"types": `./${style}/*.d.ts`,
"import": `./${style}/esm/*.js`
types: `./${style}/*.d.ts`,
import: `./${style}/esm/*.js`,
}
}

Expand Down Expand Up @@ -193,11 +193,7 @@ async function main(package) {

let packageJson = JSON.parse(await fs.readFile(`./${package}/package.json`, 'utf8'))

packageJson.exports = await buildExports([
'20/solid',
'24/outline',
'24/solid',
])
packageJson.exports = await buildExports(['20/solid', '24/outline', '24/solid'])

await ensureWriteJson(`./${package}/package.json`, packageJson)

Expand Down

0 comments on commit af8933a

Please sign in to comment.