Skip to content

Commit d6d0dd6

Browse files
committed
update icons script
1 parent 4605a54 commit d6d0dd6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.build/update-icons.mjs

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ import fs from 'fs'
33
import path from 'path'
44
import { ICONS_SRC_DIR, getMaxUnicode, getArgvs, getPackageJson } from './helpers.mjs'
55

6-
const p = getPackageJson(),
7-
argv = getArgvs(),
8-
newVersion = argv['new-version'] || `${p.version}`
9-
10-
console.log(argv);
6+
const argv = getArgvs(),
7+
newVersion = argv['new-version']
118

129
const files = globSync(path.join(ICONS_SRC_DIR, '**/*.svg'))
1310

@@ -34,11 +31,13 @@ files.forEach(function (file) {
3431
if (newVersion) {
3532
// Add version to svg files
3633
if (!svgFile.match(/\nversion: "?([a-f0-9.]+)"?/i)) {
34+
const minorVersion = newVersion.split('.').slice(0, 2).join('.')
35+
3736
svgFile = svgFile.replace(/-->\n<svg/i, function (m) {
38-
return `version: "${newVersion}"\n${m}`
37+
return `version: "${minorVersion}"\n${m}`
3938
})
4039

41-
console.log(`Add version "${newVersion}" to "${file}"`)
40+
console.log(`Add version "${minorVersion}" to "${file}"`)
4241
fs.writeFileSync(file, svgFile, 'utf8')
4342
}
4443
}

0 commit comments

Comments
 (0)