Skip to content

Commit 0d0a855

Browse files
kanadguptaerunion
andauthored
chore: renaming src/cmds to src/commands (#1070)
## 🧰 Changes recreating @erunion's work in #1069: > This is a super minor addendum to the oclif work going on in #1068 but I've renamed our `src/cmds` directory to `src/commands` as when you run `oclif generate command <command name>` that's the directory it wants to place a new command into. > > We could _probably_ configure `src/cmds` somehow to be the place it looks but I don't see anything in their [config docs](https://oclif.io/docs/config) about it. Co-authored-by: Jon Ursenbach <[email protected]>
1 parent ff72a9d commit 0d0a855

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+53
-53
lines changed

CONTRIBUTING.md

+1-1

__tests__/cmds/categories/create.test.ts renamed to __tests__/commands/categories/create.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import nock from 'nock';
22
import { describe, beforeAll, afterEach, it, expect } from 'vitest';
33

4-
import Command from '../../../src/cmds/categories/create.js';
4+
import Command from '../../../src/commands/categories/create.js';
55
import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock.js';
66
import { runCommand } from '../../helpers/setup-oclif-config.js';
77

__tests__/cmds/categories/index.test.ts renamed to __tests__/commands/categories/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import nock from 'nock';
22
import { describe, beforeAll, afterEach, it, expect } from 'vitest';
33

4-
import Command from '../../../src/cmds/categories/index.js';
4+
import Command from '../../../src/commands/categories/index.js';
55
import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock.js';
66
import { runCommand } from '../../helpers/setup-oclif-config.js';
77

__tests__/cmds/changelogs/index.test.ts renamed to __tests__/commands/changelogs/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import frontMatter from 'gray-matter';
66
import nock from 'nock';
77
import { describe, beforeAll, afterAll, beforeEach, it, expect } from 'vitest';
88

9-
import Command from '../../../src/cmds/changelogs.js';
9+
import Command from '../../../src/commands/changelogs.js';
1010
import APIError from '../../../src/lib/apiError.js';
1111
import getAPIMock from '../../helpers/get-api-mock.js';
1212
import hashFileContents from '../../helpers/hash-file-contents.js';

__tests__/cmds/changelogs/single.test.ts renamed to __tests__/commands/changelogs/single.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import frontMatter from 'gray-matter';
66
import nock from 'nock';
77
import { describe, beforeAll, afterAll, beforeEach, it, expect } from 'vitest';
88

9-
import Command from '../../../src/cmds/changelogs.js';
9+
import Command from '../../../src/commands/changelogs.js';
1010
import APIError from '../../../src/lib/apiError.js';
1111
import getAPIMock from '../../helpers/get-api-mock.js';
1212
import hashFileContents from '../../helpers/hash-file-contents.js';

__tests__/cmds/custompages/index.test.ts renamed to __tests__/commands/custompages/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import frontMatter from 'gray-matter';
66
import nock from 'nock';
77
import { describe, beforeAll, afterAll, beforeEach, it, expect } from 'vitest';
88

9-
import Command from '../../../src/cmds/custompages.js';
9+
import Command from '../../../src/commands/custompages.js';
1010
import APIError from '../../../src/lib/apiError.js';
1111
import getAPIMock from '../../helpers/get-api-mock.js';
1212
import hashFileContents from '../../helpers/hash-file-contents.js';

__tests__/cmds/custompages/single.test.ts renamed to __tests__/commands/custompages/single.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import frontMatter from 'gray-matter';
66
import nock from 'nock';
77
import { describe, beforeAll, afterAll, beforeEach, it, expect } from 'vitest';
88

9-
import Command from '../../../src/cmds/custompages.js';
9+
import Command from '../../../src/commands/custompages.js';
1010
import APIError from '../../../src/lib/apiError.js';
1111
import getAPIMock from '../../helpers/get-api-mock.js';
1212
import hashFileContents from '../../helpers/hash-file-contents.js';

__tests__/cmds/docs/index.test.ts renamed to __tests__/commands/docs/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import nock from 'nock';
1010
import prompts from 'prompts';
1111
import { describe, beforeAll, afterAll, beforeEach, afterEach, it, expect, vi, type MockInstance } from 'vitest';
1212

13-
import Command from '../../../src/cmds/docs/index.js';
13+
import Command from '../../../src/commands/docs/index.js';
1414
import APIError from '../../../src/lib/apiError.js';
1515
import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock.js';
1616
import { after, before } from '../../helpers/get-gha-setup.js';

__tests__/cmds/docs/multiple.test.ts renamed to __tests__/commands/docs/multiple.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import frontMatter from 'gray-matter';
55
import nock from 'nock';
66
import { describe, beforeAll, afterAll, it, expect } from 'vitest';
77

8-
import Command from '../../../src/cmds/docs/index.js';
8+
import Command from '../../../src/commands/docs/index.js';
99
import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock.js';
1010
import hashFileContents from '../../helpers/hash-file-contents.js';
1111
import { runCommand } from '../../helpers/setup-oclif-config.js';

__tests__/cmds/docs/prune.test.ts renamed to __tests__/commands/docs/prune.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import nock from 'nock';
33
import prompts from 'prompts';
44
import { describe, beforeAll, afterAll, it, expect } from 'vitest';
55

6-
import Command from '../../../src/cmds/docs/prune.js';
6+
import Command from '../../../src/commands/docs/prune.js';
77
import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock.js';
88
import { runCommand } from '../../helpers/setup-oclif-config.js';
99

__tests__/cmds/docs/single.test.ts renamed to __tests__/commands/docs/single.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import frontMatter from 'gray-matter';
66
import nock from 'nock';
77
import { describe, beforeAll, afterAll, beforeEach, afterEach, it, expect } from 'vitest';
88

9-
import Command from '../../../src/cmds/docs/index.js';
9+
import Command from '../../../src/commands/docs/index.js';
1010
import APIError from '../../../src/lib/apiError.js';
1111
import getAPIMock, { getAPIMockWithVersionHeader } from '../../helpers/get-api-mock.js';
1212
import hashFileContents from '../../helpers/hash-file-contents.js';

__tests__/cmds/login.test.ts renamed to __tests__/commands/login.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import nock from 'nock';
22
import prompts from 'prompts';
33
import { describe, beforeAll, afterAll, afterEach, it, expect } from 'vitest';
44

5-
import Command from '../../src/cmds/login.js';
5+
import Command from '../../src/commands/login.js';
66
import APIError from '../../src/lib/apiError.js';
77
import configStore from '../../src/lib/configstore.js';
88
import getAPIMock from '../helpers/get-api-mock.js';

__tests__/cmds/logout.test.ts renamed to __tests__/commands/logout.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, afterEach, beforeAll, it, expect } from 'vitest';
22

33
import pkg from '../../package.json';
4-
import Command from '../../src/cmds/logout.js';
4+
import Command from '../../src/commands/logout.js';
55
import configStore from '../../src/lib/configstore.js';
66
import { runCommand } from '../helpers/setup-oclif-config.js';
77

__tests__/cmds/open.test.ts renamed to __tests__/commands/open.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { Version } from '../../src/cmds/versions/index.js';
1+
import type { Version } from '../../src/commands/versions/index.js';
22

33
import chalk from 'chalk';
44
import { describe, afterEach, beforeAll, it, expect } from 'vitest';
55

66
import pkg from '../../package.json';
7-
import Command from '../../src/cmds/open.js';
7+
import Command from '../../src/commands/open.js';
88
import configStore from '../../src/lib/configstore.js';
99
import getAPIMock from '../helpers/get-api-mock.js';
1010
import { runCommand } from '../helpers/setup-oclif-config.js';

__tests__/cmds/openapi/convert.test.ts renamed to __tests__/commands/openapi/convert.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from 'node:fs';
33
import prompts from 'prompts';
44
import { describe, it, expect, vi, beforeAll, beforeEach, afterEach } from 'vitest';
55

6-
import Command from '../../../src/cmds/openapi/convert.js';
6+
import Command from '../../../src/commands/openapi/convert.js';
77
import { runCommand } from '../../helpers/setup-oclif-config.js';
88

99
const successfulConversion = () => 'Your API definition has been converted and bundled and saved to output.json!';

__tests__/cmds/openapi/index.test.ts renamed to __tests__/commands/openapi/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import nock from 'nock';
77
import prompts from 'prompts';
88
import { describe, beforeAll, beforeEach, afterEach, it, expect, vi, type MockInstance } from 'vitest';
99

10-
import Command from '../../../src/cmds/openapi/index.js';
10+
import Command from '../../../src/commands/openapi/index.js';
1111
import APIError from '../../../src/lib/apiError.js';
1212
import config from '../../../src/lib/config.js';
1313
import petstoreWeird from '../../__fixtures__/petstore-simple-weird-version.json' with { type: 'json' };

__tests__/cmds/openapi/inspect.test.ts renamed to __tests__/commands/openapi/inspect.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import assert from 'node:assert';
44

55
import { describe, it, expect, beforeAll } from 'vitest';
66

7-
import Command from '../../../src/cmds/openapi/inspect.js';
7+
import Command from '../../../src/commands/openapi/inspect.js';
88
import { runCommand } from '../../helpers/setup-oclif-config.js';
99

1010
describe('rdme openapi:inspect', () => {

__tests__/cmds/openapi/reduce.test.ts renamed to __tests__/commands/openapi/reduce.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import chalk from 'chalk';
55
import prompts from 'prompts';
66
import { describe, beforeAll, beforeEach, afterEach, it, expect, vi, type MockInstance } from 'vitest';
77

8-
import Command from '../../../src/cmds/openapi/reduce.js';
8+
import Command from '../../../src/commands/openapi/reduce.js';
99
import { runCommand } from '../../helpers/setup-oclif-config.js';
1010

1111
const successfulReduction = () => 'Your reduced API definition has been saved to output.json! 🤏';

__tests__/cmds/openapi/validate.test.ts renamed to __tests__/commands/openapi/validate.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import chalk from 'chalk';
77
import prompts from 'prompts';
88
import { describe, beforeAll, beforeEach, afterEach, it, expect, vi, type MockInstance } from 'vitest';
99

10-
import Command from '../../../src/cmds/openapi/validate.js';
10+
import Command from '../../../src/commands/openapi/validate.js';
1111
import { after, before } from '../../helpers/get-gha-setup.js';
1212
import { runCommand } from '../../helpers/setup-oclif-config.js';
1313

__tests__/cmds/versions/create.test.ts renamed to __tests__/commands/versions/create.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import nock from 'nock';
22
import prompts from 'prompts';
33
import { describe, beforeAll, afterEach, it, expect } from 'vitest';
44

5-
import Command from '../../../src/cmds/versions/create.js';
5+
import Command from '../../../src/commands/versions/create.js';
66
import APIError from '../../../src/lib/apiError.js';
77
import getAPIMock from '../../helpers/get-api-mock.js';
88
import { runCommand } from '../../helpers/setup-oclif-config.js';

__tests__/cmds/versions/delete.test.ts renamed to __tests__/commands/versions/delete.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import nock from 'nock';
22
import { describe, beforeAll, afterEach, it, expect } from 'vitest';
33

4-
import Command from '../../../src/cmds/versions/delete.js';
4+
import Command from '../../../src/commands/versions/delete.js';
55
import APIError from '../../../src/lib/apiError.js';
66
import getAPIMock from '../../helpers/get-api-mock.js';
77
import { runCommand } from '../../helpers/setup-oclif-config.js';

__tests__/cmds/versions/index.test.ts renamed to __tests__/commands/versions/index.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { Version } from '../../../src/cmds/versions/index.js';
1+
import type { Version } from '../../../src/commands/versions/index.js';
22

33
import nock from 'nock';
44
import { describe, beforeAll, afterEach, it, expect } from 'vitest';
55

6-
import Command from '../../../src/cmds/versions/index.js';
6+
import Command from '../../../src/commands/versions/index.js';
77
import getAPIMock from '../../helpers/get-api-mock.js';
88
import { runCommand } from '../../helpers/setup-oclif-config.js';
99

__tests__/cmds/versions/update.test.ts renamed to __tests__/commands/versions/update.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import nock from 'nock';
22
import prompts from 'prompts';
33
import { describe, beforeAll, afterEach, it, expect } from 'vitest';
44

5-
import Command from '../../../src/cmds/versions/update.js';
5+
import Command from '../../../src/commands/versions/update.js';
66
import APIError from '../../../src/lib/apiError.js';
77
import getAPIMock from '../../helpers/get-api-mock.js';
88
import { runCommand } from '../../helpers/setup-oclif-config.js';

__tests__/cmds/whoami.test.ts renamed to __tests__/commands/whoami.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, afterEach, it, expect, beforeAll } from 'vitest';
22

33
import pkg from '../../package.json';
4-
import Command from '../../src/cmds/whoami.js';
4+
import Command from '../../src/commands/whoami.js';
55
import configStore from '../../src/lib/configstore.js';
66
import { runCommand } from '../helpers/setup-oclif-config.js';
77

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
"description": "Sync or prune Guides pages in your ReadMe developer hub."
179179
},
180180
"openapi": {
181-
"description": "Manage your API definition. Supports OpenAPI, Swagger, Postman."
181+
"description": "Manage your API definition. Supports OpenAPI, Swagger, and Postman."
182182
},
183183
"versions": {
184184
"description": "Manage your documentation versions."
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/index.ts

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import CategoriesCreateCommand from './cmds/categories/create.js';
2-
import CategoriesCommand from './cmds/categories/index.js';
3-
import ChangelogsCommand from './cmds/changelogs.js';
4-
import CustomPagesCommand from './cmds/custompages.js';
5-
import DocsCommand from './cmds/docs/index.js';
6-
import DocsPruneCommand from './cmds/docs/prune.js';
7-
import LoginCommand from './cmds/login.js';
8-
import LogoutCommand from './cmds/logout.js';
9-
import OpenCommand from './cmds/open.js';
10-
import OpenAPIConvertCommand from './cmds/openapi/convert.js';
11-
import OpenAPICommand from './cmds/openapi/index.js';
12-
import OpenAPIInspectCommand from './cmds/openapi/inspect.js';
13-
import OpenAPIReduceCommand from './cmds/openapi/reduce.js';
14-
import OpenAPIValidateCommand from './cmds/openapi/validate.js';
15-
import CreateVersionCommand from './cmds/versions/create.js';
16-
import DeleteVersionCommand from './cmds/versions/delete.js';
17-
import VersionsCommand from './cmds/versions/index.js';
18-
import UpdateVersionCommand from './cmds/versions/update.js';
19-
import WhoAmICommand from './cmds/whoami.js';
1+
import CategoriesCreateCommand from './commands/categories/create.js';
2+
import CategoriesCommand from './commands/categories/index.js';
3+
import ChangelogsCommand from './commands/changelogs.js';
4+
import CustomPagesCommand from './commands/custompages.js';
5+
import DocsCommand from './commands/docs/index.js';
6+
import DocsPruneCommand from './commands/docs/prune.js';
7+
import LoginCommand from './commands/login.js';
8+
import LogoutCommand from './commands/logout.js';
9+
import OpenCommand from './commands/open.js';
10+
import OpenAPIConvertCommand from './commands/openapi/convert.js';
11+
import OpenAPICommand from './commands/openapi/index.js';
12+
import OpenAPIInspectCommand from './commands/openapi/inspect.js';
13+
import OpenAPIReduceCommand from './commands/openapi/reduce.js';
14+
import OpenAPIValidateCommand from './commands/openapi/validate.js';
15+
import CreateVersionCommand from './commands/versions/create.js';
16+
import DeleteVersionCommand from './commands/versions/delete.js';
17+
import VersionsCommand from './commands/versions/index.js';
18+
import UpdateVersionCommand from './commands/versions/update.js';
19+
import WhoAmICommand from './commands/whoami.js';
2020

2121
export { default as createGHA } from './lib/hooks/createGHA.js';
2222
export { default as prerun } from './lib/hooks/prerun.js';

src/lib/createGHA/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function getKey(args: CommandFlag, opts: ParsedOpts): string | false {
6060
/**
6161
* Constructs the command string that we pass into the workflow file.
6262
*/
63-
function constructCmdString(commandId: string, args: CommandArg, flags: CommandFlag, opts: ParsedOpts): string {
63+
function constructCommandString(commandId: string, args: CommandArg, flags: CommandFlag, opts: ParsedOpts): string {
6464
const argsString = Object.keys(args)
6565
.map(arg => {
6666
return opts[arg];
@@ -264,7 +264,7 @@ export default async function createGHA(
264264
branch,
265265
cleanCommand: cleanFileName(commandId),
266266
command: commandId,
267-
commandString: constructCmdString(commandId, args, flags, parsedOpts),
267+
commandString: constructCommandString(commandId, args, flags, parsedOpts),
268268
rdmeVersion: `v${majorPkgVersion}`,
269269
timestamp: new Date().toISOString(),
270270
};

src/lib/prompts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Version } from '../cmds/versions/index.js';
1+
import type { Version } from '../commands/versions/index.js';
22
import type { Choice, PromptObject } from 'prompts';
33

44
import parse from 'parse-link-header';

src/lib/syncDocsPath.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ReadDocMetadata } from './readDoc.js';
2-
import type ChangelogsCommand from '../cmds/changelogs.js';
3-
import type CustomPagesCommand from '../cmds/custompages.js';
4-
import type DocsCommand from '../cmds/docs/index.js';
2+
import type ChangelogsCommand from '../commands/changelogs.js';
3+
import type CustomPagesCommand from '../commands/custompages.js';
4+
import type DocsCommand from '../commands/docs/index.js';
55

66
import fs from 'node:fs/promises';
77
import path from 'node:path';

src/lib/versionSelect.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { APIErrorResponse } from './apiError.js';
2-
import type { Version } from '../cmds/versions/index.js';
2+
import type { Version } from '../commands/versions/index.js';
33

44
import APIError from './apiError.js';
55
import isCI from './isCI.js';

0 commit comments

Comments
 (0)