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
Publish packages for each individual API. #806
Comments
@lukesneeringer #1167 is already merged so it can be marked as done I believe. |
👋 We are at the stage where each individual API can have We're really blocked on #525. There are a variety of ways to approach it, but it hasn't been pressing just yet. |
Just to add to the list: since each API can now be used in a browser, we need to be able to publish each individual API as a webpack bundle, versioned (e.g. drive-v1.2.3.min.js). This is a separate (but related) problem to autoreleases. |
Is webpack the better choice here? I think other bundlers such as rollup should be considered, so you don't have to ship the full API to the browser but just what the user uses. |
👋 some hot takes from this conversation so far:
|
@nicoabie @bcoe re: webpack, there is no need to bundle all APIs since we now support webpacking just one API: you need to run webpack from inside the API folder. E.g. see the README from Drive API: https://github.com/googleapis/google-api-nodejs-client/tree/master/src/apis/drive#building-a-browser-bundle (the same applies to all other APIs). (I'm not arguing on webpack vs rollup vs whatever here, it's just webpack that I used and know it works, other bundlers will probably work as well) |
@alexander-fenster fair point, I think this issue is almost resolved then. |
any updates on this? |
Any updates would be appreciated. The current version of the npm package is costly, 42.6MB, 846 files, and 165 folders. |
In case it's useful to others finding this thread… my use of Before, using import {google, sheets_v4} from 'googleapis';
const creds = JSON.parse(await fs.readFile(credentialsFile, 'utf8'));
const client = new google.auth.JWT({
email: creds.client_email,
key: creds.private_key,
scopes: ['https://www.googleapis.com/auth/spreadsheets.readonly'],
});
await client.authorize();
const sheets = google.sheets({version: 'v4', auth: client});
const result = await sheets.spreadsheets.values.get({
spreadsheetId: sheetId,
range: 'A:ZZ',
}); After, using the underlying libraries: import {JWT} from 'google-auth-library';
import {AuthPlus, createAPIRequest} from 'googleapis-common';
interface GetParams {
spreadsheetId: string;
range: string;
}
export interface ValueRange {
majorDimension?: string | null;
range?: string | null;
values?: any[][] | null;
}
// This is adapted from google-api-nodejs-client:
// https://github.com/googleapis/google-api-nodejs-client/blob/master/src/apis/sheets/v4.ts#L6483
// See https://github.com/googleapis/google-api-nodejs-client/issues/806
function getValues(auth: JWT, params: GetParams) {
return createAPIRequest<ValueRange>({
options: {
url: 'https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}',
method: 'GET',
},
params,
requiredParams: ['spreadsheetId', 'range'],
pathParams: ['range', 'spreadsheetId'],
context: {
_options: {
auth,
},
},
});
}
const creds = JSON.parse(await fs.readFile(credentialsFile, 'utf8'));
const auth = new AuthPlus();
const client = new auth.JWT({
email: creds.client_email,
key: creds.private_key,
scopes: ['https://www.googleapis.com/auth/spreadsheets.readonly'],
});
await client.authorize();
const result = await getValues(client, {
spreadsheetId: sheetId,
range: 'A:ZZ',
}); I ran across this issue in the context of TypeScript getting slow. Removing |
Hello, is there any update on this? Having trouble treeshaking googleapis. My particular use case is for Google Cloud Functions (Firebase functions). The cold start of functions using googleapis is extremely slow since the function needs to load the whole package at cold start, and I'm only using calendar and auth from all the apis. |
@nermaljcat just a heads up, I edited your comment to remove a bit of sass. I'll refer you to our code of conduct, in case there are any questions. |
ok @JustinBeckwith - I've deleted my comments. I reject censorship and prefer not to participate in a censored forum. |
It was delightful to read that your work on the automated release process hit its next step. I recall that was blocking this issue here. Thank you for the great work! #525 (comment) |
Just to keep y'all in the loop - one of the big remaining concerns over the split was creating confusion between the packages for cloud focused APIs in google-cloud-node. In many cases here, there will be two very similar packages. For example, as laid out today we'd have a As a first step, we landed #2242 which adds a specific callout on the individual READMEs. The next adventure is googleapis/release-please#471 |
@JustinBeckwith wouldn't the cloud focused package be able to depends on the |
Sorta not really :/ With a few exceptions, the majority of cloud packages in the We're starting to come around to the idea of |
Something to consider might be to start splitting API that are not cloud first? |
👋 an update on this long standing issue. There's work that's been happening this quarter that will facilitate publishing submodules, using the same release automation we use elsewhere -- this project has been bigger than expected, due to some of the constraints:
In terms of time lines, I'm hopeful we'll be able to start testing individual package publishes within ~2 weeks. |
This is going to be done in several steps:
googleapis-common
npm module that just contains shared bits that will be used by all packagesnpm publish
process so that each individual package is published along with the larger meta-packageThese steps are of course subject to change as we discover things through the process :)
--- UPDATE ---
We're down to the last step of actually publishing the individual modules. @alexander-fenster, @jkwlui, and @JustinBeckwith last got together to chat about this, and came to a few conclusions:
State of the world today
npm run generate
, and then submitting a PR with like 1344247584 changes.src/apis
directory, and re-creating every API from scratch every time. This makes it easy to detect new APIs, and easy to detect removed APIs.Where we need to be
synthtool
for this.releasetool
andsemantic-release
could be used to cut individual releases. A scoped tag would be used for each package release from the mono-repo.There's still a lot to figure out, but I suspect @bcoe is gonna love this problem.
The text was updated successfully, but these errors were encountered: