Skip to content

Commit

Permalink
Merge pull request #95 from nestdotland/chore/rename-cli-options
Browse files Browse the repository at this point in the history
Rename cli options (breaking changes)
  • Loading branch information
SteelAlloy authored Oct 21, 2020
2 parents 577a2b7 + b814ef0 commit accbbd6
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 77 deletions.
6 changes: 3 additions & 3 deletions Drakefile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { desc, run, sh, task } from "https://x.nest.land/[email protected].1/mod.ts";
import { desc, run, sh, task } from "https://x.nest.land/[email protected].4/mod.ts";
import { version } from "./src/version.ts";

desc("Run tests.");
Expand Down Expand Up @@ -40,14 +40,14 @@ task("link", [], async function () {
desc("Reports the details of what would have been published.");
task("dry-publish", [], async function () {
await sh(
`deno run -A --unstable eggs.ts publish eggs -do --no-check-all --check-installation --entry eggs.ts --version ${version}-dev --handsfree --dry-run `,
`deno run -A --unstable eggs.ts publish eggs -doY --no-check --check-installation --entry eggs.ts --version ${version}-dev --dry-run `,
);
});

desc("Publishes eggs to the nest.land registry.");
task("publish", [], async function () {
await sh(
`deno run -A --unstable eggs.ts publish eggs -do --no-check-all --check-installation --entry eggs.ts --version ${version} --handsfree`,
`deno run -A --unstable eggs.ts publish eggs -doY --no-check --check-installation --entry eggs.ts --version ${version}`,
);
});

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ might benefit nest.land, fork this repository and make a pull request from
your branch with the additions. Make sure to use [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/)

[Contribution guide](.github/CONTRIBUTING.md)
[Contribution guide](.github/CONTRIBUTING.md)
28 changes: 14 additions & 14 deletions deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,56 @@ export {
join,
relative,
resolve,
} from "https://x.nest.land/std@0.70.0/path/mod.ts";
} from "https://x.nest.land/std@0.74.0/path/mod.ts";

export {
exists,
existsSync,
expandGlob,
expandGlobSync,
walkSync,
} from "https://x.nest.land/std@0.70.0/fs/mod.ts";
} from "https://x.nest.land/std@0.74.0/fs/mod.ts";

export * as log from "https://x.nest.land/std@0.70.0/log/mod.ts";
export * as log from "https://x.nest.land/std@0.74.0/log/mod.ts";

export { LogRecord } from "https://x.nest.land/std@0.70.0/log/logger.ts";
export { LogRecord } from "https://x.nest.land/std@0.74.0/log/logger.ts";

export type { LevelName } from "https://x.nest.land/std@0.70.0/log/levels.ts";
export { LogLevels } from "https://x.nest.land/std@0.70.0/log/levels.ts";
export type { LevelName } from "https://x.nest.land/std@0.74.0/log/levels.ts";
export { LogLevels } from "https://x.nest.land/std@0.74.0/log/levels.ts";

export { BaseHandler } from "https://x.nest.land/std@0.70.0/log/handlers.ts";
export { BaseHandler } from "https://x.nest.land/std@0.74.0/log/handlers.ts";

export * from "https://x.nest.land/std@0.70.0/fmt/colors.ts";
export * from "https://x.nest.land/std@0.74.0/fmt/colors.ts";

export {
assert,
assertEquals,
assertMatch,
} from "https://x.nest.land/std@0.70.0/testing/asserts.ts";
} from "https://x.nest.land/std@0.74.0/testing/asserts.ts";

export {
parse as parseYaml,
stringify as stringifyYaml,
} from "https://x.nest.land/std@0.70.0/encoding/yaml.ts";
} from "https://x.nest.land/std@0.74.0/encoding/yaml.ts";

/**************** cliffy ****************/
export {
Command,
CompletionsCommand,
HelpCommand,
} from "https://x.nest.land/[email protected].1/command/mod.ts";
} from "https://x.nest.land/[email protected].3/command/mod.ts";

export { string as stringType } from "https://x.nest.land/[email protected].1/flags/types/string.ts";
export { string as stringType } from "https://x.nest.land/[email protected].3/flags/types/string.ts";

export {
Checkbox,
Confirm,
Input,
List,
Select,
} from "https://x.nest.land/[email protected].1/prompt/mod.ts";
} from "https://x.nest.land/[email protected].3/prompt/mod.ts";

export type { ITypeInfo } from "https://x.nest.land/[email protected].1/flags/types.ts";
export type { ITypeInfo } from "https://x.nest.land/[email protected].3/flags/types.ts";

/**************** semver ****************/
export * as semver from "https://deno.land/x/[email protected]/mod.ts";
Expand Down
39 changes: 20 additions & 19 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type { semver } from "../../deps.ts";
import { validateURL, validateVersion } from "../utilities/types.ts";
import { fetchModule } from "../api/fetch.ts";
import type { DefaultOptions } from "../commands.ts";
import { version } from "../version.ts";
import { version as eggsVersion } from "../version.ts";
import { setupLog } from "../utilities/log.ts";

/** Init Command.
Expand Down Expand Up @@ -56,12 +56,12 @@ export async function init(options: Options) {
message: "Description:",
default: currentConfig.description || existing?.description,
}) || undefined;
const repository: string | undefined = await Input.prompt({
message: "Module repository:",
default: currentConfig.repository || existing?.repository,
const homepage: string | undefined = await Input.prompt({
message: "Module homepage:",
default: currentConfig.homepage || existing?.repository,
validate: (value) => value === "" || validateURL(value),
}) || undefined;
let bump: string | undefined = await Select.prompt({
let releaseType: string | undefined = await Select.prompt({
message: "Semver increment:",
options: [
{ name: "none", value: "none" },
Expand All @@ -81,9 +81,9 @@ export async function init(options: Options) {
next: ["down", "2", "d"],
},
});
if (bump === "none") bump = undefined;
if (releaseType === "none") releaseType = undefined;

const version_: string | undefined = await Input.prompt({
const version: string | undefined = await Input.prompt({
message: "Version:",
default: existing?.getLatestVersion(),
validate: (value) => value === "" || validateVersion(value),
Expand Down Expand Up @@ -111,13 +111,14 @@ export async function init(options: Options) {
});
if (ignore.length === 1 && ignore[0] === "") ignore = undefined;

const checkAll: boolean | undefined = await Confirm.prompt({
const check: boolean | undefined = await Confirm.prompt({
message: "Perform all checks before publication?",
default: currentConfig.checkAll ?? true,
default: currentConfig.check ?? true,
});
const noCheck = !check;

let checkFormat: boolean | string | undefined =
checkAll && await Confirm.prompt({
noCheck && await Confirm.prompt({
message: "Check source files formatting before publication?",
default: (!!currentConfig.checkFormat) ?? false,
})
Expand All @@ -131,7 +132,7 @@ export async function init(options: Options) {
if (checkFormat === "") checkFormat = true;

let checkTests: boolean | string | undefined =
checkAll && await Confirm.prompt({
noCheck && await Confirm.prompt({
message: "Test your code before publication?",
default: (!!currentConfig.checkTests) ?? false,
})
Expand All @@ -144,7 +145,7 @@ export async function init(options: Options) {
: false;
if (checkTests === "") checkTests = true;

const checkInstallation: boolean | undefined = checkAll &&
const checkInstallation: boolean | undefined = noCheck &&
await Confirm.prompt({
message: "Install module and check for missing files before publication?",
default: currentConfig.checkInstallation ?? false,
Expand All @@ -164,22 +165,22 @@ export async function init(options: Options) {
},
});

const config = {
"$schema": `https://x.nest.land/eggs@${version}/src/schema.json`,
const config: Partial<Config> = {
"$schema": `https://x.nest.land/eggs@${eggsVersion}/src/schema.json`,
name,
entry,
description,
repository,
version: version_,
bump: bump as semver.ReleaseType,
homepage,
version,
releaseType: releaseType as semver.ReleaseType,
unstable,
unlisted,
files,
ignore,
checkFormat,
checkTests,
checkInstallation,
checkAll,
check,
};

log.debug("Config: ", config, format);
Expand All @@ -193,6 +194,6 @@ export type Options = DefaultOptions;
export type Arguments = [];

export const initCommand = new Command<Options, Arguments>()
.version(version)
.version(eggsVersion)
.description("Initiates a new module for the nest.land registry.")
.action(init);
Loading

0 comments on commit accbbd6

Please sign in to comment.