Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Apr 26, 2024
0 parents commit f29d6e4
Show file tree
Hide file tree
Showing 21 changed files with 6,126 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.js]
indent_style = space
indent_size = 2

[{package.json,*.yml,*.cjson}]
indent_style = space
indent_size = 2
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/---bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 🐛 Bug report
description: Something's not working
labels: [bug]
body:
- type: textarea
validations:
required: true
attributes:
label: 🐛 The bug
description: What isn't working? Describe what the bug is.
- type: input
validations:
required: true
attributes:
label: 🛠️ To reproduce
description: A reproduction of the bug via https://stackblitz.com/github/danielroe/unifont/tree/main/playground
placeholder: https://stackblitz.com/[...]
- type: textarea
validations:
required: true
attributes:
label: 🌈 Expected behaviour
description: What did you expect to happen? Is there a section in the docs about this?
- type: textarea
attributes:
label: ℹ️ Additional context
description: Add any other context about the problem here.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/---feature-suggestion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 🆕 Feature suggestion
description: Suggest an idea
labels: [enhancement]
body:
- type: textarea
validations:
required: true
attributes:
label: 🆒 Your use case
description: Add a description of your use case, and how this feature would help you.
placeholder: When I do [...] I would expect to be able to do [...]
- type: textarea
validations:
required: true
attributes:
label: 🆕 The solution you'd like
description: Describe what you want to happen.
- type: textarea
attributes:
label: 🔍 Alternatives you've considered
description: Have you considered any alternative solutions or features?
- type: textarea
attributes:
label: ℹ️ Additional info
description: Is there any other context you think would be helpful to know?
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: ci

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: 📦 Install dependencies
run: pnpm install

- name: 🔠 Lint project
run: pnpm lint

test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: 📦 Install dependencies
run: pnpm install

- name: 🛠 Build project
run: pnpm build

- name: 🧪 Test project
run: pnpm test -- --coverage

- name: 🟩 Coverage
uses: codecov/codecov-action@v4
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "31 15 * * 5"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ javascript ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
dist
node_modules
coverage
.vscode
.DS_Store
.eslintcache
*.log*
*.env*
47 changes: 47 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributor Covenant Code of Conduct

## Our pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [[email protected]](mailto:[email protected]). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Daniel Roe

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:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# unifont

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions][github-actions-src]][github-actions-href]
[![Codecov][codecov-src]][codecov-href]

> Framework agnostic tools for accessing data from font CDNs and providers
## Usage

Install package:

```sh
# npm
npm install unifont

# pnpm
pnpm install unifont
```

```js
import {} from 'unifont'
```

## 💻 Development

- Clone this repository
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`

## License

Made with ❤️

Published under [MIT License](./LICENCE).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/unifont?style=flat-square
[npm-version-href]: https://npmjs.com/package/unifont
[npm-downloads-src]: https://img.shields.io/npm/dm/unifont?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/unifont
[github-actions-src]: https://img.shields.io/github/workflow/status/danielroe/unifont/ci/main?style=flat-square
[github-actions-href]: https://github.com/danielroe/unifont/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/danielroe/unifont/main?style=flat-square
[codecov-href]: https://codecov.io/gh/danielroe/unifont
16 changes: 16 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { cp, readdir, rm } from 'node:fs/promises'
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
hooks: {
'rollup:done': async function () {
// default to .js and .d.ts extensions
for (const file of await readdir('dist')) {
if (file.endsWith('.mjs') || file.endsWith('.d.mts')) {
await cp(`dist/${file}`, `dist/${file.replace('.mjs', '.js').replace('.d.mts', '.d.ts')}`)
await rm(`dist/${file}`)
}
}
},
},
})
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import antfu from '@antfu/eslint-config'

export default antfu()
55 changes: 55 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "unifont",
"type": "module",
"version": "0.0.0",
"packageManager": "[email protected]",
"description": "Framework agnostic tools for accessing data from font CDNs and providers",
"license": "MIT",
"repository": "danielroe/unifont",
"sideEffects": false,
"exports": {
".": "./dist/index.js"
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "vitest dev",
"lint": "eslint . --fix",
"prepare": "simple-git-hooks",
"prepack": "pnpm build",
"prepublishOnly": "pnpm lint && pnpm test",
"release": "bumpp && npm publish",
"test": "pnpm test:unit && pnpm test:types",
"test:unit": "vitest",
"test:types": "tsc --noEmit"
},
"devDependencies": {
"@antfu/eslint-config": "latest",
"@types/node": "20.12.7",
"@vitest/coverage-v8": "latest",
"bumpp": "^9.4.0",
"eslint": "latest",
"lint-staged": "latest",
"simple-git-hooks": "latest",
"typescript": "latest",
"unbuild": "latest",
"vite": "latest",
"vitest": "latest"
},
"resolutions": {
"unifont": "link:."
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged"
},
"lint-staged": {
"*.{js,ts,mjs,cjs,json,.*rc}": [
"pnpm eslint --fix"
]
}
}
7 changes: 7 additions & 0 deletions playground/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import assert from 'node:assert'
import * as pkg from 'unifont'

// eslint-disable-next-line no-console
console.log(pkg.welcome())

assert.strictEqual(pkg.welcome(), 'hello world')
10 changes: 10 additions & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "module",
"private": true,
"scripts": {
"dev": "node index.js"
},
"dependencies": {
"unifont": "latest"
}
}
Loading

0 comments on commit f29d6e4

Please sign in to comment.