From 5d910ca0844e1096bd28fb4ca4d98c3d79001583 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 10:13:07 -0400 Subject: [PATCH 01/17] working on getting actions to run --- .github/workflows/test.yml | 28 ++++++++ Tone/component/channel/Channel.ts | 2 +- Tone/core/context/Context.ts | 2 +- Tone/core/context/ToneAudioNode.ts | 2 +- Tone/core/context/ToneWithContext.ts | 2 +- Tone/instrument/DuoSynth.ts | 2 +- Tone/instrument/PolySynth.ts | 1 - Tone/source/buffer/Player.test.ts | 3 + Tone/source/buffer/Players.ts | 2 +- Tone/source/oscillator/OmniOscillator.ts | 2 +- examples/meter.html | 2 +- examples/mixer.html | 2 +- examples/pingPongDelay.html | 2 +- package-lock.json | 92 ++++++++++++------------ package.json | 4 +- scripts/typedoc.json | 6 +- test/scripts/test_examples.cjs | 52 +++++++------- 17 files changed, 118 insertions(+), 88 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..96d6b7740 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,28 @@ +name: Run tests + +on: + pull_request: + types: [opened, reopened, synchronize] + branches: + - dev + push: + branches: + - dev +jobs: + all-tests: + 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 \ No newline at end of file diff --git a/Tone/component/channel/Channel.ts b/Tone/component/channel/Channel.ts index faa32cf94..b7741bf5d 100644 --- a/Tone/component/channel/Channel.ts +++ b/Tone/component/channel/Channel.ts @@ -91,7 +91,7 @@ export class Channel extends ToneAudioNode { } /** - * 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; diff --git a/Tone/core/context/Context.ts b/Tone/core/context/Context.ts index 08311730e..dc3ecd017 100644 --- a/Tone/core/context/Context.ts +++ b/Tone/core/context/Context.ts @@ -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 { if (isAudioContext(this._context)) { diff --git a/Tone/core/context/ToneAudioNode.ts b/Tone/core/context/ToneAudioNode.ts index c34c19438..6276dedd1 100644 --- a/Tone/core/context/ToneAudioNode.ts +++ b/Tone/core/context/ToneAudioNode.ts @@ -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(); diff --git a/Tone/core/context/ToneWithContext.ts b/Tone/core/context/ToneWithContext.ts index 4bbcfad2d..c58e50f88 100644 --- a/Tone/core/context/ToneWithContext.ts +++ b/Tone/core/context/ToneWithContext.ts @@ -97,7 +97,7 @@ export abstract class ToneWithContext 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); diff --git a/Tone/instrument/DuoSynth.ts b/Tone/instrument/DuoSynth.ts index 47d4f0d74..09284b515 100644 --- a/Tone/instrument/DuoSynth.ts +++ b/Tone/instrument/DuoSynth.ts @@ -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(); diff --git a/Tone/instrument/PolySynth.ts b/Tone/instrument/PolySynth.ts index 026bfa854..07cdfa58b 100644 --- a/Tone/instrument/PolySynth.ts +++ b/Tone/instrument/PolySynth.ts @@ -285,7 +285,6 @@ export class PolySynth = 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. diff --git a/Tone/source/buffer/Player.test.ts b/Tone/source/buffer/Player.test.ts index d23a8c8a1..ee167cde9 100644 --- a/Tone/source/buffer/Player.test.ts +++ b/Tone/source/buffer/Player.test.ts @@ -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); diff --git a/Tone/source/buffer/Players.ts b/Tone/source/buffer/Players.ts index 4a5ac9caa..c75b45a9e 100644 --- a/Tone/source/buffer/Players.ts +++ b/Tone/source/buffer/Players.ts @@ -206,7 +206,7 @@ export class Players extends ToneAudioNode { * 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 { diff --git a/Tone/source/oscillator/OmniOscillator.ts b/Tone/source/oscillator/OmniOscillator.ts index a21f6f9f0..562d2ee2a 100644 --- a/Tone/source/oscillator/OmniOscillator.ts +++ b/Tone/source/oscillator/OmniOscillator.ts @@ -315,7 +315,7 @@ export class OmniOscillator /** * The width of the oscillator when sourceType === "pulse". - * See [[PWMOscillator.width]] + * See [[PWMOscillator]] */ get width(): IsPulseOscillator> { if (this._getOscType(this._oscillator, "pulse")) { diff --git a/examples/meter.html b/examples/meter.html index f890359d4..b3a11c53a 100644 --- a/examples/meter.html +++ b/examples/meter.html @@ -33,7 +33,7 @@ }).toDestination(); const toneMeter = new Tone.Meter({ - channels: 2, + channelCount: 2, }); player.connect(toneMeter); diff --git a/examples/mixer.html b/examples/mixer.html index 6de258bfc..8c2a7325c 100644 --- a/examples/mixer.html +++ b/examples/mixer.html @@ -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, diff --git a/examples/pingPongDelay.html b/examples/pingPongDelay.html index 9d8aba9be..a68133cd0 100644 --- a/examples/pingPongDelay.html +++ b/examples/pingPongDelay.html @@ -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({ diff --git a/package-lock.json b/package-lock.json index 538280d8e..665bb53ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { @@ -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", @@ -1544,15 +1544,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": { @@ -8720,13 +8720,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 +9367,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", @@ -10586,17 +10586,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==" } } }, @@ -11488,12 +11488,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": { @@ -17192,13 +17192,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 +17681,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", diff --git a/package.json b/package.json index 24682eca4..a077f577a 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": { diff --git a/scripts/typedoc.json b/scripts/typedoc.json index b7725d900..7f842cb37 100644 --- a/scripts/typedoc.json +++ b/scripts/typedoc.json @@ -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"], "excludeProtected" : true, "excludePrivate" : true, - "listInvalidSymbolLinks" : true, - "excludeNotExported" : false + "hideGenerator": true, } \ No newline at end of file diff --git a/test/scripts/test_examples.cjs b/test/scripts/test_examples.cjs index 52eceef38..1aa1817a5 100644 --- a/test/scripts/test_examples.cjs +++ b/test/scripts/test_examples.cjs @@ -6,31 +6,39 @@ const { file } = 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)]; } @@ -75,15 +83,7 @@ async function testExampleString(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]; From 51dc8765b364e1faadec6b17d512985e279cd21e Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 10:20:59 -0400 Subject: [PATCH 02/17] running all tests --- .github/workflows/test.yml | 47 ++++++++++++++++++++++++++++++++++++-- package.json | 2 +- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 96d6b7740..89378f2ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,8 @@ on: branches: - dev jobs: - all-tests: + run-tests: + name: All tests permissions: contents: read id-token: write @@ -25,4 +26,46 @@ jobs: - name: Install dependencies run: npm install - name: Build - run: npm run build \ No newline at end of file + run: npm run build + - name: All tests + run: npm run test + test-code-examples: + name: Test inline typedoc 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 Docs + run: npm run build && npm run docs:json + - name: Code example tests + run: npm run test:examples + test-html-examples: + name: Test 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 Docs + run: npm run build + - name: Code example tests + run: npm run test:html \ No newline at end of file diff --git a/package.json b/package.json index a077f577a..62ad76049 100644 --- a/package.json +++ b/package.json @@ -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", From 4aa74e3b3c3ec0caec8d866c918b62dde4050559 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 10:25:45 -0400 Subject: [PATCH 03/17] run on CHROME only --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 89378f2ff..021f9088b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,8 @@ jobs: id-token: write runs-on: ubuntu-latest steps: + - env: + BROWSER: chrome - name: Check out Git repository uses: actions/checkout@v2 - name: Setup Nodejs From 6a78a5db0db903037647e95ece8c917176c7d1a3 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 10:27:28 -0400 Subject: [PATCH 04/17] Update test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 021f9088b..558133ce6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,9 +15,9 @@ jobs: contents: read id-token: write runs-on: ubuntu-latest + env: + BROWSER: chrome steps: - - env: - BROWSER: chrome - name: Check out Git repository uses: actions/checkout@v2 - name: Setup Nodejs From f7a39b81c7a7477a77f974d554f034053fc5dc5a Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 11:41:00 -0400 Subject: [PATCH 05/17] ignoring node_modules --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 23365bccc..98a33d7f6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,5 +24,6 @@ "include": [ "Tone/**/*.ts", "test/**/*.ts" - ] + ], + "exclude": ["node_modules"] } \ No newline at end of file From 96c1fdd02dd41098501db6b107aab58e33aa724a Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 11:47:17 -0400 Subject: [PATCH 06/17] updating typedocs --- .github/workflows/test.yml | 4 +- package-lock.json | 97 ++++++++++++++++++++++---------------- package.json | 2 +- 3 files changed, 60 insertions(+), 43 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 558133ce6..23a325191 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: - name: All tests run: npm run test test-code-examples: - name: Test inline typedoc examples + name: Check @examples permissions: contents: read id-token: write @@ -52,7 +52,7 @@ jobs: - name: Code example tests run: npm run test:examples test-html-examples: - name: Test HTML Examples + name: Run HTML Examples permissions: contents: read id-token: write diff --git a/package-lock.json b/package-lock.json index 665bb53ce..0b5379034 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", @@ -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", @@ -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" @@ -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": { @@ -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", @@ -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" @@ -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" diff --git a/package.json b/package.json index 62ad76049..56498d957 100644 --- a/package.json +++ b/package.json @@ -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", From 85dcc544d41d5d14976c442e4ee8ff0b50e6389e Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 11:52:31 -0400 Subject: [PATCH 07/17] trying to ignore compiler errors --- .github/workflows/test.yml | 86 +++++++++++++++++++------------------- scripts/typedoc.json | 2 +- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 23a325191..852f5ab54 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,30 +9,30 @@ on: branches: - dev jobs: - run-tests: - name: All tests - permissions: - contents: read - id-token: write - runs-on: ubuntu-latest - env: - BROWSER: chrome - 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 + # run-tests: + # name: All tests + # permissions: + # contents: read + # id-token: write + # runs-on: ubuntu-latest + # env: + # BROWSER: chrome + # 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 test-code-examples: - name: Check @examples + name: Check typedocs permissions: contents: read id-token: write @@ -51,23 +51,23 @@ jobs: run: npm run build && npm run docs:json - name: Code example tests 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 Docs - run: npm run build - - name: Code example tests - run: npm run test:html \ No newline at end of file + # 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 Docs + # run: npm run build + # - name: Code example tests + # run: npm run test:html \ No newline at end of file diff --git a/scripts/typedoc.json b/scripts/typedoc.json index 7f842cb37..a497d987a 100644 --- a/scripts/typedoc.json +++ b/scripts/typedoc.json @@ -5,7 +5,7 @@ "defaultCategory" : "Global", "categorizeByGroup" : true, "categoryOrder" : ["Core", "Source", "Instrument", "Effect", "Component", "Signal"], - "exclude" : ["./Tone/**/*.test.ts", "./test/**/*.ts"], + "externalPattern": ["**/node_modules/**"], "excludeProtected" : true, "excludePrivate" : true, "hideGenerator": true, From 54673972e9e5886c91084ef80b879ef0124097c5 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 12:08:20 -0400 Subject: [PATCH 08/17] Update tsconfig.json --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index 98a33d7f6..c3d976120 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ "removeComments": false, "outDir": "./build/esm", "sourceMap": true, + "skipLibCheck": true, "moduleResolution": "node", "strictPropertyInitialization": true, "downlevelIteration": true, From 93bb967b35a7f3ffc872278602b8d4f949fce476 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 12:31:20 -0400 Subject: [PATCH 09/17] running doc tests in parallel --- .github/workflows/test.yml | 86 +++++++++++++++++----------------- test/scripts/test_examples.cjs | 39 ++++++++------- 2 files changed, 66 insertions(+), 59 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 852f5ab54..65b602485 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,28 +9,28 @@ on: branches: - dev jobs: - # run-tests: - # name: All tests - # permissions: - # contents: read - # id-token: write - # runs-on: ubuntu-latest - # env: - # BROWSER: chrome - # 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 + run-tests: + name: All tests + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + env: + BROWSER: chrome + 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 test-code-examples: name: Check typedocs permissions: @@ -49,25 +49,25 @@ jobs: run: npm install - name: Build Docs run: npm run build && npm run docs:json - - name: Code example tests + - 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 Docs - # run: npm run build - # - name: Code example tests - # run: npm run test:html \ No newline at end of file + 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 Docs + run: npm run build + - name: Code example tests + run: npm run test:html \ No newline at end of file diff --git a/test/scripts/test_examples.cjs b/test/scripts/test_examples.cjs index 1aa1817a5..46d9171c4 100644 --- a/test/scripts/test_examples.cjs +++ b/test/scripts/test_examples.cjs @@ -5,6 +5,8 @@ const { exec } = require("child_process"); const { file } = require("tmp-promise"); const { writeFile } = require("fs-extra"); const toneJson = require("../../docs/tone.json"); +const { parallelLimit } = require("async"); +const { cpus } = require("os"); /** * Get all of the examples @@ -85,22 +87,27 @@ async function testExampleString(str) { async function main() { 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; - } - } + + await parallelLimit( + examples.map((example) => { + return async () => { + 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; + } + }; + }), cpus().length + ); + console.log(`\nvalid examples ${passed}/${examples.length}`); if (passed !== examples.length) { throw new Error("didn't pass all tests"); From 3ab8c5bb91dee49264669f83482f180f13ddd3ca Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 13:02:09 -0400 Subject: [PATCH 10/17] speeding up docs example tests --- .github/workflows/test.yml | 24 ++++++++++++++-- scripts/increment_version.cjs | 8 +++--- test/scripts/test_examples.cjs | 51 ++++++++++------------------------ 3 files changed, 40 insertions(+), 43 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 65b602485..1fc550914 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,7 +67,27 @@ jobs: cache: 'npm' - name: Install dependencies run: npm install - - name: Build Docs + - name: Build run: npm run build - name: Code example tests - run: npm run test:html \ No newline at end of file + 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 + - name: Opens in Node.js + run: npm run test:node \ No newline at end of file diff --git a/scripts/increment_version.cjs b/scripts/increment_version.cjs index 9fdd050f2..a8b793ab3 100644 --- a/scripts/increment_version.cjs +++ b/scripts/increment_version.cjs @@ -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 diff --git a/test/scripts/test_examples.cjs b/test/scripts/test_examples.cjs index 46d9171c4..c5e6ff1f2 100644 --- a/test/scripts/test_examples.cjs +++ b/test/scripts/test_examples.cjs @@ -2,11 +2,9 @@ /* 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 { parallelLimit } = require("async"); -const { cpus } = require("os"); /** * Get all of the examples @@ -63,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, "../../")}" @@ -72,45 +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() { const examples = findExamples(toneJson); let passed = 0; - await parallelLimit( - examples.map((example) => { - return async () => { - 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; - } - }; - }), cpus().length + const tmp = await dir({ unsafeCleanup: true }); + await Promise.all( + examples.map((e, i) => testExampleString(e, tmp.path, i)) ); - - console.log(`\nvalid examples ${passed}/${examples.length}`); - if (passed !== examples.length) { - throw new Error("didn't pass all tests"); - } + + await execPromise( + `tsc --noEmit --target es5 --lib dom,ES2015 ${tmp.path}/*.ts` + ); + + await tmp.cleanup(); + + console.log(`Tested ${examples.length} examples`); } main(); From cd4e000449dc6a21dde0638a25c8588023640d6a Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 13:08:02 -0400 Subject: [PATCH 11/17] Update test.yml --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1fc550914..3546bf108 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -88,6 +88,4 @@ jobs: - name: Install dependencies run: npm install - name: Linting - run: npm run lint - - name: Opens in Node.js - run: npm run test:node \ No newline at end of file + run: npm run lint \ No newline at end of file From 4128a904568735756cc7a5a0b8244b5bacbb0434 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 13:09:43 -0400 Subject: [PATCH 12/17] testing README --- .github/workflows/test.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3546bf108..966a8e26b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -88,4 +88,24 @@ jobs: - name: Install dependencies run: npm install - name: Linting - run: npm run lint \ No newline at end of file + 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 \ No newline at end of file From 2f2f9478616cae2b4b63c41ffddebb81f8f38cb9 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 13:29:26 -0400 Subject: [PATCH 13/17] 2 spaces instead of 4 --- .github/workflows/test.yml | 214 ++++++++++++++++++------------------- 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 966a8e26b..ac674a791 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,111 +1,111 @@ name: Run tests on: - pull_request: - types: [opened, reopened, synchronize] - branches: - - dev - push: - branches: - - dev + 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 - 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 - 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 \ No newline at end of file + run-tests: + name: All tests + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + env: + BROWSER: chrome + 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 + 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 \ No newline at end of file From 2e775bf96919ac60362c07cd0adb43911181a9f1 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 13:38:15 -0400 Subject: [PATCH 14/17] codecov --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac674a791..a37cc4aba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,8 @@ jobs: run: npm run build - name: All tests run: npm run test + - name: Upload coverage + uses: codecov/codecov-action@v3 test-code-examples: name: Check typedocs permissions: From 820ee9e1768749589f0982df54d588dd7cbb16b6 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 13:39:28 -0400 Subject: [PATCH 15/17] remove travis ci --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 57946f51f..a9f239087 100644 --- a/README.md +++ b/README.md @@ -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. From 1fa00e6e42cc5ac3af5f81a47d41fc4a969c1839 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 13:47:57 -0400 Subject: [PATCH 16/17] adding token --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a37cc4aba..82a37dab0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: runs-on: ubuntu-latest env: BROWSER: chrome + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} steps: - name: Check out Git repository uses: actions/checkout@v2 From dbda70d977d172f7783ec6657da4b7fe6b65bd8d Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Apr 2024 13:59:25 -0400 Subject: [PATCH 17/17] updating codecov --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82a37dab0..3b21fc1a3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,10 @@ jobs: - name: All tests run: npm run test - name: Upload coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} test-code-examples: name: Check typedocs permissions: