cli-macro 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/index.js +8 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -10,15 +10,18 @@ const argv = process.argv;
10
10
  const command = argv[2];
11
11
  let filename = argv[3];
12
12
 
13
- // 홈 디렉토리 경로
14
- const homeDir = os.homedir();
13
+ // 홈 디렉토리 아래 .clim 폴더 경로
14
+ const dataDir = path.join(os.homedir(), ".clim");
15
+ if (!fs.existsSync(dataDir)) {
16
+ fs.mkdirSync(dataDir, { recursive: true });
17
+ }
15
18
 
16
19
  // 파일명에 .clim 확장자 추가/처리
17
20
  function getClimFilePath(name) {
18
21
  if (!name.endsWith(".clim")) {
19
22
  name = name + ".clim";
20
23
  }
21
- return path.join(homeDir, name);
24
+ return path.join(dataDir, name);
22
25
  }
23
26
 
24
27
  // 기본 사용법 안내
@@ -138,8 +141,8 @@ if (command === "new" || command === "n") {
138
141
  console.log(`${path.basename(filepath)} was deleted`);
139
142
  } else if (command === "list" || command === "ls") {
140
143
  // 파일 목록 보기 기능 (.clim 파일만)
141
- const files = fs.readdirSync(homeDir).filter(file => {
142
- const fullPath = path.join(homeDir, file);
144
+ const files = fs.readdirSync(dataDir).filter(file => {
145
+ const fullPath = path.join(dataDir, file);
143
146
  return fs.statSync(fullPath).isFile() && file.endsWith(".clim");
144
147
  });
145
148
  if (files.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-macro",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "CLI Macro",
5
5
  "keywords": [
6
6
  "CLIM",