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

Add zeit 2 support #1417

Merged
merged 1 commit into from Jan 15, 2019
Merged

Add zeit 2 support #1417

merged 1 commit into from Jan 15, 2019

Conversation

SaraVieira
Copy link
Contributor

@SaraVieira SaraVieira commented Jan 1, 2019

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 used

Here 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

'now-start': `cd ${this.distDir} && serve -s ./`,
...parsedFile.scripts,
Copy link
Contributor Author

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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very smart!

Copy link
Contributor Author

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

@SaraVieira
Copy link
Contributor Author

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',
Copy link
Contributor Author

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`,
Copy link
Contributor Author

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

Copy link

@leo leo left a 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.

@darielnoel
Copy link

+1

@CompuIves CompuIves merged commit d86e42d into master Jan 15, 2019
@SaraVieira SaraVieira deleted the zeit2 branch January 16, 2019 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants