Skip to content

Commit 864afb7

Browse files
authored
Swapped to NPM and ran npm audit fix to fix some dev dependencies which failed the audit. (#340)
* Swapped to NPM * Validated all the scripts run using npm * Updated workflows to use npm
1 parent 070bcdc commit 864afb7

13 files changed

+16676
-5659
lines changed

.changeset/dry-pugs-bow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@google/generative-ai": patch
3+
---
4+
5+
Swapped the package manager to npm, in order to take advantage of npm audit fix

.github/workflows/check-docs.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: Doc Change Check (Run "yarn docs" if this fails)
15+
name: Doc Change Check (Run "npm run docs" if this fails)
1616

1717
on: pull_request
1818

@@ -31,12 +31,12 @@ jobs:
3131
uses: actions/setup-node@v3
3232
with:
3333
node-version: 18
34-
- name: Yarn install
35-
run: yarn
34+
- name: npm install
35+
run: npm install
3636
- name: Run doc generation
37-
run: yarn docs
37+
run: npm run docs
3838
- name: Check for changes in docs-devsite dir (fail if so)
3939
run: git diff --exit-code docs/reference
4040
- name: Reference documentation needs to be updated. See message below.
4141
if: ${{ failure() }}
42-
run: echo "Changes in this PR affect the reference docs. Run \`yarn docs\` locally to regenerate docs and add them to this PR."
42+
run: echo "Changes in this PR affect the reference docs. Run \`npm run docs\` locally to regenerate docs and add them to this PR."

.github/workflows/create-release-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
node-version: 18
3737

3838
- name: Install Dependencies
39-
run: yarn
39+
run: npm install
4040

4141
- name: Create Release Pull Request
4242
uses: changesets/action@v1

.github/workflows/publish.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
node-version: 18
3939

4040
- name: Install Dependencies & build
41-
run: yarn && yarn build
41+
run: npm install && npm run build
4242

4343
- name: Create .npmrc
4444
run: |
@@ -55,7 +55,7 @@ jobs:
5555
git config --global user.email "github-actions[bot]@users.noreply.github.com"
5656
5757
- name: NPM publish
58-
run: yarn changeset publish
58+
run: npx @changesets/cli publish
5959

6060
- name: Git tags
6161
# list tags then try to push them

.github/workflows/test.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ jobs:
3232
with:
3333
node-version: ${{ matrix.node-version }}
3434

35-
- name: yarn install
36-
run: yarn
35+
- name: npm install
36+
run: npm install
3737

3838
- name: run formatting and license check
39-
run: yarn format:check
39+
run: npm run format:check
4040

4141
- name: run unit tests (includes lint)
42-
run: yarn test
42+
run: npm run test
4343

4444
node-integration-test:
4545
if: github.secret_source == 'Actions'
@@ -53,15 +53,15 @@ jobs:
5353
uses: actions/setup-node@v3
5454
with:
5555
node-version: ${{ matrix.node-version }}
56-
cache: 'yarn'
56+
cache: 'npm'
5757

58-
- name: yarn install
59-
run: yarn
58+
- name: npm install
59+
run: npm install
6060

6161
- name: run node iTests
6262
env:
6363
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
64-
run: yarn test:node:integration
64+
run: npm run test:node:integration
6565

6666
web-integration-test:
6767
if: github.secret_source == 'Actions'
@@ -75,15 +75,15 @@ jobs:
7575
uses: actions/setup-node@v3
7676
with:
7777
node-version: ${{ matrix.node-version }}
78-
cache: 'yarn'
78+
cache: 'npm'
7979

80-
- name: yarn install
81-
run: yarn
80+
- name: npm install
81+
run: npm install
8282

8383
- name: run web iTests
8484
env:
8585
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
86-
run: yarn test:web:integration
86+
run: npm run test:web:integration
8787

8888
interface-alignment-test:
8989
name: Interface Alignment Test
@@ -94,7 +94,7 @@ jobs:
9494
uses: actions/setup-node@v3
9595
with:
9696
node-version: 20
97-
cache: 'yarn'
97+
cache: 'npm'
9898

9999
- name: Get VertexAI repo
100100
# Need to npm install inner repo first or there will be errors
@@ -103,7 +103,7 @@ jobs:
103103
cd nodejs-vertexai
104104
npm install
105105
cd ..
106-
yarn
106+
npm install
107107
108108
- name: Run tests
109109
env:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ temp/
55
.DS_Store
66
testfiles
77
nodejs-vertexai/
8-
samples/yarn.lock
8+
samples/package-lock.json

docs/contributing.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ Steps to build locally:
3131

3232
1. clone this repo
3333
1. `cd generative-ai-js`
34-
1. Run `yarn` to install dependencies.
34+
1. Run `npm install` to install dependencies.
3535
1. Make changes as needed to source code.
36-
1. Run `yarn build` to build.
37-
1. Run `yarn test` to run unit tests.
38-
1. Run `yarn docs` to generate any changes to reference docs (destination dir is docs/reference).
39-
1. Run `yarn format` to fix formatting and add license headers as needed.
40-
1. Run `yarn changeset` to generate the changeset summary.
36+
1. Run `npm run build` to build.
37+
1. Run `npm run test` to run unit tests.
38+
1. Run `npm run docs` to generate any changes to reference docs (destination dir is docs/reference).
39+
1. Run `npm run format` to fix formatting and add license headers as needed.
40+
1. Run `npx @changeset/cli` to generate the changeset summary.
4141

4242
### Code Reviews
4343

0 commit comments

Comments
 (0)