@reliverse/dler 2.2.17 → 2.3.1
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 +190 -55
- package/dist/cli.js +5 -2
- package/dist/cmds/biome/cmd.d.ts +5 -1
- package/dist/cmds/biome/cmd.js +20 -29
- package/dist/cmds/biome/impl.js +26 -21
- package/dist/cmds/build/cmd.d.ts +91 -1
- package/dist/cmds/build/cmd.js +289 -580
- package/dist/cmds/clean/cmd.d.ts +14 -1
- package/dist/cmds/clean/cmd.js +61 -112
- package/dist/cmds/clean/impl.js +61 -76
- package/dist/cmds/clean/presets.js +2 -9
- package/dist/cmds/init/cmd.d.ts +9 -0
- package/dist/cmds/init/cmd.js +87 -0
- package/dist/cmds/publish/cmd.d.ts +32 -1
- package/dist/cmds/publish/cmd.js +125 -165
- package/dist/cmds/senv/cmd.d.ts +7 -1
- package/dist/cmds/senv/cmd.js +41 -80
- package/dist/cmds/test/cmd.d.ts +9 -0
- package/dist/cmds/test/cmd.js +157 -0
- package/dist/cmds/tsc/cache.d.ts +2 -2
- package/dist/cmds/tsc/cache.js +37 -19
- package/dist/cmds/tsc/cmd.d.ts +14 -1
- package/dist/cmds/tsc/cmd.js +44 -80
- package/dist/cmds/tsc/impl.js +42 -92
- package/dist/cmds/update/cmd.d.ts +11 -1
- package/dist/cmds/update/cmd.js +57 -81
- package/dist/cmds/update/impl.js +16 -30
- package/dist/cmds/update/utils.js +116 -82
- package/dist/mod.d.ts +3 -0
- package/dist/mod.js +6 -0
- package/dist/utils/find-entry.d.ts +1 -0
- package/dist/utils/find-entry.js +46 -0
- package/package.json +53 -30
- package/src/cli.ts +9 -0
- package/LICENSE +0 -21
- /package/dist/{cmds/const.d.ts → const.d.ts} +0 -0
- /package/dist/{cmds/const.js → const.js} +0 -0
|
@@ -1,2 +1,33 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("@reliverse/rempts-core").Command<{
|
|
2
|
+
ignore: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
3
|
+
filter: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
4
|
+
cwd: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
5
|
+
bump: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<"major" | "minor" | "patch" | "premajor" | "preminor" | "prepatch" | "prerelease" | undefined, {}>>;
|
|
6
|
+
tag: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
7
|
+
access: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<"public" | "restricted" | undefined, {}>>;
|
|
8
|
+
dryRun: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
9
|
+
otp: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
10
|
+
authType: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<"web" | "legacy" | undefined, {}>>;
|
|
11
|
+
concurrency: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<number | undefined, {}>>;
|
|
12
|
+
verbose: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
13
|
+
registry: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
14
|
+
kind: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
15
|
+
bumpDisable: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
16
|
+
withNpmLogs: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
17
|
+
gzipLevel: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
18
|
+
ca: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
19
|
+
cafile: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
20
|
+
ignoreScripts: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
21
|
+
silent: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
22
|
+
noProgress: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
23
|
+
noSummary: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
24
|
+
bunRegistry: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
25
|
+
skipTip2FA: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
26
|
+
stopOnError: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
27
|
+
release: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
28
|
+
version: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
29
|
+
github: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
30
|
+
noTest: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
31
|
+
noBuild: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
32
|
+
}, {}, string>;
|
|
2
33
|
export default _default;
|
package/dist/cmds/publish/cmd.js
CHANGED
|
@@ -1,206 +1,166 @@
|
|
|
1
|
+
import { loadConfig } from "@reliverse/config";
|
|
1
2
|
import {
|
|
2
3
|
publishAllPackages
|
|
3
4
|
} from "@reliverse/publish";
|
|
4
5
|
import { logger } from "@reliverse/relinka";
|
|
5
|
-
import {
|
|
6
|
+
import { defineCommand, option } from "@reliverse/rempts-core";
|
|
7
|
+
import { type } from "arktype";
|
|
8
|
+
const BumpType = type(
|
|
9
|
+
"'major' | 'minor' | 'patch' | 'premajor' | 'preminor' | 'prepatch' | 'prerelease'"
|
|
10
|
+
);
|
|
11
|
+
const AccessType = type("'public' | 'restricted'");
|
|
12
|
+
const AuthType = type("'web' | 'legacy'");
|
|
6
13
|
export default defineCommand({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
examples: [
|
|
11
|
-
"dler publish",
|
|
12
|
-
'dler publish --filter "@reliverse/rempts,@reliverse/build"',
|
|
13
|
-
'dler publish --filter "@reliverse/dler-*"',
|
|
14
|
-
'dler publish --ignore "@reliverse/*"',
|
|
15
|
-
'dler publish --ignore "@reliverse/relico" --ignore "@reliverse/dler-v1"',
|
|
16
|
-
'dler publish --ignore "@reliverse/relico @reliverse/dler-v1"',
|
|
17
|
-
"dler publish --cwd /path/to/monorepo",
|
|
18
|
-
"dler publish --cwd /path/to/monorepo --ignore @reliverse/*",
|
|
19
|
-
"dler publish --bump minor",
|
|
20
|
-
"dler publish --bump major --tag next",
|
|
21
|
-
"dler publish --tag beta --access restricted",
|
|
22
|
-
"dler publish --dry-run",
|
|
23
|
-
"dler publish --dry-run --verbose",
|
|
24
|
-
"dler publish --concurrency 5",
|
|
25
|
-
"dler publish --concurrency 2 --stopOnError",
|
|
26
|
-
"dler publish --ignore @reliverse/* --concurrency 6 --stopOnError",
|
|
27
|
-
"dler publish --verbose",
|
|
28
|
-
"dler publish --verbose --ignore @reliverse/*",
|
|
29
|
-
"dler publish --verbose --concurrency 2 --stopOnError",
|
|
30
|
-
"dler publish --registry jsr",
|
|
31
|
-
"dler publish --registry npm-jsr",
|
|
32
|
-
"dler publish --registry vercel",
|
|
33
|
-
"dler publish --kind browser-app --registry vercel",
|
|
34
|
-
"dler publish --kind native-app --registry none",
|
|
35
|
-
"dler publish --kind cli --registry jsr",
|
|
36
|
-
"dler publish --bumpDisable",
|
|
37
|
-
"dler publish --bumpDisable --dry-run",
|
|
38
|
-
"dler publish --bumpDisable --tag next",
|
|
39
|
-
"",
|
|
40
|
-
"# Configuration Examples:",
|
|
41
|
-
"# Create dler.ts in your monorepo root:",
|
|
42
|
-
"# export default {",
|
|
43
|
-
"# publish: {",
|
|
44
|
-
"# global: { access: 'public', tag: 'latest', registry: 'npm', kind: 'library' },",
|
|
45
|
-
"# packages: { ",
|
|
46
|
-
"# 'my-library': { tag: 'next', bump: 'minor', registry: 'jsr', kind: 'library' },",
|
|
47
|
-
"# 'my-web-app': { registry: 'vercel', kind: 'browser-app' },",
|
|
48
|
-
"# 'my-native-app': { registry: 'none', kind: 'native-app' },",
|
|
49
|
-
"# 'my-cli-tool': { registry: 'npm', kind: 'cli' },",
|
|
50
|
-
"# 'my-library': { bumpDisable: true, tag: 'next' }",
|
|
51
|
-
"# },",
|
|
52
|
-
"# patterns: [{ pattern: '*example*', config: { dryRun: true, registry: 'vercel', kind: 'browser-app' } }]",
|
|
53
|
-
"# }",
|
|
54
|
-
"# }",
|
|
55
|
-
"",
|
|
56
|
-
"# Note: Make sure to run 'dler build' first to:",
|
|
57
|
-
"# - Generate dist folders and declaration files",
|
|
58
|
-
"# - Transform package.json (adds files field, transforms exports, adds bin for CLI)",
|
|
59
|
-
"# The publish command will then handle version bumping and registry publishing",
|
|
60
|
-
"# CLI flags override dler.ts configuration settings"
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
args: defineArgs({
|
|
64
|
-
ignore: {
|
|
65
|
-
type: "string",
|
|
14
|
+
description: "Publish packages to NPM, JSR (soon), GitHub Releases, Vercel (soon), or multiple registries. Supports version bumping, dist-tags, access control, and concurrent publishing. Automatically loads .env files for authentication. Works with dler.ts configuration for per-package settings.",
|
|
15
|
+
options: {
|
|
16
|
+
ignore: option(type("string | undefined"), {
|
|
66
17
|
description: "Package(s) to ignore (supports wildcards like @reliverse/*)"
|
|
67
|
-
},
|
|
68
|
-
filter: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
cwd: {
|
|
73
|
-
type: "string",
|
|
18
|
+
}),
|
|
19
|
+
filter: option(type("string | undefined"), {
|
|
20
|
+
description: "Package(s) to include (supports wildcards and comma-separated values like 'rempts,@reliverse/build'). Takes precedence over --ignore when both are provided."
|
|
21
|
+
}),
|
|
22
|
+
cwd: option(type("string | undefined"), {
|
|
74
23
|
description: "Working directory (monorepo root)"
|
|
75
|
-
},
|
|
76
|
-
bump: {
|
|
77
|
-
type: "string",
|
|
24
|
+
}),
|
|
25
|
+
bump: option(BumpType.or(type.undefined), {
|
|
78
26
|
description: "Version bump type: major, minor, patch, premajor, preminor, prepatch, prerelease (default: patch)"
|
|
79
|
-
},
|
|
80
|
-
tag: {
|
|
81
|
-
type: "string",
|
|
27
|
+
}),
|
|
28
|
+
tag: option(type("string | undefined"), {
|
|
82
29
|
description: "npm dist-tag (default: latest)"
|
|
83
|
-
},
|
|
84
|
-
access: {
|
|
85
|
-
type: "string",
|
|
30
|
+
}),
|
|
31
|
+
access: option(AccessType.or(type.undefined), {
|
|
86
32
|
description: "Access level: public or restricted (default: public)"
|
|
87
|
-
},
|
|
88
|
-
dryRun: {
|
|
89
|
-
type: "boolean",
|
|
33
|
+
}),
|
|
34
|
+
dryRun: option(type("boolean | undefined"), {
|
|
90
35
|
description: "Simulate publishing without actually publishing (default: false)"
|
|
91
|
-
},
|
|
92
|
-
otp: {
|
|
93
|
-
type: "string",
|
|
36
|
+
}),
|
|
37
|
+
otp: option(type("string | undefined"), {
|
|
94
38
|
description: "One-time password for 2FA authentication"
|
|
95
|
-
},
|
|
96
|
-
authType: {
|
|
97
|
-
type: "string",
|
|
39
|
+
}),
|
|
40
|
+
authType: option(AuthType.or(type.undefined), {
|
|
98
41
|
description: "Authentication method: web or legacy (default: legacy)"
|
|
99
|
-
},
|
|
100
|
-
concurrency: {
|
|
101
|
-
type: "number",
|
|
42
|
+
}),
|
|
43
|
+
concurrency: option(type("number | undefined"), {
|
|
102
44
|
description: "Number of packages to publish concurrently (default: 3)"
|
|
103
|
-
},
|
|
104
|
-
verbose: {
|
|
105
|
-
type: "boolean",
|
|
45
|
+
}),
|
|
46
|
+
verbose: option(type("boolean | undefined"), {
|
|
106
47
|
description: "Verbose mode (default: false)"
|
|
107
|
-
},
|
|
108
|
-
registry: {
|
|
109
|
-
type: "string",
|
|
48
|
+
}),
|
|
49
|
+
registry: option(type("string | undefined"), {
|
|
110
50
|
description: "Registry to publish to: npm, jsr, vercel, npm-jsr, or none (default: npm)"
|
|
111
|
-
},
|
|
112
|
-
kind: {
|
|
113
|
-
type: "string",
|
|
51
|
+
}),
|
|
52
|
+
kind: option(type("string | undefined"), {
|
|
114
53
|
description: "Package kind: library, browser-app, native-app, or cli (default: library)"
|
|
115
|
-
},
|
|
116
|
-
bumpDisable: {
|
|
117
|
-
type: "boolean",
|
|
54
|
+
}),
|
|
55
|
+
bumpDisable: option(type("boolean | undefined"), {
|
|
118
56
|
description: "Disable version bumping for all published packages, overwrites config (default: false)"
|
|
119
|
-
},
|
|
120
|
-
withNpmLogs: {
|
|
121
|
-
type: "boolean",
|
|
57
|
+
}),
|
|
58
|
+
withNpmLogs: option(type("boolean | undefined"), {
|
|
122
59
|
description: "Display bun publish logs directly to terminal instead of hiding them (setting this to false is not recommended) (default: true)"
|
|
123
|
-
},
|
|
124
|
-
gzipLevel: {
|
|
125
|
-
type: "string",
|
|
60
|
+
}),
|
|
61
|
+
gzipLevel: option(type("string | undefined"), {
|
|
126
62
|
description: "Level of gzip compression when packing (0-9, default: 9). Only applies when packing the package."
|
|
127
|
-
},
|
|
128
|
-
ca: {
|
|
129
|
-
type: "string",
|
|
63
|
+
}),
|
|
64
|
+
ca: option(type("string | undefined"), {
|
|
130
65
|
description: "Certificate Authority signing certificate (inline)"
|
|
131
|
-
},
|
|
132
|
-
cafile: {
|
|
133
|
-
type: "string",
|
|
66
|
+
}),
|
|
67
|
+
cafile: option(type("string | undefined"), {
|
|
134
68
|
description: "Path to Certificate Authority certificate file"
|
|
135
|
-
},
|
|
136
|
-
ignoreScripts: {
|
|
137
|
-
type: "boolean",
|
|
69
|
+
}),
|
|
70
|
+
ignoreScripts: option(type("boolean | undefined"), {
|
|
138
71
|
description: "Skip lifecycle scripts during packing and publishing (default: false)"
|
|
139
|
-
},
|
|
140
|
-
silent: {
|
|
141
|
-
type: "boolean",
|
|
72
|
+
}),
|
|
73
|
+
silent: option(type("boolean | undefined"), {
|
|
142
74
|
description: "Suppress all output from bun publish (default: false)"
|
|
143
|
-
},
|
|
144
|
-
noProgress: {
|
|
145
|
-
type: "boolean",
|
|
75
|
+
}),
|
|
76
|
+
noProgress: option(type("boolean | undefined"), {
|
|
146
77
|
description: "Hide progress bar from bun publish (default: false)"
|
|
147
|
-
},
|
|
148
|
-
noSummary: {
|
|
149
|
-
type: "boolean",
|
|
78
|
+
}),
|
|
79
|
+
noSummary: option(type("boolean | undefined"), {
|
|
150
80
|
description: "Don't print publish summary from bun publish (default: false)"
|
|
151
|
-
},
|
|
152
|
-
bunRegistry: {
|
|
153
|
-
type: "string",
|
|
81
|
+
}),
|
|
82
|
+
bunRegistry: option(type("string | undefined"), {
|
|
154
83
|
description: "Registry URL for bun publish (overrides .npmrc and bunfig.toml). Note: This is different from dler's --registry option which controls which registry type to use."
|
|
155
|
-
},
|
|
156
|
-
skipTip2FA: {
|
|
157
|
-
type: "boolean",
|
|
84
|
+
}),
|
|
85
|
+
skipTip2FA: option(type("boolean | undefined"), {
|
|
158
86
|
description: "Skip the 2FA tip message and the 3-second wait when using --with-npm-logs (default: false)"
|
|
159
|
-
},
|
|
160
|
-
stopOnError: {
|
|
161
|
-
type: "boolean",
|
|
87
|
+
}),
|
|
88
|
+
stopOnError: option(type("boolean | undefined"), {
|
|
162
89
|
description: "Stop on first error instead of collecting all errors (default: false)"
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
90
|
+
}),
|
|
91
|
+
// Release options
|
|
92
|
+
release: option(type("boolean | undefined"), {
|
|
93
|
+
description: "Run full release workflow (test, build, version, tag, publish, GitHub)"
|
|
94
|
+
}),
|
|
95
|
+
version: option(type("'patch'|'minor'|'major' | string | undefined"), {
|
|
96
|
+
short: "v",
|
|
97
|
+
description: "Version to release (patch/minor/major/x.y.z) - only used with --release"
|
|
98
|
+
}),
|
|
99
|
+
github: option(type("boolean | undefined"), {
|
|
100
|
+
description: "Create GitHub release - only used with --release"
|
|
101
|
+
}),
|
|
102
|
+
noTest: option(type("boolean | undefined"), {
|
|
103
|
+
description: "Skip tests during release - only used with --release"
|
|
104
|
+
}),
|
|
105
|
+
noBuild: option(type("boolean | undefined"), {
|
|
106
|
+
description: "Skip build during release - only used with --release"
|
|
107
|
+
})
|
|
108
|
+
},
|
|
109
|
+
handler: async ({ flags }) => {
|
|
166
110
|
try {
|
|
167
111
|
if (typeof process.versions.bun === "undefined") {
|
|
168
112
|
logger.error("\u274C This command requires Bun runtime. Sorry.");
|
|
169
113
|
process.exit(1);
|
|
170
114
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
115
|
+
const dryRun = flags.dryRun ?? false;
|
|
116
|
+
const verbose = flags.verbose ?? false;
|
|
117
|
+
const bumpDisable = flags.bumpDisable ?? false;
|
|
118
|
+
const withNpmLogs = flags.withNpmLogs ?? true;
|
|
119
|
+
const ignoreScripts = flags.ignoreScripts ?? false;
|
|
120
|
+
const silent = flags.silent ?? false;
|
|
121
|
+
const noProgress = flags.noProgress ?? false;
|
|
122
|
+
const noSummary = flags.noSummary ?? false;
|
|
123
|
+
const skipTip2FA = flags.skipTip2FA ?? false;
|
|
124
|
+
const _stopOnError = flags.stopOnError ?? false;
|
|
125
|
+
if (flags.authType === "web") {
|
|
126
|
+
logger.error("\u274C --auth-type web is not supported. Please use --auth-type legacy instead.");
|
|
175
127
|
process.exit(1);
|
|
176
128
|
}
|
|
177
|
-
const isVerbose =
|
|
129
|
+
const isVerbose = verbose === true;
|
|
130
|
+
const config = await loadConfig(flags.cwd);
|
|
178
131
|
const options = {
|
|
179
|
-
dryRun
|
|
180
|
-
tag:
|
|
181
|
-
access:
|
|
182
|
-
otp:
|
|
183
|
-
authType:
|
|
184
|
-
verbose
|
|
185
|
-
bump:
|
|
186
|
-
concurrency:
|
|
187
|
-
registry:
|
|
188
|
-
kind:
|
|
189
|
-
bumpDisable
|
|
190
|
-
withNpmLogs
|
|
191
|
-
gzipLevel:
|
|
192
|
-
ca:
|
|
193
|
-
cafile:
|
|
194
|
-
ignoreScripts
|
|
195
|
-
silent:
|
|
196
|
-
noProgress:
|
|
197
|
-
noSummary:
|
|
198
|
-
bunRegistry:
|
|
199
|
-
skipTip2FA
|
|
132
|
+
dryRun,
|
|
133
|
+
tag: flags.tag || "latest",
|
|
134
|
+
access: flags.access || "public",
|
|
135
|
+
otp: flags.otp || "",
|
|
136
|
+
authType: flags.authType || "legacy",
|
|
137
|
+
verbose,
|
|
138
|
+
bump: flags.bump || "patch",
|
|
139
|
+
concurrency: flags.concurrency || 3,
|
|
140
|
+
registry: flags.registry || "npm",
|
|
141
|
+
kind: flags.kind || "library",
|
|
142
|
+
bumpDisable,
|
|
143
|
+
withNpmLogs,
|
|
144
|
+
gzipLevel: flags.gzipLevel || "",
|
|
145
|
+
ca: flags.ca || "",
|
|
146
|
+
cafile: flags.cafile || "",
|
|
147
|
+
ignoreScripts,
|
|
148
|
+
silent: silent !== void 0 ? silent : !isVerbose,
|
|
149
|
+
noProgress: noProgress !== void 0 ? noProgress : !isVerbose,
|
|
150
|
+
noSummary: noSummary !== void 0 ? noSummary : !isVerbose,
|
|
151
|
+
bunRegistry: flags.bunRegistry || "",
|
|
152
|
+
skipTip2FA,
|
|
153
|
+
// Release workflow options
|
|
154
|
+
release: flags.release ?? false,
|
|
155
|
+
test: flags.release ? !flags.noTest : void 0,
|
|
156
|
+
build: flags.release ? !flags.noBuild : void 0,
|
|
157
|
+
github: flags.release ? flags.github ?? config?.release?.github ?? false : void 0,
|
|
158
|
+
gitTag: flags.release ? true : void 0,
|
|
159
|
+
version: flags.release ? flags.version : void 0
|
|
200
160
|
};
|
|
201
|
-
const results = await publishAllPackages(
|
|
161
|
+
const results = await publishAllPackages(flags.cwd, flags.ignore, {
|
|
202
162
|
...options,
|
|
203
|
-
filter:
|
|
163
|
+
filter: flags.filter || ""
|
|
204
164
|
});
|
|
205
165
|
if (results.warningCount > 0) {
|
|
206
166
|
for (const result of results.results) {
|
|
@@ -226,7 +186,7 @@ export default defineCommand({
|
|
|
226
186
|
process.exit(1);
|
|
227
187
|
}
|
|
228
188
|
logger.success("\nAll packages published successfully!");
|
|
229
|
-
if (
|
|
189
|
+
if (flags.verbose) {
|
|
230
190
|
for (const result of results.results) {
|
|
231
191
|
if (result.success && !result.warning) {
|
|
232
192
|
logger.log(` \u2705 ${result.packageName}@${result.version}`);
|
package/dist/cmds/senv/cmd.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: import("@reliverse/rempts-core").Command<{
|
|
2
|
+
action: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
3
|
+
name: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
4
|
+
value: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | undefined, {}>>;
|
|
5
|
+
persist: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
6
|
+
yes: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
7
|
+
}, {}, string>;
|
|
2
8
|
export default _default;
|
package/dist/cmds/senv/cmd.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "@reliverse/relifso";
|
|
2
2
|
import { logger } from "@reliverse/relinka";
|
|
3
|
-
import {
|
|
3
|
+
import { defineCommand, option } from "@reliverse/rempts-core";
|
|
4
|
+
import { type } from "arktype";
|
|
4
5
|
const isWindows = () => {
|
|
5
6
|
const bun = globalThis;
|
|
6
7
|
return bun.Bun?.platform?.() === "win32" || process.platform === "win32";
|
|
@@ -38,7 +39,9 @@ const uniqueByComparable = (entries) => {
|
|
|
38
39
|
};
|
|
39
40
|
const backupFile = async (path) => {
|
|
40
41
|
try {
|
|
41
|
-
if (!await fileExists(path))
|
|
42
|
+
if (!await fileExists(path)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
42
45
|
const now = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
43
46
|
const random = Math.random().toString(36).substring(2, 8);
|
|
44
47
|
const bak = `${path}.bak.${now}.${random}`;
|
|
@@ -93,12 +96,9 @@ const persistPosix = async (name, value) => {
|
|
|
93
96
|
try {
|
|
94
97
|
const exists = await fileExists(profile);
|
|
95
98
|
if (!exists) {
|
|
96
|
-
await fs.writeFile(
|
|
97
|
-
profile,
|
|
98
|
-
`# created by dler senv
|
|
99
|
+
await fs.writeFile(profile, `# created by dler senv
|
|
99
100
|
export ${name}="${value}"
|
|
100
|
-
`
|
|
101
|
-
);
|
|
101
|
+
`);
|
|
102
102
|
logger.info(`Wrote new ${profile}`);
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
@@ -139,7 +139,9 @@ const persistPosixEditPath = async (name, entry, action) => {
|
|
|
139
139
|
} else {
|
|
140
140
|
const targetKey = toComparable(normalizedEntry);
|
|
141
141
|
const idx = entries.findIndex((e) => toComparable(e) === targetKey);
|
|
142
|
-
if (idx >= 0)
|
|
142
|
+
if (idx >= 0) {
|
|
143
|
+
entries.splice(idx, 1);
|
|
144
|
+
}
|
|
143
145
|
}
|
|
144
146
|
entries = uniqueByComparable(entries);
|
|
145
147
|
const newVal = joinPathEntries(entries);
|
|
@@ -151,62 +153,36 @@ export ${name}="${newVal}"
|
|
|
151
153
|
logger.info(`Persisted ${name} in ${profile}`);
|
|
152
154
|
};
|
|
153
155
|
export default defineCommand({
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
examples: [
|
|
158
|
-
"dler senv --action list",
|
|
159
|
-
"dler senv --action list --name Path",
|
|
160
|
-
"dler senv --action get --name Path",
|
|
161
|
-
"dler senv --action set --name Path --value C\\\\bin",
|
|
162
|
-
"dler senv --action append --name Path --value C\\\\msys64\\\\ucrt64\\\\bin --yes",
|
|
163
|
-
"dler senv --action contains --name Path --value C\\\\bin"
|
|
164
|
-
]
|
|
165
|
-
},
|
|
166
|
-
args: defineArgs({
|
|
167
|
-
action: {
|
|
168
|
-
type: "string",
|
|
169
|
-
required: true,
|
|
156
|
+
description: "Inspect and modify environment variables (process and user-level)",
|
|
157
|
+
options: {
|
|
158
|
+
action: option(type("string | undefined"), {
|
|
170
159
|
description: "Operation to perform: list|get|set|append|remove|contains"
|
|
171
|
-
},
|
|
172
|
-
name: {
|
|
173
|
-
type: "string",
|
|
160
|
+
}),
|
|
161
|
+
name: option(type("string | undefined"), {
|
|
174
162
|
description: "Environment variable name (optional for list)"
|
|
175
|
-
},
|
|
176
|
-
value: {
|
|
177
|
-
type: "string",
|
|
163
|
+
}),
|
|
164
|
+
value: option(type("string | undefined"), {
|
|
178
165
|
description: "Value for set/append/remove/contains"
|
|
179
|
-
},
|
|
180
|
-
persist: {
|
|
181
|
-
type: "boolean",
|
|
166
|
+
}),
|
|
167
|
+
persist: option(type("boolean | undefined"), {
|
|
182
168
|
description: "Persist change to user environment (default: true)"
|
|
183
|
-
},
|
|
184
|
-
yes: {
|
|
185
|
-
type: "boolean",
|
|
169
|
+
}),
|
|
170
|
+
yes: option(type("boolean | undefined"), {
|
|
186
171
|
description: "Skip interactive confirmation message"
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
172
|
+
})
|
|
173
|
+
},
|
|
174
|
+
handler: async ({ flags }) => {
|
|
190
175
|
try {
|
|
191
176
|
if (typeof process.versions.bun === "undefined") {
|
|
192
177
|
logger.error("\u274C This command requires Bun runtime. Sorry.");
|
|
193
178
|
process.exit(1);
|
|
194
179
|
}
|
|
195
|
-
const { action, name, value } =
|
|
196
|
-
const persist =
|
|
197
|
-
const yes =
|
|
198
|
-
const allowed = /* @__PURE__ */ new Set([
|
|
199
|
-
|
|
200
|
-
"get"
|
|
201
|
-
"set",
|
|
202
|
-
"append",
|
|
203
|
-
"remove",
|
|
204
|
-
"contains"
|
|
205
|
-
]);
|
|
206
|
-
if (!allowed.has(action)) {
|
|
207
|
-
logger.error(
|
|
208
|
-
"Unknown action. Allowed: list, get, set, append, remove, contains"
|
|
209
|
-
);
|
|
180
|
+
const { action, name, value } = flags;
|
|
181
|
+
const persist = flags.persist ?? true;
|
|
182
|
+
const yes = flags.yes ?? false;
|
|
183
|
+
const allowed = /* @__PURE__ */ new Set(["list", "get", "set", "append", "remove", "contains"]);
|
|
184
|
+
if (action && !allowed.has(action)) {
|
|
185
|
+
logger.error("Unknown action. Allowed: list, get, set, append, remove, contains");
|
|
210
186
|
process.exit(2);
|
|
211
187
|
}
|
|
212
188
|
if (action === "list") {
|
|
@@ -253,9 +229,7 @@ export default defineCommand({
|
|
|
253
229
|
if (isWindows()) {
|
|
254
230
|
try {
|
|
255
231
|
await runPowerShellSetUser(name, value);
|
|
256
|
-
logger.success(
|
|
257
|
-
`Persisted ${name} to User environment (Windows).`
|
|
258
|
-
);
|
|
232
|
+
logger.success(`Persisted ${name} to User environment (Windows).`);
|
|
259
233
|
} catch (e) {
|
|
260
234
|
logger.error("Failed to persist via PowerShell:");
|
|
261
235
|
logger.error(String(e));
|
|
@@ -293,20 +267,16 @@ export default defineCommand({
|
|
|
293
267
|
if (isWindows()) {
|
|
294
268
|
try {
|
|
295
269
|
const userVal = (await runPowerShellGetUser(name)).trim();
|
|
296
|
-
const userEntries = normalizePathEntries(userVal || "").map(
|
|
297
|
-
normalizeEntry
|
|
298
|
-
);
|
|
270
|
+
const userEntries = normalizePathEntries(userVal || "").map(normalizeEntry);
|
|
299
271
|
const uSet = new Set(userEntries.map(toComparable));
|
|
300
|
-
if (
|
|
272
|
+
if (uSet.has(targetKey)) {
|
|
273
|
+
logger.info("User-level already contains the entry \u2014 no change.");
|
|
274
|
+
} else {
|
|
301
275
|
userEntries.push(normalizedValue);
|
|
302
276
|
const uniqueEntries = uniqueByComparable(userEntries);
|
|
303
277
|
const joined = joinPathEntries(uniqueEntries);
|
|
304
278
|
await runPowerShellSetUser(name, joined);
|
|
305
279
|
logger.success(`Persisted append to User ${name} (Windows).`);
|
|
306
|
-
} else {
|
|
307
|
-
logger.info(
|
|
308
|
-
"User-level already contains the entry \u2014 no change."
|
|
309
|
-
);
|
|
310
280
|
}
|
|
311
281
|
} catch (e) {
|
|
312
282
|
logger.error("Failed to persist append on Windows:");
|
|
@@ -314,7 +284,7 @@ export default defineCommand({
|
|
|
314
284
|
}
|
|
315
285
|
} else {
|
|
316
286
|
try {
|
|
317
|
-
await persistPosixEditPath(name,
|
|
287
|
+
await persistPosixEditPath(name, normalizedValue, "append");
|
|
318
288
|
} catch (e) {
|
|
319
289
|
logger.error("Failed to persist append on POSIX:");
|
|
320
290
|
logger.error(String(e));
|
|
@@ -339,22 +309,13 @@ export default defineCommand({
|
|
|
339
309
|
if (isWindows()) {
|
|
340
310
|
try {
|
|
341
311
|
const userVal = (await runPowerShellGetUser(name)).trim();
|
|
342
|
-
const userEntries = normalizePathEntries(userVal || "").map(
|
|
343
|
-
|
|
344
|
-
);
|
|
345
|
-
const i2 = userEntries.findIndex(
|
|
346
|
-
(e) => toComparable(e) === targetKey
|
|
347
|
-
);
|
|
312
|
+
const userEntries = normalizePathEntries(userVal || "").map(normalizeEntry);
|
|
313
|
+
const i2 = userEntries.findIndex((e) => toComparable(e) === targetKey);
|
|
348
314
|
if (i2 >= 0) {
|
|
349
315
|
userEntries.splice(i2, 1);
|
|
350
316
|
const uniqueEntries = uniqueByComparable(userEntries);
|
|
351
|
-
await runPowerShellSetUser(
|
|
352
|
-
|
|
353
|
-
joinPathEntries(uniqueEntries)
|
|
354
|
-
);
|
|
355
|
-
logger.success(
|
|
356
|
-
`Persisted removal to User ${name} (Windows).`
|
|
357
|
-
);
|
|
317
|
+
await runPowerShellSetUser(name, joinPathEntries(uniqueEntries));
|
|
318
|
+
logger.success(`Persisted removal to User ${name} (Windows).`);
|
|
358
319
|
} else {
|
|
359
320
|
logger.info("User-level did not contain entry \u2014 no change.");
|
|
360
321
|
}
|
|
@@ -364,7 +325,7 @@ export default defineCommand({
|
|
|
364
325
|
}
|
|
365
326
|
} else {
|
|
366
327
|
try {
|
|
367
|
-
await persistPosixEditPath(name,
|
|
328
|
+
await persistPosixEditPath(name, normalizedValue, "remove");
|
|
368
329
|
} catch (e) {
|
|
369
330
|
logger.error("Failed to persist removal on POSIX:");
|
|
370
331
|
logger.error(String(e));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts-core").Command<{
|
|
2
|
+
pattern: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<string | string[] | undefined, {}>>;
|
|
3
|
+
watch: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
4
|
+
coverage: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
5
|
+
bail: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
6
|
+
timeout: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<number | undefined, {}>>;
|
|
7
|
+
all: import("@reliverse/rempts-core").CLIOption<import("arktype").BaseType<boolean | undefined, {}>>;
|
|
8
|
+
}, {}, string>;
|
|
9
|
+
export default _default;
|