ntn 0.1.19 → 0.1.27

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
@@ -7,11 +7,8 @@ A command-line interface for Notion.
7
7
 
8
8
  ## Installation
9
9
 
10
- Download and install the latest release:
11
-
12
10
  ```bash
13
- curl -fsSL https://github.com/makenotion/cli/releases/latest/download/ntn-aarch64-apple-darwin.tar.gz \
14
- | tar xz --strip-components=1 -C /usr/local/bin ntn-*/ntn
11
+ npm i -g ntn
15
12
  ```
16
13
 
17
14
  ## Building from source
Binary file
package/install.cjs ADDED
@@ -0,0 +1,46 @@
1
+ const fs = require("node:fs");
2
+ const path = require("node:path");
3
+
4
+ const PLATFORMS = {
5
+ "darwin-arm64": "ntn-darwin-arm64",
6
+ };
7
+
8
+ const actions = { install, uninstall };
9
+
10
+ try {
11
+ const action = actions[process.argv[2]];
12
+ if (!action) {
13
+ console.error(`Usage: node install.cjs [install|uninstall]`);
14
+ process.exit(1);
15
+ }
16
+ action();
17
+ } catch (err) {
18
+ console.error(err);
19
+ process.exit(1);
20
+ }
21
+
22
+ function install() {
23
+ const key = `${process.platform}-${process.arch}`;
24
+ const dir = PLATFORMS[key];
25
+
26
+ if (!dir) {
27
+ console.error(
28
+ `error: ntn does not support ${process.platform} ${process.arch}`
29
+ );
30
+ process.exit(1);
31
+ }
32
+
33
+ const src = path.join(__dirname, "dist", dir, "ntn");
34
+ const dest = path.join(__dirname, "bin", "ntn");
35
+
36
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
37
+ fs.copyFileSync(src, dest);
38
+ fs.chmodSync(dest, 0o755);
39
+ }
40
+
41
+ function uninstall() {
42
+ const dest = path.join(__dirname, "bin", "ntn");
43
+ try {
44
+ fs.unlinkSync(dest);
45
+ } catch (_) {}
46
+ }
package/package.json CHANGED
@@ -1,15 +1,29 @@
1
1
  {
2
- "name": "ntn",
3
- "version": "0.1.19",
4
- "description": "Notion CLI",
5
- "license": "MIT",
6
- "bin": {
7
- "ntn": "bin/ntn"
8
- },
9
- "files": [
10
- "bin",
11
- "dist",
12
- "LICENSE.md",
13
- "README.md"
14
- ]
2
+ "name": "ntn",
3
+ "version": "0.1.27",
4
+ "description": "Notion CLI",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "ntn": "bin/ntn"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "dist",
12
+ "install.cjs",
13
+ "LICENSE.md",
14
+ "README.md"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "scripts": {
20
+ "preinstall": "node install.cjs install",
21
+ "preuninstall": "node install.cjs uninstall"
22
+ },
23
+ "os": [
24
+ "darwin"
25
+ ],
26
+ "cpu": [
27
+ "arm64"
28
+ ]
15
29
  }