@diuyuy/snippet-generator 1.0.2 → 1.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/README.md CHANGED
@@ -11,5 +11,3 @@ To run:
11
11
  ```bash
12
12
  bun run index.ts
13
13
  ```
14
-
15
- This project was created using `bun init` in bun v1.3.5. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
@@ -24,6 +24,11 @@ export async function generateSnippet(allFiles: string[]) {
24
24
  const buffer = fs.readFileSync(answer);
25
25
  let texts = buffer.toString();
26
26
 
27
+ const name = await input({
28
+ message: "Snippet name:",
29
+ required: true,
30
+ });
31
+
27
32
  const prefix = await input({
28
33
  message: "prefix:",
29
34
  required: true,
@@ -51,7 +56,11 @@ export async function generateSnippet(allFiles: string[]) {
51
56
  spinner.start();
52
57
  const body = texts.split("\n");
53
58
 
54
- const snippet = JSON.stringify({ prefix, description, body }, null, 2);
59
+ const snippet = JSON.stringify(
60
+ { [name]: { prefix, description, body } },
61
+ null,
62
+ 2
63
+ ).slice(1, -1);
55
64
  await clipboard.write(snippet);
56
65
 
57
66
  spinner.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diuyuy/snippet-generator",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "gsnippet": "./dist/index.js"