@kokiito0926/fmeditor 0.0.2 → 0.0.3
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/index.js +3 -4
- package/package.json +1 -2
package/index.js
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
// >> $ curl -fsSL https://raw.githubusercontent.com/Kernix13/markdown-cheatsheet/refs/heads/master/frontmatter.md | ./index.js set --tags '["markdown", "frontmatter", "yaml"]'
|
|
5
5
|
// >> $ curl -fsSL https://raw.githubusercontent.com/Kernix13/markdown-cheatsheet/refs/heads/master/frontmatter.md | ./index.js remove --title --tags
|
|
6
6
|
|
|
7
|
-
import { stdin, argv } from "zx";
|
|
7
|
+
import { stdin, argv, YAML } from "zx";
|
|
8
8
|
import matter from "gray-matter";
|
|
9
|
-
import yaml from "js-yaml";
|
|
10
9
|
|
|
11
10
|
if (process.stdin.isTTY) {
|
|
12
11
|
process.exit(1);
|
|
@@ -41,13 +40,13 @@ if (command === "set") {
|
|
|
41
40
|
|
|
42
41
|
const keys = Object.keys(flags);
|
|
43
42
|
if (keys.length === 0) {
|
|
44
|
-
console.log(
|
|
43
|
+
console.log(YAML.stringify(doc.data));
|
|
45
44
|
} else {
|
|
46
45
|
const result = {};
|
|
47
46
|
keys.forEach((k) => {
|
|
48
47
|
if (k in doc.data) result[k] = doc.data[k];
|
|
49
48
|
});
|
|
50
|
-
console.log(
|
|
49
|
+
console.log(YAML.stringify(result));
|
|
51
50
|
}
|
|
52
51
|
} else if (command === "remove") {
|
|
53
52
|
const doc = matter(input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kokiito0926/fmeditor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "フロントマターを編集することができるコマンドラインのツールです。",
|
|
6
6
|
"keywords": [
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"gray-matter": "^4.0.3",
|
|
38
|
-
"js-yaml": "^4.1.1",
|
|
39
38
|
"zx": "^8.8.4"
|
|
40
39
|
},
|
|
41
40
|
"engines": {
|