nippotion 0.0.1 → 0.0.4
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 +6 -5
- package/dist/cli.js +2 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
A CLI tool that delivers daily reports (diary entries) written in a Notion database to Slack channels based on their labels, every morning. Runs with **`npx nippotion` and a single config file**.
|
|
4
4
|
|
|
5
|
-
- Delivers **the previous business day's** entries on weekday mornings (weekends are skipped; set `"holidays": "jp"` to also skip Japanese holidays via [@holiday-jp/holiday_jp](https://github.com/holiday-jp/holiday_jp). Monday delivers Friday
|
|
5
|
+
- Delivers **the previous business day's** entries on weekday mornings (weekends are skipped; set `"holidays": "jp"` to also skip Japanese holidays via [@holiday-jp/holiday_jp](https://github.com/holiday-jp/holiday_jp). Monday delivers entries dated Friday through Sunday)
|
|
6
6
|
- Routes entries to multiple Slack channels based on their labels (multi-select)
|
|
7
|
-
- Randomly picks one entry each time to feature as the "pickup" entry
|
|
7
|
+
- Randomly picks one entry each time to feature as the "pickup" entry (chosen from all of the day's entries and shared by every channel, even ones whose labels don't match it)
|
|
8
8
|
- Timezone, holiday skipping, language (Japanese/English), and Slack message wording are all configurable (works for non-Japan offices and English-speaking workspaces too)
|
|
9
9
|
|
|
10
10
|
```bash
|
|
@@ -66,7 +66,7 @@ NOTION_API_TOKEN=xxx SLACK_BOT_API_TOKEN=xoxb-xxx npx nippotion
|
|
|
66
66
|
| `SLACK_BOT_API_TOKEN` | Slack Bot User OAuth Token (not needed with `--debug`) |
|
|
67
67
|
| `NIPPOTION_CONFIG` | Path to the config file (same as `--config`; the flag takes precedence) |
|
|
68
68
|
| `NIPPOTION_DEBUG` | Set to `1` for debug mode (same as `--debug`) |
|
|
69
|
-
| `NIPPOTION_LANG` | Language for CLI help
|
|
69
|
+
| `NIPPOTION_LANG` | Language for CLI help, log/error messages, and the default Slack message wording (`ja` / `en`, default: `en`). The config's `language` takes precedence if set |
|
|
70
70
|
| `TZ` | Fallback timezone for date evaluation. Prefer setting `timezone` in the config file |
|
|
71
71
|
|
|
72
72
|
### Scheduled runs with GitHub Actions
|
|
@@ -92,7 +92,7 @@ jobs:
|
|
|
92
92
|
- uses: actions/setup-node@v6
|
|
93
93
|
with:
|
|
94
94
|
node-version: 24
|
|
95
|
-
- run: npx nippotion@
|
|
95
|
+
- run: npx nippotion@0 ${{ github.event.inputs.debug_mode == 'true' && '--debug' || '' }}
|
|
96
96
|
env:
|
|
97
97
|
NOTION_API_TOKEN: ${{ secrets.NOTION_API_TOKEN }}
|
|
98
98
|
SLACK_BOT_API_TOKEN: ${{ secrets.SLACK_BOT_API_TOKEN }}
|
|
@@ -132,8 +132,9 @@ To verify it works, trigger it manually from the Actions tab with `debug_mode: t
|
|
|
132
132
|
|
|
133
133
|
- `channelId` can be found at the end of the Slack channel's link URL, or from the channel details
|
|
134
134
|
- Listing the same label in multiple recipients delivers it to multiple channels
|
|
135
|
+
- As long as at least one entry exists for the day, every recipient channel receives a message — a channel whose labels match no entries still gets the header, pickup, and footer (delivery is skipped entirely only when there are no entries at all)
|
|
135
136
|
- `timezone` is the IANA timezone name used to evaluate business days and "the previous business day" (defaults to the runtime's local timezone if omitted)
|
|
136
|
-
- `language` sets the default Slack message wording and the log/error message language (`ja` / `en
|
|
137
|
+
- `language` sets the default Slack message wording and the log/error message language (`ja` / `en`; **defaults to `NIPPOTION_LANG`, or `en` if neither is set**). Set `"language": "ja"` to use it in Japanese
|
|
137
138
|
- Setting `holidays` to a country code also excludes that country's holidays from business days (**weekends only if omitted**; currently only `jp` — Japanese holidays — is supported). Non-business days are not delivered, and are also skipped when computing "the previous business day" (entries from a holiday arrive together on the next business day)
|
|
138
139
|
- `messages` lets you override individual pieces of Slack wording. All fields are optional (defaults follow `language`). `{database}` is replaced with a link to the database, and `{writer}` with the entry's author name
|
|
139
140
|
|
package/dist/cli.js
CHANGED
|
@@ -257,14 +257,14 @@ var loadConfig = (filePath) => {
|
|
|
257
257
|
raw = readFileSync(filePath, "utf-8");
|
|
258
258
|
} catch (error) {
|
|
259
259
|
const message = error instanceof Error ? error.message : String(error);
|
|
260
|
-
throw new Error(t("config.readFailed", { filePath, message }));
|
|
260
|
+
throw new Error(t("config.readFailed", { filePath, message }), { cause: error });
|
|
261
261
|
}
|
|
262
262
|
let data;
|
|
263
263
|
try {
|
|
264
264
|
data = JSON.parse(raw);
|
|
265
265
|
} catch (error) {
|
|
266
266
|
const message = error instanceof Error ? error.message : String(error);
|
|
267
|
-
throw new Error(t("config.parseFailed", { filePath, message }));
|
|
267
|
+
throw new Error(t("config.parseFailed", { filePath, message }), { cause: error });
|
|
268
268
|
}
|
|
269
269
|
return validateConfig(data);
|
|
270
270
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nippotion",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Deliver daily reports written in Notion to Slack channels based on their labels",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@holiday-jp/holiday_jp": "^2.5.1",
|
|
19
19
|
"@notionhq/client": "^5.22.0",
|
|
20
|
-
"@slack/web-api": "^
|
|
20
|
+
"@slack/web-api": "^8.0.0",
|
|
21
21
|
"dayjs": "^1.11.21",
|
|
22
22
|
"i18next": "^26.3.6",
|
|
23
23
|
"p-retry": "^8.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@eslint/js": "
|
|
27
|
-
"@types/node": "^
|
|
28
|
-
"eslint": "
|
|
26
|
+
"@eslint/js": "10.0.1",
|
|
27
|
+
"@types/node": "^26.1.1",
|
|
28
|
+
"eslint": "10.8.1",
|
|
29
29
|
"tsup": "8.5.1",
|
|
30
30
|
"tsx": "^4.22.4",
|
|
31
31
|
"typescript": "^6.0.3",
|
|
32
|
-
"typescript-eslint": "8.
|
|
32
|
+
"typescript-eslint": "8.67.0",
|
|
33
33
|
"vitest": "^4.1.9"
|
|
34
34
|
},
|
|
35
35
|
"overrides": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"nippotion": "dist/cli.js"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
|
-
"node": ">=
|
|
47
|
+
"node": ">=22"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
50
|
"dist"
|