terrafaker 0.0.6 → 0.0.8
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 +52 -213
- package/dist/commands/generate/file.js +4 -4
- package/dist/commands/generate/repo.js +22 -15
- package/dist/commands/gh/repo/clone.js +22 -0
- package/dist/commands/gh/repo/delete.js +22 -0
- package/dist/commands/glab/repo/clone.js +22 -0
- package/dist/commands/glab/repo/delete.js +20 -0
- package/dist/commands/util/format-psv.js +3 -3
- package/dist/commands/util/format-tsv.js +10 -10
- package/dist/commands/util/index.js +1 -1
- package/dist/constants/aws.js +82 -82
- package/dist/constants/azure.js +95 -95
- package/dist/constants/gcp.js +66 -66
- package/dist/enums/help-messages.js +2 -0
- package/dist/enums/providers.js +1 -1
- package/dist/enums/vcs-providers.js +5 -0
- package/dist/topics/generate.js +5 -0
- package/dist/topics/gh.js +6 -0
- package/dist/topics/glab.js +6 -0
- package/dist/types/repo.js +1 -0
- package/dist/utilities/base-command.js +45 -0
- package/dist/utilities/flags.js +22 -8
- package/dist/utilities/generators/aws-generator.js +11 -11
- package/dist/utilities/generators/azure-generator.js +7 -7
- package/dist/utilities/generators/file-generator.js +2 -2
- package/dist/utilities/generators/gcp-generator.js +13 -9
- package/dist/utilities/generators/generator-utils.js +5 -5
- package/dist/utilities/generators/provider-generator.js +26 -8
- package/dist/utilities/generators/repo-generator.js +5 -5
- package/dist/utilities/github.js +27 -4
- package/dist/utilities/gitlab.js +29 -0
- package/dist/utilities/repo-utils.js +6 -0
- package/dist/utilities/tag-utils.js +2 -2
- package/oclif.manifest.json +139 -100
- package/package.json +11 -5
- package/dist/commands/generate/index.js +0 -9
- package/dist/commands/gh/clone-repos.js +0 -46
- package/dist/commands/gh/delete-repos.js +0 -41
- package/dist/commands/gh/index.js +0 -10
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Command, Flags } from "@oclif/core";
|
|
2
|
-
import { execSync } from "node:child_process";
|
|
3
|
-
import { confirm } from "@inquirer/prompts";
|
|
4
|
-
import { isEmpty } from "lodash-es";
|
|
5
|
-
import { listRepos, stringifyRepos } from "../../utilities/github.js";
|
|
6
|
-
import { HelpMessages } from "../../enums/help-messages.js";
|
|
7
|
-
class DeleteRepos extends Command {
|
|
8
|
-
static description = `Deletes repos from your Github account, useful for cleaning up generated test data. ${HelpMessages.RequiresGhCli}
|
|
9
|
-
|
|
10
|
-
If the deletion fails, you may need to refresh your CLI permissions with \`gh auth refresh -s delete_repo\``;
|
|
11
|
-
static flags = {
|
|
12
|
-
prefix: Flags.string({
|
|
13
|
-
description: "Prefix for the repos to delete, such as 'tf_'",
|
|
14
|
-
required: true,
|
|
15
|
-
}),
|
|
16
|
-
};
|
|
17
|
-
async run() {
|
|
18
|
-
const { flags } = await this.parse(DeleteRepos);
|
|
19
|
-
const { prefix } = flags;
|
|
20
|
-
const allRepos = listRepos();
|
|
21
|
-
const repos = allRepos.filter((repo) => repo.name.startsWith(prefix));
|
|
22
|
-
if (isEmpty(repos)) {
|
|
23
|
-
this.log(`Repos found:\n${stringifyRepos(allRepos)}`);
|
|
24
|
-
this.log(`No repos found with prefix '${prefix}'`);
|
|
25
|
-
this.exit();
|
|
26
|
-
}
|
|
27
|
-
this.log(`Repos to delete:\n${stringifyRepos(repos)}`);
|
|
28
|
-
const confirmation = await confirm({
|
|
29
|
-
message: "Continue with deletion of these repos?",
|
|
30
|
-
});
|
|
31
|
-
if (!confirmation) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
repos.forEach((repo) => {
|
|
35
|
-
execSync(`gh repo delete ${repo.nameWithOwner} --yes`, {
|
|
36
|
-
stdio: "inherit",
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export { DeleteRepos };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from "../../utilities/base-command.js";
|
|
2
|
-
import { HelpMessages } from "../../enums/help-messages.js";
|
|
3
|
-
class Gh extends BaseCommand {
|
|
4
|
-
static hidden = true;
|
|
5
|
-
static description = `Utility commands that wrap the \`gh\` CLI. ${HelpMessages.RequiresGhCli}`;
|
|
6
|
-
async run() {
|
|
7
|
-
await this.showHelp();
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export { Gh };
|