@contentpilot/read-more 2.0.2 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +53 -22
- package/index.esm.js +6 -0
- package/index.js +203 -169
- package/package.json +15 -3
- package/.github/workflows/npm-publish.yml +0 -29
- package/.prettierrc +0 -7
- package/eslint.config.js +0 -26
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
# Content Pilot Read More
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@contentpilot/read-more)
|
|
4
|
+
|
|
3
5
|
Find and convert `<!--more-->` tag in the WordPress Editor into a button that allows visitor to toggle content visibility.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install the package:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @contentpilot/read-more --save-dev
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import the module:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import { ReadMore, init } from "@contentpilot/read-more";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or include `./node_modules/@contentpilot/read-more/index.js` as a plain
|
|
22
|
+
script.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
6
25
|
|
|
7
|
-
|
|
26
|
+
Without jQuery, it auto-initializes on `.entry-content` on `DOMContentLoaded`.
|
|
27
|
+
With jQuery, nothing runs until you call `.cpReadMore()`.
|
|
8
28
|
|
|
9
|
-
|
|
29
|
+
**Initialize:**
|
|
10
30
|
|
|
11
|
-
|
|
31
|
+
```javascript
|
|
32
|
+
import { init } from "@contentpilot/read-more";
|
|
12
33
|
|
|
13
|
-
|
|
34
|
+
init(".entry-content", {
|
|
35
|
+
more: '<button type="button" class="read-more">Read More</button>',
|
|
36
|
+
less: '<button type="button" class="read-less">Less</button>',
|
|
37
|
+
transitionSpeed: 350,
|
|
38
|
+
});
|
|
39
|
+
```
|
|
14
40
|
|
|
15
|
-
|
|
41
|
+
**jQuery Compatibility:**
|
|
16
42
|
|
|
17
43
|
```javascript
|
|
18
44
|
$(".entry-content").cpReadMore();
|
|
@@ -30,27 +56,32 @@ $(".entry-content").cpReadMore({
|
|
|
30
56
|
});
|
|
31
57
|
```
|
|
32
58
|
|
|
33
|
-
|
|
59
|
+
The 1.x options still work exactly as they did in 1.x. Sites using the jQuery
|
|
60
|
+
plugin need no code changes.
|
|
34
61
|
|
|
35
|
-
|
|
36
|
-
browser script, not a module to `import`/`require`.
|
|
62
|
+
### Options
|
|
37
63
|
|
|
38
|
-
|
|
39
|
-
|
|
64
|
+
- `target` - Selector of the `<!--more-->` marker (default `[id^="more-"]`)
|
|
65
|
+
- `unwrap` - Remove the `<p>` wrapping the marker (default `true`)
|
|
66
|
+
- `replace` - Replace the marker with the More button (default `true`)
|
|
67
|
+
- `more` - More button HTML; must be a `<button>` with class `read-more`
|
|
68
|
+
- `less` - Less button HTML
|
|
69
|
+
- `hideClass` - Class toggled on the hidden content (default `display-none`)
|
|
70
|
+
- `transitionSpeed` - Slide duration in ms (default `350`)
|
|
40
71
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
moreLabel: "Read More",
|
|
46
|
-
lessLabel: "Read Less",
|
|
47
|
-
});
|
|
48
|
-
```
|
|
72
|
+
**Legacy 1.x options** (used instead of `more`/`less` when present):
|
|
73
|
+
|
|
74
|
+
- `moreLabel` / `lessLabel` - Button labels, may contain HTML (default `More` / `Less`)
|
|
75
|
+
- `moreCSS` / `lessCSS` - Button classes (default `button clean`)
|
|
49
76
|
|
|
50
|
-
|
|
77
|
+
## Publish to NPM
|
|
51
78
|
|
|
52
79
|
To update this repository on NPM using the GitHub action,
|
|
53
80
|
|
|
54
81
|
1. Bump the version number in `package.json`
|
|
55
|
-
2.
|
|
56
|
-
3.
|
|
82
|
+
2. Open a PR titled `Release x.x.x`
|
|
83
|
+
3. Squash and merge it once approved
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
package/index.esm.js
ADDED
package/index.js
CHANGED
|
@@ -1,207 +1,241 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Read More
|
|
3
|
-
* Find and convert
|
|
2
|
+
* Read More
|
|
3
|
+
* Find and convert the WordPress <!--more--> read more tag to toggle all content below
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
* @link https://www.contentpilot.com
|
|
9
|
-
* @copyright Copyright © 2018 Content Pilot
|
|
10
|
-
* @license GPL-2.0+
|
|
5
|
+
* @author Content Pilot
|
|
6
|
+
* @copyright Copyright (c) 2019 Content Pilot
|
|
7
|
+
* @license MIT
|
|
11
8
|
*/
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
slideUp(element, callback) {
|
|
50
|
-
element.style.height = element.scrollHeight + "px";
|
|
51
|
-
element.style.overflow = "hidden";
|
|
52
|
-
element.style.transition = "height 0.5s ease";
|
|
10
|
+
// Plain script, no leaked globals; bundlers get index.esm.js.
|
|
11
|
+
(() => {
|
|
12
|
+
class ReadMore {
|
|
13
|
+
static idCounter = 0;
|
|
14
|
+
|
|
15
|
+
constructor(element, options = {}) {
|
|
16
|
+
if (element.dataset.cpReadMoreInit) return;
|
|
17
|
+
element.dataset.cpReadMoreInit = "true";
|
|
18
|
+
|
|
19
|
+
this.element = element;
|
|
20
|
+
|
|
21
|
+
// Legacy 1.x options — build more/less HTML the same way the jQuery
|
|
22
|
+
// plugin did (raw string concatenation, labels may contain HTML).
|
|
23
|
+
const legacyKeys = ["moreLabel", "moreCSS", "lessLabel", "lessCSS"];
|
|
24
|
+
const legacySettings = legacyKeys.some((key) => key in options)
|
|
25
|
+
? {
|
|
26
|
+
more: `<button type="button" class="read-more ${options.moreCSS ?? "button clean"}">${options.moreLabel ?? "More"}</button>`,
|
|
27
|
+
less: `<button type="button" class="read-less ${options.lessCSS ?? "button clean"}">${options.lessLabel ?? "Less"}</button>`,
|
|
28
|
+
}
|
|
29
|
+
: {};
|
|
30
|
+
|
|
31
|
+
this.settings = {
|
|
32
|
+
target: '[id^="more-"]',
|
|
33
|
+
unwrap: true,
|
|
34
|
+
replace: true,
|
|
35
|
+
more: '<button type="button" class="read-more button clean">More</button>',
|
|
36
|
+
less: '<button type="button" class="read-less button clean">Less</button>',
|
|
37
|
+
hideClass: "display-none",
|
|
38
|
+
transitionSpeed: 350,
|
|
39
|
+
...legacySettings,
|
|
40
|
+
...options,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
this.init();
|
|
44
|
+
}
|
|
53
45
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
createButtonFromHTML(html) {
|
|
47
|
+
const template = document.createElement("template");
|
|
48
|
+
template.innerHTML = html.trim();
|
|
49
|
+
return template.content.firstElementChild;
|
|
50
|
+
}
|
|
57
51
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
element.style.overflow = "";
|
|
62
|
-
element.style.transition = "";
|
|
63
|
-
if (callback) {
|
|
64
|
-
callback();
|
|
65
|
-
}
|
|
66
|
-
}, 500);
|
|
67
|
-
}
|
|
52
|
+
createMoreButton() {
|
|
53
|
+
return this.createButtonFromHTML(this.settings.more);
|
|
54
|
+
}
|
|
68
55
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
element.style.height = "0";
|
|
73
|
-
element.style.overflow = "hidden";
|
|
74
|
-
element.style.transition = "height 0.5s ease";
|
|
56
|
+
createLessButton() {
|
|
57
|
+
return this.createButtonFromHTML(this.settings.less);
|
|
58
|
+
}
|
|
75
59
|
|
|
76
|
-
|
|
77
|
-
element.style.height =
|
|
78
|
-
|
|
60
|
+
slideUp(element, callback) {
|
|
61
|
+
element.style.height = element.scrollHeight + "px";
|
|
62
|
+
element.style.overflow = "hidden";
|
|
63
|
+
element.style.transition = `height ${this.settings.transitionSpeed}ms ease`;
|
|
79
64
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
element.style.transition = "";
|
|
84
|
-
if (callback) {
|
|
85
|
-
callback();
|
|
86
|
-
}
|
|
87
|
-
}, 500);
|
|
88
|
-
}
|
|
65
|
+
requestAnimationFrame(() => {
|
|
66
|
+
element.style.height = "0";
|
|
67
|
+
});
|
|
89
68
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
69
|
+
element.addEventListener(
|
|
70
|
+
"transitionend",
|
|
71
|
+
(e) => {
|
|
72
|
+
if (e.propertyName !== "height") return;
|
|
73
|
+
element.style.display = "none";
|
|
74
|
+
element.style.height = "";
|
|
75
|
+
element.style.overflow = "";
|
|
76
|
+
element.style.transition = "";
|
|
77
|
+
element.classList.add(this.settings.hideClass);
|
|
78
|
+
if (callback) {
|
|
79
|
+
callback();
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{ once: true }
|
|
83
|
+
);
|
|
84
|
+
}
|
|
94
85
|
|
|
95
|
-
|
|
96
|
-
element.
|
|
97
|
-
|
|
86
|
+
slideDown(element, callback) {
|
|
87
|
+
element.classList.remove(this.settings.hideClass);
|
|
88
|
+
element.style.display = "";
|
|
89
|
+
const height = element.scrollHeight;
|
|
90
|
+
element.style.height = "0";
|
|
91
|
+
element.style.overflow = "hidden";
|
|
92
|
+
element.style.transition = `height ${this.settings.transitionSpeed}ms ease`;
|
|
98
93
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}, 500);
|
|
103
|
-
}
|
|
94
|
+
requestAnimationFrame(() => {
|
|
95
|
+
element.style.height = height + "px";
|
|
96
|
+
});
|
|
104
97
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
98
|
+
element.addEventListener(
|
|
99
|
+
"transitionend",
|
|
100
|
+
(e) => {
|
|
101
|
+
if (e.propertyName !== "height") return;
|
|
102
|
+
element.style.height = "";
|
|
103
|
+
element.style.overflow = "";
|
|
104
|
+
element.style.transition = "";
|
|
105
|
+
if (callback) {
|
|
106
|
+
callback();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{ once: true }
|
|
110
110
|
);
|
|
111
|
-
targets.forEach((target) => {
|
|
112
|
-
const parent = target.parentElement;
|
|
113
|
-
if (parent.tagName === "P") {
|
|
114
|
-
parent.replaceWith(target);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
111
|
}
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const moreButton = this.createMoreButton();
|
|
124
|
-
target.replaceWith(moreButton);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
113
|
+
fadeIn(element) {
|
|
114
|
+
element.style.opacity = "0";
|
|
115
|
+
element.style.display = "";
|
|
116
|
+
element.style.transition = "opacity 0.5s ease";
|
|
127
117
|
|
|
128
|
-
|
|
129
|
-
|
|
118
|
+
requestAnimationFrame(() => {
|
|
119
|
+
element.style.opacity = "1";
|
|
120
|
+
});
|
|
130
121
|
|
|
131
|
-
|
|
132
|
-
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
element.style.opacity = "";
|
|
124
|
+
element.style.transition = "";
|
|
125
|
+
}, 500);
|
|
133
126
|
}
|
|
134
127
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
128
|
+
init() {
|
|
129
|
+
// Remove the wrapping paragraph elements from target elements
|
|
130
|
+
if (this.settings.unwrap) {
|
|
131
|
+
const targets = this.element.querySelectorAll(
|
|
132
|
+
`p > ${this.settings.target}`
|
|
133
|
+
);
|
|
134
|
+
targets.forEach((target) => {
|
|
135
|
+
const parent = target.parentElement;
|
|
136
|
+
if (parent.tagName === "P") {
|
|
137
|
+
parent.replaceWith(target);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
// Replace target elements with More button
|
|
143
|
+
if (this.settings.replace) {
|
|
144
|
+
const targets = this.element.querySelectorAll(this.settings.target);
|
|
145
|
+
targets.forEach((target) => {
|
|
146
|
+
const moreButton = this.createMoreButton();
|
|
147
|
+
target.replaceWith(moreButton);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
144
150
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
contentWrapper.className = `read-more-content ${this.settings.hideClass}`;
|
|
148
|
-
contentWrapper.id = `read-more-content-${ReadMore.idCounter++}`;
|
|
149
|
-
contentWrapper.innerHTML = afterContent;
|
|
151
|
+
// Find first instance of read-more button
|
|
152
|
+
let rmBtn = this.element.querySelector("button.read-more");
|
|
150
153
|
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
if (!rmBtn) {
|
|
155
|
+
return;
|
|
153
156
|
}
|
|
154
|
-
}
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
// Split content at button position
|
|
159
|
+
const rmParent = rmBtn.parentElement;
|
|
160
|
+
if (rmParent) {
|
|
161
|
+
const parentHtml = rmParent.innerHTML;
|
|
162
|
+
const buttonHtml = rmBtn.outerHTML;
|
|
163
|
+
const splitIdx = parentHtml.indexOf(buttonHtml) + buttonHtml.length;
|
|
164
|
+
|
|
165
|
+
const beforeContent = parentHtml.substring(0, splitIdx);
|
|
166
|
+
const afterContent = parentHtml.substring(splitIdx);
|
|
167
|
+
|
|
168
|
+
if (afterContent.trim()) {
|
|
169
|
+
const contentWrapper = document.createElement("span");
|
|
170
|
+
contentWrapper.className = `read-more-content ${this.settings.hideClass}`;
|
|
171
|
+
contentWrapper.id = `read-more-content-${ReadMore.idCounter++}`;
|
|
172
|
+
contentWrapper.innerHTML = afterContent;
|
|
173
|
+
|
|
174
|
+
rmParent.innerHTML = beforeContent;
|
|
175
|
+
rmParent.appendChild(contentWrapper);
|
|
176
|
+
|
|
177
|
+
// rmParent.innerHTML rewrite above detaches the original button
|
|
178
|
+
// node from the DOM — re-query the live one so click handlers
|
|
179
|
+
// attach to what's actually on the page.
|
|
180
|
+
rmBtn = rmParent.querySelector("button.read-more");
|
|
181
|
+
}
|
|
182
|
+
}
|
|
160
183
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
184
|
+
// Create and setup Less button
|
|
185
|
+
const contentWrapper = this.element.querySelector(".read-more-content");
|
|
164
186
|
|
|
165
|
-
|
|
166
|
-
|
|
187
|
+
if (!contentWrapper) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
rmBtn.setAttribute("aria-expanded", "false");
|
|
192
|
+
rmBtn.setAttribute("aria-controls", contentWrapper.id);
|
|
167
193
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
194
|
+
const lessButton = this.createLessButton();
|
|
195
|
+
lessButton.setAttribute("aria-expanded", "true");
|
|
196
|
+
lessButton.setAttribute("aria-controls", contentWrapper.id);
|
|
197
|
+
lessButton.addEventListener("click", () => {
|
|
198
|
+
this.slideUp(contentWrapper, () => {
|
|
199
|
+
this.fadeIn(rmBtn);
|
|
200
|
+
});
|
|
174
201
|
});
|
|
175
|
-
});
|
|
176
202
|
|
|
177
|
-
|
|
203
|
+
contentWrapper.appendChild(lessButton);
|
|
178
204
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
205
|
+
// Setup More button click handler
|
|
206
|
+
rmBtn.addEventListener("click", (e) => {
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
rmBtn.style.display = "none";
|
|
209
|
+
this.slideDown(contentWrapper, () => {
|
|
210
|
+
this.fadeIn(lessButton);
|
|
211
|
+
});
|
|
185
212
|
});
|
|
186
|
-
}
|
|
213
|
+
}
|
|
187
214
|
}
|
|
188
|
-
}
|
|
189
215
|
|
|
190
|
-
// jQuery plugin wrapper for backwards compatibility.
|
|
191
|
-
if (typeof jQuery !== "undefined") {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
216
|
+
// jQuery plugin wrapper for backwards compatibility.
|
|
217
|
+
if (typeof jQuery !== "undefined") {
|
|
218
|
+
jQuery.fn.cpReadMore = function (options) {
|
|
219
|
+
return this.each(function () {
|
|
220
|
+
new ReadMore(this, options);
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
}
|
|
198
224
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
if (typeof jQuery === "undefined") {
|
|
202
|
-
const contentElements = document.querySelectorAll(".entry-content");
|
|
225
|
+
function init(selector = ".entry-content", options = {}) {
|
|
226
|
+
const contentElements = document.querySelectorAll(selector);
|
|
203
227
|
contentElements.forEach((element) => {
|
|
204
|
-
new ReadMore(element);
|
|
228
|
+
new ReadMore(element, options);
|
|
205
229
|
});
|
|
206
230
|
}
|
|
207
|
-
|
|
231
|
+
|
|
232
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
233
|
+
// Only auto-init if jQuery plugin wasn't used.
|
|
234
|
+
if (typeof jQuery === "undefined") {
|
|
235
|
+
init();
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// Exposed for index.esm.js.
|
|
240
|
+
window.CpReadMore = { ReadMore, init };
|
|
241
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentpilot/read-more",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Find and convert the WordPress <!--more--> read more tag to toggle all content below",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"module": "index.esm.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.esm.js",
|
|
10
|
+
"default": "./index.js"
|
|
11
|
+
},
|
|
12
|
+
"./index.js": "./index.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.js",
|
|
16
|
+
"index.esm.js"
|
|
17
|
+
],
|
|
6
18
|
"type": "module",
|
|
7
19
|
"scripts": {
|
|
8
|
-
"lint": "eslint index.js",
|
|
9
|
-
"lint:fix": "eslint index.js --fix",
|
|
20
|
+
"lint": "eslint index.js index.esm.js",
|
|
21
|
+
"lint:fix": "eslint index.js index.esm.js --fix",
|
|
10
22
|
"format": "prettier --write .",
|
|
11
23
|
"format:check": "prettier --check ."
|
|
12
24
|
},
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
name: npm-publish
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- main
|
|
6
|
-
jobs:
|
|
7
|
-
npm-publish:
|
|
8
|
-
name: npm-publish
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
if: contains(github.event.head_commit.message, 'Release')
|
|
11
|
-
steps:
|
|
12
|
-
- name: Checkout repository
|
|
13
|
-
uses: actions/checkout@v4
|
|
14
|
-
- name: Setup Node.js
|
|
15
|
-
uses: actions/setup-node@v4
|
|
16
|
-
with:
|
|
17
|
-
node-version: "20.x"
|
|
18
|
-
- name: Publish to NPM
|
|
19
|
-
uses: JS-DevTools/npm-publish@v3
|
|
20
|
-
with:
|
|
21
|
-
package: "./package.json"
|
|
22
|
-
access: public
|
|
23
|
-
tag: latest
|
|
24
|
-
token: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
25
|
-
- name: Create Git tag
|
|
26
|
-
run: |
|
|
27
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
28
|
-
git tag "$VERSION"
|
|
29
|
-
git push origin "$VERSION"
|
package/.prettierrc
DELETED
package/eslint.config.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
|
-
import prettier from "eslint-config-prettier";
|
|
3
|
-
|
|
4
|
-
export default [
|
|
5
|
-
js.configs.recommended,
|
|
6
|
-
prettier,
|
|
7
|
-
{
|
|
8
|
-
languageOptions: {
|
|
9
|
-
ecmaVersion: "latest",
|
|
10
|
-
sourceType: "module",
|
|
11
|
-
globals: {
|
|
12
|
-
document: "readonly",
|
|
13
|
-
jQuery: "readonly",
|
|
14
|
-
requestAnimationFrame: "readonly",
|
|
15
|
-
setTimeout: "readonly",
|
|
16
|
-
ReadMore: "writable",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
rules: {
|
|
20
|
-
"no-unused-vars": "warn",
|
|
21
|
-
"no-console": "warn",
|
|
22
|
-
"prefer-const": "error",
|
|
23
|
-
"no-var": "error",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
];
|