Publish version after npm publish (#672)

* Add publish to github step

* Include file with release

* Supress logs if silent mode = true

* 🔖 Version 7.1.1

* Rejig console logs

* Update error log conditional
This commit is contained in:
Josh Johnson 2019-10-22 12:50:40 +01:00 committed by GitHub
parent 8782564ddf
commit 1285602b2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 21 deletions

View file

@ -63,4 +63,19 @@ jobs:
HUSKY_SKIP_INSTALL: true
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-github:
needs: publish-npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- run: echo ${{ github.sha }} > RELEASE.txt
- run: cat Release.txt
- uses: softprops/action-gh-release@v1
with:
files: RELEASE.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "choices.js",
"version": "7.0.6",
"version": "7.1.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,6 +1,6 @@
{
"name": "choices.js",
"version": "7.1.0",
"version": "7.1.1",
"description": "A vanilla JS customisable text input/select box plugin",
"main": "./public/assets/scripts/choices.min.js",
"types": "./types/index.d.ts",

View file

@ -80,9 +80,13 @@ class Choices {
: element;
if (!passedElement) {
return console.error(
'Could not find passed element or passed element was of an invalid type',
);
if (!this.config.silent) {
console.error(
'Could not find passed element or passed element was of an invalid type',
);
}
return;
}
this._isTextElement = passedElement.type === 'text';
@ -109,16 +113,6 @@ class Choices {
return console.error('Passed element was of an invalid type');
}
if (
this.config.shouldSortItems === true &&
this._isSelectOneElement &&
!this.config.silent
) {
console.warn(
"shouldSortElements: Type of passed element is 'select-one', falling back to false.",
);
}
this.initialised = false;
this._store = new Store(this.render);
@ -164,11 +158,19 @@ class Choices {
this._onDirectionKey = this._onDirectionKey.bind(this);
this._onDeleteKey = this._onDeleteKey.bind(this);
// If element has already been initialised with Choices, fail silently
if (this.passedElement.element.getAttribute('data-choice') === 'active') {
console.warn(
'Trying to initialise Choices on element already initialised',
);
if (!this.config.silent) {
if (this.config.shouldSortItems === true && this._isSelectOneElement) {
console.warn(
"shouldSortElements: Type of passed element is 'select-one', falling back to false.",
);
}
// If element has already been initialised with Choices, fail silently
if (this.passedElement.element.getAttribute('data-choice') === 'active') {
console.warn(
'Trying to initialise Choices on element already initialised',
);
}
}
// Let's go

View file

@ -36,6 +36,7 @@ describe('choices', () => {
beforeEach(() => {
instance = new Choices(passedElement, {
callbackOnInit: callbackOnInitSpy,
silent: true,
});
});