hiroppy 1.0.24 → 1.0.25
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 +4 -4
- package/generated/images.tar.gz +0 -0
- package/package.json +12 -11
- package/lib/github.mjs +0 -95
- package/lib/hatena.mjs +0 -19
- package/lib/index.mjs +0 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ I am a JS engineer living in Japan, and I love creating OSS and web services.
|
|
|
16
16
|
## Active Repositories
|
|
17
17
|
|
|
18
18
|
- [web-app-template](https://github.com/hiroppy/web-app-template)
|
|
19
|
-
- A minimal web service template 🎃
|
|
19
|
+
- A minimal web service template 🎃 "npx create-app-foundation@latest" !
|
|
20
20
|
- [nextjs-app-router-training](https://github.com/hiroppy/nextjs-app-router-training)
|
|
21
21
|
- Introducing various basic patterns of app router with simplified code.
|
|
22
22
|
|
|
@@ -141,6 +141,6 @@ $ npm i hiroppy
|
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
```ts
|
|
144
|
-
import jobs
|
|
145
|
-
import media from "hiroppy/media" with { type: "json" };
|
|
146
|
-
```
|
|
144
|
+
import jobs from "hiroppy/data/jobs" with { type: "json" };
|
|
145
|
+
import media from "hiroppy/data/media" with { type: "json" };
|
|
146
|
+
```
|
package/generated/images.tar.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hiroppy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"packageManager": "pnpm@10.11.0",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
6
8
|
"exports": {
|
|
7
|
-
"
|
|
9
|
+
"./data/*": {
|
|
8
10
|
"require": "./generated/*.json",
|
|
9
11
|
"import": "./generated/*.json",
|
|
10
12
|
"default": "./generated/*.json"
|
|
@@ -13,18 +15,16 @@
|
|
|
13
15
|
"require": "./generated/images/*",
|
|
14
16
|
"import": "./generated/images/*",
|
|
15
17
|
"default": "./generated/images/*"
|
|
16
|
-
},
|
|
17
|
-
"./helpers": {
|
|
18
|
-
"import": "./lib/index.mjs",
|
|
19
|
-
"default": "./lib/index.mjs"
|
|
20
18
|
}
|
|
21
19
|
},
|
|
22
20
|
"scripts": {
|
|
23
21
|
"setup": "corepack enable pnpm",
|
|
24
|
-
"build": "
|
|
25
|
-
"build:
|
|
22
|
+
"build": "pnpm run /build:.*/ && pnpm lint",
|
|
23
|
+
"build:generated": "node scripts/index.ts",
|
|
24
|
+
"build:readme": "node scripts/readme.ts",
|
|
25
|
+
"build:src": "tsc -p src/tsconfig.json",
|
|
26
26
|
"lint": "prettier -w './**/*.{md,yml}' && biome check . --fix",
|
|
27
|
-
"reset": "rm -rf generated && mkdir generated && mkdir generated/images",
|
|
27
|
+
"reset": "rm -rf generated dist && mkdir generated && mkdir generated/images",
|
|
28
28
|
"cleanup": "node scripts/cleanup-unused-images.ts",
|
|
29
29
|
"compress:images": "node scripts/compress-images.ts",
|
|
30
30
|
"decompress:images": "node scripts/decompress-images.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"files": [
|
|
40
40
|
"generated",
|
|
41
|
-
"
|
|
41
|
+
"dist",
|
|
42
42
|
"scripts/decompress-images.js"
|
|
43
43
|
],
|
|
44
44
|
"publishConfig": {
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"emoji-js": "3.8.1",
|
|
60
60
|
"lefthook": "1.11.13",
|
|
61
61
|
"prettier": "3.5.3",
|
|
62
|
-
"sharp": "0.34.2"
|
|
62
|
+
"sharp": "0.34.2",
|
|
63
|
+
"typescript": "5.8.3"
|
|
63
64
|
}
|
|
64
65
|
}
|
package/lib/github.mjs
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Octokit } from "octokit";
|
|
2
|
-
|
|
3
|
-
let octokit = null;
|
|
4
|
-
|
|
5
|
-
function getOctokit() {
|
|
6
|
-
if (!octokit) {
|
|
7
|
-
const token = process.env.GITHUB_TOKEN;
|
|
8
|
-
if (!token) {
|
|
9
|
-
throw new Error("GITHUB_TOKEN environment variable is required");
|
|
10
|
-
}
|
|
11
|
-
octokit = new Octokit({ auth: token });
|
|
12
|
-
}
|
|
13
|
-
return octokit;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get star count for a repository
|
|
18
|
-
* @param owner - Repository owner
|
|
19
|
-
* @param repo - Repository name
|
|
20
|
-
* @returns Promise<number> - Star count
|
|
21
|
-
*/
|
|
22
|
-
export async function getStarCount(owner, repo) {
|
|
23
|
-
try {
|
|
24
|
-
const octokit = getOctokit();
|
|
25
|
-
const { data } = await octokit.rest.repos.get({
|
|
26
|
-
owner,
|
|
27
|
-
repo,
|
|
28
|
-
});
|
|
29
|
-
return data.stargazers_count;
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error(`Failed to fetch star count for ${owner}/${repo}:`, error);
|
|
32
|
-
return 0;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get star counts for multiple repositories
|
|
38
|
-
* @param repos - Array of repository names in "owner/repo" format
|
|
39
|
-
* @returns Promise<Record<string, number>> - Object mapping repo names to star counts
|
|
40
|
-
*/
|
|
41
|
-
export async function getStarCounts(repos) {
|
|
42
|
-
const results = {};
|
|
43
|
-
|
|
44
|
-
const promises = repos.map(async (repoName) => {
|
|
45
|
-
const [owner, repo] = repoName.split("/");
|
|
46
|
-
if (!owner || !repo) {
|
|
47
|
-
console.warn(
|
|
48
|
-
`Invalid repository name format: ${repoName}. Expected "owner/repo"`,
|
|
49
|
-
);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const stars = await getStarCount(owner, repo);
|
|
54
|
-
results[repoName] = stars;
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
await Promise.all(promises);
|
|
58
|
-
return results;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Get repository information including star count
|
|
63
|
-
* @param owner - Repository owner
|
|
64
|
-
* @param repo - Repository name
|
|
65
|
-
* @returns Promise<object> - Repository information
|
|
66
|
-
*/
|
|
67
|
-
export async function getRepositoryInfo(owner, repo) {
|
|
68
|
-
try {
|
|
69
|
-
const octokit = getOctokit();
|
|
70
|
-
const { data } = await octokit.rest.repos.get({
|
|
71
|
-
owner,
|
|
72
|
-
repo,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
name: data.full_name,
|
|
77
|
-
url: data.html_url,
|
|
78
|
-
description: data.description,
|
|
79
|
-
language: data.language,
|
|
80
|
-
stars: data.stargazers_count,
|
|
81
|
-
forks: data.forks_count,
|
|
82
|
-
openIssues: data.open_issues_count,
|
|
83
|
-
defaultBranch: data.default_branch,
|
|
84
|
-
createdAt: data.created_at,
|
|
85
|
-
updatedAt: data.updated_at,
|
|
86
|
-
avatar: data.owner.avatar_url,
|
|
87
|
-
};
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error(
|
|
90
|
-
`Failed to fetch repository info for ${owner}/${repo}:`,
|
|
91
|
-
error,
|
|
92
|
-
);
|
|
93
|
-
throw error;
|
|
94
|
-
}
|
|
95
|
-
}
|
package/lib/hatena.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get bookmark count from Hatena Bookmark
|
|
3
|
-
* @param {string} entry - URL to get bookmark count for
|
|
4
|
-
* @returns {Promise<number>} Bookmark count
|
|
5
|
-
*/
|
|
6
|
-
export async function getBookmark(entry) {
|
|
7
|
-
try {
|
|
8
|
-
const url = `https://b.hatena.ne.jp/entry/json/${entry}`;
|
|
9
|
-
const res = await fetch(url);
|
|
10
|
-
if (!res.ok) {
|
|
11
|
-
throw new Error(`HTTP error! status: ${res.status}`);
|
|
12
|
-
}
|
|
13
|
-
const data = await res.json();
|
|
14
|
-
return data.count || 0;
|
|
15
|
-
} catch (error) {
|
|
16
|
-
console.error(`Failed to fetch bookmark for ${entry}:`, error);
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
19
|
-
}
|
package/lib/index.mjs
DELETED