mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-13 12:28:47 +00:00
reverting isNote test, fixing workflow
This commit is contained in:
parent
9353d33435
commit
7882bed066
3 changed files with 34 additions and 36 deletions
33
.github/workflows/publish.yml
vendored
33
.github/workflows/publish.yml
vendored
|
@ -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' }}
|
28
.github/workflows/test.yml
vendored
28
.github/workflows/test.yml
vendored
|
@ -117,3 +117,31 @@ jobs:
|
|||
run: npm run build
|
||||
- name: Test
|
||||
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' }}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue