diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 6577cce0..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Publish -on: - workflow_run: - workflows: ["Tests"] - types: - - completed -jobs: - publish: - runs-on: ubuntu-latest - # not on PRs - if: github.event_name != 'pull_request' - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - GITHUB_CI: true - steps: - - uses: actions/checkout@v4 - # Setup .npmrc file to publish to npm - - uses: actions/setup-node@v4 - with: - node-version: 18.12.0 - registry-url: 'https://registry.npmjs.org' - - name: Install dependencies - run: npm install - - name: Build - run: npm run build - - name: Increment version - run: npm run increment - - name: Publish @next - run: npm publish --tag next - if: ${{ github.ref == 'refs/heads/dev' }} - - name: Publish @latest - run: npm publish - if: ${{ github.ref == 'refs/heads/main' }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4174a6e..8a7265a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -116,4 +116,32 @@ jobs: - name: Build run: npm run build - name: Test - run: npm run test:readme \ No newline at end of file + run: npm run test:readme + publish: + runs-on: ubuntu-latest + # make sure all the tests pass first + needs: [run-tests, test-code-examples, test-html-examples, test-lint] + # not on PRs + if: github.event_name != 'pull_request' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_CI: true + steps: + - uses: actions/checkout@v4 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v4 + with: + node-version: 18.12.0 + registry-url: 'https://registry.npmjs.org' + - name: Install dependencies + run: npm install + - name: Build + run: npm run build + - name: Increment version + run: npm run increment + - name: Publish @next + run: npm publish --tag next + if: ${{ github.ref == 'refs/heads/dev' }} + - name: Publish @latest + run: npm publish + if: ${{ github.ref == 'refs/heads/main' }} diff --git a/Tone/core/util/TypeCheck.ts b/Tone/core/util/TypeCheck.ts index 204d4db0..f0e76a7a 100644 --- a/Tone/core/util/TypeCheck.ts +++ b/Tone/core/util/TypeCheck.ts @@ -32,7 +32,10 @@ export function isNumber(arg: any): arg is number { * Test if the given argument is an object literal (i.e. `{}`); */ export function isObject(arg: any): arg is object { - return Object.prototype.toString.call(arg) === "[object Object]" && arg.constructor === Object; + return ( + Object.prototype.toString.call(arg) === "[object Object]" && + arg.constructor === Object + ); } /** @@ -61,5 +64,5 @@ export function isString(arg: any): arg is string { * e.g. "C4" */ export function isNote(arg: any): arg is Note { - return isString(arg) && /^([a-g](?:b|#|x|bb)?)(-[4321]|[0-9]|10|11)$/.test(arg); + return isString(arg) && /^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(arg); }