Skip to content

Commit

Permalink
tonal package instead of @tonaljs/tonal (#344)
Browse files Browse the repository at this point in the history
* feat: create tonal package without prefix

* feat: use `tonal` instead of `@tonaljs/tonal`

* chore: remove lerna mention in contributing

* feat: add instructions on publishing

* chore: copy readme

* chore: fix typo and release

* fix: package names
  • Loading branch information
danigb authored Nov 18, 2022
1 parent a4889a6 commit b120fc4
Show file tree
Hide file tree
Showing 41 changed files with 772 additions and 136 deletions.
27 changes: 27 additions & 0 deletions .changeset/stale-roses-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
"@tonaljs/abc-notation": minor
"@tonaljs/chord": minor
"@tonaljs/chord-detect": minor
"@tonaljs/chord-type": minor
"@tonaljs/collection": minor
"@tonaljs/duration-value": minor
"@tonaljs/interval": minor
"@tonaljs/key": minor
"@tonaljs/midi": minor
"@tonaljs/mode": minor
"@tonaljs/modules": minor
"@tonaljs/note": minor
"@tonaljs/pcset": minor
"@tonaljs/progression": minor
"@tonaljs/range": minor
"@tonaljs/roman-numeral": minor
"@tonaljs/scale": minor
"@tonaljs/scale-type": minor
"@tonaljs/time-signature": minor
"tonal": minor
"@tonaljs/voice-leading": minor
"@tonaljs/voicing": minor
"@tonaljs/voicing-dictionary": minor
---

Publish tonal in `tonal` package. So use `npm install tonal` instead of `npm install @tonaljs/tonal`
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tonal

[![npm version](https://img.shields.io/npm/v/@tonaljs/tonal.svg?style=flat-square)](https://www.npmjs.com/package/@tonaljs/tonal)
[![npm version](https://img.shields.io/npm/v/tonal.svg?style=flat-square)](https://www.npmjs.com/package/tonal)
[![build status](https://img.shields.io/github/workflow/status/tonaljs/tonal/tests?style=flat-square)](https://github.com/tonaljs/tonal/actions)
![minified size](https://img.shields.io/badge/minified-31.1kb-blue?style=flat-square)
![gzipped size](https://img.shields.io/badge/gzipped-11.01kb-blue?style=flat-square)
Expand All @@ -18,7 +18,7 @@ mutation, and entities are represented by data structures instead of objects.
## Example

```js
import { Interval, Note, Scale } from "@tonaljs/tonal";
import { Interval, Note, Scale } from "tonal";

Note.midi("A4"); // => 60
Note.freq("a4").freq; // => 440
Expand All @@ -34,7 +34,7 @@ Scale.get("C major").notes; // =>["C", "D", "E", "F", "G", "A", "B"];
Install all packages at once:

```bash
npm install --save @tonaljs/tonal
npm install --save tonal
```

## Usage
Expand All @@ -44,21 +44,21 @@ Tonal is compatible with both ES5 and ES6 modules, and browser.
#### ES6 `import`:

```js
import { Note, Scale } from "@tonaljs/tonal";
import { Note, Scale } from "tonal";
```

#### ES5 `require`:

```js
const { Note, Scale } = require("@tonaljs/tonal");
const { Note, Scale } = require("tonal");
```

#### Browser

You can use the browser version from jsdelivr CDN directly in your html:

```html
<script src="https://cdn.jsdelivr.net/npm/@tonaljs/tonal/browser/tonal.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tonal/browser/tonal.min.js"></script>
<script>
console.log(Tonal.Key.minorKey("Ab"));
</script>
Expand All @@ -70,11 +70,13 @@ from the repository.

#### Bundle size

`@tonaljs/tonal` includes all published modules.
`tonal` includes all published modules.

Although the final bundle it is small (~10kb minified and gzipped), you can
Although the final bundle it is small, you can
reduce bundle sizes even more by installing the modules individually, and
importing only the functions you need:
importing only the functions you need.

Note that individual modules are prefixed with `@tonaljs`. For example:

```bash
npm i @tonaljs/note
Expand All @@ -87,11 +89,11 @@ transpose("A4", "P5");

## Documentation

Generally, you just need to install:
Generally, you just need to install `tonal` package (before it was called `@tonaljs/tonal`).

- [@tonaljs/tonal](/packages/tonal): All modules bundled in one package
- [tonal](/packages/tonal): All modules bundled in one package

The API documentation lives inside README.md file of each module
The API documentation is inside README.md of each module 👇

#### Notes and intervals

Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Adopt a fixed/locked mode with lerna. Before, each module has it's own version.

Deprecated modules:

- @tonaljs/modules (use @tonaljs/tonal)
- @tonaljs/modules (use tonal)
- @tonaljs/array (use @tonaljs/collection)

#### Releases
Expand Down
16 changes: 15 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,21 @@ To create a new module:
- Add a new folder inside packages: `packages/my-module`
- Add a new package.json inside the folder (see any of them as an example)
- Add required dependencies to "dependencies" inside package.json. Ensure correct dependency versions. For example, if your module needs to use `tonal/core` look at core's package.json to see what version to use
- After adding your dependencies, use lerna to wire them up: run `yarn lerna` at root folder
- Add your functionality and tests
- Ensure everything works: run `yarn test:ci` at root folder
- Create a pull request

## Release

Releases are built using changesets: https://turbo.build/repo/docs/handbook/publishing-packages/versioning-and-publishing:

```
# Add a new changeset
yarn changeset
# Create new versions of packages
yarn changeset version
# Publish all changed packages to npm
yarn changeset publish
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "tonal-workspace",
"name": "workspace",
"private": true,
"workspaces": [
"packages/*"
Expand Down
4 changes: 2 additions & 2 deletions packages/abc-notation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
ES6:

```js
import { AbcNotation } from "@tonaljs/tonal";
import { AbcNotation } from "tonal";
```

nodejs:

```js
const { AbcNotation } = require("@tonaljs/tonal");
const { AbcNotation } = require("tonal");
```

## API
Expand Down
4 changes: 2 additions & 2 deletions packages/chord-detect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
With ES6 `import`:

```js
import { Chord } from "@tonaljs/tonal";
import { Chord } from "tonal";
```

With ES5 `require`:

```js
const { Chord } = require("@tonaljs/tonal");
const { Chord } = require("tonal");
```

Standalone:
Expand Down
2 changes: 1 addition & 1 deletion packages/chord-detect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"chord-detect",
"music",
"theory",
"@tonaljs/tonal"
"tonal"
],
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
8 changes: 4 additions & 4 deletions packages/chord-type/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
ES6:

```js
import { ChordType } from "@tonaljs/tonal";
import { ChordType } from "tonal";
```

node:

```js
const { ChordType } = require("@tonaljs/tonal");
const { ChordType } = require("tonal");
```

## API
Expand Down Expand Up @@ -71,8 +71,8 @@ add(["1P", "3M", "5P"], ["M"], "mayor");

```js
ChordType.all()
.filter(get => get.length === 3)
.map(get => get.name);
.filter((get) => get.length === 3)
.map((get) => get.name);
```

#### How to add a chord type to the dictionary?
Expand Down
4 changes: 2 additions & 2 deletions packages/chord/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
ES6:

```js
import { Chord } from "@tonaljs/tonal";
import { Chord } from "tonal";
```

Nodejs:

```js
const { Chord } = require("@tonaljs/tonal");
const { Chord } = require("tonal");
```

## API
Expand Down
4 changes: 2 additions & 2 deletions packages/collection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
ES6:

```js
import { Collection } from "@tonaljs/tonal";
import { Collection } from "tonal";
```

node:

```js
const { Collection } = require("@tonaljs/tonal");
const { Collection } = require("tonal");
```

## API
Expand Down
4 changes: 2 additions & 2 deletions packages/duration-value/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
ES6:

```js
import { DurationValue } from "@tonaljs/tonal";
import { DurationValue } from "tonal";
```

node:

```js
const { DurationValue } = require("@tonaljs/tonal");
const { DurationValue } = require("tonal");
```

single module:
Expand Down
4 changes: 2 additions & 2 deletions packages/interval/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
ES6:

```js
import { Interval } from "@tonaljs/tonal";
import { Interval } from "tonal";
```

nodejs:

```js
const { Interval } = require("@tonaljs/tonal");
const { Interval } = require("tonal");
```

## API
Expand Down
4 changes: 2 additions & 2 deletions packages/key/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Get scale and chords of major and minor keys.
ES6:

```js
import { Key } from "@tonaljs/tonal";
import { Key } from "tonal";
```

nodejs:

```js
const { Key } = require("@tonaljs/tonal");
const { Key } = require("tonal");
```

## API
Expand Down
4 changes: 2 additions & 2 deletions packages/midi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
ES6:

```js
import { Midi } from "@tonaljs/tonal";
import { Midi } from "tonal";
```

nodejs:

```js
const { Midi } = require("@tonaljs/tonal");
const { Midi } = require("tonal");
```

## API
Expand Down
6 changes: 3 additions & 3 deletions packages/mode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
ES6:

```js
import { Mode } from "@tonaljs/tonal";
import { Mode } from "tonal";
```

node:

```js
const { Mode } = require("@tonaljs/tonal");
const { Mode } = require("tonal");
```

## API
Expand Down Expand Up @@ -109,7 +109,7 @@ Mode.relativeTonic("minor", "major", "C"); // => "A"
For example, "A major" mode:

```js
import { Mode, Note } from "@tonaljs/tonal";
import { Mode, Note } from "tonal";

Mode.get("major").intervals.map(Note.transposeFrom("A"));
["A", "B", "C#", "D", "E", "F#", "G#"];
Expand Down
2 changes: 1 addition & 1 deletion packages/modules/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

- Bug fixing
- Updated dependencies
- @tonaljs/tonal@4.6.10
- [email protected]
2 changes: 1 addition & 1 deletion packages/modules/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Deprecated

## Use: [@tonaljs/tonal](/packages/tonal)
## Use: [tonal](/packages/tonal)
2 changes: 1 addition & 1 deletion packages/modules/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "@tonaljs/tonal";
export * from "tonal";
2 changes: 1 addition & 1 deletion packages/modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"types": "dist/index.d.ts",
"dependencies": {
"@tonaljs/tonal": "^4.6.10"
"tonal": "^4.6.10"
},
"author": "[email protected]",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/note/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
ES6:

```js
import { Note } from "@tonaljs/tonal";
import { Note } from "tonal";
```

nodejs:

```js
const { Note } = require("@tonaljs/tonal");
const { Note } = require("tonal");
```

## API
Expand Down
Loading

0 comments on commit b120fc4

Please sign in to comment.