mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-27 19:13:00 +02:00
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:
parent
8782564ddf
commit
1285602b2f
17
.github/workflows/npmpublish.yml
vendored
17
.github/workflows/npmpublish.yml
vendored
|
@ -63,4 +63,19 @@ jobs:
|
||||||
HUSKY_SKIP_INSTALL: true
|
HUSKY_SKIP_INSTALL: true
|
||||||
- run: npm publish
|
- run: npm publish
|
||||||
env:
|
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
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "choices.js",
|
"name": "choices.js",
|
||||||
"version": "7.0.6",
|
"version": "7.1.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "choices.js",
|
"name": "choices.js",
|
||||||
"version": "7.1.0",
|
"version": "7.1.1",
|
||||||
"description": "A vanilla JS customisable text input/select box plugin",
|
"description": "A vanilla JS customisable text input/select box plugin",
|
||||||
"main": "./public/assets/scripts/choices.min.js",
|
"main": "./public/assets/scripts/choices.min.js",
|
||||||
"types": "./types/index.d.ts",
|
"types": "./types/index.d.ts",
|
||||||
|
|
|
@ -80,9 +80,13 @@ class Choices {
|
||||||
: element;
|
: element;
|
||||||
|
|
||||||
if (!passedElement) {
|
if (!passedElement) {
|
||||||
return console.error(
|
if (!this.config.silent) {
|
||||||
'Could not find passed element or passed element was of an invalid type',
|
console.error(
|
||||||
);
|
'Could not find passed element or passed element was of an invalid type',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._isTextElement = passedElement.type === 'text';
|
this._isTextElement = passedElement.type === 'text';
|
||||||
|
@ -109,16 +113,6 @@ class Choices {
|
||||||
return console.error('Passed element was of an invalid type');
|
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.initialised = false;
|
||||||
|
|
||||||
this._store = new Store(this.render);
|
this._store = new Store(this.render);
|
||||||
|
@ -164,11 +158,19 @@ class Choices {
|
||||||
this._onDirectionKey = this._onDirectionKey.bind(this);
|
this._onDirectionKey = this._onDirectionKey.bind(this);
|
||||||
this._onDeleteKey = this._onDeleteKey.bind(this);
|
this._onDeleteKey = this._onDeleteKey.bind(this);
|
||||||
|
|
||||||
// If element has already been initialised with Choices, fail silently
|
if (!this.config.silent) {
|
||||||
if (this.passedElement.element.getAttribute('data-choice') === 'active') {
|
if (this.config.shouldSortItems === true && this._isSelectOneElement) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Trying to initialise Choices on element already initialised',
|
"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
|
// Let's go
|
||||||
|
|
|
@ -36,6 +36,7 @@ describe('choices', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
instance = new Choices(passedElement, {
|
instance = new Choices(passedElement, {
|
||||||
callbackOnInit: callbackOnInitSpy,
|
callbackOnInit: callbackOnInitSpy,
|
||||||
|
silent: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue