gulp-stacksvg 2.0.3 → 4.0.0
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.md +2 -2
- package/README.md +56 -69
- package/lib/index.js +48 -26
- package/package.json +29 -27
package/LICENSE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright ©
|
|
4
|
-
Copyright ©
|
|
3
|
+
Copyright © Sergey Artemov <firefoxic.dev@gmail.com>, 2022
|
|
4
|
+
Copyright © Andrey Kuzmin <unsoundscapes@gmail.com>, 2014
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
7
7
|
|
package/README.md
CHANGED
|
@@ -1,71 +1,63 @@
|
|
|
1
1
|
<!-- markdownlint-disable MD007 -->
|
|
2
2
|
# gulp-stacksvg
|
|
3
3
|
|
|
4
|
-
[![Test Status][test-image]][test-url]
|
|
5
4
|
[![License: MIT][license-image]][license-url]
|
|
5
|
+
[![Changelog][changelog-image]][changelog-url]
|
|
6
6
|
[![NPM version][npm-image]][npm-url]
|
|
7
|
-
[![
|
|
7
|
+
[![Test Status][test-image]][test-url]
|
|
8
8
|
|
|
9
|
-
The
|
|
9
|
+
The gulp plugin to combine svg files into one using the stack method.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```shell
|
|
14
|
-
|
|
14
|
+
pnpm add -D gulp gulp-stacksvg
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Add the following to your `gulpfile.js`:
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
22
|
import { stacksvg } from "gulp-stacksvg"
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
const { src, dest } = gulp
|
|
23
|
+
import { dest, src } from "gulp"
|
|
26
24
|
|
|
27
|
-
function
|
|
28
|
-
return src(`./src/icons/**/*.svg`)
|
|
29
|
-
.pipe(stacksvg(
|
|
30
|
-
.pipe(dest(`./
|
|
25
|
+
export function createStack () {
|
|
26
|
+
return src(`./src/shared/icons/**/*.svg`)
|
|
27
|
+
.pipe(stacksvg())
|
|
28
|
+
.pipe(dest(`./dist/shared/icons`))
|
|
31
29
|
}
|
|
32
30
|
```
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
To combine all icons from `./src/shared/icons/` into the `./dist/shared/icons/stack.svg` run:
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| `separator` | Replaces the directory separator for the `id` attribute. | `_` |
|
|
40
|
-
| `spacer` | Joins space-separated words for the `id` attribute. | `-` |
|
|
41
|
-
|
|
42
|
-
### Inlining stacksvg result into markup
|
|
43
|
-
|
|
44
|
-
You just don't have to want it.
|
|
34
|
+
```shell
|
|
35
|
+
pnpm exec gulp createStack
|
|
36
|
+
```
|
|
45
37
|
|
|
46
|
-
## Why a
|
|
38
|
+
## Why a stack?
|
|
47
39
|
|
|
48
|
-
Unlike all other methods for
|
|
40
|
+
Unlike all other methods for assembling a sprite, the stack does not limit us in choosing how to insert a vector into a page. Take a look at [the results](https://demos.frontend-design.ru/sprite/src/) of different ways to display fragments of different types of sprites.
|
|
49
41
|
|
|
50
|
-
We can use the
|
|
42
|
+
We can use the stack in all four possible ways:
|
|
51
43
|
|
|
52
|
-
- in
|
|
44
|
+
- in markup:
|
|
53
45
|
|
|
54
|
-
- in
|
|
55
|
-
- in
|
|
46
|
+
- in `src` of `img` tag — static,
|
|
47
|
+
- in the `href` of the `use` tag — with the possibility of repainting,
|
|
56
48
|
|
|
57
|
-
- in
|
|
49
|
+
- in styles:
|
|
58
50
|
|
|
59
|
-
- in
|
|
60
|
-
- in
|
|
51
|
+
- in `url()` properties `background` — static,
|
|
52
|
+
- in `url()` properties `mask` — with the possibility of repainting.
|
|
61
53
|
|
|
62
|
-
[Demo page](https://firefoxic.github.io/gulp-stacksvg/example/) to
|
|
54
|
+
[Demo page](https://firefoxic.github.io/gulp-stacksvg/example/) to prove it.
|
|
63
55
|
|
|
64
|
-
## Stack under
|
|
56
|
+
## Stack under the hood
|
|
65
57
|
|
|
66
|
-
This method was first mentioned in
|
|
58
|
+
This method was first mentioned in a Simurai [article](https://simurai.com/blog/2012/04/02/svg-stacks) on April 2, 2012. But even it uses unnecessarily complex code transformations.
|
|
67
59
|
|
|
68
|
-
This can be done much easier. In
|
|
60
|
+
This can be done much easier. In general, the stack is arranged almost like a symbol sprite, but without changing the icon tag (it remains the `svg` tag, as in the original icon files) and with the addition of a tiny bit of style.
|
|
69
61
|
|
|
70
62
|
```xml
|
|
71
63
|
<svg xmlns="http://www.w3.org/2000/svg">
|
|
@@ -101,13 +93,13 @@ This can be done much easier. In general, the stack is arranged almost like a sy
|
|
|
101
93
|
</svg>
|
|
102
94
|
```
|
|
103
95
|
|
|
104
|
-
The
|
|
96
|
+
The magic is in the stack inner style, which shows only the fragment requested by the link, hiding everything else:
|
|
105
97
|
|
|
106
98
|
```css
|
|
107
99
|
:root svg:not(:target) { display: none }
|
|
108
100
|
```
|
|
109
101
|
|
|
110
|
-
And now the
|
|
102
|
+
And now the icons from the external sprite are available in the styles <img width="16" height="16" title="heart" src="https://raw.githubusercontent.com/firefoxic/gulp-stacksvg/main/docs/example/stack.svg#heart-red" alt="heart">
|
|
111
103
|
|
|
112
104
|
```html
|
|
113
105
|
<button class="button button--icon_heart" type="button">
|
|
@@ -120,46 +112,41 @@ And now the icons from the external sprite are available in the styles <img widt
|
|
|
120
112
|
display: inline-flex;
|
|
121
113
|
align-items: center;
|
|
122
114
|
gap: 0.5em;
|
|
123
|
-
}
|
|
124
115
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
116
|
+
&:hover {
|
|
117
|
+
--fill: red;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&::before {
|
|
121
|
+
content: "";
|
|
122
|
+
width: 1em;
|
|
123
|
+
height: 1em;
|
|
124
|
+
/* icon shape */
|
|
125
|
+
mask: var(--icon) no-repeat center / contain;
|
|
126
|
+
/* icon color */
|
|
127
|
+
background: var(--fill, orangered);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&:where(.button--icon_heart) {
|
|
131
|
+
--icon: url("../icons/stack.svg#heart");
|
|
132
|
+
}
|
|
141
133
|
}
|
|
142
134
|
```
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
> We still need the [autoprefixer](https://github.com/postcss/autoprefixer) for the mask property.
|
|
146
|
-
|
|
147
|
-
For an icon inserted via `mask`, simply change the `background`. Moreover, unlike `use`, you can draw anything in the background under the mask, for example, a gradient.
|
|
136
|
+
For an icon inserted via `mask`, simply change the `background`. Moreover, unlike `use`, you can draw anything in the background under the mask, for example, a gradient.
|
|
148
137
|
|
|
149
|
-
##
|
|
138
|
+
## More info
|
|
150
139
|
|
|
151
|
-
- [Changelog](CHANGELOG.md)
|
|
152
|
-
- [License](LICENSE)
|
|
153
140
|
- [SVG sprites: old-school, modern, unknown, and forgotten](https://pepelsbey.dev/articles/svg-sprites/#forgotten-stacks) by [Vadim Makeev](https://mastodon.social/@pepelsbey)
|
|
154
141
|
|
|
155
|
-
[
|
|
156
|
-
[
|
|
142
|
+
[license-url]: https://github.com/firefoxic/gulp-stacksvg/blob/main/LICENSE.md
|
|
143
|
+
[license-image]: https://img.shields.io/badge/License-MIT-limegreen.svg
|
|
157
144
|
|
|
158
|
-
[
|
|
159
|
-
[
|
|
145
|
+
[changelog-url]: https://github.com/firefoxic/gulp-stacksvg/blob/main/CHANGELOG.md
|
|
146
|
+
[changelog-image]: https://img.shields.io/badge/CHANGELOG-md-limegreen
|
|
160
147
|
|
|
161
|
-
[
|
|
162
|
-
[
|
|
148
|
+
[npm-url]: https://npmjs.com/package/gulp-stacksvg
|
|
149
|
+
[npm-image]: https://badge.fury.io/js/gulp-stacksvg.svg
|
|
163
150
|
|
|
164
|
-
[
|
|
165
|
-
[
|
|
151
|
+
[test-url]: https://github.com/firefoxic/gulp-stacksvg/actions
|
|
152
|
+
[test-image]: https://github.com/firefoxic/gulp-stacksvg/actions/workflows/test.yml/badge.svg?branch=main
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { basename, extname, sep } from "node:path"
|
|
2
|
-
import { Transform } from "node:stream"
|
|
3
1
|
import { createHmac } from "node:crypto"
|
|
2
|
+
import { Transform } from "node:stream"
|
|
3
|
+
import { basename, extname, sep } from "node:path"
|
|
4
4
|
|
|
5
5
|
import { parse } from "node-html-parser"
|
|
6
6
|
import PluginError from "plugin-error"
|
|
@@ -19,17 +19,11 @@ const excessAttrs = [
|
|
|
19
19
|
const xlink = `http://www.w3.org/1999/xlink`
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @param {Object} [options] - The option object.
|
|
25
|
-
* @param {string} [options.output=stack] - The name of the output file.
|
|
26
|
-
* @param {string} [options.separator=_] - The symbol that will replace the directory separator for the fragment id.
|
|
27
|
-
* @param {string} [options.spacer=-] - The character that will replace the whitespace characters for the fragment id.
|
|
22
|
+
* Gulp plugin for combining SVG icons into a single file.
|
|
28
23
|
*
|
|
29
|
-
* @
|
|
24
|
+
* @exports {function} stacksvg - Gulp plugin.
|
|
30
25
|
*/
|
|
31
|
-
export function stacksvg (
|
|
32
|
-
|
|
26
|
+
export function stacksvg () {
|
|
33
27
|
let isEmpty = true
|
|
34
28
|
const ids = {}
|
|
35
29
|
const namespaces = new Map([[`http://www.w3.org/2000/svg`, `xmlns`]])
|
|
@@ -37,8 +31,14 @@ export function stacksvg ( { output = `stack`, separator = `_`, spacer = `-` } =
|
|
|
37
31
|
const rootSvg = stack.querySelector(`svg`)
|
|
38
32
|
const stream = new Transform({ objectMode: true })
|
|
39
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Transform function for the plugin.
|
|
36
|
+
*
|
|
37
|
+
* @param {Vinyl} file - Gulp file object.
|
|
38
|
+
* @param {string} [enc=null] - Encoding to use when writing the file.
|
|
39
|
+
* @param {function} cb - Callback function.
|
|
40
|
+
*/
|
|
40
41
|
function transform (file, _, cb) {
|
|
41
|
-
|
|
42
42
|
if (file.isStream()) {
|
|
43
43
|
return cb(new PluginError(`gulp-stacksvg`, `Streams are not supported!`))
|
|
44
44
|
}
|
|
@@ -53,7 +53,7 @@ export function stacksvg ( { output = `stack`, separator = `_`, spacer = `-` } =
|
|
|
53
53
|
isEmpty = false
|
|
54
54
|
|
|
55
55
|
const iconId = basename(
|
|
56
|
-
file.relative.split(sep).join(
|
|
56
|
+
file.relative.split(sep).join(`_`).replace(/\s/g, `-`),
|
|
57
57
|
extname(file.relative),
|
|
58
58
|
)
|
|
59
59
|
|
|
@@ -75,16 +75,30 @@ export function stacksvg ( { output = `stack`, separator = `_`, spacer = `-` } =
|
|
|
75
75
|
excessAttrs.forEach((attr) => iconSvg.removeAttribute(attr))
|
|
76
76
|
iconSvg.querySelectorAll(`[id]`).forEach(changeInnerId)
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Update the id of a child element if it has the same id.
|
|
80
|
+
*
|
|
81
|
+
* @param {Element} targetElem - Child element to update.
|
|
82
|
+
* @param {string} suffix - Suffix to append to the id.
|
|
83
|
+
*/
|
|
78
84
|
function changeInnerId (targetElem, suffix) {
|
|
79
85
|
let oldId = targetElem.id
|
|
80
86
|
let newId = `${iconId}_${suffix}`
|
|
87
|
+
|
|
81
88
|
targetElem.setAttribute(`id`, newId)
|
|
82
89
|
iconSvg.querySelectorAll(`*`).forEach(updateUsingId)
|
|
83
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Update the id of a child element if it has the same id.
|
|
93
|
+
*
|
|
94
|
+
* @param {Element} elem - Child element to update.
|
|
95
|
+
*/
|
|
84
96
|
function updateUsingId (elem) {
|
|
85
97
|
if (~elem.rawAttrs.search(`#${oldId}`)) {
|
|
98
|
+
// eslint-disable-next-line guard-for-in
|
|
86
99
|
for (let attr in elem._attrs) {
|
|
87
100
|
let attrValue = elem._attrs[attr].replace(`#${oldId}`, `#${newId}`)
|
|
101
|
+
|
|
88
102
|
elem.setAttribute(attr, attrValue)
|
|
89
103
|
}
|
|
90
104
|
}
|
|
@@ -98,6 +112,7 @@ export function stacksvg ( { output = `stack`, separator = `_`, spacer = `-` } =
|
|
|
98
112
|
let nsId = attrs[attrName]
|
|
99
113
|
let oldNsAlias = attrName.slice(6)
|
|
100
114
|
let newNsAlias = oldNsAlias
|
|
115
|
+
|
|
101
116
|
if (namespaces.has(nsId)) {
|
|
102
117
|
if (namespaces.get(nsId) !== attrName) {
|
|
103
118
|
newNsAlias = namespaces.get(nsId).slice(6)
|
|
@@ -114,13 +129,14 @@ export function stacksvg ( { output = `stack`, separator = `_`, spacer = `-` } =
|
|
|
114
129
|
break
|
|
115
130
|
}
|
|
116
131
|
}
|
|
132
|
+
|
|
117
133
|
iconDom.querySelectorAll(`*`).some((elem) => {
|
|
118
134
|
if (
|
|
119
135
|
elem.rawTagName.startsWith(`${newNsAlias}:`)
|
|
120
|
-
||
|
|
121
|
-
Object.keys(elem._attrs).some((attr) => attr.startsWith(`${newNsAlias}:`))
|
|
136
|
+
|| Object.keys(elem._attrs).some((attr) => attr.startsWith(`${newNsAlias}:`))
|
|
122
137
|
) {
|
|
123
138
|
namespaces.set(nsId, `xmlns:${newNsAlias}`)
|
|
139
|
+
|
|
124
140
|
return true
|
|
125
141
|
}
|
|
126
142
|
})
|
|
@@ -131,9 +147,15 @@ export function stacksvg ( { output = `stack`, separator = `_`, spacer = `-` } =
|
|
|
131
147
|
}
|
|
132
148
|
|
|
133
149
|
rootSvg.appendChild(iconSvg)
|
|
150
|
+
|
|
134
151
|
cb()
|
|
135
152
|
}
|
|
136
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Flush function for the plugin.
|
|
156
|
+
*
|
|
157
|
+
* @param {function} cb - Callback function.
|
|
158
|
+
*/
|
|
137
159
|
function flush (cb) {
|
|
138
160
|
if (isEmpty) {
|
|
139
161
|
return cb()
|
|
@@ -143,11 +165,10 @@ export function stacksvg ( { output = `stack`, separator = `_`, spacer = `-` } =
|
|
|
143
165
|
rootSvg.setAttribute(nsAttr, nsId)
|
|
144
166
|
}
|
|
145
167
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const file = new Vinyl({ path: output, contents: Buffer.from(stack.toString()) })
|
|
168
|
+
const file = new Vinyl({ path: `stack.svg`, contents: Buffer.from(stack.toString()) })
|
|
149
169
|
|
|
150
170
|
this.push(file)
|
|
171
|
+
|
|
151
172
|
cb()
|
|
152
173
|
}
|
|
153
174
|
|
|
@@ -158,18 +179,20 @@ export function stacksvg ( { output = `stack`, separator = `_`, spacer = `-` } =
|
|
|
158
179
|
}
|
|
159
180
|
|
|
160
181
|
/**
|
|
161
|
-
*
|
|
182
|
+
* Changes the namespace alias of an element and all its children.
|
|
162
183
|
*
|
|
163
|
-
* @param {
|
|
164
|
-
* @param {string} oldAlias -
|
|
165
|
-
* @param {string} newAlias -
|
|
184
|
+
* @param {Element} iconDom - Element to modify.
|
|
185
|
+
* @param {string} oldAlias - Old namespace alias to replace.
|
|
186
|
+
* @param {string} newAlias - New namespace alias.
|
|
166
187
|
*/
|
|
167
188
|
function changeNsAlias (iconDom, oldAlias, newAlias) {
|
|
168
189
|
iconDom.querySelectorAll(`*`).forEach((elem) => {
|
|
169
190
|
let prefix = newAlias === `` ? `` : `${newAlias}:`
|
|
191
|
+
|
|
170
192
|
if (elem.rawTagName.startsWith(`${oldAlias}:`)) {
|
|
171
193
|
elem.rawTagName = `${prefix}${elem.rawTagName.slice((oldAlias.length + 1))}`
|
|
172
194
|
}
|
|
195
|
+
|
|
173
196
|
for (let name of Object.keys(elem._attrs)) {
|
|
174
197
|
if (name.startsWith(`${oldAlias}:`)) {
|
|
175
198
|
elem.setAttribute(`${prefix}${name.slice((oldAlias.length + 1))}`, elem._attrs[name])
|
|
@@ -180,11 +203,10 @@ function changeNsAlias (iconDom, oldAlias, newAlias) {
|
|
|
180
203
|
}
|
|
181
204
|
|
|
182
205
|
/**
|
|
183
|
-
* Get
|
|
184
|
-
*
|
|
185
|
-
* @param {string} str - An arbitrary line of code.
|
|
206
|
+
* Get a hash for a given string.
|
|
186
207
|
*
|
|
187
|
-
* @
|
|
208
|
+
* @param {string} str - String to hash.
|
|
209
|
+
* @returns {string} Hash of the string.
|
|
188
210
|
*/
|
|
189
211
|
function getHash (str) {
|
|
190
212
|
return createHmac(`sha1`, `xmlns`)
|
package/package.json
CHANGED
|
@@ -1,53 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gulp-stacksvg",
|
|
3
|
-
"description": "The
|
|
4
|
-
"version": "
|
|
5
|
-
"type": "module",
|
|
6
|
-
"exports": "./lib/index.js",
|
|
7
|
-
"files": [
|
|
8
|
-
"./lib/index.js"
|
|
9
|
-
],
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"node-html-parser": "^6.1.11",
|
|
12
|
-
"plugin-error": "^2.0.1",
|
|
13
|
-
"vinyl": "^3.0.0"
|
|
14
|
-
},
|
|
15
|
-
"engines": {
|
|
16
|
-
"node": "^16.20.0 || ^18.16.0"
|
|
17
|
-
},
|
|
3
|
+
"description": "The gulp plugin to combine svg files into one using the stack method.",
|
|
4
|
+
"version": "4.0.0",
|
|
18
5
|
"license": "MIT",
|
|
19
6
|
"author": {
|
|
20
7
|
"name": "Sergey Artemov",
|
|
21
8
|
"email": "firefoxic.dev@gmail.com"
|
|
22
9
|
},
|
|
23
|
-
"homepage": "https://github.com/firefoxic/gulp-stacksvg",
|
|
10
|
+
"homepage": "https://github.com/firefoxic/gulp-stacksvg#readme",
|
|
24
11
|
"bugs": {
|
|
25
12
|
"url": "https://github.com/firefoxic/gulp-stacksvg/issues"
|
|
26
13
|
},
|
|
27
14
|
"repository": {
|
|
28
15
|
"type": "git",
|
|
29
|
-
"url": "git://github.com/firefoxic/gulp-stacksvg"
|
|
16
|
+
"url": "git://github.com/firefoxic/gulp-stacksvg.git"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": "./lib/index.js",
|
|
20
|
+
"files": [
|
|
21
|
+
"./lib/"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": "^18.18.2 || ^20.9.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"node-html-parser": "^6.1.13",
|
|
28
|
+
"plugin-error": "^2.0.1",
|
|
29
|
+
"vinyl": "^3.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@firefoxic/eslint-config": "^1.0.0",
|
|
33
|
+
"@firefoxic/update-changelog": "^0.1.0",
|
|
34
|
+
"eslint": "^9.2.0",
|
|
35
|
+
"gulp": "^5.0.0",
|
|
36
|
+
"husky": "^9.0.11"
|
|
30
37
|
},
|
|
31
38
|
"keywords": [
|
|
39
|
+
"gulp",
|
|
32
40
|
"gulpplugin",
|
|
33
41
|
"svg",
|
|
34
42
|
"icon",
|
|
43
|
+
"sprite",
|
|
35
44
|
"stack",
|
|
36
|
-
"
|
|
45
|
+
"vector"
|
|
37
46
|
],
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"editorconfig-checker": "^5.1.1",
|
|
40
|
-
"eslint": "^8.52.0",
|
|
41
|
-
"gulp": "^4.0.2",
|
|
42
|
-
"husky": "^8.0.3"
|
|
43
|
-
},
|
|
44
47
|
"scripts": {
|
|
45
|
-
"lint
|
|
46
|
-
"lint:es": "eslint ./",
|
|
47
|
-
"lint": "pnpm /^lint:/",
|
|
48
|
+
"lint": "eslint",
|
|
48
49
|
"test": "node --test",
|
|
49
50
|
"pretest": "pnpm lint",
|
|
50
51
|
"preversion": "pnpm test",
|
|
52
|
+
"version": "update-changelog && git add CHANGELOG.md",
|
|
51
53
|
"postversion": "pnpm publish"
|
|
52
54
|
}
|
|
53
55
|
}
|