Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: firebase/firebase-functions
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.3.0
Choose a base ref
...
head repository: firebase/firebase-functions
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.4.0
Choose a head ref
  • 13 commits
  • 28 files changed
  • 10 contributors

Commits on Oct 10, 2019

  1. Copy the full SHA
    3018b60 View commit details

Commits on Oct 24, 2019

  1. Linking to external types - docgen (#549)

    * First version of addTypeAliasLinks that will scan TypeDoc HTML output and insert links to external library documentation.
    
    * Updated link for UserRecord and UserInfo
    
    * Resolving a few of Hiranya's comments. Removing unecessary debugging console log, JSDOM is now imported with one line, and Map of types and links is now created from a JSON file,  Still need to resolve a couple of Hiranya's comments.
    
    * Ran npm run format:fix
    
    * Resolving more of Hiranya's comments. Loading JSON file uses 'require' rather than 'read file'. JSON file is now simpler. Script only replaces fully qualified names rather than aliases in document.
    
    * Adding comment as requested by thechenky.
    
    * Updating package.json to include JSDom module required by doc generation script.
    esmacik authored and egilmorez committed Oct 24, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c5d3a7b View commit details

Commits on Oct 31, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fd04eec View commit details

Commits on Nov 8, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    dd6cde1 View commit details

Commits on Nov 19, 2019

  1. Porting in minimal content for functions.config() reference (#582)

    * I persist in trying to fix links.
    
    * Adding comments for functions.config() along with a change that somehow evaded my last update to storage.ts.
    
    * Adding new entry for new config.Config.html file.
    
    * Removing circular link per review.
    egilmorez authored Nov 19, 2019
    Copy the full SHA
    edcb35d View commit details

Commits on Nov 27, 2019

  1. Allow specifying failure policies (#482)

    * Define an interface for FailurePolicy
    
    * Extract functions config to avoid dependency cycles, assign failure policy to triggers
    
    * Add a changelog entry
    
    * Update dependencies, minor version bump
    
    * Reformat
    
    * Fix a typo: allows -> allow
    
    * Avoid abbreviations to improve readability
    
    * Rename remaining Opts to Options
    
    * Add tests for specifying failure policy
    
    * Reformat
    
    * Change format of an entry in the changelog
    
    * Revert version bump
    
    * Extract configuration to break dependency cycle
    
    * Add comments to Schedule and ScheduleRetryConfig
    
    * Stricten regions definition
    
    * Fix tests broken due to strict typings
    
    * More strict types for regions - reverse order
    
    * Reformat
    
    * Remove unused import
    
    * Conform with npm formatting
    
    * Reintroduce unused variable to minimize diff size
    
    * Import lodash using _ exclusively
    
    * Kepp @hidden tags in one line if no other JSDoc is present
    
    * Fix a typo - sentence ending with a comma
    
    * Wrap JSDoc as specified in Google JavaScript Style Guide
    
    * Move memory lookup table to functions-configuration and stricten type definition
    
    * Move default failure policy to functions-configuration
    
    * Separate standarization of options from construction of the options object
    
    * Rephrase failure policy description
    
    * Rephrase description of memory and timeoutSeconds options
    
    * Simplify tests for invalid failure policies
    
    * Align public description of failure policies with a documentation of its interface
    
    * Add a missing dot in the Changelog
    
    * Minor stylistic changes to the documentation
    
    * Make a test case more understandable
    
    * Reformat
    merlinnot authored and kevinajian committed Nov 27, 2019
    Copy the full SHA
    8039e02 View commit details

Commits on Jan 13, 2020

  1. adding scheduled function to handler builder (#230)

    * adding scheduled function to handler builder
    tinaliang authored Jan 13, 2020
    Copy the full SHA
    9df27f4 View commit details

Commits on Feb 5, 2020

  1. Copy the full SHA
    ae90279 View commit details
  2. Revert "Allow specifying failure policies" (#623)

    * Revert "Allow specifying failure policies (#482)
    tinaliang authored Feb 5, 2020
    Copy the full SHA
    d9fc8a6 View commit details

Commits on Feb 6, 2020

  1. Copy the full SHA
    ff852c5 View commit details

Commits on Mar 19, 2020

  1. Copy the full SHA
    2940a4b View commit details
  2. New Publish Path (#231)

    bkendall authored Mar 19, 2020
    Copy the full SHA
    6873662 View commit details
  3. 3.4.0

    google-oss-bot committed Mar 19, 2020
    Copy the full SHA
    f41bdaa View commit details
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**IMPORTANT: Please update to this version of `firebase-functions` if you are using Node.js 10 functions, otherwise your functions will break in production.**

- Prevents deployment and runtime issues caused by upcoming changes to Cloud Functions infrastructure for Node.js 10 functions. (Issue #630)
- Adds support for writing scheduled functions under handler namespace.
1 change: 0 additions & 1 deletion changelog.txt

This file was deleted.

2 changes: 2 additions & 0 deletions docgen/content-sources/toc.yaml
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ toc:
section:
- title: 'Config'
path: /docs/reference/functions/config_.config.html
- title: 'config.Config'
path: /docs/reference/functions/config_.config.config.html

- title: 'functions.analytics'
path: /docs/reference/functions/providers_analytics_.html
34 changes: 34 additions & 0 deletions docgen/generate-docs.js
Original file line number Diff line number Diff line change
@@ -39,6 +39,10 @@ const contentPath = path.resolve(`${__dirname}/content-sources`);
const tempHomePath = path.resolve(`${contentPath}/HOME_TEMP.md`);
const devsitePath = `/docs/reference/functions/`;

const { JSDOM } = require("jsdom");

const typeMap = require('./type-aliases.json');

/**
* Strips path prefix and returns only filename.
* @param {string} path
@@ -103,6 +107,7 @@ function renameFiles() {
*/
function fixLinks(file) {
return fs.readFile(file, 'utf8').then(data => {
data = addTypeAliasLinks(data);
const flattenedLinks = data
.replace(/\.\.\//g, '')
.replace(/(modules|interfaces|classes)\//g, '')
@@ -116,6 +121,35 @@ function fixLinks(file) {
});
}

/**
* Adds links to external documentation for type aliases that
* reference an external library.
*
* @param data File data to add external library links to.
*/
function addTypeAliasLinks(data) {
const htmlDom = new JSDOM(data);
/**
* Select .tsd-signature-type because all potential external
* links will have this identifier.
*/
const fileTags = htmlDom.window.document.querySelectorAll(".tsd-signature-type");
fileTags.forEach(tag => {
const mapping = typeMap[tag.textContent];
if (mapping) {
console.log('Adding link to '+tag.textContent+" documentation.");

// Add the corresponding document link to this type
const linkChild = htmlDom.window.document.createElement('a');
linkChild.setAttribute('href', mapping);
linkChild.textContent = tag.textContent;
tag.textContent = null;
tag.appendChild(linkChild);
}
});
return htmlDom.serialize();
}

let tocText = '';

/**
5 changes: 5 additions & 0 deletions docgen/type-aliases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"firebase.firestore.DocumentSnapshot": "https://googleapis.dev/nodejs/firestore/latest/DocumentSnapshot.html",
"firebase.auth.UserRecord": "https://firebase.google.com/docs/reference/admin/node/admin.auth.UserRecord.html",
"firebase.auth.UserInfo": "https://firebase.google.com/docs/reference/admin/node/admin.auth.UserInfo.html"
}
2 changes: 1 addition & 1 deletion integration_test/package.node10.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
},
"main": "lib/index.js",
"devDependencies": {
"typescript": "~3.5.0"
"typescript": "~3.6.0"
},
"engines": {
"node": "10"
2 changes: 1 addition & 1 deletion integration_test/package.node8.json
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
},
"main": "lib/index.js",
"devDependencies": {
"typescript": "~3.5.0"
"typescript": "~3.6.0"
},
"engines": {
"node": "8"
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firebase-functions",
"version": "3.3.0",
"version": "3.4.0",
"description": "Firebase SDK for Cloud Functions",
"keywords": [
"firebase",
@@ -14,7 +14,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/firebase/firebase-functions.git"
"url": "https://github.com/firebase/firebase-functions.git"
},
"license": "MIT",
"author": "Firebase Team",
@@ -23,10 +23,13 @@
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"publishConfig": {
"registry": "https://wombat-dressing-room.appspot.com"
},
"scripts": {
"apidocs": "node docgen/generate-docs.js",
"build:pack": "rm -rf lib && npm install && tsc -p tsconfig.release.json && npm pack",
"build:release": "npm install --production && npm install typescript firebase-admin && tsc -p tsconfig.release.json",
"build:release": "npm install --production && npm install --no-save typescript firebase-admin && tsc -p tsconfig.release.json",
"build": "tsc -p tsconfig.release.json",
"format": "prettier --check '**/*.{json,md,ts,yml,yaml}'",
"format:fix": "prettier --write '**/*.{json,md,ts,yml,yaml}'",
@@ -58,6 +61,7 @@
"firebase-admin": "^8.2.0",
"istanbul": "^0.4.5",
"js-yaml": "^3.13.1",
"jsdom": "^15.2.0",
"mocha": "^6.1.4",
"mock-require": "^3.0.3",
"mz": "^2.7.0",
12 changes: 12 additions & 0 deletions scripts/publish-container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:8

# Install dependencies
RUN apt-get update && \
apt-get install -y curl git jq

# Install npm at latest.
RUN npm install --global npm@latest

# Install hub
RUN curl -fsSL --output hub.tgz https://github.com/github/hub/releases/download/v2.13.0/hub-linux-amd64-2.13.0.tgz
RUN tar --strip-components=2 -C /usr/bin -xf hub.tgz hub-linux-amd64-2.13.0/bin/hub
4 changes: 4 additions & 0 deletions scripts/publish-container/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/package-builder', '.']
images: ['gcr.io/$PROJECT_ID/package-builder']
135 changes: 135 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash
set -e

printusage() {
echo "publish.sh <version>"
echo "REPOSITORY_ORG and REPOSITORY_NAME should be set in the environment."
echo "e.g. REPOSITORY_ORG=user, REPOSITORY_NAME=repo"
echo ""
echo "Arguments:"
echo " version: 'patch', 'minor', or 'major'."
}

VERSION=$1
if [[ $VERSION == "" ]]; then
printusage
exit 1
elif [[ ! ($VERSION == "patch" || $VERSION == "minor" || $VERSION == "major") ]]; then
printusage
exit 1
fi

if [[ $REPOSITORY_ORG == "" ]]; then
printusage
exit 1
fi
if [[ $REPOSITORY_NAME == "" ]]; then
printusage
exit 1
fi

WDIR=$(pwd)

echo "Checking for commands..."
trap "echo 'Missing hub.'; exit 1" ERR
which hub &> /dev/null
trap - ERR

trap "echo 'Missing node.'; exit 1" ERR
which node &> /dev/null
trap - ERR

trap "echo 'Missing jq.'; exit 1" ERR
which jq &> /dev/null
trap - ERR
echo "Checked for commands."

echo "Checking for Twitter credentials..."
trap "echo 'Missing Twitter credentials.'; exit 1" ERR
test -f "${WDIR}/scripts/twitter.json"
trap - ERR
echo "Checked for Twitter credentials..."

echo "Checking for logged-in npm user..."
trap "echo 'Please login to npm using \`npm login --registry https://wombat-dressing-room.appspot.com\`'; exit 1" ERR
npm whoami --registry https://wombat-dressing-room.appspot.com
trap - ERR
echo "Checked for logged-in npm user."

echo "Moving to temporary directory.."
TEMPDIR=$(mktemp -d)
echo "[DEBUG] ${TEMPDIR}"
cd "${TEMPDIR}"
echo "Moved to temporary directory."

echo "Cloning repository..."
git clone "git@github.com:${REPOSITORY_ORG}/${REPOSITORY_NAME}.git"
cd "${REPOSITORY_NAME}"
echo "Cloned repository."

echo "Making sure there is a changelog..."
if [ ! -s CHANGELOG.md ]; then
echo "CHANGELOG.md is empty. aborting."
exit 1
fi
echo "Made sure there is a changelog."

echo "Running npm install..."
npm install
echo "Ran npm install."

echo "Running tests..."
npm test
echo "Ran tests."

echo "Running publish build..."
npm run build:release
echo "Ran publish build."

echo "Making a $VERSION version..."
npm version $VERSION
NEW_VERSION=$(jq -r ".version" package.json)
echo "Made a $VERSION version."

echo "Making the release notes..."
RELEASE_NOTES_FILE=$(mktemp)
echo "[DEBUG] ${RELEASE_NOTES_FILE}"
echo "v${NEW_VERSION}" >> "${RELEASE_NOTES_FILE}"
echo "" >> "${RELEASE_NOTES_FILE}"
cat CHANGELOG.md >> "${RELEASE_NOTES_FILE}"
echo "Made the release notes."

echo "Publishing to npm..."
if [[ $DRY_RUN == "" ]]; then
npm publish
else
echo "DRY RUN: running publish with --dry-run"
npm publish --dry-run
fi
echo "Published to npm."

if [[ $DRY_RUN != "" ]]; then
echo "All other commands are mutations, and we are doing a dry run."
echo "Terminating."
exit
fi

echo "Cleaning up release notes..."
rm CHANGELOG.md
touch CHANGELOG.md
git commit -m "[firebase-release] Removed change log and reset repo after ${NEW_VERSION} release" CHANGELOG.md
echo "Cleaned up release notes."

echo "Pushing to GitHub..."
git push origin master --tags
echo "Pushed to GitHub."

echo "Publishing release notes..."
hub release create --file "${RELEASE_NOTES_FILE}" "v${NEW_VERSION}"
echo "Published release notes."

echo "Making the tweet..."
npm install --no-save twitter@1.7.1
cp -v "${WDIR}/scripts/twitter.json" "${TEMPDIR}/${REPOSITORY_NAME}/scripts/"
node ./scripts/tweet.js ${NEW_VERSION}
echo "Made the tweet."
Loading