Skip to content

Commit

Permalink
build: migrate build to Vite (#19)
Browse files Browse the repository at this point in the history
This commit moves the build to Vite, simplifying the build setup.

BREAKING CHANGE: the build now targets Vite's default target, which is
browsers natively supporting ES modules. This means that the code may
not work on older platforms without transpilation.
  • Loading branch information
Ian Johnson authored Dec 27, 2021
1 parent 4fe589b commit 7662e7e
Show file tree
Hide file tree
Showing 29 changed files with 9,136 additions and 3,598 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode
dist
node_modules
website
18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
plugins: ["@typescript-eslint", "eslint-plugin-tsdoc"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
rules: {
"tsdoc/syntax": "error",
},
ignorePatterns: [".eslintrc.cjs", "jest.config.cjs", "vite.config.ts"],
};
16 changes: 0 additions & 16 deletions .eslintrc.json

This file was deleted.

7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [12, 14, 16, 17]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm run build
- run: npm test
env:
CI: true
2 changes: 1 addition & 1 deletion .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16'
node-version: 16
- name: Build pitchy
run: |
npm ci
Expand Down
68 changes: 3 additions & 65 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,65 +1,3 @@
lib/
umd/

## From https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
.vscode
dist
node_modules
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.vscode
dist
node_modules
website/.docusaurus
website/build
website/docs/api
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"proseWrap": "always"
}
20 changes: 20 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"branches": [
"main",
{ "name": "beta", "prerelease": true },
{ "name": "alpha", "prerelease": true }
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{ "type": "build", "scope": "deps", "release": "patch" }
]
}
],
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic
Versioning](http://semver.org/spec/v2.0.0.html).
and this project adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

Expand All @@ -13,8 +13,8 @@ Versioning](http://semver.org/spec/v2.0.0.html).
### Changed

- The pitch detection algorithm is now more accurate, using quadratic
interpolation as described in [the MPM
paper](http://www.cs.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf)
interpolation as described in
[the MPM paper](http://www.cs.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf)
to get a better estimate of the clearest frequency.

## [2.0.3] - 2021-01-02
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2018 Ian Johnson
Copyright 2018-2021 Ian Johnson

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
Expand Down
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
# pitchy

[![npm](https://img.shields.io/npm/v/pitchy.svg)](https://www.npmjs.com/package/pitchy)
[![Travis](https://img.shields.io/travis/ianprime0509/pitchy.svg)](https://travis-ci.org/ianprime0509/pitchy)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/ianprime0509/pitchy/CI)

pitchy is a simple pitch-detection library written entirely in JavaScript that
aims to be fast and accurate enough to be used in real-time applications such as
tuners. To do this, it uses the McLeod Pitch Method, described in the paper [A
Smarter Way to Find
Pitch](http://www.cs.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf)
tuners. To do this, it uses the McLeod Pitch Method, described in the paper
[A Smarter Way to Find Pitch](http://www.cs.otago.ac.nz/tartini/papers/A_Smarter_Way_to_Find_Pitch.pdf)
by Philip McLeod and Geoff Wyvill.

## Installation

You can install pitchy using npm:
You can install pitchy using NPM (or similar tools such as Yarn):

```sh
```shell
npm install pitchy
```

Alternatively, to use pitchy in a simple web page without any bundler tools, you
can use [unpkg](https://unpkg.com). This is the approach taken in the simple
example under the `examples/simple` directory in this project: just include the
following `script` tag in your page and then access the contents of the library
under the `pitchy` global object:
You can also use a CDN, such as [esm.sh](https://esm.sh), directly from a
browser or Deno:

```html
<script src="https://unpkg.com/pitchy@2.1.0/umd/index.js"></script>
```js
import { PitchDetector } from "https://esm.sh/pitchy@3";
```

## Examples and documentation

For examples and documentation, see the [project
site](https://ianjohnson.dev/pitchy).
For examples and documentation, see the
[project site](https://ianjohnson.dev/pitchy).

## License

This is free software, distributed under the [MIT
license](https://opensource.org/licenses/MIT).
This is free software, distributed under the
[MIT license](https://opensource.org/licenses/MIT).
7 changes: 0 additions & 7 deletions babel.config.json

This file was deleted.

4 changes: 4 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: "ts-jest",
resolver: "ts-jest-resolver",
};
Loading

0 comments on commit 7662e7e

Please sign in to comment.