Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(oclif): renaming src/cmds to src/commands #1069

Closed
wants to merge 151 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
855b72f
chore: install base deps
kanadgupta Dec 21, 2023
725683b
chore: rename cmds/index.ts
kanadgupta Dec 21, 2023
d533ac4
chore: base bin scripts
kanadgupta Dec 21, 2023
fa4045e
refactor: use `src/` as root
kanadgupta Dec 21, 2023
1f8c422
chore: add config
kanadgupta Dec 21, 2023
abf41a5
chore: remove eslint rule
kanadgupta Dec 21, 2023
22151e4
feat: first pass at base class
kanadgupta Dec 21, 2023
f0784e3
feat: migrate open command to oclif
kanadgupta Dec 21, 2023
137b047
feat: migrate whoami to oclif
kanadgupta Dec 21, 2023
c16f7c5
feat(oclif): logout
kanadgupta Dec 21, 2023
9106fb6
feat(oclif): login
kanadgupta Dec 21, 2023
8a49273
chore(deps): bump to vitest 1.x
kanadgupta Dec 24, 2023
2a52998
Merge branch 'vitest-1' into oclif
kanadgupta Dec 24, 2023
1dfac0a
fix: return command output in wrapper
kanadgupta Dec 26, 2023
713fd5f
refactor: try some fancy base class stuff
kanadgupta Dec 26, 2023
48d01df
refactor: use vite stub
kanadgupta Dec 26, 2023
161a810
revert: don't add error handling here yet
kanadgupta Dec 26, 2023
1b64116
test: use oclif config for running commands
kanadgupta Dec 26, 2023
c2ee0ea
feat: first pass at createGHA hook
kanadgupta Dec 26, 2023
fde53d6
fix: prerun hook quirks in tests
kanadgupta Dec 26, 2023
5857d4d
feat: openapi:validate command to oclif
kanadgupta Dec 26, 2023
1cadce0
feat: openapi:reduce + oclif
kanadgupta Dec 26, 2023
e58dab3
feat: openapi:inspect + oclif
kanadgupta Dec 26, 2023
bde84e6
refactor: use simpler signature for running createGHA
kanadgupta Dec 27, 2023
3617f74
fix: use stored config value for apiKey properly
kanadgupta Dec 27, 2023
1a6897b
feat: changelogs to oclif
kanadgupta Dec 27, 2023
55e431b
fix(openapi/reduce): fix up some flags + debug
kanadgupta Dec 27, 2023
42b6326
Merge branch 'next' into oclif
kanadgupta Dec 27, 2023
1e78a7b
fix: oops
kanadgupta Dec 27, 2023
5f06164
feat: openapi:convert to oclif
kanadgupta Dec 27, 2023
4f0b7a3
Merge branch 'next' into oclif
kanadgupta Jan 2, 2024
bf50be7
feat: extend debug function in base class
kanadgupta Jan 3, 2024
fae8b51
refactor: rename flag var names
kanadgupta Jan 3, 2024
2dbfb0f
feat(oclif): custompages
kanadgupta Jan 3, 2024
3e14f31
feat(oclif): categories
kanadgupta Jan 3, 2024
5ddd883
refactor: mark key as required flag
kanadgupta Jan 3, 2024
8ffad56
feat(oclif): categories:create
kanadgupta Jan 3, 2024
f2dc3ea
fix: key is a flag, not an arg
kanadgupta Jan 3, 2024
52c3b98
fix: add env var to get mocked GHA env working properly
kanadgupta Jan 3, 2024
047362e
feat(oclif): docs and guides
kanadgupta Jan 3, 2024
22fa18b
feat(oclif): docs:prune and guides:prune
kanadgupta Jan 3, 2024
d10c264
chore: tiny fix
kanadgupta Jan 3, 2024
7f93f7a
feat(oclif): versions
kanadgupta Jan 4, 2024
ebaadcc
fix: enhance version flags
kanadgupta Jan 4, 2024
13d0cfb
feat(oclif): versions:create
kanadgupta Jan 4, 2024
3ee9794
feat: better debugging in prerun hook and configstore retrieval
kanadgupta Jan 4, 2024
18597de
chore: clean up a few stray Command.debug statements
kanadgupta Jan 4, 2024
29daa6b
chore(base): remove unused properties, unprotect a few
kanadgupta Jan 4, 2024
f9da725
refactor: clean up syncDocsPath + affected commands
kanadgupta Jan 4, 2024
b6c432b
chore: remove comments oops
kanadgupta Jan 4, 2024
cd1bc3f
feat(oclif): versions:delete
kanadgupta Jan 4, 2024
783a478
chore: small refactor to minimize diff
kanadgupta Jan 4, 2024
9bd77c1
feat(oclif): versions:update
kanadgupta Jan 4, 2024
91a0c28
chore(deps): bump oclif and friends
kanadgupta Jan 4, 2024
afb26e7
refactor: remove config.cli in favor of oclif's config.bin
kanadgupta Jan 4, 2024
8a285e1
refactor: define run() return type in base class
kanadgupta Jan 4, 2024
cdad30b
chore: small tsconfig fix for tests
kanadgupta Jan 4, 2024
185ca64
chore: add debug statements after parsing
kanadgupta Jan 4, 2024
6ec35b2
feat(oclif): openapi (last one!!!)
kanadgupta Jan 4, 2024
a8b01e2
fix: output result in top-level runner
kanadgupta Jan 4, 2024
a6b14b4
chore: rename baseCommandNew to baseCommand
kanadgupta Jan 4, 2024
51613e2
chore: rename createGHA file
kanadgupta Jan 4, 2024
1230c35
chore: remove a few more unused files
kanadgupta Jan 5, 2024
af84069
Merge branch 'next' into oclif
kanadgupta Jan 5, 2024
d806b99
chore: typo
kanadgupta Jan 9, 2024
efb7f9f
fix: don't mess with key flag in test env
kanadgupta Jan 9, 2024
4e92554
test: remove test coverage around `--key` flag
kanadgupta Jan 9, 2024
abd4d26
fix: unused imports
kanadgupta Jan 9, 2024
d10797e
test: remove test coverage around docs
kanadgupta Jan 9, 2024
350afe2
chore: remove unused test
kanadgupta Jan 9, 2024
b1fc91c
test: single-threaded openapi tests
kanadgupta Jan 9, 2024
5d0da44
test: fix snapshot oops
kanadgupta Jan 9, 2024
5ca695a
test: oclif-ify createGHA tests
kanadgupta Jan 9, 2024
e92a2b3
chore: swap out when we surface node warnings
kanadgupta Jan 9, 2024
174321a
Merge branch 'next' into oclif
kanadgupta Jan 9, 2024
46c6578
fix: stricter flag.option typing
kanadgupta Jan 9, 2024
d881a89
Merge branch 'next' into oclif
kanadgupta Jan 9, 2024
585236e
feat: docker-gha as oclif
kanadgupta Jan 10, 2024
c1f00b5
feat: add GHA output handling in baseCommand
kanadgupta Jan 10, 2024
66c47f3
chore: whoops
kanadgupta Jan 10, 2024
867cf85
test: more tests
kanadgupta Jan 10, 2024
9d27eed
test: fix bin test
kanadgupta Jan 10, 2024
2cf1fe3
test: another test
kanadgupta Jan 10, 2024
5d68614
chore: rip bin/rdme.js
kanadgupta Jan 10, 2024
98ed9aa
chore: remove unused interface
kanadgupta Jan 10, 2024
8dc9dde
chore: fix link in comment
kanadgupta Jan 10, 2024
99819a9
feat: oclif-friendly help screen
kanadgupta Jan 10, 2024
8155657
docs: various smol updates
kanadgupta Jan 11, 2024
da96609
chore: rip test coverage
kanadgupta Jan 11, 2024
c9d0ea7
chore: backfill helpClass oops
kanadgupta Jan 11, 2024
f5a74da
chore: point to right bin script oops
kanadgupta Jan 11, 2024
1ddf2ec
chore: files in favor of npmignore
kanadgupta Jan 11, 2024
d8ea26a
chore: gitignore tmp
kanadgupta Jan 11, 2024
cf3bf59
chore: backfill plugins and topics oops
kanadgupta Jan 11, 2024
bbdfbd8
chore: delete index.test.js, add test todos in hooks
kanadgupta Jan 11, 2024
f01cbd8
chore: remove vi.useFakeTimers()
kanadgupta Jan 11, 2024
0063c02
chore: remove mock that evidently is redundant
kanadgupta Jan 11, 2024
2b14476
chore: remove unnecessary baseUrl tsconfig option
kanadgupta Jan 11, 2024
670f1b9
chore: remove unused packages
kanadgupta Jan 11, 2024
e92b702
feat: add @oclif/plugin-warn-if-update-available
kanadgupta Jan 11, 2024
9d8035e
chore: bump outdated oclif deps
kanadgupta Jan 11, 2024
52b5a9c
chore: rebuild lockfile
kanadgupta Jan 11, 2024
b0a62dd
chore: knip cleanup
kanadgupta Jan 11, 2024
9acf1af
chore: lint
kanadgupta Jan 11, 2024
f393077
chore: fix import path
kanadgupta Jan 11, 2024
1fdb970
chore: minor rollup fixes
kanadgupta Jan 11, 2024
d31cca2
Merge branch 'next' into oclif
kanadgupta Jan 29, 2024
714e164
Merge branch 'next' into oclif
kanadgupta Feb 16, 2024
51ae453
chore: rebuild lockfile
kanadgupta Feb 16, 2024
2114ed0
fix: bad merge
kanadgupta Feb 16, 2024
08d4a00
chore: lint
kanadgupta Feb 16, 2024
23c1198
chore: backfill changes to a few tests
kanadgupta Feb 16, 2024
610a4e6
chore(deps): bump to dev branch
kanadgupta Feb 20, 2024
0a31040
refactor: explicit config
kanadgupta Feb 20, 2024
36c5d18
feat: first pass at oclif + esbuild + pkg
kanadgupta Feb 20, 2024
5776038
chore(deps): bump
kanadgupta Feb 28, 2024
793bbe6
chore: i had these commands backwards oops
kanadgupta Feb 28, 2024
911ed1f
Merge branch 'next' into oclif-explicit
kanadgupta Oct 16, 2024
6a9046a
test: bad merge
kanadgupta Oct 16, 2024
17ecfa3
chore: lint issues
kanadgupta Oct 16, 2024
bad985d
Merge branch 'next' into oclif-explicit
kanadgupta Oct 16, 2024
88955ff
chore(deps): bump oclif and friends to latest
kanadgupta Oct 16, 2024
25bbf9a
fix: shebangs
kanadgupta Oct 16, 2024
86ab05e
test: fix underlying spy
kanadgupta Oct 16, 2024
d38142a
fix: ts wants this
kanadgupta Oct 16, 2024
9899d63
test: typo
kanadgupta Oct 17, 2024
4d0968e
chore: bump a few oclif deps
kanadgupta Oct 22, 2024
76388e4
test: migrate a bunch of commands over
kanadgupta Nov 9, 2024
576d42a
test: convert a few openapi subcommands over to @oclif/test
kanadgupta Nov 9, 2024
3f66de8
Merge branch 'next' into oclif-explicit
kanadgupta Nov 9, 2024
27479ca
Merge branch 'next' into oclif-explicit
kanadgupta Nov 15, 2024
c296efb
test(openapi): get convert and reduce tests working again
kanadgupta Nov 15, 2024
708892a
test(openapi/index): merge conflicts
kanadgupta Nov 15, 2024
d65545b
test(openapi/validate): get tests mostly working
kanadgupta Nov 15, 2024
080e5dd
test: add types for mock spy instances
kanadgupta Nov 15, 2024
09f510c
test: fix snap
kanadgupta Nov 16, 2024
39dd8aa
test(openapi/index): get test moved over to new setup
kanadgupta Nov 16, 2024
67a66ac
test: lint
kanadgupta Nov 16, 2024
02a8ef0
revert: bring back snaps
kanadgupta Nov 16, 2024
2cc57a6
test: fix validation test omfg
kanadgupta Nov 16, 2024
f329dae
chore: comment
kanadgupta Nov 16, 2024
52cc04b
chore: lint fixes
kanadgupta Nov 16, 2024
aff7b45
fix: correct import attribute
kanadgupta Nov 16, 2024
2bd0106
chore(deps): remove esbuild
kanadgupta Nov 16, 2024
4bbb4ce
chore: delete unused file
kanadgupta Nov 16, 2024
a77c7c3
chore: oops
kanadgupta Nov 16, 2024
b366876
chore: remove docker command
kanadgupta Nov 16, 2024
6677c5f
chore: simplify knip
kanadgupta Nov 16, 2024
12b8408
chore(deps): remove string-argv
kanadgupta Nov 17, 2024
b3b14e3
chore(deps): rebuild lockfile
kanadgupta Nov 17, 2024
f0b4ecd
chore: renaming `src/cmds` to `src/commands`
erunion Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
/**
* This is a small rule to prevent us from using console.log() statements in our commands.
*
* We've had troubles in the past where our test coverage required us to use Jest mocks for
* We've had troubles in the past where our test coverage required us to use Vitest mocks for
* console.log() calls, hurting our ability to write resilient tests and easily debug issues.
*
* We should be returning Promise-wrapped values in our main command functions
* so we can write robust tests and take advantage of `bin/rdme.js`,
* so we can write robust tests and take advantage of `bin/run.js` and `src/baseCommand.ts`,
* which we use for printing function outputs and returning correct exit codes.
*
* Furthermore, we should also be using our custom loggers (see src/lib/logger.js)
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ coverage/
dist/
exe/
node_modules/
tmp/

# required for building with TS
src/package.json
10 changes: 0 additions & 10 deletions .npmignore

This file was deleted.

6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Running Shell Commands Locally 🐚

To run test commands from within the repository, run the build and then run your commands from the root of the repository and use `./bin/rdme.js` instead of `rdme` so it properly points to the command executable, like so:
To run test commands from within the repository, run the build and then run your commands from the root of the repository and use `./bin/run.js` instead of `rdme` so it properly points to the command executable, like so:

```sh
npm run build
./bin/rdme.js openapi:validate __tests__/__fixtures__/ref-oas/petstore.json
./bin/run.js openapi:validate __tests__/__fixtures__/ref-oas/petstore.json
```

If you need to debug commands quicker and re-building TS everytime is becoming cumbersome, you can use the debug command, like so:
Expand Down Expand Up @@ -70,7 +70,7 @@ act -j simple

### Usage of `console`

As you'll learn in our commands logic (see [`bin/rdme.js`](bin/rdme.js) and the [`src/cmds`](src/cmds) directory), we wrap our command outputs in resolved/rejected [`Promise` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) and use [`bin/rdme.js`](bin/rdme.js) file to log the results to the console and return the correct status code. This is so we can write more resilient tests, ensure that the proper exit codes are being returned, and make debugging easier.
As you'll learn in our commands logic (see [`bin/run.js`](bin/run.js) and the [`src/commands`](src/commands) directory), we wrap our command outputs in resolved/rejected [`Promise` objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) and use [`bin/run.js`](bin/run.js) file to log the results to the console and return the correct status code. This is so we can write more resilient tests, ensure that the proper exit codes are being returned, and make debugging easier.

When writing command logic, avoid using `console` statements (and correspondingly, avoid mocking `console` statements in tests) when possible.

Expand Down
4 changes: 2 additions & 2 deletions __tests__/bin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ describe('bin', () => {
expect.assertions(1);

await new Promise(resolve => {
exec(`node ${__dirname}/../bin/rdme.js`, (error, stdout) => {
expect(stdout).toContain('a utility for interacting with ReadMe');
exec(`node ${__dirname}/../bin/run.js`, (error, stdout) => {
expect(stdout).toContain("ReadMe's official CLI and GitHub Action");
resolve(true);
});
});
Expand Down
3 changes: 0 additions & 3 deletions __tests__/cmds/__snapshots__/whoami.test.ts.snap

This file was deleted.

34 changes: 0 additions & 34 deletions __tests__/cmds/logout.test.ts

This file was deleted.

206 changes: 0 additions & 206 deletions __tests__/cmds/versions/create.test.ts

This file was deleted.

27 changes: 0 additions & 27 deletions __tests__/cmds/whoami.test.ts

This file was deleted.

Loading
Loading