-
Notifications
You must be signed in to change notification settings - Fork 140
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
Add "observable deploy" command. #187
Conversation
Now that Michael's auth PR is merged and we've chosen our testing strategy (undici mocking), I'll get this PR properly integrated with his code and ready for non-draft review. |
92bee89
to
f656fd7
Compare
PR updated and now ready for actual review. Thanks all! |
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.
some concerns around error handling - will review the test cases later! (I also needed the OBSERVABLEHQ_API_HOST
env var for testing locally 😆)
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.
some minor suggestions but it worked well from testing locally! will approve after the small changes and increasing test coverage
…ing postDeployFile test breakage.
Co-authored-by: Michael Cooper <[email protected]>
|
||
// Mark the deploy as uploaded. | ||
await apiClient.postDeployUploaded(deployId); | ||
logger.log(`Deployed project now visible at ${getObservableUiHost()}/p/${projectId}`); |
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.
Is the projectId
the hexadecimal identifier? We should try to never show that to the user, especially for the URL that they are likely to copy-paste and share.
We might also have the API return the URL for the project, so that we can change the logic more easily on the API side without needing clients to update.
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.
headers: [...this._apiHeaders, ["Content-Type", "application/json"]], | ||
body: JSON.stringify({}) | ||
}); | ||
if (response.status !== 200) { |
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.
Use response.ok here? (And below.)
|
||
interface Config { | ||
const observableConfigName = ".observablehq"; | ||
interface ObservableConfig { |
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.
“ObservableConfig” sounds a little ambiguous. Should we call this “UserConfig” (since it typically lives in the user’s home directory)?
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.
Nice job with the tests! 👏
Will address comments in a followup PR. Thanks! |
Description
Add a new "yarn deploy" command that talks to our new API endpoints.
Resolves https://github.com/observablehq/observablehq/issues/15128 and https://github.com/observablehq/observablehq/issues/15134
Internal workflow:
Review notes
To test locally, you'll need the feature flag enabled in your local db:
INSERT INTO user_features (feature, canary) VALUES ('cli_project', true);
Then you can login from the CLI:
NODE_TLS_REJECT_UNAUTHORIZED=0 OBSERVABLEHQ_HOST=https://observable.test:5000/ yarn tsx bin/observable.ts login
And then do a deploy from the CLI:
NODE_TLS_REJECT_UNAUTHORIZED=0 OBSERVABLEHQ_HOST=https://observable.test:5000/ yarn deploy
Tests
Adds to ObservableApiMock introduced in #39.
Risk
Low.