tylersong 1.0.15 โ†’ 1.0.16

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
@@ -46,6 +46,23 @@
46
46
  npx tylersong
47
47
  ```
48
48
 
49
+ ### ๐Ÿ”ง ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ • (์„ ํƒ์‚ฌํ•ญ)
50
+
51
+ ๋” ์ž์„ธํ•œ ๊ฒฝ๋ ฅ ์ •๋ณด์™€ ํฌํŠธํด๋ฆฌ์˜ค ์ •๋ณด๋ฅผ ๋ณด๋ ค๋ฉด Sanity CMS ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์„ค์ •ํ•˜์„ธ์š”:
52
+
53
+ ```bash
54
+ # ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ •
55
+ export SANITY_PROJECT_ID='your-project-id'
56
+ export SANITY_DATASET='production'
57
+ export SANITY_API_VERSION='2025-12-06'
58
+ export SANITY_API_TOKEN='your-token' # ์„ ํƒ์‚ฌํ•ญ, ์ฝ๊ธฐ ์ „์šฉ ๊ถŒ์žฅ
59
+
60
+ # ์‹คํ–‰
61
+ npx tylersong
62
+ ```
63
+
64
+ > **์ฐธ๊ณ **: ํ™˜๊ฒฝ ๋ณ€์ˆ˜๊ฐ€ ์„ค์ •๋˜์ง€ ์•Š์•„๋„ ๊ธฐ๋ณธ ํ”„๋กœํ•„ ์ •๋ณด๋Š” ์ •์ƒ์ ์œผ๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.
65
+
49
66
  ### ๐Ÿ“ฆ ์ „์—ญ ์„ค์น˜
50
67
 
51
68
  ์ž์ฃผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์ „์—ญ์œผ๋กœ ์„ค์น˜ํ•˜์„ธ์š”:
@@ -22,5 +22,5 @@ export declare const getPortfolio: (name: string | undefined) => Promise<Portfol
22
22
  /**
23
23
  * Sanity ํด๋ผ์ด์–ธํŠธ ์ธ์Šคํ„ด์Šค๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค (ํ•„์š”ํ•œ ๊ฒฝ์šฐ)
24
24
  */
25
- export declare const getSanityClient: () => ReturnType<typeof createClient>;
25
+ export declare const getSanityClient: () => ReturnType<typeof createClient> | null;
26
26
  //# sourceMappingURL=sanity.d.ts.map
@@ -2,6 +2,7 @@ import { createClient } from "@sanity/client";
2
2
  /**
3
3
  * ํ™˜๊ฒฝ ๋ณ€์ˆ˜์—์„œ Sanity ์„ค์ •์„ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค
4
4
  * npm ํŒจํ‚ค์ง€์—์„œ๋Š” process.env์—์„œ๋งŒ ์ฝ์Šต๋‹ˆ๋‹ค
5
+ * ํ™˜๊ฒฝ ๋ณ€์ˆ˜๊ฐ€ ์—†์œผ๋ฉด null์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค
5
6
  */
6
7
  const loadEnvConfig = () => {
7
8
  const projectId = process.env.SANITY_PROJECT_ID;
@@ -9,15 +10,7 @@ const loadEnvConfig = () => {
9
10
  const apiVersion = process.env.SANITY_API_VERSION;
10
11
  const token = process.env.SANITY_API_TOKEN;
11
12
  if (!projectId || !dataset || !apiVersion) {
12
- throw new Error("Sanity ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ์„ค์ •ํ•ด์ฃผ์„ธ์š”:\n" +
13
- " - SANITY_PROJECT_ID\n" +
14
- " - SANITY_DATASET\n" +
15
- " - SANITY_API_VERSION\n" +
16
- " - SANITY_API_TOKEN (์„ ํƒ์‚ฌํ•ญ)\n\n" +
17
- "ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ • ๋ฐฉ๋ฒ•:\n" +
18
- " export SANITY_PROJECT_ID='your-project-id'\n" +
19
- " export SANITY_DATASET='production'\n" +
20
- " export SANITY_API_VERSION='2025-12-06'");
13
+ return null;
21
14
  }
22
15
  return {
23
16
  projectId,
@@ -32,6 +25,9 @@ const loadEnvConfig = () => {
32
25
  */
33
26
  const createSanityClient = () => {
34
27
  const config = loadEnvConfig();
28
+ if (!config) {
29
+ return null;
30
+ }
35
31
  return createClient({
36
32
  projectId: config.projectId,
37
33
  dataset: config.dataset,
@@ -46,7 +42,7 @@ let client = null;
46
42
  * Sanity ํด๋ผ์ด์–ธํŠธ๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค (์ง€์—ฐ ์ดˆ๊ธฐํ™”)
47
43
  */
48
44
  const getClient = () => {
49
- if (!client) {
45
+ if (client === null) {
50
46
  client = createSanityClient();
51
47
  }
52
48
  return client;
@@ -56,6 +52,10 @@ const getClient = () => {
56
52
  */
57
53
  export const getExperiences = async () => {
58
54
  try {
55
+ const client = getClient();
56
+ if (!client) {
57
+ return [];
58
+ }
59
59
  const query = `*[_type == "experience"] | order(startDate asc) {
60
60
  _id,
61
61
  company,
@@ -66,7 +66,7 @@ export const getExperiences = async () => {
66
66
  technologies,
67
67
  location
68
68
  }`;
69
- const experiences = await getClient().fetch(query);
69
+ const experiences = await client.fetch(query);
70
70
  return experiences;
71
71
  }
72
72
  catch (error) {
@@ -78,6 +78,10 @@ export const getExperiences = async () => {
78
78
  */
79
79
  export const getExperienceById = async (id) => {
80
80
  try {
81
+ const client = getClient();
82
+ if (!client) {
83
+ return null;
84
+ }
81
85
  const query = `*[_type == "experience" && _id == $id][0] {
82
86
  _id,
83
87
  company,
@@ -88,7 +92,7 @@ export const getExperienceById = async (id) => {
88
92
  technologies,
89
93
  location
90
94
  }`;
91
- const experience = await getClient().fetch(query, {
95
+ const experience = await client.fetch(query, {
92
96
  id,
93
97
  });
94
98
  return experience;
@@ -99,6 +103,10 @@ export const getExperienceById = async (id) => {
99
103
  };
100
104
  export const getPortfolio = async (name) => {
101
105
  try {
106
+ const client = getClient();
107
+ if (!client) {
108
+ return null;
109
+ }
102
110
  // name์ด ์ œ๊ณต๋œ ๊ฒฝ์šฐ author์˜ name๊ณผ ์ผ์น˜ํ•˜๋Š” portfolio๋งŒ ์กฐํšŒ
103
111
  const query = `*[_type == "portfolio" && author->name == $name][0] {
104
112
  "author": author-> {
@@ -107,8 +115,8 @@ export const getPortfolio = async (name) => {
107
115
  }
108
116
  }`;
109
117
  const portfolio = name
110
- ? await getClient().fetch(query, { name })
111
- : await getClient().fetch(query);
118
+ ? await client.fetch(query, { name })
119
+ : await client.fetch(query);
112
120
  return portfolio;
113
121
  }
114
122
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tylersong",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "๋‚˜์˜ CLI ์ž๊ธฐ์†Œ๊ฐœ ๋„๊ตฌ",
5
5
  "main": "dist/index.js",
6
6
  "bin": {