@modkit-org/aksel-icons-vue 1.0.0 → 1.0.1
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/.changeset/config.json +10 -10
- package/.github/scripts/check-latest-release.mjs +72 -72
- package/.github/workflows/publish.yml +59 -51
- package/.github/workflows/schedule-update-icons.yml +58 -58
- package/.yarnrc.yml +1 -1
- package/CHANGELOG.md +7 -0
- package/package.json +30 -30
- package/src/generate.mjs +103 -103
- package/src/lib/cleanup.mjs +18 -18
- package/src/lib/config.mjs +105 -105
- package/src/lib/fs-utils.mjs +10 -10
- package/src/lib/icon-package.mjs +59 -59
- package/src/lib/identifier.mjs +23 -23
- package/src/lib/logger.mjs +77 -77
- package/src/lib/metadata.mjs +25 -25
- package/src/lib/path-utils.mjs +3 -3
- package/src/lib/paths.mjs +10 -10
- package/src/lib/svg-discovery.mjs +54 -54
- package/src/lib/vue-writer.mjs +189 -189
- package/.changeset/quick-insects-smash.md +0 -5
package/.changeset/config.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "public",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "public",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
11
|
}
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const DEFAULT_RELEASE_URL =
|
|
4
|
-
"https://api.github.com/repos/navikt/aksel/releases/latest";
|
|
5
|
-
|
|
6
|
-
const args = parseArgs(process.argv.slice(2));
|
|
7
|
-
const releaseUrl = args.releaseUrl ?? DEFAULT_RELEASE_URL;
|
|
8
|
-
const plain = Boolean(args.plain);
|
|
9
|
-
|
|
10
|
-
async function getAkselIconsVersion(url) {
|
|
11
|
-
if (!plain) {
|
|
12
|
-
console.log(`Fetching latest Aksel icons version from: ${url}`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
const response = await fetch(url, {
|
|
17
|
-
headers: {
|
|
18
|
-
"User-Agent": "Node.js",
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
if (!response.ok) {
|
|
23
|
-
throw new Error(`HTTP ${response.status} ${response.statusText}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const payload = await response.json();
|
|
27
|
-
const version = payload?.tag_name;
|
|
28
|
-
|
|
29
|
-
if (!version) {
|
|
30
|
-
throw new Error("Response did not contain 'tag_name'.");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return version;
|
|
34
|
-
} catch (error) {
|
|
35
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
36
|
-
console.error(`Failed to fetch version from GitHub: ${message}`);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function parseArgs(argv) {
|
|
42
|
-
const parsed = {};
|
|
43
|
-
|
|
44
|
-
for (let index = 0; index < argv.length; index += 1) {
|
|
45
|
-
const token = argv[index];
|
|
46
|
-
|
|
47
|
-
if (token === "--release-url" || token === "-r") {
|
|
48
|
-
const value = argv[index + 1];
|
|
49
|
-
if (value && !value.startsWith("-")) {
|
|
50
|
-
parsed.releaseUrl = value;
|
|
51
|
-
index += 1;
|
|
52
|
-
}
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (token.startsWith("--release-url=")) {
|
|
57
|
-
parsed.releaseUrl = token.slice("--release-url=".length);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (token === "--plain" || token === "-p") {
|
|
61
|
-
parsed.plain = true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return parsed;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const version = await getAkselIconsVersion(releaseUrl);
|
|
69
|
-
if (!plain) {
|
|
70
|
-
console.log(`Aksel Icons Version: ${version}`);
|
|
71
|
-
}
|
|
72
|
-
console.log(version);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const DEFAULT_RELEASE_URL =
|
|
4
|
+
"https://api.github.com/repos/navikt/aksel/releases/latest";
|
|
5
|
+
|
|
6
|
+
const args = parseArgs(process.argv.slice(2));
|
|
7
|
+
const releaseUrl = args.releaseUrl ?? DEFAULT_RELEASE_URL;
|
|
8
|
+
const plain = Boolean(args.plain);
|
|
9
|
+
|
|
10
|
+
async function getAkselIconsVersion(url) {
|
|
11
|
+
if (!plain) {
|
|
12
|
+
console.log(`Fetching latest Aksel icons version from: ${url}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const response = await fetch(url, {
|
|
17
|
+
headers: {
|
|
18
|
+
"User-Agent": "Node.js",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(`HTTP ${response.status} ${response.statusText}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const payload = await response.json();
|
|
27
|
+
const version = payload?.tag_name;
|
|
28
|
+
|
|
29
|
+
if (!version) {
|
|
30
|
+
throw new Error("Response did not contain 'tag_name'.");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return version;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
36
|
+
console.error(`Failed to fetch version from GitHub: ${message}`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function parseArgs(argv) {
|
|
42
|
+
const parsed = {};
|
|
43
|
+
|
|
44
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
45
|
+
const token = argv[index];
|
|
46
|
+
|
|
47
|
+
if (token === "--release-url" || token === "-r") {
|
|
48
|
+
const value = argv[index + 1];
|
|
49
|
+
if (value && !value.startsWith("-")) {
|
|
50
|
+
parsed.releaseUrl = value;
|
|
51
|
+
index += 1;
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (token.startsWith("--release-url=")) {
|
|
57
|
+
parsed.releaseUrl = token.slice("--release-url=".length);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (token === "--plain" || token === "-p") {
|
|
61
|
+
parsed.plain = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return parsed;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const version = await getAkselIconsVersion(releaseUrl);
|
|
69
|
+
if (!plain) {
|
|
70
|
+
console.log(`Aksel Icons Version: ${version}`);
|
|
71
|
+
}
|
|
72
|
+
console.log(version);
|
|
@@ -1,51 +1,59 @@
|
|
|
1
|
-
name: Release & Publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- name:
|
|
26
|
-
uses: actions/
|
|
27
|
-
with:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
name: Release & Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write
|
|
12
|
+
contents: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
issues: write
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
release-and-publish:
|
|
18
|
+
name: Release & Publish
|
|
19
|
+
environment: npm
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout repository
|
|
23
|
+
uses: actions/checkout@v6
|
|
24
|
+
|
|
25
|
+
- name: Setup Node
|
|
26
|
+
uses: actions/setup-node@v6
|
|
27
|
+
with:
|
|
28
|
+
node-version: 24
|
|
29
|
+
registry-url: "https://registry.npmjs.org"
|
|
30
|
+
|
|
31
|
+
- name: Enable Corepack and Yarn 4
|
|
32
|
+
run: |
|
|
33
|
+
corepack enable
|
|
34
|
+
corepack prepare yarn@4.12.0 --activate
|
|
35
|
+
|
|
36
|
+
- name: Cache Yarn
|
|
37
|
+
uses: actions/cache@v4
|
|
38
|
+
with:
|
|
39
|
+
path: |
|
|
40
|
+
.yarn/cache
|
|
41
|
+
.yarn/unplugged
|
|
42
|
+
.yarn/build-state.yml
|
|
43
|
+
.yarn/install-state.gz
|
|
44
|
+
.pnp.*
|
|
45
|
+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
46
|
+
restore-keys: |
|
|
47
|
+
${{ runner.os }}-yarn-
|
|
48
|
+
|
|
49
|
+
- name: Install Dependencies
|
|
50
|
+
run: yarn install
|
|
51
|
+
|
|
52
|
+
- name: Create Release Pull Request or Publish
|
|
53
|
+
uses: changesets/action@v1
|
|
54
|
+
env:
|
|
55
|
+
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PAT }}
|
|
56
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
57
|
+
with:
|
|
58
|
+
version: yarn changeset version
|
|
59
|
+
publish: yarn changeset publish
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
name: Scheduled Icon Update
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
# schedule:
|
|
5
|
-
# - cron: "0 5 1 * *"
|
|
6
|
-
workflow_dispatch:
|
|
7
|
-
inputs:
|
|
8
|
-
release_url:
|
|
9
|
-
description: "GitHub API URL for latest Aksel release"
|
|
10
|
-
required: false
|
|
11
|
-
default: "https://api.github.com/repos/navikt/aksel/releases/latest"
|
|
12
|
-
|
|
13
|
-
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
check-version:
|
|
17
|
-
name: Check Aksel version
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
permissions:
|
|
20
|
-
contents: read
|
|
21
|
-
|
|
22
|
-
outputs:
|
|
23
|
-
should_dispatch: ${{ steps.compare.outputs.should_dispatch }}
|
|
24
|
-
|
|
25
|
-
steps:
|
|
26
|
-
- name: Checkout
|
|
27
|
-
uses: actions/checkout@v4
|
|
28
|
-
|
|
29
|
-
- name: Setup Node.js
|
|
30
|
-
uses: actions/setup-node@v4
|
|
31
|
-
with:
|
|
32
|
-
node-version: 20
|
|
33
|
-
|
|
34
|
-
- name: Compare API version with metadata
|
|
35
|
-
id: compare
|
|
36
|
-
env:
|
|
37
|
-
RELEASE_URL: ${{ github.event.inputs.release_url || 'https://api.github.com/repos/navikt/aksel/releases/latest' }}
|
|
38
|
-
run: |
|
|
39
|
-
latest_version="$(node ./.github/scripts/check-latest-release.mjs --release-url "$RELEASE_URL" --plain)"
|
|
40
|
-
current_version="$(node -e "const fs=require('node:fs'); let current=''; try { const raw=fs.readFileSync('./src/metadata.json','utf8'); const parsed=JSON.parse(raw); current=parsed?.version ?? ''; } catch {} process.stdout.write(String(current));")"
|
|
41
|
-
should_dispatch="$(node -e "const current=process.argv[1] ?? ''; const latest=process.argv[2] ?? ''; process.stdout.write(String(current !== latest));" "$current_version" "$latest_version")"
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
echo "current_version=$current_version"
|
|
45
|
-
echo "latest_version=$latest_version"
|
|
46
|
-
echo "should_dispatch=$should_dispatch"
|
|
47
|
-
} >> "$GITHUB_OUTPUT"
|
|
48
|
-
|
|
49
|
-
- name: No update found
|
|
50
|
-
if: steps.compare.outputs.should_dispatch != 'true'
|
|
51
|
-
run: echo "No icon update available."
|
|
52
|
-
|
|
53
|
-
publish:
|
|
54
|
-
name: Call publish workflow
|
|
55
|
-
needs: check-version
|
|
56
|
-
if: needs.check-version.outputs.should_dispatch == 'true'
|
|
57
|
-
uses: ./.github/workflows/publish.yml
|
|
58
|
-
secrets: inherit
|
|
1
|
+
name: Scheduled Icon Update
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# schedule:
|
|
5
|
+
# - cron: "0 5 1 * *"
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
release_url:
|
|
9
|
+
description: "GitHub API URL for latest Aksel release"
|
|
10
|
+
required: false
|
|
11
|
+
default: "https://api.github.com/repos/navikt/aksel/releases/latest"
|
|
12
|
+
|
|
13
|
+
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
check-version:
|
|
17
|
+
name: Check Aksel version
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
|
|
22
|
+
outputs:
|
|
23
|
+
should_dispatch: ${{ steps.compare.outputs.should_dispatch }}
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout
|
|
27
|
+
uses: actions/checkout@v4
|
|
28
|
+
|
|
29
|
+
- name: Setup Node.js
|
|
30
|
+
uses: actions/setup-node@v4
|
|
31
|
+
with:
|
|
32
|
+
node-version: 20
|
|
33
|
+
|
|
34
|
+
- name: Compare API version with metadata
|
|
35
|
+
id: compare
|
|
36
|
+
env:
|
|
37
|
+
RELEASE_URL: ${{ github.event.inputs.release_url || 'https://api.github.com/repos/navikt/aksel/releases/latest' }}
|
|
38
|
+
run: |
|
|
39
|
+
latest_version="$(node ./.github/scripts/check-latest-release.mjs --release-url "$RELEASE_URL" --plain)"
|
|
40
|
+
current_version="$(node -e "const fs=require('node:fs'); let current=''; try { const raw=fs.readFileSync('./src/metadata.json','utf8'); const parsed=JSON.parse(raw); current=parsed?.version ?? ''; } catch {} process.stdout.write(String(current));")"
|
|
41
|
+
should_dispatch="$(node -e "const current=process.argv[1] ?? ''; const latest=process.argv[2] ?? ''; process.stdout.write(String(current !== latest));" "$current_version" "$latest_version")"
|
|
42
|
+
|
|
43
|
+
{
|
|
44
|
+
echo "current_version=$current_version"
|
|
45
|
+
echo "latest_version=$latest_version"
|
|
46
|
+
echo "should_dispatch=$should_dispatch"
|
|
47
|
+
} >> "$GITHUB_OUTPUT"
|
|
48
|
+
|
|
49
|
+
- name: No update found
|
|
50
|
+
if: steps.compare.outputs.should_dispatch != 'true'
|
|
51
|
+
run: echo "No icon update available."
|
|
52
|
+
|
|
53
|
+
publish:
|
|
54
|
+
name: Call publish workflow
|
|
55
|
+
needs: check-version
|
|
56
|
+
if: needs.check-version.outputs.should_dispatch == 'true'
|
|
57
|
+
uses: ./.github/workflows/publish.yml
|
|
58
|
+
secrets: inherit
|
package/.yarnrc.yml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
nodeLinker: pnp
|
|
1
|
+
nodeLinker: pnp
|
package/CHANGELOG.md
ADDED
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@modkit-org/aksel-icons-vue",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Aksel Icons Vue (unofficial)",
|
|
5
|
-
"packageManager": "yarn@4.12.0",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/ModKit-Org/aksel-icons-vue.git"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"check-latest-release": "node ./.github/scripts/check-latest-release.mjs",
|
|
13
|
-
"generate-icons": "node ./src/generate.mjs"
|
|
14
|
-
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"extract-zip": "^2.0.1",
|
|
17
|
-
"yarn": "^1.22.22"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"aksel",
|
|
21
|
-
"icons",
|
|
22
|
-
"vue",
|
|
23
|
-
"generator"
|
|
24
|
-
],
|
|
25
|
-
"author": "ModKit",
|
|
26
|
-
"license": "MIT",
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@changesets/cli": "^2.29.8"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@modkit-org/aksel-icons-vue",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Aksel Icons Vue (unofficial)",
|
|
5
|
+
"packageManager": "yarn@4.12.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/ModKit-Org/aksel-icons-vue.git"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"check-latest-release": "node ./.github/scripts/check-latest-release.mjs",
|
|
13
|
+
"generate-icons": "node ./src/generate.mjs"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"extract-zip": "^2.0.1",
|
|
17
|
+
"yarn": "^1.22.22"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"aksel",
|
|
21
|
+
"icons",
|
|
22
|
+
"vue",
|
|
23
|
+
"generator"
|
|
24
|
+
],
|
|
25
|
+
"author": "ModKit",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@changesets/cli": "^2.29.8"
|
|
29
|
+
}
|
|
30
|
+
}
|