Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [22.x, 24.x]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ COPY --from=protos /tmp/bazel-bin-copy/google/ads/googleads/${GOOGLE_ADS_VERSION
RUN tar -xvzf googleads-nodejs.tar.gz -C .

RUN cd googleads-nodejs && \
npm pkg delete devDependencies.@types/mocha devDependencies.@types/sinon devDependencies.c8 devDependencies.gts devDependencies.jsdoc devDependencies.jsdoc-fresh devDependencies.jsdoc-region-tag devDependencies.mocha devDependencies.pack-n-play devDependencies.sinon && \
node -e 'const fs=require("fs");const p="tsconfig.json";const t=JSON.parse(fs.readFileSync(p,"utf8"));delete t.extends;t.compilerOptions={allowUnreachableCode:false,allowUnusedLabels:false,composite:true,forceConsistentCasingInFileNames:true,module:"commonjs",noEmitOnError:true,noFallthroughCasesInSwitch:true,noImplicitReturns:true,pretty:true,sourceMap:true,stripInternal:true,strict:true,target:"ES2022",...t.compilerOptions};t.exclude=["node_modules"];fs.writeFileSync(p,JSON.stringify(t,null,2)+"\n")' && \
npm uninstall google-gax && \
npm install google-gax && \
rm -rf test/ system-test/
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Google Ads API version
# This only needs changing for major versions e.g. v8 -> v9
GOOGLE_ADS_VERSION=v24
GOOGLE_ADS_VERSION=v25

BUNDLE=googleads-nodejs.tar.gz
PACKAGE_BUILD=/package/googleads-nodejs
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<p align="center">
<a href="https://developers.google.com/google-ads/api/docs/release-notes">
<img src="https://img.shields.io/badge/google%20ads-v24.1-009688.svg?style=flat-square">
<img src="https://img.shields.io/badge/google%20ads-v25.1-009688.svg?style=flat-square">
</a>
<a href="https://www.npmjs.com/package/google-ads-node">
<img src="https://img.shields.io/npm/v/google-ads-node.svg?style=flat-square">
Expand Down Expand Up @@ -38,18 +38,29 @@ This library (google-ads-node) is the compiled output of the experimental [Googl
npm install google-ads-node
```

Requires Node.js 22 or newer.

## Upgrading API Versions

1. Update to the latest `gapic-tools` version in `/package/googleads-nodejs/package.json`.
1. Update to the latest `gapic-tools` version in `/package/googleads-nodejs/package.json` (re-apply after `make protos`, which regenerates this file).
1. Update to the latest `google-gax` version in `/package/googleads-nodejs/package.json` & `/package.json`.
1. Update `GOOGLE_ADS_VERSION` in the Makefile to the latest version (if required).
1. Run `make protos` to pull in the new protos and compile them. This command will take around 10 minutes. There are often errors here that need to be fixed due to changes in bazel, the docker image, or the protos themselves. Fix these errors as they come up.
1. Check for request parameters that the Dockerfile's `sed` rules do not convert to snake_case: `grep -hE 'request\.[a-z]+[A-Z][A-Za-z]*' package/googleads-nodejs/src/v*/*.ts | grep -vE '^\s*\*'` should print nothing (the second grep drops JSDoc lines, which legitimately contain camelCase names). Add a `sed` rule to the Dockerfile for anything it prints.
1. If upgrading to a new major version delete the old version folders from `package/googleads-nodejs/protos/google/ads/googleads/{OLD_VERSION}`, `package/googleads-nodejs/src/{OLD_VERSION}` and `package/googleads-nodejs/samples/generated/{OLD_VERSION}`.
1. Run `yarn` to prepare the package and install the latest dependencies.
1. You may find that the tsc build fails because of camelcase issues. If so, make sure that the `compile-protos` command in `/package/googleads-nodejs/package.json` includes all required arguments, like so: `compileProtos --keep-case --force-number src`
1. Update any references to old version numbers in `tests/protos.js`.
1. Update any references to old version numbers in `tests/protos.js` and `tests/esm.mjs`.
1. Run `yarn test` to make sure everything worked.
1. Double check that any files that should have been updated have been.
1. Update the readme to reflect the new Google Ads API version number
1. Make a pull request, get it approved and merged into `master`.
1. Publish to npm.

## About Opteo

This library is developed and maintained by [Opteo](https://opteo.com), the Advertising Efficiency Manager (AEM) for paid media teams working across Google Ads, Meta Ads, Microsoft Advertising, LinkedIn Ads and TikTok Ads.

Opteo brings together live account data, business context, skills, and specialist marketing tools in one workspace. Connect your marketing accounts, analyse your data with professional-grade tools, build expert marketing agents, and implement changes that increase ROAS.

Learn more about [Opteo](https://opteo.com).
16 changes: 5 additions & 11 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

set -e

# install dependencies + compile proto files in sub package
cd package/googleads-nodejs
npm install

# get current version from Makefile and remove any old version folders
CURRENT_VERSION=$(awk -F'=' '/^GOOGLE_ADS_VERSION=/ {print $2}' ../../Makefile | tr -d '[:space:]')
Expand All @@ -18,19 +16,15 @@ CURRENT_VERSION_NUM=$(echo "$CURRENT_VERSION" | tr -d 'v')
PREVIOUS_VERSION_NUM=$((CURRENT_VERSION_NUM - 1))
PREVIOUS_VERSION="v${PREVIOUS_VERSION_NUM}"

echo "Searching for old version directories to remove ($PREVIOUS_VERSION)..."
DIRECTORIES_TO_DELETE=$(find . -type d -name "${PREVIOUS_VERSION}")
echo "Removing $PREVIOUS_VERSION directories..."
rm -rf "src/$PREVIOUS_VERSION" "protos/google/ads/googleads/$PREVIOUS_VERSION" "samples/generated/$PREVIOUS_VERSION" "build/src/$PREVIOUS_VERSION" "build/protos/google/ads/googleads/$PREVIOUS_VERSION"

if [ -z "$DIRECTORIES_TO_DELETE" ]; then
echo "No old version directories found."
else
echo "Found and deleting the following directories:"
echo "$DIRECTORIES_TO_DELETE"
echo "$DIRECTORIES_TO_DELETE" | xargs rm -rf
fi
# install dependencies + compile proto files in sub package
npm install

# remove large auto-generated tests we don't need
rm -rf build/test build/system-test

# copy the build up to the main package directory
rm -rf ../../build
cp -r build ../../
Loading
Loading