Working on getting github actions to run (#1231)

* working on getting actions to run

* running all tests

* run on CHROME only

* Update test.yml

* ignoring node_modules

* updating typedocs

* trying to ignore compiler errors

* Update tsconfig.json

* running doc tests in parallel

* speeding up docs example tests

* Update test.yml

* testing README

* 2 spaces instead of 4

* codecov

* remove travis ci

* adding token

* updating codecov
This commit is contained in:
Yotam Mann 2024-04-25 14:06:55 -04:00 committed by GitHub
parent 08df7ad68c
commit a256ae2e6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 291 additions and 169 deletions

117
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,117 @@
name: Run tests
on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- dev
push:
branches:
- dev
jobs:
run-tests:
name: All tests
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
env:
BROWSER: chrome
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: All tests
run: npm run test
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
test-code-examples:
name: Check typedocs
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build Docs
run: npm run build && npm run docs:json
- name: tsdoc @example checks
run: npm run test:examples
test-html-examples:
name: Run HTML Examples
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Code example tests
run: npm run test:html
test-lint:
name: Linting and environment checks
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Linting
run: npm run lint
test-readme:
name: Ensure that examples in the README compile
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: 18.12.0
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Test
run: npm run test:readme

View file

@ -1,7 +1,7 @@
Tone.js
=========
[![Build Status](https://travis-ci.com/Tonejs/Tone.js.svg?branch=dev)](https://app.travis-ci.com/github/Tonejs/Tone.js) [![codecov](https://codecov.io/gh/Tonejs/Tone.js/branch/dev/graph/badge.svg)](https://codecov.io/gh/Tonejs/Tone.js)
[![codecov](https://codecov.io/gh/Tonejs/Tone.js/branch/dev/graph/badge.svg)](https://codecov.io/gh/Tonejs/Tone.js)
Tone.js is a Web Audio framework for creating interactive music in the browser. The architecture of Tone.js aims to be familiar to both musicians and audio programmers creating web-based audio applications. On the high-level, Tone offers common DAW (digital audio workstation) features like a global transport for synchronizing and scheduling events as well as prebuilt synths and effects. Additionally, Tone provides high-performance building blocks to create your own synthesizers, effects, and complex control signals.

View file

@ -91,7 +91,7 @@ export class Channel extends ToneAudioNode<ChannelOptions> {
}
/**
* Solo/unsolo the channel. Soloing is only relative to other [[Channels]] and [[Solo]] instances
* Solo/unsolo the channel. Soloing is only relative to other [[Channel]]s and [[Solo]] instances
*/
get solo(): boolean {
return this._solo.solo;

View file

@ -475,7 +475,7 @@ export class Context extends BaseContext {
/**
* Starts the audio context from a suspended state. This is required
* to initially start the AudioContext. See [[Tone.start]]
* to initially start the AudioContext. See [[start]]
*/
resume(): Promise<void> {
if (isAudioContext(this._context)) {

View file

@ -385,7 +385,7 @@ export function disconnect(
* const player1 = new Tone.Player("https://tonejs.github.io/audio/drum-samples/conga-rhythm.mp3");
* const filter = new Tone.Filter("G5").toDestination();
* // connect nodes to a common destination
* fanIn(player, player1, filter);
* Tone.fanIn(player, player1, filter);
*/
export function fanIn(...nodes: OutputNode[]): void {
const dstNode = nodes.pop();

View file

@ -97,7 +97,7 @@ export abstract class ToneWithContext<Options extends ToneWithContextOptions> ex
/**
* Convert the incoming time to seconds.
* This is calculated against the current [[Tone.Transport]] bpm
* This is calculated against the current [[Transport]] bpm
* @example
* const gain = new Tone.Gain();
* setInterval(() => console.log(gain.toSeconds("4n")), 100);

View file

@ -18,7 +18,7 @@ export interface DuoSynthOptions extends MonophonicOptions {
}
/**
* DuoSynth is a monophonic synth composed of two [[MonoSynths]] run in parallel with control over the
* DuoSynth is a monophonic synth composed of two [[MonoSynth]]s run in parallel with control over the
* frequency ratio between the two voices and vibrato effect.
* @example
* const duoSynth = new Tone.DuoSynth().toDestination();

View file

@ -285,7 +285,6 @@ export class PolySynth<Voice extends Monophonic<any> = Synth> extends Instrument
* @param notes The notes to play. Accepts a single Frequency or an array of frequencies.
* @param time When the release will be triggered.
* @example
* @example
* const poly = new Tone.PolySynth(Tone.AMSynth).toDestination();
* poly.triggerAttack(["Ab3", "C4", "F5"]);
* // trigger the release of the given notes.

View file

@ -709,11 +709,14 @@ describe("Player", () => {
setTimeout(() => {
player.restart(undefined, undefined, 1);
const checkStopTimes = new Set();
// @ts-ignore
player._activeSources.forEach(source => {
// @ts-ignore
checkStopTimes.add(source._stopTime);
});
getContext().lookAhead = originalLookAhead;
// ensure each source has a different stopTime
// @ts-ignore
expect(checkStopTimes.size).to.equal(player._activeSources.size);
done();
}, 250);

View file

@ -206,7 +206,7 @@ export class Players extends ToneAudioNode<PlayersOptions> {
* const players = new Tone.Players();
* players.add("gong", "https://tonejs.github.io/audio/berklee/gong_1.mp3", () => {
* console.log("gong loaded");
* players.get("gong").start();
* players.player("gong").start();
* });
*/
add(name: string, url: string | ToneAudioBuffer | AudioBuffer, callback?: () => void): this {

View file

@ -315,7 +315,7 @@ export class OmniOscillator<OscType extends AnyOscillator>
/**
* The width of the oscillator when sourceType === "pulse".
* See [[PWMOscillator.width]]
* See [[PWMOscillator]]
*/
get width(): IsPulseOscillator<OscType, Signal<"audioRange">> {
if (this._getOscType(this._oscillator, "pulse")) {

View file

@ -33,7 +33,7 @@
}).toDestination();
const toneMeter = new Tone.Meter({
channels: 2,
channelCount: 2,
});
player.connect(toneMeter);

View file

@ -55,7 +55,7 @@
}
// create a meter on the destination node
const toneMeter = new Tone.Meter({ channels: 2 });
const toneMeter = new Tone.Meter({ channelCount: 2 });
Tone.Destination.chain(toneMeter);
meter({
tone: toneMeter,

View file

@ -39,7 +39,7 @@
// play a snare sound through it
const player = new Tone.Player("https://tonejs.github.io/audio/drum-samples/CR78/snare.mp3").connect(feedbackDelay);
const toneMeter = new Tone.Meter({ channels: 2 });
const toneMeter = new Tone.Meter({ channelCount: 2 });
feedbackDelay.connect(toneMeter);
meter({

189
package-lock.json generated
View file

@ -1,15 +1,15 @@
{
"name": "tone",
"version": "14.8.0",
"version": "14.9.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "tone",
"version": "14.8.0",
"version": "14.9.0",
"license": "MIT",
"dependencies": {
"standardized-audio-context": "^25.3.37",
"standardized-audio-context": "^25.3.70",
"tslib": "^2.3.1"
},
"devDependencies": {
@ -47,7 +47,7 @@
"tmp-promise": "^2.1.1",
"ts-loader": "^7.0.5",
"ts-node": "^8.10.2",
"typedoc": "^0.23.24",
"typedoc": "^0.25.13",
"typescript": "^4.4.4",
"ua-parser-js": "^0.7.31",
"webpack": "^5.65.0",
@ -417,20 +417,20 @@
}
},
"node_modules/@babel/runtime": {
"version": "7.20.13",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz",
"integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==",
"version": "7.24.4",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.4.tgz",
"integrity": "sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA==",
"dependencies": {
"regenerator-runtime": "^0.13.11"
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/runtime/node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
"node_modules/@babel/template": {
"version": "7.18.10",
@ -1416,6 +1416,12 @@
"node": ">=0.10.0"
}
},
"node_modules/ansi-sequence-parser": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz",
"integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==",
"dev": true
},
"node_modules/ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
@ -1544,15 +1550,15 @@
"dev": true
},
"node_modules/automation-events": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/automation-events/-/automation-events-5.0.0.tgz",
"integrity": "sha512-SkYa2YBwgRUJNsR5v6GxeJwP5IGnYtOMW37coplTOWMUpDYYrk5j8gGOhYa765rchRln/HssFzMAck/2P6zTFw==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/automation-events/-/automation-events-7.0.4.tgz",
"integrity": "sha512-uM5VFyhksP/GzzOuGi/ygeI16ked+IA5enGLH9b+BvxUSDnfAWC54RZnnem/iprEKtuWV29FX5gvYcesPAgPAw==",
"dependencies": {
"@babel/runtime": "^7.20.7",
"tslib": "^2.4.1"
"@babel/runtime": "^7.24.4",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=14.15.4"
"node": ">=18.2.0"
}
},
"node_modules/available-typed-arrays": {
@ -6292,9 +6298,9 @@
}
},
"node_modules/jsonc-parser": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz",
"integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz",
"integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==",
"dev": true
},
"node_modules/jsonfile": {
@ -6842,9 +6848,9 @@
"dev": true
},
"node_modules/marked": {
"version": "4.2.12",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz",
"integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==",
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz",
"integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==",
"dev": true,
"bin": {
"marked": "bin/marked.js"
@ -8529,11 +8535,12 @@
}
},
"node_modules/shiki": {
"version": "0.12.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.12.1.tgz",
"integrity": "sha512-aieaV1m349rZINEBkjxh2QbBvFFQOlgqYTNtCal82hHj4dDZ76oMlQIX+C7ryerBTDiga3e5NfH6smjdJ02BbQ==",
"version": "0.14.7",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz",
"integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==",
"dev": true,
"dependencies": {
"ansi-sequence-parser": "^1.1.0",
"jsonc-parser": "^3.2.0",
"vscode-oniguruma": "^1.7.0",
"vscode-textmate": "^8.0.0"
@ -8720,13 +8727,13 @@
"dev": true
},
"node_modules/standardized-audio-context": {
"version": "25.3.37",
"resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.37.tgz",
"integrity": "sha512-lr0+RH/IJXYMts95oYKIJ+orTmstOZN3GXWVGmlkbMj8OLahREkRh7DhNGLYgBGDkBkhhc4ev5pYGSFN3gltHw==",
"version": "25.3.70",
"resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.70.tgz",
"integrity": "sha512-v07apb+yDztoTrYu6aU4DZGbbO/gkcyC/P+u+SCalDFq+eUp5kbQYnxS8Z/6tA2Vnm/YslhVaR5VzsCYafg3BQ==",
"dependencies": {
"@babel/runtime": "^7.20.7",
"automation-events": "^5.0.0",
"tslib": "^2.4.1"
"@babel/runtime": "^7.24.4",
"automation-events": "^7.0.4",
"tslib": "^2.6.2"
}
},
"node_modules/statuses": {
@ -9367,9 +9374,9 @@
}
},
"node_modules/tslib": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
"integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA=="
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"node_modules/tsutils": {
"version": "3.21.0",
@ -9445,24 +9452,24 @@
}
},
"node_modules/typedoc": {
"version": "0.23.24",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.23.24.tgz",
"integrity": "sha512-bfmy8lNQh+WrPYcJbtjQ6JEEsVl/ce1ZIXyXhyW+a1vFrjO39t6J8sL/d6FfAGrJTc7McCXgk9AanYBSNvLdIA==",
"version": "0.25.13",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.13.tgz",
"integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==",
"dev": true,
"dependencies": {
"lunr": "^2.3.9",
"marked": "^4.2.5",
"minimatch": "^5.1.2",
"shiki": "^0.12.1"
"marked": "^4.3.0",
"minimatch": "^9.0.3",
"shiki": "^0.14.7"
},
"bin": {
"typedoc": "bin/typedoc"
},
"engines": {
"node": ">= 14.14"
"node": ">= 16"
},
"peerDependencies": {
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x"
"typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x"
}
},
"node_modules/typedoc/node_modules/brace-expansion": {
@ -9475,15 +9482,18 @@
}
},
"node_modules/typedoc/node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz",
"integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
"dev": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/typescript": {
@ -10586,17 +10596,17 @@
"dev": true
},
"@babel/runtime": {
"version": "7.20.13",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz",
"integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==",
"version": "7.24.4",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.4.tgz",
"integrity": "sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA==",
"requires": {
"regenerator-runtime": "^0.13.11"
"regenerator-runtime": "^0.14.0"
},
"dependencies": {
"regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
}
}
},
@ -11376,6 +11386,12 @@
"integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==",
"dev": true
},
"ansi-sequence-parser": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz",
"integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==",
"dev": true
},
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
@ -11488,12 +11504,12 @@
"dev": true
},
"automation-events": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/automation-events/-/automation-events-5.0.0.tgz",
"integrity": "sha512-SkYa2YBwgRUJNsR5v6GxeJwP5IGnYtOMW37coplTOWMUpDYYrk5j8gGOhYa765rchRln/HssFzMAck/2P6zTFw==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/automation-events/-/automation-events-7.0.4.tgz",
"integrity": "sha512-uM5VFyhksP/GzzOuGi/ygeI16ked+IA5enGLH9b+BvxUSDnfAWC54RZnnem/iprEKtuWV29FX5gvYcesPAgPAw==",
"requires": {
"@babel/runtime": "^7.20.7",
"tslib": "^2.4.1"
"@babel/runtime": "^7.24.4",
"tslib": "^2.6.2"
}
},
"available-typed-arrays": {
@ -15284,9 +15300,9 @@
"dev": true
},
"jsonc-parser": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz",
"integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz",
"integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==",
"dev": true
},
"jsonfile": {
@ -15733,9 +15749,9 @@
"dev": true
},
"marked": {
"version": "4.2.12",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz",
"integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==",
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz",
"integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==",
"dev": true
},
"md5.js": {
@ -17037,11 +17053,12 @@
"dev": true
},
"shiki": {
"version": "0.12.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.12.1.tgz",
"integrity": "sha512-aieaV1m349rZINEBkjxh2QbBvFFQOlgqYTNtCal82hHj4dDZ76oMlQIX+C7ryerBTDiga3e5NfH6smjdJ02BbQ==",
"version": "0.14.7",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz",
"integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==",
"dev": true,
"requires": {
"ansi-sequence-parser": "^1.1.0",
"jsonc-parser": "^3.2.0",
"vscode-oniguruma": "^1.7.0",
"vscode-textmate": "^8.0.0"
@ -17192,13 +17209,13 @@
"dev": true
},
"standardized-audio-context": {
"version": "25.3.37",
"resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.37.tgz",
"integrity": "sha512-lr0+RH/IJXYMts95oYKIJ+orTmstOZN3GXWVGmlkbMj8OLahREkRh7DhNGLYgBGDkBkhhc4ev5pYGSFN3gltHw==",
"version": "25.3.70",
"resolved": "https://registry.npmjs.org/standardized-audio-context/-/standardized-audio-context-25.3.70.tgz",
"integrity": "sha512-v07apb+yDztoTrYu6aU4DZGbbO/gkcyC/P+u+SCalDFq+eUp5kbQYnxS8Z/6tA2Vnm/YslhVaR5VzsCYafg3BQ==",
"requires": {
"@babel/runtime": "^7.20.7",
"automation-events": "^5.0.0",
"tslib": "^2.4.1"
"@babel/runtime": "^7.24.4",
"automation-events": "^7.0.4",
"tslib": "^2.6.2"
}
},
"statuses": {
@ -17681,9 +17698,9 @@
}
},
"tslib": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
"integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA=="
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
},
"tsutils": {
"version": "3.21.0",
@ -17740,15 +17757,15 @@
}
},
"typedoc": {
"version": "0.23.24",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.23.24.tgz",
"integrity": "sha512-bfmy8lNQh+WrPYcJbtjQ6JEEsVl/ce1ZIXyXhyW+a1vFrjO39t6J8sL/d6FfAGrJTc7McCXgk9AanYBSNvLdIA==",
"version": "0.25.13",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.13.tgz",
"integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==",
"dev": true,
"requires": {
"lunr": "^2.3.9",
"marked": "^4.2.5",
"minimatch": "^5.1.2",
"shiki": "^0.12.1"
"marked": "^4.3.0",
"minimatch": "^9.0.3",
"shiki": "^0.14.7"
},
"dependencies": {
"brace-expansion": {
@ -17761,9 +17778,9 @@
}
},
"minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"version": "9.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz",
"integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==",
"dev": true,
"requires": {
"brace-expansion": "^2.0.1"

View file

@ -1,6 +1,6 @@
{
"name": "tone",
"version": "14.8.0",
"version": "14.9.0",
"description": "A Web Audio framework for making interactive music in the browser.",
"browser": "build/Tone.js",
"main": "build/esm/index.js",
@ -19,7 +19,7 @@
"build": "npm run increment && rm -rf build && npm run ts:build && npm run webpack:build",
"codecov": "codecov",
"docs": "node scripts/generate_docs.cjs",
"docs:json": "cross-var typedoc --options \"./scripts/typedoc.json\" --json \"$npm_config_docs_json\"",
"docs:json": "cross-var typedoc --options \"./scripts/typedoc.json\" --json \"./docs/tone.json\"",
"increment": "node scripts/increment_version.cjs",
"karma": "cross-var karma start ./test/karma.conf.cjs --single-run --file $npm_config_file --dir $npm_config_dir",
"karma:browser": "cross-var karma start ./test/karma.conf.cjs --auto-watch --browsers OnlineChrome --file $npm_config_file --dir $npm_config_dir",
@ -95,7 +95,7 @@
"tmp-promise": "^2.1.1",
"ts-loader": "^7.0.5",
"ts-node": "^8.10.2",
"typedoc": "^0.23.24",
"typedoc": "^0.25.13",
"typescript": "^4.4.4",
"ua-parser-js": "^0.7.31",
"webpack": "^5.65.0",
@ -103,7 +103,7 @@
"yargs": "^17.3.0"
},
"dependencies": {
"standardized-audio-context": "^25.3.37",
"standardized-audio-context": "^25.3.70",
"tslib": "^2.3.1"
},
"prettier": {

View file

@ -6,11 +6,11 @@ const { resolve } = require("path");
const { execSync } = require("child_process");
const tsVersion = execSync("npm show tone@next version").toString();
const masterVersion = execSync("npm show tone version").toString();
const mainVersion = execSync("npm show tone version").toString();
// go with whichever is the latest version
let version = masterVersion;
if (tsVersion && semver.gt(tsVersion, masterVersion)) {
let version = mainVersion;
if (tsVersion && semver.gt(tsVersion, mainVersion)) {
version = tsVersion;
}
@ -29,7 +29,7 @@ if (semver.gt(packageObj.version, version)) {
console.log(`incrementing to version ${version}`);
packageObj.version = version;
// only if it's travis, update the package.json
if (process.env.TRAVIS) {
if (process.env.GITHUB_CI) {
fs.writeFileSync(packageFile, JSON.stringify(packageObj, undefined, " "));
// write a version file

View file

@ -1,12 +1,12 @@
{
"name" : "Tone.js",
"mode": "file",
"entryPoints": ["../Tone"],
"out":"../docs",
"defaultCategory" : "Global",
"categorizeByGroup" : true,
"categoryOrder" : ["Core", "Source", "Instrument", "Effect", "Component", "Signal"],
"exclude" : ["./Tone/**/*.test.ts", "./test/**/*.ts"],
"externalPattern": ["**/node_modules/**"],
"excludeProtected" : true,
"excludePrivate" : true,
"listInvalidSymbolLinks" : true,
"excludeNotExported" : false
"hideGenerator": true,
}

View file

@ -2,35 +2,43 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { resolve } = require("path");
const { exec } = require("child_process");
const { file } = require("tmp-promise");
const { dir } = require("tmp-promise");
const { writeFile } = require("fs-extra");
const toneJson = require("../../docs/tone.json");
const testSplit = parseInt(process.env.TEST_EXAMPLES || "0");
/**
* Get all of the examples
*/
function findExamples(obj) {
let examples = [];
for (const prop in obj) {
if (Array.isArray(obj[prop])) {
obj[prop].forEach((child) => {
examples = [...examples, ...findExamples(child)];
function traverse(node) {
if (node.comment && node.comment.blockTags) {
node.comment.blockTags.forEach((tag) => {
if (tag.tag === "@example") {
tag.content.forEach((example) => {
examples.push(
example.text.trim().replace(/^```ts\n|```$/g, "")
);
});
}
});
} else if (prop === "comment" && obj[prop].tags) {
examples = [
...examples,
...obj[prop].tags
.filter((tag) => tag.tag === "example")
.map((tag) => tag.text),
];
} else if (typeof obj[prop] === "object") {
examples = [...examples, ...findExamples(obj[prop])];
} else {
// console.log(prop);
}
["children", "getSignature", "setSignature", "signatures"].forEach(
(prop) => {
if (prop in node) {
if (Array.isArray(node[prop])) {
node[prop].forEach((child) => traverse(child));
} else {
traverse(node[prop]);
}
}
}
);
}
traverse(obj);
// filter any repeats
return [...new Set(examples)];
}
@ -53,7 +61,7 @@ function execPromise(cmd) {
/**
* Run the string through the typescript compiler
*/
async function testExampleString(str) {
async function testExampleString(str, tmpDir, index) {
// str = str.replace("from \"tone\"", `from "${resolve(__dirname, "../../")}"`);
str = `
import * as Tone from "${resolve(__dirname, "../../")}"
@ -62,48 +70,24 @@ async function testExampleString(str) {
}
main();
`;
const { path, cleanup } = await file({ postfix: ".ts" });
try {
// work with file here in fd
await writeFile(path, str);
await execPromise(
`tsc --noEmit --target es5 --lib dom,ES2015 ${path}`
);
} finally {
cleanup();
}
await writeFile(resolve(tmpDir, index + ".ts"), str);
}
async function main() {
let examples = findExamples(toneJson);
if (testSplit > 0) {
// split it in half and choose either the first or second half
const halfLength = Math.ceil(examples.length / 2);
const splitStart = (testSplit - 1) * halfLength;
const splitEnd = testSplit * halfLength;
examples = examples.slice(splitStart, splitEnd);
console.log(`testing examples ${splitStart} - ${splitEnd}`);
}
const examples = findExamples(toneJson);
let passed = 0;
for (let i = 0; i < examples.length; i++) {
const example = examples[i];
try {
await testExampleString(example);
passed++;
// print a dot for each passed example
process.stdout.write(".");
// add a new line occasionally
if (passed % 100 === 0) {
process.stdout.write("\n");
}
} catch (e) {
console.log(example + "\n" + e);
throw e;
}
}
console.log(`\nvalid examples ${passed}/${examples.length}`);
if (passed !== examples.length) {
throw new Error("didn't pass all tests");
}
const tmp = await dir({ unsafeCleanup: true });
await Promise.all(
examples.map((e, i) => testExampleString(e, tmp.path, i))
);
await execPromise(
`tsc --noEmit --target es5 --lib dom,ES2015 ${tmp.path}/*.ts`
);
await tmp.cleanup();
console.log(`Tested ${examples.length} examples`);
}
main();

View file

@ -10,6 +10,7 @@
"removeComments": false,
"outDir": "./build/esm",
"sourceMap": true,
"skipLibCheck": true,
"moduleResolution": "node",
"strictPropertyInitialization": true,
"downlevelIteration": true,
@ -24,5 +25,6 @@
"include": [
"Tone/**/*.ts",
"test/**/*.ts"
]
],
"exclude": ["node_modules"]
}