GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add dependency unification script by ace-n · Pull Request #293 · GoogleCloudPlatform/nodejs-docs-samples

Conversation

@ace-n

@ace-n ace-n commented Jan 9, 2017

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ace-n
ace-n requested a review from jmdobry January 9, 2017 22:54
jmdobry
jmdobry requested changes Jan 9, 2017
View reviewed changes
Comment thread scripts/unify Outdated
// See the License for the specific language governing permissions and
// limitations under the License.

const async = require(`async`);

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Remove

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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 combination with #293 (comment)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated
const fs = require(`fs`);
const path = require(`path`);

const PROJECT_ROOT = path.dirname(__dirname);

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Should be:

const PROJECT_ROOT = path.join(__dirname, '..');

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated
// Dedupe package.json dependencies
// WARNING: This will fail if two different versions of the same package are required.
let pkgSet = {};
let devPkgSet = {};

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

You should have to look at dev dependencies at all. They've all moved to the root package already.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated

// Get subdirectories with a `package.json` file
const directories = fs.readdirSync(PROJECT_ROOT)
.filter(dir => fs.existsSync(`${PROJECT_ROOT}/${dir}/package.json`));

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Style nit: Change dir => to (dir) =>

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Also, use path.join(PROJECT_ROOT, dir, 'package.json') instead of a template string.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated
let pkgSet = {};
let devPkgSet = {};
let pkgJson;
for (const dir of directories) {

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Prefer Array#forEach for arrays.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated
pkgJson = JSON.parse(fs.readFileSync(`${PROJECT_ROOT}/${dir}/package.json`));

const deps = pkgJson[`dependencies`];
const devDeps = pkgJson[`devDependencies`];

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Don't use bracket syntax, use pkgJson.dependencies

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated

for (p in deps) {
pkgSet[p] = deps[p];
}

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Instead of these 3 lines just do:

Object.assign(pkgSet, deps);

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated

// Update root-level package.json (by shelling to npm)
const spawn = require('child_process').spawn;
process.chdir(PROJECT_ROOT);

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Remove line.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ace-n ace-n Jan 10, 2017

Copy link
Copy Markdown
Contributor Author

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.

Done.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated
const spawn = require('child_process').spawn;
process.chdir(PROJECT_ROOT);
Object.keys(pkgSet).forEach(pkg => spawn(`yarn`, [`add`, `${pkg}@${pkgSet[pkg]}`]));
Object.keys(devPkgSet).forEach(pkg => spawn(`yarn`, [`add`, `${pkg}@${devPkgSet[pkg]}`, `-D`])); No newline at end of file

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Remove line.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated
// Update root-level package.json (by shelling to npm)
const spawn = require('child_process').spawn;
process.chdir(PROJECT_ROOT);
Object.keys(pkgSet).forEach(pkg => spawn(`yarn`, [`add`, `${pkg}@${pkgSet[pkg]}`]));

@jmdobry jmdobry Jan 9, 2017

Copy link
Copy Markdown
Member

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.

Instead of spawning 30+ processes, just spawn one:

spawn(`yarn`, [`add`].concat(Object.keys(pkgSet).map((pkg) => `${pkg}@${pkgSet[pkg]}`).join(' ')));

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jmdobry jmdobry assigned ace-n Jan 9, 2017
@ace-n
ace-n force-pushed the add-unify branch 2 times, most recently from 7b02ead to 2bca91f Compare January 10, 2017 20:33
@codecov-io

codecov-io commented Jan 10, 2017

Copy link
Copy Markdown

Current coverage is 91.78% (diff: 100%)

Merging #293 into master will decrease coverage by 0.28%

@@             master       #293   diff @@
==========================================
  Files            71         70     -1   
  Lines          2838       2702   -136   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           2613       2480   -133   
+ Misses          225        222     -3   
  Partials          0          0          

Powered by Codecov. Last update f0f1e17...2bca91f

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jmdobry
jmdobry requested changes Jan 10, 2017
View reviewed changes
Comment thread scripts/unify Outdated

// Dedupe package.json dependencies
// WARNING: This will fail if two different versions of the same package are required.
let pkgSet = {};

@jmdobry jmdobry Jan 10, 2017

Copy link
Copy Markdown
Member

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 let can be a const

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated
directories.forEach((dir) => {
pkgJson = JSON.parse(fs.readFileSync(path.join(PROJECT_ROOT, dir, `package.json`)));
Object.assign(pkgSet, pkgJson.dependencies);
})

@jmdobry jmdobry Jan 10, 2017

Copy link
Copy Markdown
Member

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.

Missing semicolon. I don't think the lint script is seeing this file. We'll need to update the lint script to look at scripts/*

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jmdobry
jmdobry requested changes Jan 11, 2017
View reviewed changes
Comment thread scripts/unify Outdated

// Dedupe package.json dependencies
// WARNING: This will fail if two different versions of the same package are required.
let pkgSet = {};

@jmdobry jmdobry Jan 11, 2017

Copy link
Copy Markdown
Member

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 let can be a const

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify Outdated
directories.forEach((dir) => {
pkgJson = JSON.parse(fs.readFileSync(path.join(PROJECT_ROOT, dir, `package.json`)));
Object.assign(pkgSet, pkgJson.dependencies);
})

@jmdobry jmdobry Jan 11, 2017

Copy link
Copy Markdown
Member

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.

Missing semicolon; Looks like the linter isn't checking this file.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/unify

// Update root-level package.json (by shelling to npm)
const spawn = require('child_process').spawn;
spawn(`yarn`, [`add`].concat(Object.keys(pkgSet).map(pkg => `${pkg}@${pkgSet[pkg]}`)));

@jmdobry jmdobry Jan 11, 2017

Copy link
Copy Markdown
Member

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.

Missing newline at end of file

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ace-n

ace-n commented Jan 11, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Messed up a rebase; don't merge this until it's fixed.

Rebase has been fixed - feel free to review + merge.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Ace Nassri added 4 commits January 11, 2017 14:23
Ace Nassri
Add dependency unification script
a715cc0
Ace Nassri
Address comments
3acb0fd
Ace Nassri
Add use strict to unify script
b2ab69c
Ace Nassri
Address comments + fix lint
81e6bc4
@ace-n
ace-n force-pushed the add-unify branch from fb6bd5b to 81e6bc4 Compare January 11, 2017 22:23
@googlebot

googlebot commented Jan 11, 2017

Copy link
Copy Markdown

CLAs look good, thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jmdobry
jmdobry approved these changes Jan 11, 2017
View reviewed changes
@ace-n

ace-n commented Jan 11, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@jmdobry it looks like the CircleCI failures are unrelated to this, so I'm merging this now. (If they are in fact related, let me know and I'll try to fix things.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ace-n
ace-n merged commit 4e82315 into master Jan 11, 2017
@ace-n
ace-n deleted the add-unify branch January 11, 2017 23:47
ivanmkc pushed a commit that referenced this pull request Nov 3, 2022
@release-please
chore: release 2.2.4 (#293)
e7e14cb
🤖 I have created a release \*beep\* \*boop\*
---
### [2.2.4](https://www.github.com/googleapis/nodejs-datalabeling/compare/v2.2.3...v2.2.4) (2021-06-30)


### Bug Fixes

* **deps:** google-gax v2.17.0 with mTLS ([#291](https://www.github.com/googleapis/nodejs-datalabeling/issues/291)) ([ba455a8](https://www.github.com/googleapis/nodejs-datalabeling/commit/ba455a8d574f9bb87c9f7531ba56e199ad0dc8be))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@ivanmkc ivanmkc mentioned this pull request Nov 3, 2022
Migrate code from googleapis/nodejs-datalabeling #2797
Merged
grayside pushed a commit that referenced this pull request Nov 8, 2022
@release-please @grayside
chore: release 2.2.4 (#293)
f60c998
🤖 I have created a release \*beep\* \*boop\*
---
### [2.2.4](https://www.github.com/googleapis/nodejs-datalabeling/compare/v2.2.3...v2.2.4) (2021-06-30)


### Bug Fixes

* **deps:** google-gax v2.17.0 with mTLS ([#291](https://www.github.com/googleapis/nodejs-datalabeling/issues/291)) ([ba455a8](https://www.github.com/googleapis/nodejs-datalabeling/commit/ba455a8d574f9bb87c9f7531ba56e199ad0dc8be))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
NimJay pushed a commit that referenced this pull request Nov 9, 2022
@release-please
chore: release 3.1.1 (#294)
4c26e30
🤖 I have created a release \*beep\* \*boop\*
---
### [3.1.1](https://www.github.com/googleapis/nodejs-containeranalysis/compare/v3.1.0...v3.1.1) (2021-04-27)


### Bug Fixes

* specify valid go_package option ([#293](https://www.github.com/googleapis/nodejs-containeranalysis/issues/293)) ([84ba201](https://www.github.com/googleapis/nodejs-containeranalysis/commit/84ba201c2d2eb81faf36461cf1ff3bfccf33f5ed))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
NimJay pushed a commit that referenced this pull request Nov 11, 2022
Benjamin E. Coe
chore: update UUID to latest (#293)
5dbf7ff
There are some slight breaking changes in the newest UUID.
@NimJay NimJay mentioned this pull request Nov 11, 2022
migrate code from googleapis/nodejs-kms #2839
Merged
ace-n pushed a commit that referenced this pull request Nov 11, 2022
Benjamin E. Coe Ace Nassri
chore: update UUID to latest (#293)
089edee
There are some slight breaking changes in the newest UUID.
ace-n pushed a commit that referenced this pull request Nov 11, 2022
@nnegrey Benjamin E. Coe
docs: add base samples for automl ga (#293)
f249659
* docs: add base samples for automl ga

* update package.json

* lint fix

* License header update

* Fix cleanup on GCS prefix

* Lint

Co-authored-by: Benjamin E. Coe <[email protected]>
@ace-n ace-n mentioned this pull request Nov 11, 2022
migrate code from googleapis/nodejs-automl #2841
Merged
ace-n pushed a commit that referenced this pull request Nov 11, 2022
@nnegrey Benjamin E. Coe
docs: add base samples for automl ga (#293)
f1dde39
* docs: add base samples for automl ga

* update package.json

* lint fix

* License header update

* Fix cleanup on GCS prefix

* Lint

Co-authored-by: Benjamin E. Coe <[email protected]>
ace-n pushed a commit that referenced this pull request Nov 14, 2022
@nnegrey Benjamin E. Coe Ace Nassri
docs: add base samples for automl ga (#293)
c9adeb9
* docs: add base samples for automl ga

* update package.json

* lint fix

* License header update

* Fix cleanup on GCS prefix

* Lint

Co-authored-by: Benjamin E. Coe <[email protected]>
ace-n pushed a commit that referenced this pull request Nov 15, 2022
@nnegrey Benjamin E. Coe Ace Nassri
docs: add base samples for automl ga (#293)
b6c621e
* docs: add base samples for automl ga

* update package.json

* lint fix

* License header update

* Fix cleanup on GCS prefix

* Lint

Co-authored-by: Benjamin E. Coe <[email protected]>
ace-n pushed a commit that referenced this pull request Nov 15, 2022
@nnegrey Benjamin E. Coe Ace Nassri
docs: add base samples for automl ga (#293)
2a0e948
* docs: add base samples for automl ga

* update package.json

* lint fix

* License header update

* Fix cleanup on GCS prefix

* Lint

Co-authored-by: Benjamin E. Coe <[email protected]>
ace-n pushed a commit that referenced this pull request Nov 16, 2022
@yoshi-automation @alexander-fenster
feat: .d.ts for protos (#293)
aeee285
* [CHANGE ME] Re-generated  to pick up changes in the API or client library generator.

* add protos to eslintignore

* chore: hunted down missing videos

* chore: fix video path

* test: other resources are missing, let's use the cat for now

* chore: updating URLs
@ace-n ace-n mentioned this pull request Nov 16, 2022
migrate code from googleapis/nodejs-video-intelligence #2855
Merged
ace-n pushed a commit that referenced this pull request Nov 17, 2022
@yoshi-automation Ace Nassri
feat: .d.ts for protos (#293)
de14876
* [CHANGE ME] Re-generated  to pick up changes in the API or client library generator.

* add protos to eslintignore

* chore: hunted down missing videos

* chore: fix video path

* test: other resources are missing, let's use the cat for now

* chore: updating URLs
ace-n pushed a commit that referenced this pull request Nov 17, 2022
@nnegrey Benjamin E. Coe Ace Nassri
docs: add base samples for automl ga (#293)
63eae70
* docs: add base samples for automl ga

* update package.json

* lint fix

* License header update

* Fix cleanup on GCS prefix

* Lint

Co-authored-by: Benjamin E. Coe <[email protected]>
ace-n pushed a commit that referenced this pull request Nov 17, 2022
@nnegrey Benjamin E. Coe Ace Nassri
docs: add base samples for automl ga (#293)
32090e5
* docs: add base samples for automl ga

* update package.json

* lint fix

* License header update

* Fix cleanup on GCS prefix

* Lint

Co-authored-by: Benjamin E. Coe <[email protected]>
ahrarmonsur pushed a commit that referenced this pull request Nov 17, 2022
@yoshi-automation Ahrar Monsur
feat: .d.ts for protos (#293)
ec2e05b
* [CHANGE ME] Re-generated  to pick up changes in the API or client library generator.

* add protos to eslintignore

* chore: hunted down missing videos

* chore: fix video path

* test: other resources are missing, let's use the cat for now

* chore: updating URLs
ahrarmonsur pushed a commit that referenced this pull request Nov 17, 2022
@nnegrey Benjamin E. Coe Ahrar Monsur
docs: add base samples for automl ga (#293)
4c77880
* docs: add base samples for automl ga

* update package.json

* lint fix

* License header update

* Fix cleanup on GCS prefix

* Lint

Co-authored-by: Benjamin E. Coe <[email protected]>
Shabirmean pushed a commit that referenced this pull request Feb 16, 2023
Benjamin E. Coe @JustinBeckwith
feat: auto-generate READMEs, add .repo-metdata.json (#293)
ffa3135
@Shabirmean Shabirmean mentioned this pull request Feb 16, 2023
samples: migrate code from googleapis/nodejs-dlp #3035
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jmdobry jmdobry jmdobry approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ace-n ace-n

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ace-n @codecov-io @googlebot @jmdobry
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.