Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
matronator committed Jul 8, 2024
0 parents commit 805ed41
Show file tree
Hide file tree
Showing 22 changed files with 390 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: [matronator]
patreon: matronator
open_collective: # Replace with a single Open Collective username
ko_fi: matronator
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.paypal.me/matronator', 'https://www.blockchain.com/btc/address/35VRpVQaqFWjUCnVRpGineShz76QyYgSVg']
Binary file added .github/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:best-practices",
":pinOnlyDevDependencies",
":ignoreModulesAndTests",
":preserveSemverRanges",
"group:all",
"schedule:weekly",
":maintainLockFilesMonthly"
],
"labels": ["dependencies", "renovate"],
"lockFileMaintenance": {
"commitMessageAction": "Update",
"extends": [
"group:all"
]
},
"separateMajorMinor": false,
"autoApprove": true,
"automerge": true,
"pruneBranchAfterAutomerge": true,
"automergeType": "branch"
}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
build
dist
dist-ssr
*.local
coverage

# Editor directories and files
.vscode/*
.history/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"./**/*.{ts,html,json}": "npm run format"
}
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
coverage
test
node_modules
*.log
.lintstagedrc
.prettierignore
.prettierrc
favicon.ico
vite.config.js
dts-bundle-generator.config.json
tsconfig.json
index.html
.vscode
.github
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.history
.husky
.vscode
coverage
dist
node_modules
.github
15 changes: 15 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"printWidth": 120,
"tabWidth": 4,
"singleQuote": false,
"trailingComma": "es5",
"arrowParens": "avoid",
"bracketSpacing": true,
"useTabs": false,
"endOfLine": "auto",
"singleAttributePerLine": false,
"bracketSameLine": false,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"semi": true
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log

All notable changes to the "Ping Tracker" project will be documented in this file.

## [0.1.0] - 2024-06-29

- Initial release
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2024 Matronator

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.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Vite TypeScript Library Starter

![Ping Tracker logo](.github/logo.png)

![NPM Version](https://img.shields.io/npm/v/package-name)
![NPM Downloads](https://img.shields.io/npm/dw/package-name)
![npm TypeScript version](https://img.shields.io/npm/dependency-version/package-name/dev/typescript)
![Tree shaking](https://badgen.net/bundlephobia/tree-shaking/package-name)
![Dependencies](https://badgen.net/bundlephobia/dependency-count/package-name)
![npm package minimized gzipped size](https://img.shields.io/bundlejs/size/package-name)
![Commits](https://badgen.net/github/commits/username/repository)
![Issues](https://img.shields.io/github/issues/username/repository.svg)
![License](https://img.shields.io/github/license/username/repository.svg)
<a href="https://github.com/matronator">![Follow](https://img.shields.io/github/followers/matronator.svg?style=social&label=Follow&maxAge=2592000)</a>
<a href="https://github.com/sponsors/matronator/">![GitHub Sponsors](https://img.shields.io/github/sponsors/matronator)</a>

A starter template to use for developing libraries with Vite and TypeScript.

## Tech-stack

- [Bun](https://bunpkg.com/) - A package manager for the web (faster alternative to npm and yarn)
- [Vite](https://vitejs.dev/) - A next-generation front-end tooling
- [TypeScript](https://www.typescriptlang.org/) - A typed superset of JavaScript
- [Vitest](https://vitest.dev/) - A test runner for Vite
- [Prettier](https://prettier.io/) - An opinionated code formatter
- [Renovate](https://www.mend.io/renovate/) - Automated dependency updates
- [np](https://github.com/sindresorhus/np) - A better `npm publish`

## Installation

1. Clone this repository, or
2. Click on "Use this template" button, or
3. Download the repository as a ZIP file, or
4. Use [degit](https://github.com/Rich-Harris/degit), like this:

```
bunx degit matronator/vite-ts-lib-starter my-new-library
```

## After installation

1. Change the `package.json` file to match your library's name, description, author, etc.
2. Change the `outFile` field in the `dts-bundle-generator.config.js` file to match your library's name.
3. Replace the logo with your own.
4. Modify `FUNDING.yml` in the `.github` folder with your own values or remove it completely.
5. Replace the `README.md` file with your own.
6. Change the name in the `LICENSE.md` file.
7. Replace the `CHANGELOG.md` file with your own.
8. Start creating your library in the `src` folder.
9. Write some tests in the `tests` folder.
10. When you're ready to publish your library, run `npm run build` to generate the production files.
11. Publish your library to npm with either `npm publish`, or `npm run release` to use `np` for a better publishing experience.
Binary file added bun.lockb
Binary file not shown.
11 changes: 11 additions & 0 deletions dts-bundle-generator.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const config = {
entries: [
{
filePath: "./src/index.ts",
outFile: "./dist/package-name.d.ts",
noCheck: false,
},
],
};

module.exports = config;
15 changes: 15 additions & 0 deletions favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/index.ts"></script>
</body>
</html>
87 changes: 87 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"name": "package-name",
"version": "0.1.0",
"author": {
"name": "Author Name",
"email": "[email protected]",
"url": "https://website.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/username/repository.git"
},
"main": "./dist/package-name.cjs",
"module": "./dist/package-name.mjs",
"devDependencies": {
"@types/jsdom": "^21.1.6",
"@types/node": "^20.11.5",
"@vitest/coverage-v8": "^1.2.1",
"dts-bundle-generator": "^9.2.4",
"jsdom": "^24.1.0",
"lint-staged": "^15.2.0",
"np": "^10.0.6",
"prettier": "^3.2.4",
"terser": "^5.31.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"upgradeps": "^2.0.6",
"vite": "^5.0.12",
"vitest": "^1.2.1"
},
"exports": {
".": {
"require": "./dist/package-name.cjs",
"import": "./dist/package-name.mjs",
"types": "./dist/package-name.d.ts"
},
"./dist/": {
"import": "./dist/",
"require": "./dist/",
"types": "./dist/"
}
},
"bugs": {
"url": "https://github.com/username/repository/issues"
},
"description": "Package description.",
"files": [
"dist",
"README.md",
"LICENSE.md",
"CHANGELOG.md",
"src",
"package.json"
],
"funding": [
{
"type": "individual",
"url": "https://support.example.com"
}
],
"homepage": "https://github.com/username/repository#readme",
"keywords": ["some", "keywords"],
"license": "MIT",
"private": false,
"scripts": {
"dev": "vite --host",
"build": "rm -rf dist/* && tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts",
"test": "vitest",
"test:coverage": "vitest --coverage",
"format": "prettier . --write",
"upgrade": "upgradeps",
"release": "npm run build && np"
},
"sponsor": {
"url": "https://sponsor.example.com"
},
"type": "module",
"types": "./dist/package-name.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist/package-name.d.ts"
]
}
},
"typings": "./dist/package-name.d.ts"
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { sum } from "./sum";
3 changes: 3 additions & 0 deletions src/sum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function sum(a: number, b: number): number {
return a + b;
}
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
8 changes: 8 additions & 0 deletions test/sum.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { assert, describe, it } from 'vitest';
import { sum } from '../src/index';

describe("construct", () => {
it("should return 3", () => {
assert.equal(sum(1, 2), 3);
});
});
29 changes: 29 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"rootDir": ".",
"paths": {
"@/*": ["./src/*"],
"@@/*": ["./*"]
},
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ESNext", "DOM"],
"moduleResolution": "Node",
"strict": true,
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true,
"types": ["vite/client", "node"],
"declaration": true,
"declarationDir": "dist",
"listEmittedFiles": true
},
"include": ["src", "dist/index.d.ts"],
"exclude": ["**/*.test.ts", "node_modules", "test/**", ".history/**"]
}
Loading

0 comments on commit 805ed41

Please sign in to comment.