Skip to content

Commit a4f07a5

Browse files
authored
Merge pull request #124 from nestdotland/dev
2 parents b971caa + ccd0162 commit a4f07a5

File tree

4 files changed

+71
-66
lines changed

4 files changed

+71
-66
lines changed

deps.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ export {
99
join,
1010
relative,
1111
resolve,
12-
} from "https://x.nest.land/std@0.93.0/path/mod.ts";
12+
} from "https://x.nest.land/std@0.97.0/path/mod.ts";
1313

1414
export {
1515
exists,
1616
existsSync,
1717
expandGlob,
1818
expandGlobSync,
1919
walkSync,
20-
} from "https://x.nest.land/std@0.93.0/fs/mod.ts";
20+
} from "https://x.nest.land/std@0.97.0/fs/mod.ts";
2121

22-
export * as log from "https://x.nest.land/std@0.93.0/log/mod.ts";
22+
export * as log from "https://x.nest.land/std@0.97.0/log/mod.ts";
2323

24-
export { LogRecord } from "https://x.nest.land/std@0.93.0/log/logger.ts";
24+
export { LogRecord } from "https://x.nest.land/std@0.97.0/log/logger.ts";
2525

26-
export type { LevelName } from "https://x.nest.land/std@0.93.0/log/levels.ts";
27-
export { LogLevels } from "https://x.nest.land/std@0.93.0/log/levels.ts";
26+
export type { LevelName } from "https://x.nest.land/std@0.97.0/log/levels.ts";
27+
export { LogLevels } from "https://x.nest.land/std@0.97.0/log/levels.ts";
2828

29-
export { BaseHandler } from "https://x.nest.land/std@0.93.0/log/handlers.ts";
29+
export { BaseHandler } from "https://x.nest.land/std@0.97.0/log/handlers.ts";
3030

31-
export * from "https://x.nest.land/std@0.93.0/fmt/colors.ts";
31+
export * from "https://x.nest.land/std@0.97.0/fmt/colors.ts";
3232

3333
export {
3434
assert,
3535
assertEquals,
3636
assertMatch,
37-
} from "https://x.nest.land/std@0.93.0/testing/asserts.ts";
37+
} from "https://x.nest.land/std@0.97.0/testing/asserts.ts";
3838

3939
export {
4040
parse as parseYaml,
4141
stringify as stringifyYaml,
42-
} from "https://x.nest.land/std@0.93.0/encoding/yaml.ts";
42+
} from "https://x.nest.land/std@0.97.0/encoding/yaml.ts";
4343

4444
/**************** cliffy ****************/
4545
export {
@@ -61,7 +61,7 @@ export {
6161
export type { ITypeInfo } from "https://x.nest.land/cliffy@0.18.2/flags/types.ts";
6262

6363
/**************** semver ****************/
64-
export * as semver from "https://deno.land/x/semver@v1.0.0/mod.ts";
64+
export * as semver from "https://deno.land/x/semver@v1.3.0/mod.ts";
6565

6666
/**************** base64 ****************/
6767
export * as base64 from "https://denopkg.com/chiefbiiko/base64@v0.2.0/mod.ts";

src/commands/init.ts

Lines changed: 57 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,24 @@ export async function init(options: Options) {
4949

5050
const entry: string | undefined = await Input.prompt({
5151
message: "Entry file:",
52-
default: currentConfig.entry,
53-
}) || undefined;
52+
default: currentConfig.entry ?? "./mod.ts",
53+
});
54+
5455
const description: string | undefined = await Input.prompt({
5556
message: "Description:",
56-
default: currentConfig.description || existing?.description,
57-
}) || undefined;
57+
default: currentConfig.description ?? existing?.description ?? "",
58+
});
59+
5860
const homepage: string | undefined = await Input.prompt({
5961
message: "Module homepage:",
60-
default: currentConfig.homepage || existing?.repository,
61-
validate: (value) => value === "" || validateURL(value),
62-
}) || undefined;
63-
let releaseType: string | undefined = await Select.prompt({
64-
message: "Semver increment:",
62+
default: currentConfig.homepage ?? existing?.repository ?? "",
63+
validate: (value: string) => value === "" || validateURL(value),
64+
});
65+
66+
let releaseType: string | null | undefined = await Select.prompt({
67+
message: "Automatic semver increment:",
6568
options: [
66-
{ name: "none", value: "none" },
69+
{ name: "disabled", value: "none" },
6770
Select.separator("--------"),
6871
{ name: "patch", value: "patch" },
6972
{ name: "minor", value: "minor" },
@@ -75,97 +78,99 @@ export async function init(options: Options) {
7578
{ name: "premajor", value: "premajor" },
7679
{ name: "prerelease", value: "prerelease" },
7780
],
81+
default: "none",
7882
keys: {
79-
previous: ["up", "8", "u"],
80-
next: ["down", "2", "d"],
83+
previous: ["up", "8", "u", "k"],
84+
next: ["down", "2", "d", "j"],
8185
},
8286
});
83-
if (releaseType === "none") releaseType = undefined;
87+
if (releaseType === "none") releaseType = null;
8488

8589
const version: string | undefined = await Input.prompt({
8690
message: "Version:",
87-
default: existing?.getLatestVersion(),
88-
validate: (value) => value === "" || validateVersion(value),
89-
}) || undefined;
91+
default: currentConfig.version ?? existing?.getLatestVersion() ?? "",
92+
validate: (value: string) => value === "" || validateVersion(value),
93+
});
9094

9195
const unstable: boolean | undefined = await Confirm.prompt({
9296
message: "Is this an unstable version?",
9397
default: currentConfig.unstable ?? false,
94-
}) || undefined;
98+
});
9599

96100
const unlisted: boolean | undefined = await Confirm.prompt({
97101
message: "Should this module be hidden in the gallery?",
98102
default: currentConfig.unlisted ?? false,
99-
}) || undefined;
103+
});
100104

101105
let files: string[] | undefined = await List.prompt({
102106
message: "Files and relative directories to publish, separated by a comma:",
103-
default: currentConfig.files,
107+
default: currentConfig.files ?? [],
104108
});
105-
if (files.length === 1 && files[0] === "") files = undefined;
109+
if (files?.length === 1 && files[0] === "") files = [];
106110

107111
let ignore: string[] | undefined = await List.prompt({
108112
message: "Files and relative directories to ignore, separated by a comma:",
109-
default: currentConfig.ignore,
113+
default: currentConfig.ignore ?? [],
110114
});
111-
if (ignore.length === 1 && ignore[0] === "") ignore = undefined;
115+
if (ignore?.length === 1 && ignore[0] === "") ignore = [];
112116

113117
const check: boolean | undefined = await Confirm.prompt({
114118
message: "Perform all checks before publication?",
115-
default: currentConfig.check ?? true,
119+
default: currentConfig.check ?? false,
116120
});
117121
const noCheck = !check;
118122

119-
let checkFormat: boolean | string | undefined =
120-
noCheck && await Confirm.prompt({
123+
let checkFormat: boolean | string | undefined = noCheck &&
124+
(await Confirm.prompt({
121125
message: "Check source files formatting before publication?",
122-
default: (!!currentConfig.checkFormat) ?? false,
123-
})
124-
? await Input.prompt({
125-
message: "Formatting command (leave blank for default):",
126-
default: typeof currentConfig.checkFormat === "string"
127-
? currentConfig.checkFormat
128-
: undefined,
129-
})
130-
: false;
126+
default: !!currentConfig.checkFormat ?? false,
127+
}))
128+
? await Input.prompt({
129+
message: "Formatting command (leave blank for default):",
130+
default: typeof currentConfig.checkFormat === "string"
131+
? currentConfig.checkFormat
132+
: undefined,
133+
})
134+
: false;
131135
if (checkFormat === "") checkFormat = true;
132136

133-
let checkTests: boolean | string | undefined =
134-
noCheck && await Confirm.prompt({
137+
let checkTests: boolean | string | undefined = noCheck &&
138+
(await Confirm.prompt({
135139
message: "Test your code before publication?",
136-
default: (!!currentConfig.checkTests) ?? false,
137-
})
138-
? await Input.prompt({
139-
message: "Testing command (leave blank for default):",
140-
default: typeof currentConfig.checkTests === "string"
141-
? currentConfig.checkTests
142-
: undefined,
143-
})
144-
: false;
140+
default: !!currentConfig.checkTests ?? false,
141+
}))
142+
? await Input.prompt({
143+
message: "Testing command (leave blank for default):",
144+
default: typeof currentConfig.checkTests === "string"
145+
? currentConfig.checkTests
146+
: undefined,
147+
})
148+
: false;
145149
if (checkTests === "") checkTests = true;
146150

147151
const checkInstallation: boolean | undefined = noCheck &&
148-
await Confirm.prompt({
152+
(await Confirm.prompt({
149153
message: "Install module and check for missing files before publication?",
150154
default: currentConfig.checkInstallation ?? false,
151-
});
155+
}));
152156

153157
const format = await Select.prompt({
154158
message: "Config format: ",
155-
default: (configPath ? configFormat(configPath) : ConfigFormat.JSON)
156-
.toUpperCase(),
159+
default: configPath
160+
? configFormat(configPath).toUpperCase()
161+
: ConfigFormat.JSON,
157162
options: [
158163
{ name: "YAML", value: ConfigFormat.YAML },
159164
{ name: "JSON", value: ConfigFormat.JSON },
160165
],
161166
keys: {
162-
previous: ["up", "8", "u"],
163-
next: ["down", "2", "d"],
167+
previous: ["up", "8", "u", "k"],
168+
next: ["down", "2", "d", "j"],
164169
},
165170
});
166171

167172
const config: Partial<Config> = {
168-
"$schema": `https://x.nest.land/eggs@${eggsVersion}/src/schema.json`,
173+
$schema: `https://x.nest.land/eggs@${eggsVersion}/src/schema.json`,
169174
name,
170175
entry,
171176
description,

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const version = "0.3.6";
1+
export const version = "0.3.7";

test/deps.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
export {
33
assert,
44
assertEquals,
5-
} from "https://x.nest.land/std@0.69.0/testing/asserts.ts";
5+
} from "https://x.nest.land/std@0.97.0/testing/asserts.ts";
66

7-
export { expandGlob } from "https://x.nest.land/std@0.69.0/fs/mod.ts";
7+
export { expandGlob } from "https://x.nest.land/std@0.97.0/fs/mod.ts";

0 commit comments

Comments
 (0)