Skip to content

Commit 2b0bb71

Browse files
committed
fix: bug
1 parent d48d7cf commit 2b0bb71

8 files changed

Lines changed: 596 additions & 618 deletions

File tree

.githooks/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
pnpm run lint:staged || exit 1
44
pnpm run lint:type || exit 1
5-
pnpm test
5+
pnpm test || exit 1

.github/workflows/bring-it.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ jobs:
1414
- windows-latest
1515
- ubuntu-latest
1616
node:
17-
- current
1817
- lts/*
1918
exclude:
2019
- os: ubuntu-latest
@@ -23,15 +22,15 @@ jobs:
2322
runs-on: ${{ matrix.os }}
2423
steps:
2524
- name: Run
26-
uses: airkro/bring-it@actions
25+
uses: airkro/bring-it@actions-oidc
2726
with:
2827
node-version: ${{ matrix.node }}
2928

3029
publish:
3130
needs: [test]
3231
runs-on: ubuntu-latest
32+
permissions:
33+
id-token: write
3334
steps:
3435
- name: Run
35-
uses: airkro/bring-it@actions
36-
with:
37-
npm-token: ${{ secrets.NPM_TOKEN }}
36+
uses: airkro/bring-it@actions-oidc

.npmrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A library to parse/stringify metadata of markdown code block.
88

99
[npm-url]: https://www.npmjs.com/package/markdown-code-block-meta
1010
[npm-badge]: https://img.shields.io/npm/v/markdown-code-block-meta.svg?style=flat-square&logo=npm
11-
[github-url]: https://github.com/nice-move/markdown-code-block-meta
11+
[github-url]: https://github.com/show-docs/markdown-code-block-meta
1212
[github-badge]: https://img.shields.io/npm/l/markdown-code-block-meta.svg?style=flat-square&colorB=blue&logo=github
1313
[node-badge]: https://img.shields.io/node/v/markdown-code-block-meta.svg?style=flat-square&colorB=green&logo=node.js
1414

@@ -70,6 +70,6 @@ getValue("'abc'"); // abc
7070

7171
## Related
7272

73-
- [remark-code-example](https://github.com/nice-move/remark-code-example)
74-
- [remark-kroki](https://github.com/nice-move/remark-kroki)
75-
- [remark-docusaurus](https://github.com/nice-move/remark-docusaurus)
73+
- [remark-code-example](https://github.com/show-docs/remark-code-example)
74+
- [remark-kroki](https://github.com/show-docs/remark-kroki)
75+
- [remark-docusaurus](https://github.com/show-docs/remark-docusaurus)

index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11
const regexp =
22
/((?<k1>[^=\s]+)=((?<v1>(["'`])(.*?)\5)|(?<v2>\S+)))|(?<k2>\S+)/g;
33

4-
export function parse(string: string) {
4+
export function parse(string: string): Map<string, string | undefined> {
55
const io = (string ?? '').matchAll(regexp);
66

77
return new Map(
88
[...io]
99
.map((item) => item?.groups || {})
10-
.map(({ k1, k2, v1, v2 }) => [k1 ?? k2, v1 ?? v2]),
10+
.map(
11+
({ k1, k2, v1, v2 }) =>
12+
[k1 ?? k2, v1 ?? v2] as [string, string | undefined],
13+
),
1114
);
1215
}
1316

1417
export function stringify(object: object | Map<string, unknown>) {
1518
return (
1619
object instanceof Map ? [...object.entries()] : Object.entries(object)
1720
)
18-
.map(([k, v]) => [k, v].filter((i) => i !== undefined).join('='))
21+
.map(([k, v]) => [k, v].filter((i) => i !== undefined))
22+
.map((pair) => pair.join('='))
1923
.join(' ');
2024
}
2125

22-
export function getValue(string: string): string {
23-
return string?.match?.(/(["'`])(?<value>.*?)\1/)?.groups?.value ?? string;
26+
export function getValue(string?: string): string | undefined {
27+
return string
28+
? (string.match?.(/(["'`])(?<value>.*?)\1/)?.groups?.value ?? string)
29+
: undefined;
2430
}

package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "markdown-code-block-meta",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "A library to parse/stringify metadata of markdown code block",
55
"license": "MIT",
66
"author": {
@@ -15,13 +15,13 @@
1515
"pair",
1616
"remark"
1717
],
18-
"homepage": "https://github.com/nice-move/markdown-code-block-meta",
18+
"homepage": "https://github.com/show-docs/markdown-code-block-meta",
1919
"repository": {
2020
"type": "git",
21-
"url": "git+https://github.com/nice-move/markdown-code-block-meta.git"
21+
"url": "git+https://github.com/show-docs/markdown-code-block-meta.git"
2222
},
2323
"bugs": {
24-
"url": "https://github.com/nice-move/markdown-code-block-meta/issues"
24+
"url": "https://github.com/show-docs/markdown-code-block-meta/issues"
2525
},
2626
"main": "index.js",
2727
"files": [
@@ -30,25 +30,27 @@
3030
"type": "module",
3131
"scripts": {
3232
"build": "tsc -p tsconfig.build.json",
33+
"lint:eslint": "eslint . --quiet --fix --concurrency=auto",
3334
"lint:staged": "nice-move lint staged",
3435
"lint:type": "tsc -p tsconfig.json",
3536
"prepare": "nice-move git hooks",
36-
"prepublishOnly": "pnpm run lint:staged && pnpm test && pnpm run build",
37+
"prepublishOnly": "pnpm run lint:staged && pnpm run lint:type && pnpm test && pnpm run build",
3738
"snapshot": "ava --fail-fast -u",
3839
"test": "ava --fail-fast"
3940
},
4041
"devDependencies": {
41-
"@bring-it/npm": "^0.9.0",
42-
"@nice-move/all-in-base": "^0.6.18",
42+
"@bring-it/npm": "^0.9.3",
43+
"@nice-move/all-in-base": "^0.6.31",
4344
"ava": "^6.4.1",
44-
"eslint": "^9.37.0",
45-
"garou": "^0.9.15",
46-
"prettier": "^3.6.2",
47-
"typescript": "^5.9.3"
45+
"eslint": "^9.39.2",
46+
"garou": "^0.9.17",
47+
"prettier": "~3.7.4",
48+
"typescript": "~5.9.3"
4849
},
49-
"packageManager": "pnpm@10.18.1",
50+
"packageManager": "pnpm@10.28.0",
5051
"engines": {
51-
"node": ">=20.0.0"
52+
"node": ">=20.0.0",
53+
"pnpm": "^10.28.0"
5254
},
5355
"publishConfig": {
5456
"access": "public",

0 commit comments

Comments
 (0)