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 zeit 2 support #1417
Add zeit 2 support #1417
Conversation
'now-start': `cd ${this.distDir} && serve -s ./`, | ||
...parsedFile.scripts, |
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.
This was moved because I may want to override your now-start
@@ -167,10 +121,11 @@ export async function aliasDeployment({ http, path, props, state }) { | |||
export async function postToZeit({ http, path, props, state }) { | |||
const { apiData } = props; | |||
const token = state.get('user.integrations.zeit.token'); | |||
const deploymentVersion = apiData.version === 2 ? 'v6' : 'v3'; |
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.
Very smart!
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.
That's what my momma says
Kind of amazing that adding Zeit 2 actually removed more code then it added 😂 |
@@ -101,13 +46,12 @@ export async function createApiData({ props, state }) { | |||
|
|||
const nowDefaults = { | |||
name: `csb-${sandbox.id}`, | |||
type: 'NPM', |
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.
This was removed because it's actually the default now 1 uses and it was ruining version 2
|
||
try { | ||
const deployment = await http.request({ | ||
url: 'https://api.zeit.co/v3/now/deployments', | ||
url: `https://api.zeit.co/${deploymentVersion}/now/deployments?forceNew=1`, |
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.
In now 2 force new is passed like this and version 1 ignores it so yay
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.
In the future, the type
(LAMBDAS
) property might be gone. But in that case, we'll ship a new API version anyway, of course.
+1 |
What kind of change does this PR introduce?
Adds support for zeit now version 2
What is the current behavior?
Currently we have a counter and it had like 500 people so I guess it's time
What is the new behavior?
If the now.json has
version:2
specified the new now platform will be usedHere is an example:
https://codesandbox-v2-test.now.sh/graphql
Also all the other endpoints remained the same so it was easier then I thought o.o
cc @timothyis @rauchg