-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add the eject and translate commands (#1668)
* feat: add the translations command * feat: add eject command * Update .changeset/short-panthers-smoke.md Co-authored-by: Lorna Jane Mitchell <[email protected]> * Update packages/cli/src/index.ts Co-authored-by: Lorna Jane Mitchell <[email protected]> * Update packages/cli/src/index.ts Co-authored-by: Lorna Jane Mitchell <[email protected]> * update commands descriptions * add the -p alias for preivew; update eject/contentDir description * alighn option naming with the latest Realm changes * resolve comments * rename translations to translate --------- Co-authored-by: Lorna Jane Mitchell <[email protected]>
- Loading branch information
Showing
17 changed files
with
199 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@redocly/cli": minor | ||
--- | ||
|
||
Added the `eject` and `translate` commands for use with the new Reunite-hosted product family. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { spawn } from 'child_process'; | ||
|
||
import type { CommandArgs } from '../wrapper'; | ||
import type { VerifyConfigOptions } from '../types'; | ||
|
||
export type EjectOptions = { | ||
type: 'component'; | ||
path: string; | ||
'project-dir'?: string; | ||
force: boolean; | ||
} & VerifyConfigOptions; | ||
|
||
export const handleEject = async ({ argv }: CommandArgs<EjectOptions>) => { | ||
process.stdout.write(`\nLaunching eject using NPX.\n\n`); | ||
const npxExecutableName = process.platform === 'win32' ? 'npx.cmd' : 'npx'; | ||
spawn( | ||
npxExecutableName, | ||
[ | ||
'-y', | ||
'@redocly/realm', | ||
'eject', | ||
`${argv.type}`, | ||
`${argv.path}`, | ||
`-d=${argv['project-dir']}`, | ||
argv.force ? `--force=${argv.force}` : '', | ||
], | ||
{ stdio: 'inherit' } | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
78e0881
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
765 tests passing in 108 suites.
Report generated by 🧪jest coverage report action from 78e0881