@doki-land/nifty 0.1.4 → 0.1.5
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 +55 -0
- package/package.json +23 -19
- package/src/cli/publish-cmd.ts +2 -0
- package/src/cli/publish.ts +7 -1
- package/src/native.ts +3 -0
package/Readme.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @doki-land/nifty
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@doki-land/nifty)
|
|
4
|
+
|
|
5
|
+
Programmatic and CLI surface for **Nifty** — gitmoji commit lint, hybrid Cargo + npm bumps, Oak formatting, workspace publish, and gix-backed git helpers. Product overview: [npm-tools readme](https://github.com/oovm/npm-tools#readme).
|
|
6
|
+
|
|
7
|
+
## Exports
|
|
8
|
+
|
|
9
|
+
| Subpath | Purpose |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `@doki-land/nifty` | `Nifty`, `Git`, `Github`, `Gitmoji`, config loaders, shared types |
|
|
12
|
+
| `@doki-land/nifty/cli` | CLI module re-exports (advanced integrations) |
|
|
13
|
+
| `nifty` (bin) | Full command-line interface |
|
|
14
|
+
|
|
15
|
+
Platform native bindings (`@doki-land/nifty-*`) install automatically as optional dependencies on matching hosts. Do not import them directly.
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
**CLI** — run from a project root that contains `nifty.config.ts` (optional):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
nifty check --from v0.1.0 --to HEAD
|
|
23
|
+
nifty bump --version 0.2.0 --dry-run
|
|
24
|
+
nifty format --check
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**TypeScript API** — open a hybrid workspace and read git history:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { createNifty } from "@doki-land/nifty";
|
|
31
|
+
|
|
32
|
+
const nifty = await createNifty({ cwd: process.cwd() });
|
|
33
|
+
const ok = nifty.gitmoji.validateSubject("✨ Add workspace helper");
|
|
34
|
+
const range = nifty.git.resolveRange(nifty.layout.root, {
|
|
35
|
+
fromRef: "v0.1.0",
|
|
36
|
+
toRef: "HEAD",
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Config** — typed project defaults:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { defineConfig } from "@doki-land/nifty";
|
|
44
|
+
|
|
45
|
+
export default defineConfig({
|
|
46
|
+
lint: {
|
|
47
|
+
rules: [{ id: "gitmoji/subject", severity: "error", enabled: true }],
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Related packages
|
|
53
|
+
|
|
54
|
+
- [@doki-land/nifty-skills](https://www.npmjs.com/package/@doki-land/nifty-skills) — Agent Skills for `nifty` workflows
|
|
55
|
+
- Platform sidecars (`@doki-land/nifty-win32-x64`, `@doki-land/nifty-linux-x64`, …) — prebuilt Node-API artifacts resolved by this package
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@doki-land/nifty",
|
|
3
|
-
"version": "0.1.4",
|
|
4
|
-
"description": "Gitmoji-first commit conventions and release helpers (Node-API + TypeScript)",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MPL-2.0",
|
|
7
2
|
"bin": {
|
|
8
3
|
"nifty": "cli/nifty.mjs"
|
|
9
4
|
},
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@vmz/commander": "^0.2.0",
|
|
7
|
+
"jiti": "^2.4.2"
|
|
8
|
+
},
|
|
9
|
+
"description": "Gitmoji-first commit conventions and release helpers (Node-API + TypeScript)",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@types/node": "^22.13.10",
|
|
12
|
+
"typescript": "^5.8.3"
|
|
13
|
+
},
|
|
10
14
|
"exports": {
|
|
11
15
|
".": "./src/index.ts",
|
|
12
16
|
"./cli": "./src/cli/index.ts"
|
|
@@ -16,20 +20,14 @@
|
|
|
16
20
|
"locales",
|
|
17
21
|
"src"
|
|
18
22
|
],
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"test": "node --test tests/*.test.mjs"
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@vmz/commander": "^0.2.0",
|
|
25
|
-
"jiti": "^2.4.2"
|
|
26
|
-
},
|
|
23
|
+
"license": "MPL-2.0",
|
|
24
|
+
"name": "@doki-land/nifty",
|
|
27
25
|
"optionalDependencies": {
|
|
28
|
-
"@doki-land/nifty-
|
|
29
|
-
"@doki-land/nifty-
|
|
30
|
-
"@doki-land/nifty-linux-arm64": "0.1.
|
|
31
|
-
"@doki-land/nifty-
|
|
32
|
-
"@doki-land/nifty-
|
|
26
|
+
"@doki-land/nifty-darwin-arm64": "0.1.5",
|
|
27
|
+
"@doki-land/nifty-darwin-x64": "0.1.5",
|
|
28
|
+
"@doki-land/nifty-linux-arm64": "0.1.5",
|
|
29
|
+
"@doki-land/nifty-linux-x64": "0.1.5",
|
|
30
|
+
"@doki-land/nifty-win32-x64": "0.1.5"
|
|
33
31
|
},
|
|
34
32
|
"publishConfig": {
|
|
35
33
|
"access": "public"
|
|
@@ -37,5 +35,11 @@
|
|
|
37
35
|
"repository": {
|
|
38
36
|
"type": "git",
|
|
39
37
|
"url": "git+https://github.com/oovm/npm-tools.git"
|
|
40
|
-
}
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"test": "node --test tests/*.test.mjs",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
42
|
+
},
|
|
43
|
+
"type": "module",
|
|
44
|
+
"version": "0.1.5"
|
|
41
45
|
}
|
package/src/cli/publish-cmd.ts
CHANGED
|
@@ -16,6 +16,7 @@ export function registerPublishCommand(cli: Cli): void {
|
|
|
16
16
|
.option("--package <name>", "cli.opt.package")
|
|
17
17
|
.option("--tag <tag>", "cli.opt.tag")
|
|
18
18
|
.option("--access <access>", "cli.opt.access")
|
|
19
|
+
.option("--version <version>", "cli.opt.version")
|
|
19
20
|
.option("--otp <code>", "cli.opt.otp")
|
|
20
21
|
.option("--totp-secret <secret>", "cli.opt.totp-secret")
|
|
21
22
|
.option("--npm-token <token>", "cli.opt.npm-token")
|
|
@@ -35,6 +36,7 @@ export async function cmdPublish(options: ParsedOptions): Promise<number> {
|
|
|
35
36
|
placeholder: flag(options, "placeholder"),
|
|
36
37
|
tag: str(options, "tag"),
|
|
37
38
|
access: str(options, "access") ?? "public",
|
|
39
|
+
version: str(options, "version"),
|
|
38
40
|
...(packages.length === 1
|
|
39
41
|
? { only: packages[0] }
|
|
40
42
|
: packages.length > 1
|
package/src/cli/publish.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type PublishOptions = {
|
|
|
8
8
|
placeholder?: boolean;
|
|
9
9
|
tag?: string;
|
|
10
10
|
access?: string;
|
|
11
|
+
version?: string;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
export type PublishReport = {
|
|
@@ -28,6 +29,7 @@ export async function runPublish(argv: string[]): Promise<void> {
|
|
|
28
29
|
placeholder: options.placeholder,
|
|
29
30
|
tag: options.tag,
|
|
30
31
|
access: options.access,
|
|
32
|
+
version: options.version,
|
|
31
33
|
...authPayload(options.auth),
|
|
32
34
|
});
|
|
33
35
|
printPublishReport(report, options.dryRun);
|
|
@@ -40,6 +42,7 @@ function parsePublishArgs(argv: string[]) {
|
|
|
40
42
|
let placeholder = false;
|
|
41
43
|
let tag: string | undefined;
|
|
42
44
|
let access = "public";
|
|
45
|
+
let version: string | undefined;
|
|
43
46
|
const auth = parseAuthArgs(argv);
|
|
44
47
|
|
|
45
48
|
for (let i = 0; i < argv.length; i += 1) {
|
|
@@ -56,6 +59,8 @@ function parsePublishArgs(argv: string[]) {
|
|
|
56
59
|
tag = argv[++i];
|
|
57
60
|
} else if (arg === "--access") {
|
|
58
61
|
access = argv[++i];
|
|
62
|
+
} else if (arg === "--version") {
|
|
63
|
+
version = argv[++i];
|
|
59
64
|
} else if (arg === "-h" || arg === "--help") {
|
|
60
65
|
printPublishHelp();
|
|
61
66
|
process.exit(0);
|
|
@@ -64,7 +69,7 @@ function parsePublishArgs(argv: string[]) {
|
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
|
|
67
|
-
return { cwd, dryRun, refresh, placeholder, tag, access, auth };
|
|
72
|
+
return { cwd, dryRun, refresh, placeholder, tag, access, version, auth };
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
export function printPublishReport(report: PublishReport, dryRun?: boolean): void {
|
|
@@ -96,6 +101,7 @@ Usage:
|
|
|
96
101
|
nifty publish --placeholder
|
|
97
102
|
nifty publish --tag next
|
|
98
103
|
nifty publish --access public
|
|
104
|
+
nifty publish --version 0.3.1
|
|
99
105
|
nifty publish --otp 123456
|
|
100
106
|
nifty publish -C <cwd>
|
|
101
107
|
|
package/src/native.ts
CHANGED
|
@@ -222,6 +222,7 @@ export type PublisherExports = {
|
|
|
222
222
|
placeholder?: boolean;
|
|
223
223
|
only?: string;
|
|
224
224
|
packages?: string[];
|
|
225
|
+
version?: string;
|
|
225
226
|
tag?: string;
|
|
226
227
|
access?: string;
|
|
227
228
|
npm?: string;
|
|
@@ -303,6 +304,7 @@ type NativeBinding = {
|
|
|
303
304
|
token?: string | null;
|
|
304
305
|
only?: string | null;
|
|
305
306
|
packages?: string[] | null;
|
|
307
|
+
version?: string | null;
|
|
306
308
|
}) => PublishReport;
|
|
307
309
|
publisherTrustWorkspace: (options: {
|
|
308
310
|
cwd?: string | null;
|
|
@@ -700,6 +702,7 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
|
|
|
700
702
|
...(options.placeholder !== undefined ? { placeholder: options.placeholder } : {}),
|
|
701
703
|
...(options.only !== undefined ? { only: options.only } : {}),
|
|
702
704
|
...(options.packages !== undefined ? { packages: options.packages } : {}),
|
|
705
|
+
...(options.version !== undefined ? { version: options.version } : {}),
|
|
703
706
|
...(options.tag !== undefined ? { tag: options.tag } : {}),
|
|
704
707
|
...(options.access !== undefined ? { access: options.access } : {}),
|
|
705
708
|
...(options.npm !== undefined ? { npm: options.npm } : {}),
|