@snelusha/noto 0.2.0 → 0.2.2

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/dist/cli.cjs CHANGED
@@ -25,12 +25,12 @@ const os__default = /*#__PURE__*/_interopDefaultCompat(os);
25
25
  const process__default = /*#__PURE__*/_interopDefaultCompat(process$1);
26
26
  const ora__default = /*#__PURE__*/_interopDefaultCompat(ora);
27
27
 
28
- const TEMP_DIR = node_path.join(os__default.tmpdir(), "snelusha-noto");
28
+ const APP_DIR = node_path.join(os__default.homedir(), "snelusha-noto");
29
29
  let counter = 0;
30
30
  async function openTemp() {
31
- if (!node_fs.existsSync(TEMP_DIR))
32
- await node_fs.promises.mkdir(TEMP_DIR, { recursive: true });
33
- const competitivePath = node_path.join(TEMP_DIR, `.${process__default.pid}.${counter}`);
31
+ if (!node_fs.existsSync(APP_DIR))
32
+ await node_fs.promises.mkdir(APP_DIR, { recursive: true });
33
+ const competitivePath = node_path.join(APP_DIR, `.${process__default.pid}.${counter}`);
34
34
  counter += 1;
35
35
  return node_fs.promises.open(competitivePath, "wx").then((fd) => ({
36
36
  fd,
@@ -93,7 +93,7 @@ function spinner() {
93
93
  }
94
94
 
95
95
  let storage = {};
96
- const storagePath = node_path.resolve(TEMP_DIR, "storage.json");
96
+ const storagePath = node_path.resolve(APP_DIR, "storage.json");
97
97
  async function load(fn) {
98
98
  try {
99
99
  if (!Object.keys(storage).length) {
@@ -132,7 +132,7 @@ async function getStagedDiff() {
132
132
  async function commit(message) {
133
133
  try {
134
134
  const result = await tinyexec.x("git", ["commit", "-m", message]);
135
- return result.stdout.includes("files changed");
135
+ return /file(s)? changed/i.test(result.stdout.toString());
136
136
  } catch {
137
137
  return false;
138
138
  }
package/dist/cli.mjs CHANGED
@@ -13,12 +13,12 @@ import { x } from 'tinyexec';
13
13
  import { generateText } from 'ai';
14
14
  import { createGoogleGenerativeAI } from '@ai-sdk/google';
15
15
 
16
- const TEMP_DIR = join(os.tmpdir(), "snelusha-noto");
16
+ const APP_DIR = join(os.homedir(), "snelusha-noto");
17
17
  let counter = 0;
18
18
  async function openTemp() {
19
- if (!existsSync(TEMP_DIR))
20
- await promises.mkdir(TEMP_DIR, { recursive: true });
21
- const competitivePath = join(TEMP_DIR, `.${process$1.pid}.${counter}`);
19
+ if (!existsSync(APP_DIR))
20
+ await promises.mkdir(APP_DIR, { recursive: true });
21
+ const competitivePath = join(APP_DIR, `.${process$1.pid}.${counter}`);
22
22
  counter += 1;
23
23
  return promises.open(competitivePath, "wx").then((fd) => ({
24
24
  fd,
@@ -81,7 +81,7 @@ function spinner() {
81
81
  }
82
82
 
83
83
  let storage = {};
84
- const storagePath = resolve(TEMP_DIR, "storage.json");
84
+ const storagePath = resolve(APP_DIR, "storage.json");
85
85
  async function load(fn) {
86
86
  try {
87
87
  if (!Object.keys(storage).length) {
@@ -120,7 +120,7 @@ async function getStagedDiff() {
120
120
  async function commit(message) {
121
121
  try {
122
122
  const result = await x("git", ["commit", "-m", message]);
123
- return result.stdout.includes("files changed");
123
+ return /file(s)? changed/i.test(result.stdout.toString());
124
124
  } catch {
125
125
  return false;
126
126
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "description": "generate clean commit messages in a snap! ✨",
6
6
  "license": "MIT",
7
7
  "author": {