Compare commits
167 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f79662d61 | |||
| e4830b9fd2 | |||
| 5ad4f5562c | |||
| 43bb414e23 | |||
| 64c7c53190 | |||
| 5075c870fd | |||
| b9edb415b2 | |||
| 7ca6543244 | |||
| e58b4ceed8 | |||
| c97237bcb8 | |||
| 8822a4ff69 | |||
| 772440cdaf | |||
| 1fbddf950f | |||
| 369ca3e13e | |||
| 00d38e3358 | |||
| a0ed1b73ff | |||
| e44c3ac327 | |||
| c6551231b2 | |||
| bf073be69d | |||
| aed34c75be | |||
| 78e17f5729 | |||
| ba6f477ac8 | |||
| 6482297185 | |||
| 41deaf1d21 | |||
| 23e4138c07 | |||
| 0ffb30f585 | |||
| 6f52013668 | |||
| 07e1ba29f0 | |||
| 04c64b3d10 | |||
| 4d9a95ffdb | |||
| 27486bd15e | |||
| cf919a6fb7 | |||
| d4d1031bcd | |||
| 798114075f | |||
| 838dd12ee1 | |||
| 6926223963 | |||
| 5f8372ee2d | |||
| 289374a43c | |||
| 3b333f3b9f | |||
| 7cbb1044fc | |||
| a8bfeff5d8 | |||
| fc0e100c45 | |||
| eb49f6b755 | |||
| f9e651d113 | |||
| 2f72a69ded | |||
| 8a67ac57fc | |||
| 90a41d415c | |||
| eefaa76a90 | |||
| bc3432365c | |||
| f4ac5c8487 | |||
| 9f2f567167 | |||
| 3e6f49a227 | |||
| 795398fab0 | |||
| f1a34bad20 | |||
| 84a6ea9eb4 | |||
| ff0ef2aeaf | |||
| c81e3556e8 | |||
| 8cc69b9edb | |||
| ae8ce3ec60 | |||
| df0d5d245e | |||
| 67ec5e8ceb | |||
| 4df2188e96 | |||
| 816a587578 | |||
| 0e1bd7822e | |||
| b27080d525 | |||
| 1a509873bf | |||
| fead62e958 | |||
| e2011bd0b3 | |||
| 3cdffcecba | |||
| f87d6648d7 | |||
| b1d0a83d01 | |||
| d6098eeb1c | |||
| c903b76f6c | |||
| f3a565872d | |||
| 582b03b983 | |||
| be240b1176 | |||
| 61b33543ff | |||
| 1dcba9cd88 | |||
| 8cd54d7794 | |||
| 3105b2c26a | |||
| bc5a48d4a4 | |||
| 2bbc7c464f | |||
| e85f91d582 | |||
| 862a78dfd2 | |||
| bd772abf34 | |||
| b074d719ae | |||
| a43a40b778 | |||
| 2ceeb739f3 | |||
| fa715abf45 | |||
| f943e377e8 | |||
| 30084c1369 | |||
| 668a33da34 | |||
| 19e2347759 | |||
| f17292e1b5 | |||
| 77b4330011 | |||
| 7717de4c51 | |||
| e68697e2e3 | |||
| a02ed88279 | |||
| a5914c94a8 | |||
| 63c9c9e8d7 | |||
| 4adbf82a84 | |||
| 1144b1eccb | |||
| 8970087e58 | |||
| 131e62a819 | |||
| 2fad638237 | |||
| a0940895a2 | |||
| 0a1db2ad5f | |||
| 4bd4246906 | |||
| 05ac702bc7 | |||
| 6882113bc1 | |||
| 535ee32a0b | |||
| 7cf4a2933c | |||
| 7dd6c87eec | |||
| 17f963c5d8 | |||
| ba09ba5344 | |||
| 8c36a43e91 | |||
| af14d67b84 | |||
| c8acff1cdc | |||
| 876e9842a2 | |||
| 5cb9465093 | |||
| 58f9413ad3 | |||
| 6f7674a7d0 | |||
| 8dc153db75 | |||
| 4a6f0996f6 | |||
| 522d581fc9 | |||
| 17b139f107 | |||
| 10973c3366 | |||
| fc64e68076 | |||
| ac5e92de9b | |||
| 0936353e9a | |||
| ed22d2fe7b | |||
| a5cfa88630 | |||
| bbf74f9994 | |||
| 62ad450d60 | |||
| faa4b17c86 | |||
| 4d980a8771 | |||
| 369469b4f3 | |||
| be417f2854 | |||
| 3a517c25f6 | |||
| 29b8dcf387 | |||
| c9d1e690aa | |||
| a47247b5e0 | |||
| b682213d72 | |||
| 223cf2b5bb | |||
| c387e0d79d | |||
| cbf74d5d64 | |||
| a812327acd | |||
| 35fce310e9 | |||
| 93a754a490 | |||
| 7d9d387195 | |||
| feac52d840 | |||
| f4f571efdf | |||
| a8c263c194 | |||
| 3d6c45d76e | |||
| bf841d3512 | |||
| a1d88457de | |||
| b011ae9544 | |||
| 63fdee6b9c | |||
| 257ebbb514 | |||
| 2b6c986736 | |||
| 2da4950406 | |||
| 789db83a8a | |||
| ce443792c4 | |||
| dd47867bfb | |||
| f2ebb82ba5 | |||
| 12698755be | |||
| f7d7954904 |
@@ -1,358 +0,0 @@
|
||||
# Configuration file for https://circleci.com/gh/angular/angular.js
|
||||
|
||||
# Note: YAML anchors allow an object to be re-used, reducing duplication.
|
||||
# The ampersand declares an alias for an object, then later the `<<: *name`
|
||||
# syntax dereferences it.
|
||||
# See http://blog.daemonl.com/2016/02/yaml.html
|
||||
# To validate changes, use an online parser, eg.
|
||||
# http://yaml-online-parser.appspot.com/
|
||||
|
||||
# CircleCI configuration version
|
||||
# Version 2.1 allows for extra config reuse features
|
||||
# https://circleci.com/docs/2.0/reusing-config/#getting-started-with-config-reuse
|
||||
version: 2.1
|
||||
|
||||
# Workspace persisted by the `setup` job to share build artifacts with other jobs.
|
||||
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
|
||||
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
|
||||
var_workspace_location: &workspace_location ~/
|
||||
|
||||
# Executor Definitions
|
||||
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
|
||||
# **NOTE 1**: Pin to exact images using an ID (SHA). See https://circleci.com/docs/2.0/circleci-images/#using-a-docker-image-id-to-pin-an-image-to-a-fixed-version.
|
||||
# (Using the tag in not necessary when pinning by ID, but include it anyway for documentation purposes.)
|
||||
executors:
|
||||
default-executor:
|
||||
parameters:
|
||||
resource_class:
|
||||
type: string
|
||||
default: medium
|
||||
docker:
|
||||
- image: circleci/node:12.16.3@sha256:8fe514dae7585bbee1c64bf5a6cd4dcdf393316b5c87565b47e31014872c8860
|
||||
resource_class: << parameters.resource_class >>
|
||||
working_directory: ~/ng
|
||||
cloud-sdk:
|
||||
description: The docker container to use when running gcp-gcs commands
|
||||
docker:
|
||||
- image: google/cloud-sdk:alpine@sha256:7d0cae28cb282b76f2d9babe278c63c910d54f0cceca7a65fdf6806e2b43882e
|
||||
|
||||
|
||||
# Command Definitions
|
||||
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
|
||||
commands:
|
||||
custom_attach_workspace:
|
||||
description: Attach workspace at a predefined location
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: *workspace_location
|
||||
|
||||
# Java is needed for running the Closure Compiler (during the `minall` task).
|
||||
install_java:
|
||||
description: Install java
|
||||
steps:
|
||||
- run:
|
||||
name: Install java
|
||||
command: |
|
||||
sudo apt-get update
|
||||
# Install java runtime
|
||||
sudo apt-get install default-jre
|
||||
|
||||
# Initializes the CI environment by setting up common environment variables.
|
||||
init_environment:
|
||||
description: Initializing environment (setting up variables)
|
||||
steps:
|
||||
- run:
|
||||
name: Set up environment
|
||||
environment:
|
||||
CIRCLE_GIT_BASE_REVISION: << pipeline.git.base_revision >>
|
||||
CIRCLE_GIT_REVISION: << pipeline.git.revision >>
|
||||
command: ./.circleci/env.sh
|
||||
- run:
|
||||
# Configure git as the CircleCI `checkout` command does.
|
||||
# This is needed because we only checkout on the setup job.
|
||||
# Add GitHub to known hosts
|
||||
name: Configure git
|
||||
command: |
|
||||
mkdir -p ~/.ssh
|
||||
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
|
||||
git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
|
||||
git config --global gc.auto 0 || true
|
||||
- install_java
|
||||
|
||||
init_saucelabs_environment:
|
||||
description: Sets up a domain that resolves to the local host.
|
||||
steps:
|
||||
- run:
|
||||
name: Preparing environment for running tests on Saucelabs.
|
||||
command: |
|
||||
# For SauceLabs jobs, we set up a domain which resolves to the machine which launched
|
||||
# the tunnel. We do this because devices are sometimes not able to properly resolve
|
||||
# `localhost` or `127.0.0.1` through the SauceLabs tunnel. Using a domain that does not
|
||||
# resolve to anything on SauceLabs VMs ensures that such requests are always resolved
|
||||
# through the tunnel, and resolve to the actual tunnel host machine (i.e. the CircleCI VM).
|
||||
# More context can be found in: https://github.com/angular/angular/pull/35171.
|
||||
setPublicVar SAUCE_LOCALHOST_ALIAS_DOMAIN "angular-ci.local"
|
||||
setSecretVar SAUCE_ACCESS_KEY $(echo $SAUCE_ACCESS_KEY | rev)
|
||||
- run:
|
||||
# Sets up a local domain in the machine's host file that resolves to the local
|
||||
# host. This domain is helpful in Saucelabs tests where devices are not able to
|
||||
# properly resolve `localhost` or `127.0.0.1` through the sauce-connect tunnel.
|
||||
name: Setting up alias domain for local host.
|
||||
command: echo "127.0.0.1 $SAUCE_LOCALHOST_ALIAS_DOMAIN" | sudo tee -a /etc/hosts
|
||||
|
||||
start_saucelabs:
|
||||
steps:
|
||||
- run:
|
||||
name: Starting Saucelabs tunnel service
|
||||
command: ./lib/saucelabs/sauce-service.sh start-ready-wait
|
||||
|
||||
stop_saucelabs:
|
||||
steps:
|
||||
- run:
|
||||
name: Stopping Saucelabs tunnel service
|
||||
command: ./lib/saucelabs/sauce-service.sh stop
|
||||
|
||||
|
||||
run_e2e_tests:
|
||||
parameters:
|
||||
specs:
|
||||
type: string
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- init_saucelabs_environment
|
||||
- start_saucelabs
|
||||
- run:
|
||||
command: yarn grunt test:circleci-protractor --specs="<< parameters.specs >>"
|
||||
no_output_timeout: 30m
|
||||
- stop_saucelabs
|
||||
|
||||
run_e2e_tests_jquery:
|
||||
parameters:
|
||||
specs:
|
||||
type: string
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- init_saucelabs_environment
|
||||
- start_saucelabs
|
||||
- run:
|
||||
environment:
|
||||
USE_JQUERY: 1
|
||||
command: yarn grunt test:circleci-protractor --specs="<< parameters.specs >>"
|
||||
no_output_timeout: 30m
|
||||
- stop_saucelabs
|
||||
|
||||
# Job definitions
|
||||
# Jobs can include parameters that are passed in the workflow job invocation.
|
||||
# https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs
|
||||
jobs:
|
||||
setup:
|
||||
executor: default-executor
|
||||
steps:
|
||||
- checkout
|
||||
- init_environment
|
||||
- run:
|
||||
name: Running Yarn install
|
||||
command: yarn install --frozen-lockfile --non-interactive
|
||||
# Yarn's requests sometimes take more than 10mins to complete.
|
||||
no_output_timeout: 45m
|
||||
- run: yarn grunt package
|
||||
# Persist any changes at this point to be reused by further jobs.
|
||||
# **NOTE**: To add new content to the workspace, always persist on the same root.
|
||||
- persist_to_workspace:
|
||||
root: *workspace_location
|
||||
paths:
|
||||
- ./ng
|
||||
|
||||
lint:
|
||||
executor: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- run: yarn grunt ci-checks
|
||||
- run: yarn commitplease "$CI_COMMIT_RANGE"
|
||||
- run: yarn grunt validate-angular-files
|
||||
|
||||
unit-test:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- init_saucelabs_environment
|
||||
- run: yarn grunt test:promises-aplus
|
||||
- run:
|
||||
command: yarn grunt test:jqlite --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
- run:
|
||||
command: yarn grunt test:modules --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
- run:
|
||||
command: yarn grunt test:docs --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
|
||||
unit-test-jquery:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- init_saucelabs_environment
|
||||
- run:
|
||||
command: yarn grunt test:jquery --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
- run:
|
||||
command: yarn grunt test:jquery-2.2 --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
- run:
|
||||
command: yarn grunt test:jquery-2.1 --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
|
||||
e2e-test-1:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests:
|
||||
specs: test/e2e/tests/**/*.js
|
||||
|
||||
e2e-test-2a:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests:
|
||||
specs: build/docs/ptore2e/example-ng*/**/default_test.js
|
||||
|
||||
e2e-test-2b:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests:
|
||||
specs: "build/docs/ptore2e/!(example-ng*)/**/default_test.js"
|
||||
|
||||
e2e-test-jquery-1:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests_jquery:
|
||||
specs: test/e2e/tests/**/*.js
|
||||
|
||||
e2e-test-jquery-2a:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests_jquery:
|
||||
specs: build/docs/ptore2e/example-ng*/**/jquery_test.js
|
||||
|
||||
e2e-test-jquery-2b:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests_jquery:
|
||||
specs: build/docs/ptore2e/!(example-ng*)/**/jquery_test.js
|
||||
|
||||
prepare-deployment:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- run: yarn grunt prepareDeploy
|
||||
# Write the deployment files to the workspace to be used by deploy-docs and deploy-code
|
||||
- persist_to_workspace:
|
||||
root: *workspace_location
|
||||
paths:
|
||||
- ./ng/deploy
|
||||
|
||||
deploy-docs:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- run: yarn grunt prepareDeploy
|
||||
# Install dependencies for Firebase functions to prevent parsing errors during deployment
|
||||
# See https://github.com/angular/angular.js/pull/16453
|
||||
- run: yarn -cwd ~/ng/scripts/docs.angularjs.org-firebase/functions
|
||||
- run: yarn firebase deploy --token "$FIREBASE_TOKEN" --only hosting
|
||||
|
||||
deploy-code:
|
||||
executor:
|
||||
name: cloud-sdk
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- run: ls ~/ng/deploy/code
|
||||
- run:
|
||||
name: Authenticate and configure Docker
|
||||
command: |
|
||||
echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
|
||||
gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
|
||||
- run:
|
||||
name: Sync files to code.angularjs.org
|
||||
command: |
|
||||
gsutil -m rsync -r ~/ng/deploy/code gs://code-angularjs-org-338b8.appspot.com
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
default_workflow:
|
||||
jobs:
|
||||
- setup
|
||||
- lint:
|
||||
requires:
|
||||
- setup
|
||||
- unit-test:
|
||||
requires:
|
||||
- setup
|
||||
- unit-test-jquery:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-1:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-2a:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-2b:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-jquery-1:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-jquery-2a:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-jquery-2b:
|
||||
requires:
|
||||
- setup
|
||||
- prepare-deployment:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- latest
|
||||
requires:
|
||||
- setup
|
||||
- unit-test
|
||||
- unit-test-jquery
|
||||
- e2e-test-1
|
||||
- e2e-test-2a
|
||||
- e2e-test-2b
|
||||
- e2e-test-jquery-1
|
||||
- e2e-test-jquery-2a
|
||||
- e2e-test-jquery-2b
|
||||
|
||||
- deploy-docs:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- latest
|
||||
requires:
|
||||
- prepare-deployment
|
||||
- deploy-code:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- latest
|
||||
requires:
|
||||
- prepare-deployment
|
||||
@@ -1,73 +0,0 @@
|
||||
####################################################################################################
|
||||
# Helpers for defining environment variables for CircleCI.
|
||||
#
|
||||
# In CircleCI, each step runs in a new shell. The way to share ENV variables across steps is to
|
||||
# export them from `$BASH_ENV`, which is automatically sourced at the beginning of every step (for
|
||||
# the default `bash` shell).
|
||||
#
|
||||
# See also https://circleci.com/docs/2.0/env-vars/#using-bash_env-to-set-environment-variables.
|
||||
####################################################################################################
|
||||
|
||||
# Set and print an environment variable.
|
||||
#
|
||||
# Use this function for setting environment variables that are public, i.e. it is OK for them to be
|
||||
# visible to anyone through the CI logs.
|
||||
#
|
||||
# Usage: `setPublicVar <name> <value>`
|
||||
function setPublicVar() {
|
||||
setSecretVar $1 "$2";
|
||||
echo "$1=$2";
|
||||
}
|
||||
|
||||
# Set (without printing) an environment variable.
|
||||
#
|
||||
# Use this function for setting environment variables that are secret, i.e. should not be visible to
|
||||
# everyone through the CI logs.
|
||||
#
|
||||
# Usage: `setSecretVar <name> <value>`
|
||||
function setSecretVar() {
|
||||
# WARNING: Secrets (e.g. passwords, access tokens) should NOT be printed.
|
||||
# (Keep original shell options to restore at the end.)
|
||||
local -r originalShellOptions=$(set +o);
|
||||
set +x -eu -o pipefail;
|
||||
|
||||
echo "export $1=\"${2:-}\";" >> $BASH_ENV;
|
||||
|
||||
# Restore original shell options.
|
||||
eval "$originalShellOptions";
|
||||
}
|
||||
|
||||
|
||||
# Create a function to set an environment variable, when called.
|
||||
#
|
||||
# Use this function for creating setter for public environment variables that require expensive or
|
||||
# time-consuming computaions and may not be needed. When needed, you can call this function to set
|
||||
# the environment variable (which will be available through `$BASH_ENV` from that point onwards).
|
||||
#
|
||||
# Arguments:
|
||||
# - `<name>`: The name of the environment variable. The generated setter function will be
|
||||
# `setPublicVar_<name>`.
|
||||
# - `<code>`: The code to run to compute the value for the variable. Since this code should be
|
||||
# executed lazily, it must be properly escaped. For example:
|
||||
# ```sh
|
||||
# # DO NOT do this:
|
||||
# createPublicVarSetter MY_VAR "$(whoami)"; # `whoami` will be evaluated eagerly
|
||||
#
|
||||
# # DO this isntead:
|
||||
# createPublicVarSetter MY_VAR "\$(whoami)"; # `whoami` will NOT be evaluated eagerly
|
||||
# ```
|
||||
#
|
||||
# Usage: `createPublicVarSetter <name> <code>`
|
||||
#
|
||||
# Example:
|
||||
# ```sh
|
||||
# createPublicVarSetter MY_VAR 'echo "FOO"';
|
||||
# echo $MY_VAR; # Not defined
|
||||
#
|
||||
# setPublicVar_MY_VAR;
|
||||
# source $BASH_ENV;
|
||||
# echo $MY_VAR; # FOO
|
||||
# ```
|
||||
function createPublicVarSetter() {
|
||||
echo "setPublicVar_$1() { setPublicVar $1 \"$2\"; }" >> $BASH_ENV;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Variables
|
||||
readonly projectDir=$(realpath "$(dirname ${BASH_SOURCE[0]})/..")
|
||||
readonly envHelpersPath="$projectDir/.circleci/env-helpers.inc.sh";
|
||||
|
||||
# Load helpers and make them available everywhere (through `$BASH_ENV`).
|
||||
source $envHelpersPath;
|
||||
echo "source $envHelpersPath;" >> $BASH_ENV;
|
||||
|
||||
####################################################################################################
|
||||
# Define PUBLIC environment variables for CircleCI.
|
||||
####################################################################################################
|
||||
# See https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables for more info.
|
||||
####################################################################################################
|
||||
setPublicVar CI "$CI"
|
||||
setPublicVar PROJECT_ROOT "$projectDir";
|
||||
# This is the branch being built; e.g. `pull/12345` for PR builds.
|
||||
setPublicVar CI_BRANCH "$CIRCLE_BRANCH";
|
||||
setPublicVar CI_BUILD_URL "$CIRCLE_BUILD_URL";
|
||||
setPublicVar CI_COMMIT "$CIRCLE_SHA1";
|
||||
# `CI_COMMIT_RANGE` is only used on push builds (a.k.a. non-PR, non-scheduled builds and rerun
|
||||
# workflows of such builds).
|
||||
setPublicVar CI_GIT_BASE_REVISION "${CIRCLE_GIT_BASE_REVISION}";
|
||||
setPublicVar CI_GIT_REVISION "${CIRCLE_GIT_REVISION}";
|
||||
setPublicVar CI_COMMIT_RANGE "$CIRCLE_GIT_BASE_REVISION..$CIRCLE_GIT_REVISION";
|
||||
setPublicVar CI_PULL_REQUEST "${CIRCLE_PR_NUMBER:-false}";
|
||||
setPublicVar CI_REPO_NAME "$CIRCLE_PROJECT_REPONAME";
|
||||
setPublicVar CI_REPO_OWNER "$CIRCLE_PROJECT_USERNAME";
|
||||
setPublicVar CI_PR_REPONAME "$CIRCLE_PR_REPONAME";
|
||||
setPublicVar CI_PR_USERNAME "$CIRCLE_PR_USERNAME";
|
||||
|
||||
|
||||
####################################################################################################
|
||||
# Define SauceLabs environment variables for CircleCI.
|
||||
####################################################################################################
|
||||
setPublicVar BROWSER_PROVIDER "saucelabs"
|
||||
|
||||
# The currently latest-1 version of desktop Safari on Saucelabs (v12.0) is unstable and disconnects
|
||||
# consistently. The latest version (v12.1) works fine.
|
||||
# TODO: Add `SL_Safari-1` back, once it no longer corresponds to v12.0.
|
||||
setPublicVar BROWSERS "SL_Chrome,SL_Chrome-1,\
|
||||
SL_Firefox,SL_Firefox-1,\
|
||||
SL_Safari,\
|
||||
SL_iOS,SL_iOS-1,\
|
||||
SL_IE_9,SL_IE_10,SL_IE_11,\
|
||||
SL_EDGE,SL_EDGE-1"
|
||||
|
||||
setPublicVar SAUCE_LOG_FILE /tmp/angular/sauce-connect.log
|
||||
setPublicVar SAUCE_READY_FILE /tmp/angular/sauce-connect-ready-file.lock
|
||||
setPublicVar SAUCE_PID_FILE /tmp/angular/sauce-connect-pid-file.lock
|
||||
setPublicVar SAUCE_TUNNEL_IDENTIFIER "angularjs-framework-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}"
|
||||
# Amount of seconds we wait for sauceconnect to establish a tunnel instance. In order to not
|
||||
# acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout.
|
||||
setPublicVar SAUCE_READY_FILE_TIMEOUT 120
|
||||
|
||||
####################################################################################################
|
||||
# Define additional environment variables
|
||||
####################################################################################################
|
||||
setPublicVar DIST_TAG $( jq ".distTag" "package.json" | tr -d "\"[:space:]" )
|
||||
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
## Source `$BASH_ENV` to make the variables available immediately. ##
|
||||
## ***NOTE: This must remain the the last action in this script*** ##
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
source $BASH_ENV;
|
||||
@@ -1,7 +1,3 @@
|
||||
# AngularJS is in LTS mode
|
||||
We are no longer accepting changes that are not critical bug fixes into this project.
|
||||
See https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c for more detail.
|
||||
|
||||
<!--
|
||||
IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATION
|
||||
-->
|
||||
@@ -13,9 +9,8 @@ IF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOU
|
||||
|
||||
**I'm submitting a ...**
|
||||
<!-- (check one with "x") -->
|
||||
- [ ] regression from 1.7.0
|
||||
- [ ] security issue
|
||||
- [ ] issue caused by a new browser version
|
||||
- [ ] bug report
|
||||
- [ ] feature request
|
||||
- [ ] other <!--(Please do not submit support requests here - see above)-->
|
||||
|
||||
**Current behavior:**
|
||||
@@ -31,7 +26,7 @@ please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the
|
||||
https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:yBpEi4).
|
||||
-->
|
||||
|
||||
**AngularJS version:** 1.8.x
|
||||
**AngularJS version:** 1.x.y
|
||||
<!-- Check whether this is still an issue in the most recent stable or in the snapshot AngularJS
|
||||
version (https://code.angularjs.org/snapshot/) -->
|
||||
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
# AngularJS is in LTS mode
|
||||
We are no longer accepting changes that are not critical bug fixes into this project.
|
||||
See https://blog.angular.io/stable-angularjs-and-long-term-support-7e077635ee9c for more detail.
|
||||
|
||||
<!-- General PR submission guidelines https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#submit-pr -->
|
||||
**Does this PR fix a regression since 1.7.0, a security flaw, or a problem caused by a new browser version?**
|
||||
**What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)**
|
||||
|
||||
<!-- If the answer is no, then we will not merge this PR -->
|
||||
|
||||
|
||||
**What is the current behavior? (You can also link to an open issue here)**
|
||||
|
||||
@@ -12,7 +12,6 @@ performance/temp*.html
|
||||
angular.js.tmproj
|
||||
node_modules/
|
||||
angular.xcodeproj
|
||||
.firebase/
|
||||
.idea
|
||||
*.iml
|
||||
.agignore
|
||||
@@ -23,5 +22,3 @@ npm-debug.log
|
||||
.vscode
|
||||
*.log
|
||||
*.stackdump
|
||||
scripts/docs.angularjs.org-firebase/functions/content
|
||||
/firebase.json
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- '8'
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
|
||||
branches:
|
||||
except:
|
||||
- "/^g3_.*$/"
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- JOB=ci-checks
|
||||
- JOB=unit-core BROWSER_PROVIDER=saucelabs
|
||||
- JOB=unit-jquery BROWSER_PROVIDER=saucelabs
|
||||
- JOB=unit-modules BROWSER_PROVIDER=saucelabs
|
||||
- JOB=docs-app BROWSER_PROVIDER=saucelabs
|
||||
- JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=saucelabs
|
||||
- JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=saucelabs
|
||||
global:
|
||||
- SAUCE_USERNAME=angular-ci
|
||||
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
|
||||
- LOGS_DIR=/tmp/angular-build/logs
|
||||
- BROWSER_PROVIDER_READY_FILE=/tmp/browsersprovider-tunnel-ready
|
||||
- secure: oTBjhnOKhs0qDSKTf7fE4f6DYiNDPycvB7qfSF5QRIbJK/LK/J4UtFwetXuXj79HhUZG9qnoT+5e7lPaiaMlpsIKn9ann7ffqFWN1E8TMtpJF+AGigx3djYElwfgf5nEnFUFhwjFzvbfpZNnxVGgX5YbIZpe/WUbHkP4ffU0Wks=
|
||||
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.10.1
|
||||
- export PATH="$HOME/.yarn/bin:$PATH"
|
||||
|
||||
before_script:
|
||||
- du -sh ./node_modules || true
|
||||
- "./scripts/travis/before_build.sh"
|
||||
script:
|
||||
- "./scripts/travis/build.sh"
|
||||
|
||||
after_script:
|
||||
- "./scripts/travis/tear_down_browser_provider.sh"
|
||||
- "./scripts/travis/print_logs.sh"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/d2120f3f2bb39a4531b2
|
||||
- http://104.197.9.155:8484/hubot/travis/activity #hubot-server
|
||||
on_success: always # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: always # default: false
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: deploy
|
||||
# Don't deploy from PRs. Only deploy from our default branches, or if commit is tagged.
|
||||
# This is a Travis-specific boolean language: https://docs.travis-ci.com/user/conditional-builds-stages-jobs#Specifying-conditions
|
||||
# The deployment logic for pushed branches is further defined in scripts\travis\build.sh
|
||||
if: type != pull_request and (branch =~ ^(v1\.\d+\.x|master)$ or tag IS present)
|
||||
env:
|
||||
- JOB=deploy
|
||||
before_script: skip
|
||||
script:
|
||||
# Export the variables into the current process
|
||||
- . ./scripts/travis/build.sh
|
||||
- "echo DEPLOY_DOCS: $DEPLOY_DOCS, DEPLOY_CODE: $DEPLOY_CODE"
|
||||
after_script: skip
|
||||
# Work around the 10min Travis timeout so the code.angularjs firebase+gcs code deploy can complete
|
||||
# Only run the keep_alive once (before_deploy is run for each provider)
|
||||
before_deploy: |
|
||||
if ! [ "$BEFORE_DEPLOY_RUN" ]; then
|
||||
export BEFORE_DEPLOY_RUN=1;
|
||||
|
||||
function keep_alive() {
|
||||
while true; do
|
||||
echo -en "\a"
|
||||
sleep 10
|
||||
done
|
||||
}
|
||||
keep_alive &
|
||||
fi
|
||||
deploy:
|
||||
- provider: firebase
|
||||
# the upload folder for firebase is configured in /firebase.json
|
||||
skip_cleanup: true
|
||||
project: docs-angularjs-org-9p2
|
||||
token:
|
||||
secure: $FIREBASE_TOKEN
|
||||
on:
|
||||
repo: angular/angular.js
|
||||
all_branches: true
|
||||
condition: "$DEPLOY_DOCS == true"
|
||||
- provider: gcs
|
||||
skip_cleanup: true
|
||||
access_key_id: GOOGLDB7W2J3LFHICF3R
|
||||
secret_access_key:
|
||||
secure: tHIFdSq55qkyZf9zT/3+VkhUrTvOTMuswxXU3KyWaBrSieZqG0UnUDyNm+n3lSfX95zEl/+rJAWbfvhVSxZi13ndOtvRF+MdI1cvow2JynP0aDSiPffEvVrZOmihD6mt2SlMfhskr5FTduQ69kZG6DfLcve1PPDaIwnbOv3phb8=
|
||||
bucket: code-angularjs-org-338b8.appspot.com
|
||||
local-dir: deploy/code
|
||||
detect_encoding: true # detects gzip compression
|
||||
on:
|
||||
repo: angular/angular.js
|
||||
all_branches: true
|
||||
condition: "$DEPLOY_CODE == true"
|
||||
|
||||
@@ -1,57 +1,3 @@
|
||||
|
||||
<a name="1.8.0"></a>
|
||||
# 1.8.0 nested-vaccination (2020-06-01)
|
||||
|
||||
## Bug Fixes
|
||||
- **jqLite:**
|
||||
- prevent possible XSS due to regex-based HTML replacement
|
||||
([2df43c](https://github.com/angular/angular.js/commit/2df43c07779137d1bddf7f3b282a1287a8634acd))
|
||||
|
||||
## Breaking Changes
|
||||
|
||||
### **jqLite** due to:
|
||||
- **[2df43c](https://github.com/angular/angular.js/commit/2df43c07779137d1bddf7f3b282a1287a8634acd)**: prevent possible XSS due to regex-based HTML replacement
|
||||
|
||||
JqLite no longer turns XHTML-like strings like `<div /><span />` to sibling elements `<div></div><span></span>`
|
||||
when not in XHTML mode. Instead it will leave them as-is. The browser, in non-XHTML mode, will convert these to:
|
||||
`<div><span></span></div>`.
|
||||
|
||||
This is a security fix to avoid an XSS vulnerability if a new jqLite element is created from a user-controlled HTML string.
|
||||
If you must have this functionality and understand the risk involved then it is posible to restore the original behavior by calling
|
||||
|
||||
```js
|
||||
angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement();
|
||||
```
|
||||
|
||||
But you should adjust your code for this change and remove your use of this function as soon as possible.
|
||||
|
||||
Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details about the workarounds.
|
||||
|
||||
|
||||
<a name="1.7.9"></a>
|
||||
# 1.7.9 pollution-eradication (2019-11-19)
|
||||
|
||||
## Bug Fixes
|
||||
- **angular.merge:** do not merge __proto__ property
|
||||
([726f49](https://github.com/angular/angular.js/commit/726f49dcf6c23106ddaf5cfd5e2e592841db743a))
|
||||
<br>(Thanks to the [Snyk Security Research Team](https://snyk.io/blog/snyk-research-team-discovers-severe-prototype-pollution-security-vulnerabilities-affecting-all-versions-of-lodash/) for identifyng this issue.)
|
||||
- **ngStyle:** correctly remove old style when new style value is invalid
|
||||
([5edd25](https://github.com/angular/angular.js/commit/5edd25364f617083363dc2bd61f9230b38267578),
|
||||
[#16860](https://github.com/angular/angular.js/issues/16860),
|
||||
[#16868](https://github.com/angular/angular.js/issues/16868))
|
||||
|
||||
|
||||
<a name="1.7.8"></a>
|
||||
# 1.7.8 enthusiastic-oblation (2019-03-11)
|
||||
|
||||
|
||||
## Bug Fixes
|
||||
- **required:** correctly validate required on non-input element surrounded by ngIf
|
||||
([a4c7bd](https://github.com/angular/angular.js/commit/a4c7bdccd76c39c30e33f6215da9a00cc8acde2c),
|
||||
[#16830](https://github.com/angular/angular.js/issues/16830),
|
||||
[#16836](https://github.com/angular/angular.js/issues/16836))
|
||||
|
||||
|
||||
<a name="1.7.7"></a>
|
||||
# 1.7.7 kingly-exiting (2019-02-04)
|
||||
|
||||
|
||||
+5
-5
@@ -125,8 +125,8 @@ Before you submit your pull request consider the following guidelines:
|
||||
* Follow our [Coding Rules][developers.rules].
|
||||
* If the changes affect public APIs, change or add relevant [documentation][developers.documentation].
|
||||
* Run the AngularJS [unit][developers.tests-unit] and [E2E test][developers.tests-e2e] suites, and ensure that all tests
|
||||
pass. It is generally sufficient to run the tests only on Chrome, as our continuous integration test will
|
||||
run the tests on additional browsers.
|
||||
pass. It is generally sufficient to run the tests only on Chrome, as our Travis integration will
|
||||
run the tests on all supported browsers.
|
||||
* Run `yarn grunt eslint` to check that you have followed the automatically enforced coding rules
|
||||
* Commit your changes using a descriptive commit message that follows our
|
||||
[commit message conventions][developers.commits]. Adherence to the
|
||||
@@ -151,9 +151,9 @@ Before you submit your pull request consider the following guidelines:
|
||||
```
|
||||
|
||||
* In GitHub, send a pull request to `angular.js:master`. This will trigger the check of the
|
||||
[Contributor License Agreement](#cla) and the continuous integration tests.
|
||||
[Contributor License Agreement](#cla) and the Travis integration.
|
||||
|
||||
* If you find that the continuous integration tests have failed, look into the logs to find out
|
||||
* If you find that the Travis integration has failed, look into the logs on Travis to find out
|
||||
if your changes caused test failures, the commit message was malformed etc. If you find that the
|
||||
tests failed or times out for unrelated reasons, you can ping a team member so that the build can be
|
||||
restarted.
|
||||
@@ -172,7 +172,7 @@ restarted.
|
||||
git push origin my-fix-branch -f
|
||||
```
|
||||
|
||||
This is generally easier to follow, but separate commits are useful if the Pull Request contains
|
||||
This is generally easier to follow, but seperate commits are useful if the Pull Request contains
|
||||
iterations that might be interesting to see side-by-side.
|
||||
|
||||
That's it! Thank you for your contribution!
|
||||
|
||||
+3
-2
@@ -249,7 +249,7 @@ format that includes a **type**, a **scope** and a **subject**:
|
||||
|
||||
The **header** is mandatory and the **scope** of the header is optional.
|
||||
|
||||
Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier
|
||||
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
|
||||
to read on GitHub as well as in various git tools.
|
||||
|
||||
### Revert
|
||||
@@ -257,6 +257,7 @@ If the commit reverts a previous commit, it should begin with `revert: `, follow
|
||||
of the reverted commit.
|
||||
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit
|
||||
being reverted.
|
||||
A commit with this format is automatically created by the [`git revert`][git-revert] command.
|
||||
|
||||
### Type
|
||||
Must be one of the following:
|
||||
@@ -428,7 +429,7 @@ if it is enclosed in <pre>...</pre> tags and the code lines themselv
|
||||
It is possible to embed examples in the documentation along with appropriate e2e tests. These
|
||||
examples and scenarios will be converted to runnable code within the documentation. So it is
|
||||
important that they work correctly. To ensure this, all these e2e scenarios are run as part of the
|
||||
continuous integration tests.
|
||||
automated Travis tests.
|
||||
|
||||
If you are adding an example with an e2e test, you should [run the test locally](#e2e-tests) first
|
||||
to ensure it passes. You can change `it(...)` to `fit(...)` to run only your test,
|
||||
|
||||
+31
-10
@@ -14,7 +14,7 @@ var semver = require('semver');
|
||||
var exec = require('shelljs').exec;
|
||||
var pkg = require(__dirname + '/package.json');
|
||||
|
||||
var docsScriptFolder = util.docsScriptFolder;
|
||||
var docsScriptFolder = 'scripts/docs.angularjs.org-firebase';
|
||||
|
||||
// Node.js version checks
|
||||
if (!semver.satisfies(process.version, pkg.engines.node)) {
|
||||
@@ -45,7 +45,7 @@ if (!match) {
|
||||
}
|
||||
|
||||
// Ensure Node.js dependencies have been installed
|
||||
if (!process.env.CI) {
|
||||
if (!process.env.TRAVIS && !process.env.JENKINS_HOME) {
|
||||
var yarnOutput = exec('yarn install');
|
||||
if (yarnOutput.code !== 0) {
|
||||
throw new Error('Yarn install failed: ' + yarnOutput.stderr);
|
||||
@@ -109,14 +109,16 @@ module.exports = function(grunt) {
|
||||
},
|
||||
testserver: {
|
||||
options: {
|
||||
// We start the webserver as a separate process from the E2E tests
|
||||
// We use end2end task (which does not start the webserver)
|
||||
// and start the webserver as a separate process (in travis_build.sh)
|
||||
// to avoid https://github.com/joyent/libuv/issues/826
|
||||
port: 8000,
|
||||
hostname: '0.0.0.0',
|
||||
middleware: function(connect, options) {
|
||||
var base = Array.isArray(options.base) ? options.base[options.base.length - 1] : options.base;
|
||||
return [
|
||||
function(req, resp, next) {
|
||||
// cache GET requests to speed up tests
|
||||
// cache get requests to speed up tests on travis
|
||||
if (req.method === 'GET') {
|
||||
resp.setHeader('Cache-control', 'public, max-age=3600');
|
||||
}
|
||||
@@ -158,7 +160,8 @@ module.exports = function(grunt) {
|
||||
|
||||
protractor: {
|
||||
normal: 'protractor-conf.js',
|
||||
circleci: 'protractor-circleci-conf.js'
|
||||
travis: 'protractor-travis-conf.js',
|
||||
jenkins: 'protractor-jenkins-conf.js'
|
||||
},
|
||||
|
||||
|
||||
@@ -369,9 +372,10 @@ module.exports = function(grunt) {
|
||||
},
|
||||
deployFirebaseCode: {
|
||||
files: [
|
||||
// copy files that are not handled by compress
|
||||
{
|
||||
cwd: 'build',
|
||||
src: '**',
|
||||
src: '**/*.{zip,jpg,jpeg,png}',
|
||||
dest: 'deploy/code/' + deployVersion + '/',
|
||||
expand: true
|
||||
}
|
||||
@@ -419,6 +423,16 @@ module.exports = function(grunt) {
|
||||
expand: true,
|
||||
dot: true,
|
||||
dest: dist + '/'
|
||||
},
|
||||
deployFirebaseCode: {
|
||||
options: {
|
||||
mode: 'gzip'
|
||||
},
|
||||
// Already compressed files should not be compressed again
|
||||
src: ['**', '!**/*.{zip,png,jpeg,jpg}'],
|
||||
cwd: 'build',
|
||||
expand: true,
|
||||
dest: 'deploy/code/' + deployVersion + '/'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -484,9 +498,14 @@ module.exports = function(grunt) {
|
||||
'connect:testserver',
|
||||
'protractor:normal'
|
||||
]);
|
||||
grunt.registerTask('test:circleci-protractor', 'Run the end to end tests with Protractor for CircleCI builds', [
|
||||
grunt.registerTask('test:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', [
|
||||
'connect:testserver',
|
||||
'protractor:circleci'
|
||||
'protractor:travis'
|
||||
]);
|
||||
grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', [
|
||||
'webdriver',
|
||||
'connect:testserver',
|
||||
'protractor:jenkins'
|
||||
]);
|
||||
grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']);
|
||||
grunt.registerTask('test:promises-aplus',[
|
||||
@@ -516,8 +535,10 @@ module.exports = function(grunt) {
|
||||
'eslint'
|
||||
]);
|
||||
grunt.registerTask('prepareDeploy', [
|
||||
'package',
|
||||
'compress:deployFirebaseCode',
|
||||
'copy:deployFirebaseCode',
|
||||
'firebaseDocsJsonForCI',
|
||||
'firebaseDocsJsonForTravis',
|
||||
'copy:deployFirebaseDocs'
|
||||
]);
|
||||
grunt.registerTask('default', ['package']);
|
||||
@@ -525,7 +546,7 @@ module.exports = function(grunt) {
|
||||
|
||||
|
||||
function reportOrFail(message) {
|
||||
if (process.env.CI) {
|
||||
if (process.env.TRAVIS || process.env.JENKINS_HOME) {
|
||||
throw new Error(message);
|
||||
} else {
|
||||
console.log('===============================================================================');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2020 Google, Inc. http://angularjs.org
|
||||
Copyright (c) 2010-2018 Google, Inc. http://angularjs.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AngularJS [](https://circleci.com/gh/angular/workflows/angular.js/tree/master)
|
||||
AngularJS [](https://travis-ci.org/angular/angular.js)
|
||||
=========
|
||||
|
||||
AngularJS lets you write client-side web applications as if you had a smarter browser. It lets you
|
||||
|
||||
+4
-4
@@ -36,7 +36,7 @@ Usually this will be the commit containing the release notes, but it may also be
|
||||
## Run "release" script
|
||||
|
||||
```bash
|
||||
scripts/release/release.sh --git-push-dryrun=false --commit-sha=8822a4f --version-number=1.7.6 --version-name=gravity-manipulation
|
||||
scripts/jenkins/release.sh --git-push-dryrun=false --commit-sha=8822a4f --version-number=1.7.6 --version-name=gravity-manipulation
|
||||
```
|
||||
|
||||
1) The SHA is of the commit to release (could be in the past).
|
||||
@@ -67,10 +67,10 @@ If we want to make our files available, we need submit our CLs before this time
|
||||
This is the version used to compute what version to link to in the CDN. If you update this too early then the CDN lookup fails and you end up with 'null, for the version, which breaks the docs.
|
||||
|
||||
|
||||
## Verify angularjs.org download modal has latest version (updates via CI job)
|
||||
## Verify angularjs.org download modal has latest version (updates via Travis job)
|
||||
|
||||
The versions in the modal are updated (based on the versions available on CDN) as part of the CI deploy stage.
|
||||
(You may need to explicitly trigger the CI job. e.g. re-running the last `deploy` job.)
|
||||
The versions in the modal are updated (based on the versions available on CDN) as part of the Travis deploy stage: https://github.com/angular/angularjs.org/blob/a4d25c5abcd39e8ce19d31cb1c78073d13c4c974/.travis.yml#L26
|
||||
(You may need to explicitly trigger the Travis job. e.g. re-running the last job.)
|
||||
|
||||
|
||||
## Announce the release (via official Google accounts)
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
{# Macros #}
|
||||
{%- macro addTag(name, attributes) %}
|
||||
<{$ name $}
|
||||
{%- for attrName, attrValue in attributes -%}
|
||||
{$ ' ' + attrName $}="{$ attrValue $}"
|
||||
{%- endfor -%}
|
||||
></{$ name $}>
|
||||
{%- endmacro -%}
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en" ng-app="docsApp" ng-strict-di ng-controller="DocsController">
|
||||
<head>
|
||||
@@ -33,27 +24,50 @@
|
||||
})();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// Dynamically add `<base>` tag.
|
||||
// dynamically add base tag as well as css and javascript files.
|
||||
// we can't add css/js the usual way, because some browsers (FF) eagerly prefetch resources
|
||||
// before the base attribute is added, causing 404 and terribly slow loading of the docs app.
|
||||
(function() {
|
||||
var indexFile = (location.pathname.match(/\/(index[^.]*\.html)/) || ['', ''])[1],
|
||||
rUrl = /(#!\/|api|guide|misc|tutorial|error|index[^.]*\.html).*$/,
|
||||
var indexFile = (location.pathname.match(/\/(index[^\.]*\.html)/) || ['', ''])[1],
|
||||
rUrl = /(#!\/|api|guide|misc|tutorial|error|index[^\.]*\.html).*$/,
|
||||
baseUrl = location.href.replace(rUrl, indexFile),
|
||||
production = location.hostname === 'docs.angularjs.org',
|
||||
headEl = document.getElementsByTagName('head')[0],
|
||||
baseEl = document.createElement('base');
|
||||
sync = true;
|
||||
|
||||
baseEl.setAttribute('href', baseUrl);
|
||||
headEl.appendChild(baseEl);
|
||||
addTag('base', {href: baseUrl});
|
||||
|
||||
|
||||
{% for stylesheet in doc.stylesheets %}addTag('link', {rel: 'stylesheet', href: '{$ stylesheet $}', type: 'text/css'});
|
||||
{% endfor %}
|
||||
|
||||
{% for script in doc.scripts %}addTag('script', {src: '{$ script $}' }, sync);
|
||||
{% endfor %}
|
||||
|
||||
function addTag(name, attributes, sync) {
|
||||
var el = document.createElement(name),
|
||||
attrName;
|
||||
|
||||
for (attrName in attributes) {
|
||||
el.setAttribute(attrName, attributes[attrName]);
|
||||
}
|
||||
|
||||
sync ? document.write(outerHTML(el)) : headEl.appendChild(el);
|
||||
}
|
||||
|
||||
function outerHTML(node){
|
||||
// if IE, Chrome take the internal method otherwise build one
|
||||
return node.outerHTML || (
|
||||
function(n){
|
||||
var div = document.createElement('div'), h;
|
||||
div.appendChild(n);
|
||||
h = div.innerHTML;
|
||||
div = null;
|
||||
return h;
|
||||
})(node);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
{% for stylesheet in doc.stylesheets %}
|
||||
{$- addTag('link', {rel: 'stylesheet', href: stylesheet, type: 'text/css'}) -$}
|
||||
{% endfor %}
|
||||
{% for script in doc.scripts %}
|
||||
{$- addTag('script', {src: script}) -$}
|
||||
{% endfor %}
|
||||
|
||||
<script type="text/javascript">
|
||||
// GA asynchronous tracker
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-8594346-3']);
|
||||
@@ -208,7 +222,7 @@
|
||||
<p class="pull-right"><a back-to-top>Back to top</a></p>
|
||||
|
||||
<p>
|
||||
Super-powered by Google ©2010-2020
|
||||
Super-powered by Google ©2010-2018
|
||||
(<a id="version"
|
||||
ng-href="https://github.com/angular/angular.js/blob/master/CHANGELOG.md#{{versionNumber}}"
|
||||
ng-bind-template="v{{version}}" title="Changelog of this version of AngularJS">
|
||||
|
||||
@@ -279,20 +279,15 @@ construction and lookup of dependencies.
|
||||
|
||||
Here is an example of using the injector service:
|
||||
|
||||
First create an AngularJS module that will hold the service definition. (The empty array passed as
|
||||
the second parameter means that this module does not depend on any other modules.)
|
||||
|
||||
```js
|
||||
// Create a module to hold the service definition
|
||||
// Provide the wiring information in a module
|
||||
var myModule = angular.module('myModule', []);
|
||||
```
|
||||
|
||||
Teach the injector how to build a `greeter` service, which is just an object that contains a `greet`
|
||||
method. Notice that `greeter` is dependent on the `$window` service, which will be provided
|
||||
(injected into `greeter`) by the injector.
|
||||
Teach the injector how to build a `greeter` service. Notice that `greeter` is dependent on the
|
||||
`$window` service. The `greeter` service is an object that contains a `greet` method.
|
||||
|
||||
```js
|
||||
// Define the `greeter` service
|
||||
myModule.factory('greeter', function($window) {
|
||||
return {
|
||||
greet: function(text) {
|
||||
|
||||
@@ -17,8 +17,9 @@ attributes and tags. Read this document if you are planning on deploying your An
|
||||
on IE.
|
||||
|
||||
The project currently supports and will attempt to fix bugs for IE9 and above. The continuous
|
||||
integration server runs all unit tests against IE9, IE10, and IE11. See
|
||||
[CircleCI](https://circleci.com/gh/angular/workflows/angular.js/tree/master).
|
||||
integration server runs all the tests against IE9, IE10, and IE11. See
|
||||
[Travis CI](https://travis-ci.org/angular/angular.js) and
|
||||
[ci.angularjs.org](https://ci.angularjs.org).
|
||||
|
||||
We do not run tests on IE8 and below. A subset of the AngularJS functionality may work on these
|
||||
browsers, but it is up to you to test and decide whether it works for your particular app.
|
||||
|
||||
@@ -15,30 +15,6 @@ which drives many of these changes.
|
||||
* Several new features, especially animations, would not be possible without a few changes.
|
||||
* Finally, some outstanding bugs were best fixed by changing an existing API.
|
||||
|
||||
## Migrating from 1.7 to 1.8
|
||||
|
||||
Generally updating to 1.8.0 from 1.7.x should be a straightforward process and is highly recommended.
|
||||
AngularJS 1.8 is a breaking change release from 1.7 to mitigate a security issue.
|
||||
|
||||
JqLite no longer turns XHTML-like strings like `<div /><span />` to sibling elements when not in XHTML
|
||||
mode: `<div></div><span></span>`.
|
||||
Instead it will leave the elements alone. In non-XHTML mode the browser will convert these to nested
|
||||
elements: `<div><span></span></div>`.
|
||||
|
||||
This is a security fix to avoid an XSS vulnerability if a new jqLite element is created from a
|
||||
user-controlled HTML string. If you must have this functionality and understand the risk involved
|
||||
then it is posible to restore the original behavior by calling
|
||||
|
||||
```js
|
||||
angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement();
|
||||
```
|
||||
|
||||
But you should adjust your code for this change and remove your use of this function as soon as
|
||||
possible.
|
||||
|
||||
Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the
|
||||
[jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details about the workarounds.
|
||||
|
||||
|
||||
## Migrating from 1.6 to 1.7
|
||||
|
||||
@@ -601,7 +577,7 @@ orderByFilter(['a', undefined, 'o', null, 'z']);
|
||||
|
||||
|
||||
<a name="migrate1.6to1.7-ng-misc"></a>
|
||||
### Core: _Miscellaneous_
|
||||
### Core: _Misceallenous_
|
||||
|
||||
|
||||
#### **jqLite**
|
||||
|
||||
@@ -174,9 +174,8 @@ Yes, AngularJS can use [jQuery](http://jquery.com/) if it's present in your app
|
||||
application is being bootstrapped. If jQuery is not present in your script path, AngularJS falls back
|
||||
to its own implementation of the subset of jQuery that we call {@link angular.element jQLite}.
|
||||
|
||||
For AngularJS 1.8 we support jQuery 2.1+ but we suggest jQuery 3.5.1 or above to avoid a potential
|
||||
security issue. Earlier versions of jQuery might work correctly with AngularJS but we don't guarantee
|
||||
that.
|
||||
AngularJS 1.3 only supports jQuery 2.1 or above. jQuery 1.7 and newer might work correctly with AngularJS
|
||||
but we don't guarantee that.
|
||||
|
||||
|
||||
### What is testability like in AngularJS?
|
||||
|
||||
@@ -10,7 +10,7 @@ This page describes the support status of the significant versions of AngularJS.
|
||||
On July 1, 2018 AngularJS entered a 3 year Long Term Support period.
|
||||
</div>
|
||||
|
||||
Any version branch not shown in the following table (e.g. 1.7.x) is no longer being developed.
|
||||
Any version branch not shown in the following table (e.g. 1.6.x) is no longer being developed.
|
||||
|
||||
<table class="dev-status table table-bordered">
|
||||
<thead>
|
||||
@@ -23,7 +23,7 @@ Any version branch not shown in the following table (e.g. 1.7.x) is no longer be
|
||||
<td>Last version to provide IE 8 support</td>
|
||||
</tr>
|
||||
<tr class="stable">
|
||||
<td><span>1.8.x</span></td>
|
||||
<td><span>1.7.x</span></td>
|
||||
<td>Long Term Support</td>
|
||||
<td>See {@link version-support-status#long-term-support Long Term Support} section below.</td>
|
||||
</tr>
|
||||
@@ -32,13 +32,13 @@ Any version branch not shown in the following table (e.g. 1.7.x) is no longer be
|
||||
|
||||
### Long Term Support
|
||||
|
||||
On July 1st 2018, AngularJS entered a Long Term Support period.
|
||||
On July 1st 2018, AngularJS entered a Long Term Support period for AngularJS.
|
||||
|
||||
We now focus exclusively on providing fixes to bugs that satisfy at least one of the following criteria:
|
||||
|
||||
* A security flaw is detected in the 1.8.x branch of the framework
|
||||
* One of the major browsers releases a version that will cause current production applications using AngularJS 1.8.x to stop working
|
||||
* The jQuery library releases a version that will cause current production applications using AngularJS 1.8.x to stop working.
|
||||
* A security flaw is detected in the 1.7.x branch of the framework
|
||||
* One of the major browsers releases a version that will cause current production applications using AngularJS 1.7.x to stop working
|
||||
* The jQuery library releases a version that will cause current production applications using AngularJS 1.7.x to stop working.
|
||||
|
||||
AngularJS 1.2.x will get a new version if and only if a new severe security issue is discovered.
|
||||
|
||||
|
||||
@@ -34,16 +34,16 @@ Since we are using [npm][npm] to install client-side dependencies, this step upd
|
||||
"name": "angular-phonecat",
|
||||
...
|
||||
"dependencies": {
|
||||
"angular": "1.8.x",
|
||||
"angular-route": "1.8.x",
|
||||
"angular": "1.7.x",
|
||||
"angular-route": "1.7.x",
|
||||
"bootstrap": "3.3.x"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
The new dependency `"angular-route": "1.8.x"` tells npm to install a version of the angular-route
|
||||
module that is compatible with version 1.8.x of AngularJS. We must tell npm to download and install
|
||||
The new dependency `"angular-route": "1.7.x"` tells npm to install a version of the angular-route
|
||||
module that is compatible with version 1.7.x of AngularJS. We must tell npm to download and install
|
||||
this dependency.
|
||||
|
||||
```
|
||||
|
||||
@@ -32,17 +32,17 @@ Since we are using [npm][npm] to install client-side dependencies, this step upd
|
||||
"name": "angular-phonecat",
|
||||
...
|
||||
"dependencies": {
|
||||
"angular": "1.8.x",
|
||||
"angular-resource": "1.8.x",
|
||||
"angular-route": "1.8.x",
|
||||
"angular": "1.7.x",
|
||||
"angular-resource": "1.7.x",
|
||||
"angular-route": "1.7.x",
|
||||
"bootstrap": "3.3.x"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
The new dependency `"angular-resource": "1.8.x"` tells npm to install a version of the
|
||||
angular-resource module that is compatible with version 1.8.x of AngularJS. We must tell npm to
|
||||
The new dependency `"angular-resource": "1.7.x"` tells npm to install a version of the
|
||||
angular-resource module that is compatible with version 1.7.x of AngularJS. We must tell npm to
|
||||
download and install this dependency.
|
||||
|
||||
```
|
||||
|
||||
@@ -36,20 +36,20 @@ Since we are using [npm][npm] to install client-side dependencies, this step upd
|
||||
"name": "angular-phonecat",
|
||||
...
|
||||
"dependencies": {
|
||||
"angular": "1.8.x",
|
||||
"angular-animate": "1.8.x",
|
||||
"angular-resource": "1.8.x",
|
||||
"angular-route": "1.8.x",
|
||||
"angular": "1.7.x",
|
||||
"angular-animate": "1.7.x",
|
||||
"angular-resource": "1.7.x",
|
||||
"angular-route": "1.7.x",
|
||||
"bootstrap": "3.3.x",
|
||||
"jquery": "^3.5.1"
|
||||
"jquery": "3.3.x"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
* `"angular-animate": "1.8.x"` tells npm to install a version of the angular-animate module that
|
||||
is compatible with version 1.8.x of AngularJS.
|
||||
* `"jquery": "^3.5.1"` tells npm to install a version of jQuery that is compatible with 3.5.x and at least 3.5.1.
|
||||
* `"angular-animate": "1.7.x"` tells npm to install a version of the angular-animate module that
|
||||
is compatible with version 1.7.x of AngularJS.
|
||||
* `"jquery": "3.3.x"` tells npm to install the latest patch release of the 3.3 version of jQuery.
|
||||
Note that this is not an AngularJS library; it is the standard jQuery library. We can use npm to
|
||||
install a wide range of 3rd party libraries.
|
||||
|
||||
|
||||
+36
-3
@@ -169,9 +169,42 @@ module.exports = function(config, specificOptions) {
|
||||
});
|
||||
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
var buildLabel = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
|
||||
|
||||
// Karma (with socket.io 1.x) buffers by 50 and 50 tests can take a long time on IEs;-)
|
||||
config.browserNoActivityTimeout = 120000;
|
||||
|
||||
config.browserStack.build = buildLabel;
|
||||
config.browserStack.startTunnel = false;
|
||||
config.browserStack.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
||||
|
||||
config.sauceLabs.build = buildLabel;
|
||||
config.sauceLabs.startConnect = false;
|
||||
config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
||||
config.sauceLabs.recordScreenshots = true;
|
||||
|
||||
// Try 'websocket' for a faster transmission first. Fallback to 'polling' if necessary.
|
||||
config.transports = ['websocket', 'polling'];
|
||||
|
||||
// Debug logging into a file, that we print out at the end of the build.
|
||||
config.loggers.push({
|
||||
type: 'file',
|
||||
filename: process.env.LOGS_DIR + '/' + (specificOptions.logFile || 'karma.log')
|
||||
});
|
||||
|
||||
if (process.env.BROWSER_PROVIDER === 'saucelabs' || !process.env.BROWSER_PROVIDER) {
|
||||
// Allocating a browser can take pretty long (eg. if we are out of capacity and need to wait
|
||||
// for another build to finish) and so the `captureTimeout` typically kills
|
||||
// an in-queue-pending request, which makes no sense.
|
||||
config.captureTimeout = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Terrible hack to workaround inflexibility of log4js:
|
||||
// - ignore web-server's 404 warnings,
|
||||
// - ignore DEBUG logs (on CI), we log them into a file instead.
|
||||
// - ignore DEBUG logs (on Travis), we log them into a file instead.
|
||||
var IGNORED_404 = [
|
||||
'/favicon.ico',
|
||||
'/%7B%7BtestUrl%7D%7D',
|
||||
@@ -197,8 +230,8 @@ module.exports = function(config, specificOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
// on CI, ignore DEBUG statements
|
||||
if (process.env.CI && log.level.levelStr === config.LOG_DEBUG) {
|
||||
// on Travis, ignore DEBUG statements
|
||||
if (process.env.TRAVIS && log.level.levelStr === config.LOG_DEBUG) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var http = require('http');
|
||||
var BrowserStackTunnel = require('browserstacktunnel-wrapper');
|
||||
|
||||
var HOSTNAME = 'localhost';
|
||||
var PORTS = [9876, 8000];
|
||||
var ACCESS_KEY = process.env.BROWSER_STACK_ACCESS_KEY;
|
||||
var READY_FILE = process.env.BROWSER_PROVIDER_READY_FILE;
|
||||
var TUNNEL_IDENTIFIER = process.env.TRAVIS_JOB_NUMBER;
|
||||
|
||||
// We need to start fake servers, otherwise the tunnel does not start.
|
||||
var fakeServers = [];
|
||||
var hosts = [];
|
||||
|
||||
PORTS.forEach(function(port) {
|
||||
fakeServers.push(http.createServer(function() {}).listen(port));
|
||||
hosts.push({
|
||||
name: HOSTNAME,
|
||||
port: port,
|
||||
sslFlag: 0
|
||||
});
|
||||
});
|
||||
|
||||
var tunnel = new BrowserStackTunnel({
|
||||
key: ACCESS_KEY,
|
||||
localIdentifier: TUNNEL_IDENTIFIER,
|
||||
hosts: hosts
|
||||
});
|
||||
|
||||
console.log('Starting tunnel on ports', PORTS.join(', '));
|
||||
tunnel.start(function(error) {
|
||||
if (error) {
|
||||
console.error('Can not establish the tunnel', error);
|
||||
} else {
|
||||
console.log('Tunnel established.');
|
||||
fakeServers.forEach(function(server) {
|
||||
server.close();
|
||||
});
|
||||
|
||||
if (READY_FILE) {
|
||||
fs.writeFile(READY_FILE, '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tunnel.on('error', function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
|
||||
|
||||
node ./lib/browserstack/start_tunnel.js &
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
|
||||
echo "Shutting down Browserstack tunnel"
|
||||
echo "TODO: implement me"
|
||||
exit 1
|
||||
@@ -63,8 +63,8 @@ module.exports = function(grunt) {
|
||||
util.collectErrors();
|
||||
});
|
||||
|
||||
grunt.registerTask('firebaseDocsJsonForCI', function() {
|
||||
util.firebaseDocsJsonForCI();
|
||||
grunt.registerTask('firebaseDocsJsonForTravis', function() {
|
||||
util.firebaseDocsJsonForTravis();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
+7
-8
@@ -7,7 +7,6 @@ var spawn = require('npm-run').spawn;
|
||||
|
||||
var CSP_CSS_HEADER = '/* Include this file in your html if you are using the CSP mode. */\n\n';
|
||||
|
||||
const docsScriptFolder = 'scripts/docs.angularjs.org-firebase';
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -33,8 +32,8 @@ module.exports = {
|
||||
|
||||
|
||||
updateWebdriver: function(done) {
|
||||
if (process.env.CI) {
|
||||
// Skip the webdriver-manager update on CI, since the browsers will
|
||||
if (process.env.TRAVIS) {
|
||||
// Skip the webdriver-manager update on Travis, since the browsers will
|
||||
// be provided remotely.
|
||||
done();
|
||||
return;
|
||||
@@ -111,7 +110,7 @@ module.exports = {
|
||||
.replace(/\\/g, '\\\\')
|
||||
.replace(/'/g, '\\\'')
|
||||
.replace(/\r?\n/g, '\\n');
|
||||
js = '!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend(window.angular.element(\'<style>\').text(\'' + css + '\'));';
|
||||
js = '!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend(\'<style type="text/css">' + css + '</style>\');';
|
||||
state.js.push(js);
|
||||
|
||||
return state;
|
||||
@@ -303,11 +302,11 @@ module.exports = {
|
||||
};
|
||||
},
|
||||
|
||||
docsScriptFolder,
|
||||
|
||||
// Our Firebase projects are in subfolders, but the firebase tool expects them in the root,
|
||||
// Our Firebase projects are in subfolders, but Travis expects them in the root,
|
||||
// so we need to modify the upload folder path and copy the file into the root
|
||||
firebaseDocsJsonForCI: function() {
|
||||
firebaseDocsJsonForTravis: function() {
|
||||
var docsScriptFolder = 'scripts/docs.angularjs.org-firebase';
|
||||
|
||||
var fileName = docsScriptFolder + '/firebase.json';
|
||||
var json = grunt.file.readJSON(fileName);
|
||||
|
||||
|
||||
@@ -1,459 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -u -e -o pipefail
|
||||
|
||||
####################################################################################################
|
||||
# Some helper funtions
|
||||
|
||||
@echo() {
|
||||
echo "# $*"
|
||||
}
|
||||
|
||||
@warn() {
|
||||
@echo "Warning: $*" >&2
|
||||
}
|
||||
|
||||
@fail() {
|
||||
@echo "Error! $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
@remove() {
|
||||
local f="$1"
|
||||
if [[ -f ${f} ]]; then
|
||||
@echo "Removing ${f}"
|
||||
rm -f "${f}" || @fail "Can not delete ${f} file"
|
||||
fi
|
||||
}
|
||||
|
||||
@kill() {
|
||||
for p in $1; do
|
||||
if kill -0 ${p} >/dev/null 2>&1; then
|
||||
kill ${p}
|
||||
sleep 2
|
||||
if kill -0 ${p} >/dev/null 2>&1; then
|
||||
kill -9 ${p}
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@wait_for() {
|
||||
local m="$1"
|
||||
local f="$2"
|
||||
if [[ ! -f "${f}" ]]; then
|
||||
printf "# ${m} (${f})"
|
||||
while [[ ! -f "${f}" ]]; do
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
printf "\n"
|
||||
fi
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Sauce service functions
|
||||
|
||||
readonly SCRIPT_DIR=$(cd $(dirname $0); pwd)
|
||||
readonly TMP_DIR="/tmp/angular/sauce-service"
|
||||
mkdir -p ${TMP_DIR}
|
||||
|
||||
# Location for the saucelabs log file.
|
||||
readonly SAUCE_LOG_FILE="${TMP_DIR}/sauce-connect.log"
|
||||
|
||||
# Location for the saucelabs ready to connection process id lock file.
|
||||
readonly SAUCE_PID_FILE="${TMP_DIR}/sauce-connect.pid"
|
||||
|
||||
# Location for the saucelabs ready to connect lock file.
|
||||
readonly SAUCE_READY_FILE="${TMP_DIR}/sauce-connect.lock"
|
||||
|
||||
# Location for the saucelabs params file for use by test runner.
|
||||
readonly SAUCE_PARAMS_JSON_FILE="${TMP_DIR}/sauce-connect-params.json"
|
||||
|
||||
# Amount of seconds we wait for sauceconnect to establish a tunnel instance. In order to not
|
||||
# acquire CircleCI instances for too long if sauceconnect fails, we need a connect timeout.
|
||||
readonly SAUCE_READY_FILE_TIMEOUT=120
|
||||
|
||||
readonly SERVICE_LOCK_FILE="${TMP_DIR}/service.lock"
|
||||
readonly SERVICE_START_FILE="${TMP_DIR}/service.start"
|
||||
readonly SERVICE_PID_FILE="${TMP_DIR}/service.pid"
|
||||
readonly SERVICE_LOG_FILE="${TMP_DIR}/service.log"
|
||||
|
||||
service-setup-command() {
|
||||
if [[ -z "${SAUCE_USERNAME:-}" ]]; then
|
||||
@fail "SAUCE_USERNAME environment variable required"
|
||||
fi
|
||||
|
||||
if [[ -z "${SAUCE_ACCESS_KEY:-}" ]]; then
|
||||
@fail "SAUCE_ACCESS_KEY environment variable required"
|
||||
fi
|
||||
|
||||
if [[ -z "${SAUCE_TUNNEL_IDENTIFIER:-}" ]]; then
|
||||
@fail "SAUCE_TUNNEL_IDENTIFIER environment variable required"
|
||||
fi
|
||||
|
||||
local unameOut="$(uname -s)"
|
||||
case "${unameOut}" in
|
||||
Linux*) local machine=linux ;;
|
||||
Darwin*) local machine=darwin ;;
|
||||
CYGWIN*) local machine=windows ;;
|
||||
MINGW*) local machine=windows ;;
|
||||
MSYS_NT*) local machine=windows ;;
|
||||
*) local machine=linux
|
||||
printf "\nUnrecongized uname '${unameOut}'; defaulting to use node for linux.\n" >&2
|
||||
printf "Please file an issue to https://github.com/bazelbuild/rules_nodejs/issues if \n" >&2
|
||||
printf "you would like to add your platform to the supported rules_nodejs node platforms.\n\n" >&2
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${machine}" in
|
||||
# Path to sauce connect executable
|
||||
linux)
|
||||
if [[ -z "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
|
||||
# Started manually
|
||||
SAUCE_CONNECT="${SCRIPT_DIR}/../../node_modules/sauce-connect/bin/sc"
|
||||
else
|
||||
# Started via `bazel run`
|
||||
SAUCE_CONNECT="${BUILD_WORKSPACE_DIRECTORY}/node_modules/sauce-connect/bin/sc"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [[ -z "${SAUCE_CONNECT:-}" ]]; then
|
||||
@fail "SAUCE_CONNECT environment variable is required on non-linux environments"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ! -f ${SAUCE_CONNECT} ]]; then
|
||||
@fail "sc binary not found at ${SAUCE_CONNECT}"
|
||||
fi
|
||||
|
||||
echo "{ \"SAUCE_USERNAME\": \"${SAUCE_USERNAME}\", \"SAUCE_ACCESS_KEY\": \"${SAUCE_ACCESS_KEY}\", \"SAUCE_TUNNEL_IDENTIFIER\": \"${SAUCE_TUNNEL_IDENTIFIER}\", \"SAUCE_LOCALHOST_ALIAS_DOMAIN\": \"${SAUCE_LOCALHOST_ALIAS_DOMAIN:-}\" }" > ${SAUCE_PARAMS_JSON_FILE}
|
||||
|
||||
# Command arguments that will be passed to sauce-connect.
|
||||
# By default we disable SSL bumping for all requests. This is because SSL bumping is
|
||||
# not needed for our test setup and in order to perform the SSL bumping, Saucelabs
|
||||
# intercepts all HTTP requests in the tunnel VM and modifies them. This can cause
|
||||
# flakiness as it makes all requests dependent on the SSL bumping middleware.
|
||||
# See: https://wiki.saucelabs.com/display/DOCS/Troubleshooting+Sauce+Connect#TroubleshootingSauceConnect-DisablingSSLBumping
|
||||
local sauce_args=(
|
||||
"--no-ssl-bump-domains all"
|
||||
"--logfile ${SAUCE_LOG_FILE}"
|
||||
"--pidfile ${SAUCE_PID_FILE}"
|
||||
"--readyfile ${SAUCE_READY_FILE}"
|
||||
"--tunnel-identifier ${SAUCE_TUNNEL_IDENTIFIER}"
|
||||
"--user ${SAUCE_USERNAME}"
|
||||
# Don't add the --api-key here so we don't echo it out in service-pre-start
|
||||
)
|
||||
|
||||
if [[ -n "${SAUCE_LOCALHOST_ALIAS_DOMAIN:-}" ]]; then
|
||||
# Ensures that requests to the localhost alias domain are always resolved through the tunnel.
|
||||
# This environment variable is usually configured on CI, and refers to a domain that has been
|
||||
# locally configured in the current machine's hosts file (e.g. `/etc/hosts`). The domain should
|
||||
# resolve to the current machine in Saucelabs VMs, so we need to ensure that it is resolved
|
||||
# through the tunnel we going to create.
|
||||
sauce_args+=("--tunnel-domains ${SAUCE_LOCALHOST_ALIAS_DOMAIN}")
|
||||
fi
|
||||
|
||||
@echo "Sauce connect will be started with:"
|
||||
echo " ${SAUCE_CONNECT} ${sauce_args[@]}"
|
||||
SERVICE_COMMAND="${SAUCE_CONNECT} ${sauce_args[@]} --api-key ${SAUCE_ACCESS_KEY}"
|
||||
}
|
||||
|
||||
# Called by pre-start & post-stop
|
||||
service-cleanup() {
|
||||
if [[ -f "${SAUCE_PID_FILE}" ]]; then
|
||||
local p=$(cat "${SAUCE_PID_FILE}")
|
||||
@echo "Stopping Sauce Connect (pid $p)..."
|
||||
@kill $p
|
||||
fi
|
||||
@remove "${SAUCE_PID_FILE}"
|
||||
@remove "${SAUCE_READY_FILE}"
|
||||
@remove "${SAUCE_PARAMS_JSON_FILE}"
|
||||
}
|
||||
|
||||
# Called before service is setup
|
||||
service-pre-setup() {
|
||||
service-cleanup
|
||||
}
|
||||
|
||||
# Called after service is setup
|
||||
service-post-setup() {
|
||||
@echo " sauce params : ${SAUCE_PARAMS_JSON_FILE}"
|
||||
}
|
||||
|
||||
# Called before service is started
|
||||
service-pre-start() {
|
||||
return
|
||||
}
|
||||
|
||||
# Called after service is started
|
||||
service-post-start() {
|
||||
if [[ ! -f "${SAUCE_PID_FILE}" ]]; then
|
||||
printf "# Waiting for Sauce Connect Proxy process (${SAUCE_PID_FILE})"
|
||||
while [[ ! -f "${SAUCE_PID_FILE}" ]]; do
|
||||
if ! @serviceStatus >/dev/null 2>&1; then
|
||||
printf "\n"
|
||||
@serviceStop
|
||||
@echo "Service failed to start!"
|
||||
service-failed-setup
|
||||
exit 1
|
||||
fi
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
printf "\n"
|
||||
fi
|
||||
@echo "Sauce Connect Proxy started (pid $(cat "${SAUCE_PID_FILE}"))"
|
||||
}
|
||||
|
||||
# Called if service fails to start
|
||||
service-failed-setup() {
|
||||
if [[ -f "${SERVICE_LOG_FILE}" ]]; then
|
||||
@echo "tail ${SERVICE_LOG_FILE}:"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
tail "${SERVICE_LOG_FILE}"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
echo "^^^^^ ${SERVICE_LOG_FILE} ^^^^^"
|
||||
fi
|
||||
}
|
||||
|
||||
# Called by ready-wait action
|
||||
service-ready-wait() {
|
||||
if [[ ! -f "${SAUCE_PID_FILE}" ]]; then
|
||||
@fail "Sauce Connect not running"
|
||||
fi
|
||||
if [[ ! -f "${SAUCE_READY_FILE}" ]]; then
|
||||
# Wait for saucelabs tunnel to connect
|
||||
printf "# Waiting for saucelabs tunnel to connect (${SAUCE_READY_FILE})"
|
||||
counter=0
|
||||
while [[ ! -f "${SAUCE_READY_FILE}" ]]; do
|
||||
counter=$((counter + 1))
|
||||
|
||||
# Counter needs to be multiplied by two because the while loop only sleeps a half second.
|
||||
# This has been made in favor of better progress logging (printing dots every half second)
|
||||
if [ $counter -gt $[${SAUCE_READY_FILE_TIMEOUT} * 2] ]; then
|
||||
@echo "Timed out after ${SAUCE_READY_FILE_TIMEOUT} seconds waiting for tunnel ready file."
|
||||
if [[ -f "${SAUCE_LOG_FILE}" ]]; then
|
||||
echo "================================================================================"
|
||||
echo "${SAUCE_LOG_FILE}:"
|
||||
cat "${SAUCE_LOG_FILE}"
|
||||
fi
|
||||
exit 5
|
||||
fi
|
||||
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
printf "\n"
|
||||
@echo "Saucelabs tunnel connected"
|
||||
else
|
||||
@echo "Saucelabs tunnel already connected"
|
||||
fi
|
||||
}
|
||||
|
||||
# Called before service is stopped
|
||||
service-pre-stop() {
|
||||
return
|
||||
}
|
||||
|
||||
# Called after service is stopped
|
||||
service-post-stop() {
|
||||
service-cleanup
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Generic service functions
|
||||
# This uses functions setup above but nothing below should be specific to saucelabs
|
||||
|
||||
@serviceLock() {
|
||||
# Check is Lock File exists, if not create it and set trap on exit
|
||||
printf "# Waiting for service action lock (${SERVICE_LOCK_FILE})"
|
||||
while true; do
|
||||
if { set -C; 2>/dev/null >"${SERVICE_LOCK_FILE}"; }; then
|
||||
trap "rm -f \"${SERVICE_LOCK_FILE}\"" EXIT
|
||||
printf "\n"
|
||||
break
|
||||
fi
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
@echo "Acquired service action lock"
|
||||
}
|
||||
|
||||
@serviceStatus() {
|
||||
if [ -f "${SERVICE_PID_FILE}" ] && [ ! -z "$(cat "${SERVICE_PID_FILE}")" ]; then
|
||||
local p=$(cat "${SERVICE_PID_FILE}")
|
||||
|
||||
if kill -0 $p >/dev/null 2>&1; then
|
||||
@echo "Service is running (pid $p)"
|
||||
return 0
|
||||
else
|
||||
@echo "Service is not running (process PID $p not exists)"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
@echo "Service is not running"
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
@serviceSetup() {
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
@echo "Service already running (pid $(cat "${SERVICE_PID_FILE}"))"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@echo "Setting up service..."
|
||||
@remove "${SERVICE_PID_FILE}"
|
||||
@remove "${SERVICE_START_FILE}"
|
||||
touch "${SERVICE_LOG_FILE}" >/dev/null 2>&1 || @fail "Can not create ${SERVICE_LOG_FILE} file"
|
||||
@echo " service pid : ${SERVICE_PID_FILE}"
|
||||
@echo " service logs : ${SERVICE_LOG_FILE}"
|
||||
service-pre-setup
|
||||
service-setup-command
|
||||
|
||||
(
|
||||
(
|
||||
if [[ -z "${SERVICE_COMMAND:-}" ]]; then
|
||||
@fail "No SERVICE_COMMAND is set"
|
||||
fi
|
||||
@wait_for "Waiting for start file" "${SERVICE_START_FILE}"
|
||||
${SERVICE_COMMAND}
|
||||
) >>"${SERVICE_LOG_FILE}" 2>&1
|
||||
) &
|
||||
echo $! >"${SERVICE_PID_FILE}"
|
||||
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
@echo "Service setup (pid $(cat "${SERVICE_PID_FILE}"))"
|
||||
service-post-setup
|
||||
else
|
||||
@echo "Error setting up Service!"
|
||||
service-failed-setup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
@serviceStart() {
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
@echo "Service already setup (pid $(cat "${SERVICE_PID_FILE}"))"
|
||||
else
|
||||
@serviceSetup
|
||||
fi
|
||||
if [[ -f "${SERVICE_START_FILE}" ]]; then
|
||||
@echo "Service already started"
|
||||
else
|
||||
@echo "Starting service..."
|
||||
service-pre-start
|
||||
touch "${SERVICE_START_FILE}" >/dev/null 2>&1 || @err "Can not create ${SERVICE_START_FILE} file"
|
||||
service-post-start
|
||||
@echo "Service started"
|
||||
fi
|
||||
}
|
||||
|
||||
@serviceStop() {
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
touch "${SERVICE_PID_FILE}" >/dev/null 2>&1 || @fail "Can not touch ${SERVICE_PID_FILE} file"
|
||||
|
||||
service-pre-stop
|
||||
@echo "Stopping sevice (pid $(cat "${SERVICE_PID_FILE}"))..."
|
||||
@kill $(cat "${SERVICE_PID_FILE}")
|
||||
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
@fail "Error stopping Service! Service already running with PID $(cat "${SERVICE_PID_FILE}")"
|
||||
else
|
||||
@echo "Service stopped"
|
||||
@remove "${SERVICE_PID_FILE}"
|
||||
@remove "${SERVICE_START_FILE}"
|
||||
service-post-stop
|
||||
fi
|
||||
|
||||
return 0
|
||||
else
|
||||
@warn "Service is not running"
|
||||
@remove "${SERVICE_PID_FILE}"
|
||||
@remove "${SERVICE_START_FILE}"
|
||||
service-post-stop
|
||||
fi
|
||||
}
|
||||
|
||||
@serviceStartReadyWait() {
|
||||
@serviceStart
|
||||
@serviceReadyWait
|
||||
}
|
||||
|
||||
@serviceReadyWait() {
|
||||
service-ready-wait
|
||||
}
|
||||
|
||||
@serviceRestart() {
|
||||
@serviceStop
|
||||
@serviceStart
|
||||
}
|
||||
|
||||
@serviceTail() {
|
||||
@echo "tail ${SERVICE_LOG_FILE}:"
|
||||
tail -f "${SERVICE_LOG_FILE}"
|
||||
}
|
||||
|
||||
@serviceLog() {
|
||||
@echo "cat ${SERVICE_LOG_FILE}:"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
cat "${SERVICE_LOG_FILE}"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
echo "^^^^^ ${SERVICE_LOG_FILE} ^^^^^"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
setup)
|
||||
@serviceLock
|
||||
@serviceSetup
|
||||
;;
|
||||
start)
|
||||
@serviceLock
|
||||
@serviceStart
|
||||
;;
|
||||
start-ready-wait)
|
||||
@serviceLock
|
||||
@serviceStartReadyWait
|
||||
;;
|
||||
ready-wait)
|
||||
@serviceLock
|
||||
@serviceReadyWait
|
||||
;;
|
||||
stop)
|
||||
@serviceLock
|
||||
@serviceStop
|
||||
;;
|
||||
restart)
|
||||
@serviceLock
|
||||
@serviceRestart
|
||||
;;
|
||||
status)
|
||||
@serviceLock
|
||||
@serviceStatus
|
||||
;;
|
||||
run)
|
||||
(
|
||||
service-setup-command
|
||||
if [[ -z "${SERVICE_COMMAND:-}" ]]; then
|
||||
@fail "No SERVICE_COMMAND is set"
|
||||
fi
|
||||
${SERVICE_COMMAND}
|
||||
)
|
||||
;;
|
||||
log)
|
||||
@serviceLog
|
||||
;;
|
||||
tail)
|
||||
@serviceTail
|
||||
;;
|
||||
*)
|
||||
@echo "Actions: [setup|start|start-read-wait|ready-wait|stop|restart|status|run|tail]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Setup and start Sauce Connect for your TravisCI build
|
||||
# This script requires your .travis.yml to include the following two private env variables:
|
||||
# SAUCE_USERNAME
|
||||
# SAUCE_ACCESS_KEY
|
||||
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
|
||||
#
|
||||
# Curl and run this script as part of your .travis.yml before_script section:
|
||||
# before_script:
|
||||
# - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
|
||||
SC_VERSION="4.5.2"
|
||||
CONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-linux.tar.gz"
|
||||
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
|
||||
CONNECT_DOWNLOAD="sc-$SC_VERSION-linux.tar.gz"
|
||||
|
||||
# We don't want to create a log file because sauceconnect always logs in verbose mode. This seems
|
||||
# to be overwhelming Travis and causing flakes when we are cat-ing the log in "print_logs.sh"
|
||||
CONNECT_LOG="/dev/null"
|
||||
|
||||
# Get Connect and start it
|
||||
mkdir -p $CONNECT_DIR
|
||||
cd $CONNECT_DIR
|
||||
curl $CONNECT_URL -o $CONNECT_DOWNLOAD 2> /dev/null 1> /dev/null
|
||||
mkdir sauce-connect
|
||||
tar --extract --file=$CONNECT_DOWNLOAD --strip-components=1 --directory=sauce-connect > /dev/null
|
||||
rm $CONNECT_DOWNLOAD
|
||||
|
||||
SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
|
||||
|
||||
|
||||
ARGS=""
|
||||
|
||||
# Set tunnel-id only on Travis, to make local testing easier.
|
||||
if [ ! -z "$TRAVIS_JOB_NUMBER" ]; then
|
||||
ARGS="$ARGS --tunnel-identifier $TRAVIS_JOB_NUMBER"
|
||||
fi
|
||||
if [ ! -z "$BROWSER_PROVIDER_READY_FILE" ]; then
|
||||
ARGS="$ARGS --readyfile $BROWSER_PROVIDER_READY_FILE"
|
||||
fi
|
||||
|
||||
|
||||
echo "Starting Sauce Connect in the background"
|
||||
sauce-connect/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY $ARGS \
|
||||
--logfile $CONNECT_LOG &
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
|
||||
echo "Shutting down Sauce Connect tunnel"
|
||||
|
||||
killall sc
|
||||
|
||||
while [[ -n `ps -ef | grep "sauce-connect-" | grep -v "grep"` ]]; do
|
||||
printf "."
|
||||
sleep .5
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Sauce Connect tunnel has been shut down"
|
||||
@@ -65,7 +65,7 @@ var getCodeName = function(tagName) {
|
||||
|
||||
|
||||
/**
|
||||
* Compute a build segment for the version, from the CI build number and current commit SHA
|
||||
* Compute a build segment for the version, from the Jenkins build number and current commit SHA
|
||||
* @return {String} The build segment of the version
|
||||
*/
|
||||
function getBuild() {
|
||||
@@ -189,7 +189,7 @@ var getSnapshotVersion = function() {
|
||||
// We need to clone to ensure that we are not modifying another version
|
||||
version = semver(version.raw);
|
||||
|
||||
var ciBuild = process.env.CIRCLE_BUILD_NUM || process.env.BUILD_NUMBER;
|
||||
var jenkinsBuild = process.env.TRAVIS_BUILD_NUMBER || process.env.BUILD_NUMBER;
|
||||
if (!version.prerelease || !version.prerelease.length) {
|
||||
// last release was a non beta release. Increment the patch level to
|
||||
// indicate the next release that we will be doing.
|
||||
@@ -203,7 +203,7 @@ var getSnapshotVersion = function() {
|
||||
// as this is bigger than 1.3.0-beta.2 according to semver
|
||||
version.patch++;
|
||||
}
|
||||
version.prerelease = ciBuild ? ['build', ciBuild] : ['local'];
|
||||
version.prerelease = jenkinsBuild ? ['build', jenkinsBuild] : ['local'];
|
||||
version.build = getBuild();
|
||||
version.codeName = 'snapshot';
|
||||
version.isSnapshot = true;
|
||||
|
||||
+20
-24
@@ -2,15 +2,15 @@
|
||||
"name": "angular",
|
||||
"license": "MIT",
|
||||
"branchVersion": "^1.7.0",
|
||||
"branchPattern": "1.8.*",
|
||||
"distTag": "next",
|
||||
"branchPattern": "1.7.*",
|
||||
"distTag": "latest",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.14.1",
|
||||
"yarn": ">=1.21.1",
|
||||
"node": ">=8.12.0",
|
||||
"yarn": ">=1.10.1",
|
||||
"grunt-cli": "^1.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"angular-benchpress": "0.x.x",
|
||||
"benchmark": "1.x.x",
|
||||
"bootstrap": "3.1.1",
|
||||
"browserstacktunnel-wrapper": "2.0.4",
|
||||
"browserstacktunnel-wrapper": "2.0.0",
|
||||
"canonical-path": "0.0.2",
|
||||
"changez": "^2.1.1",
|
||||
"changez-angular": "^2.1.2",
|
||||
@@ -35,7 +35,6 @@
|
||||
"dgeni-packages": "^0.26.5",
|
||||
"eslint-plugin-promise": "^3.6.0",
|
||||
"event-stream": "~3.1.0",
|
||||
"firebase-tools": "^8.3.0",
|
||||
"glob": "^6.0.1",
|
||||
"google-code-prettify": "1.0.1",
|
||||
"grunt": "^1.0.1",
|
||||
@@ -60,21 +59,21 @@
|
||||
"jasmine-core": "^2.8.0",
|
||||
"jasmine-node": "^2.0.0",
|
||||
"jasmine-reporters": "^2.2.0",
|
||||
"jquery": "3.5.1",
|
||||
"jquery": "3.2.1",
|
||||
"jquery-2.1": "npm:jquery@2.1.4",
|
||||
"jquery-2.2": "npm:jquery@2.2.4",
|
||||
"karma": "4.4.1",
|
||||
"karma-browserstack-launcher": "1.5.1",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-edge-launcher": "0.4.2",
|
||||
"karma-firefox-launcher": "1.2.0",
|
||||
"karma-ie-launcher": "1.0.0",
|
||||
"karma": "^3.1.4",
|
||||
"karma-browserstack-launcher": "^1.3.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-edge-launcher": "^0.4.2",
|
||||
"karma-firefox-launcher": "^1.1.0",
|
||||
"karma-ie-launcher": "^1.0.0",
|
||||
"karma-jasmine": "^1.1.2",
|
||||
"karma-junit-reporter": "2.0.1",
|
||||
"karma-safari-launcher": "1.0.0",
|
||||
"karma-sauce-launcher": "2.0.2",
|
||||
"karma-script-launcher": "1.0.0",
|
||||
"karma-spec-reporter": "0.0.32",
|
||||
"karma-junit-reporter": "^1.2.0",
|
||||
"karma-safari-launcher": "^1.0.0",
|
||||
"karma-sauce-launcher": "^2.0.2",
|
||||
"karma-script-launcher": "^1.0.0",
|
||||
"karma-spec-reporter": "^0.0.32",
|
||||
"load-grunt-tasks": "^3.5.0",
|
||||
"lodash": "~2.4.1",
|
||||
"log4js": "^0.6.27",
|
||||
@@ -84,12 +83,11 @@
|
||||
"npm-run": "^4.1.0",
|
||||
"open-sans-fontface": "^1.4.0",
|
||||
"promises-aplus-tests": "~2.1.0",
|
||||
"protractor": "^7.0.0",
|
||||
"protractor": "^5.4.1",
|
||||
"q": "~1.0.0",
|
||||
"q-io": "^1.10.9",
|
||||
"qq": "^0.3.5",
|
||||
"rewire": "~2.1.0",
|
||||
"sauce-connect": "https://saucelabs.com/downloads/sc-4.5.1-linux.tar.gz",
|
||||
"sax": "^1.1.1",
|
||||
"selenium-webdriver": "^4.0.0-alpha.1",
|
||||
"semver": "^5.4.1",
|
||||
@@ -103,10 +101,8 @@
|
||||
"dependencies": {},
|
||||
"resolutions": {
|
||||
"//1": "`natives@1.1.0` does not work with Node.js 10.x on Windows 10",
|
||||
"//2": "(E.g. see https://github.com/gulpjs/gulp/issues/2162 and https://github.com/nodejs/node/issues/25132.)",
|
||||
"natives": "1.1.6",
|
||||
"//3": "`graceful-fs` needs to be pinned to support gulp 3, on Node v12+",
|
||||
"graceful-fs": "^4.2.3"
|
||||
"//2": "(E.g. see https://github.com/gulpjs/gulp/issues/2162.)",
|
||||
"natives": "1.1.3"
|
||||
},
|
||||
"commitplease": {
|
||||
"style": "angular",
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('./protractor-shared-conf').config;
|
||||
|
||||
|
||||
// Using SauceLabs.
|
||||
config.capabilities = undefined;
|
||||
config.sauceUser = process.env.SAUCE_USERNAME;
|
||||
config.sauceKey = process.env.SAUCE_ACCESS_KEY;
|
||||
config.multiCapabilities = [
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'chrome',
|
||||
platform: 'OS X 10.14',
|
||||
version: '81'
|
||||
}),
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'firefox',
|
||||
platform: 'OS X 10.14',
|
||||
version: '76'
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
config.allScriptsTimeout = 30000;
|
||||
config.getPageTimeout = 30000;
|
||||
|
||||
exports.config = config;
|
||||
|
||||
|
||||
function capabilitiesForSauceLabs(capabilities) {
|
||||
return {
|
||||
'tunnel-identifier': process.env.SAUCE_TUNNEL_IDENTIFIER,
|
||||
|
||||
'name': 'AngularJS E2E',
|
||||
'build': `${process.env.CIRCLE_BUILD_NUM}-${process.env.CIRCLE_NODE_INDEX}`,
|
||||
|
||||
'browserName': capabilities.browserName,
|
||||
'platform': capabilities.platform,
|
||||
'version': capabilities.version,
|
||||
'elementScrollBehavior': 1,
|
||||
// Allow e2e test sessions to run for a maximum of 40 minutes, instead of the default 30 minutes.
|
||||
'maxDuration': 2400
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
|
||||
specs: [
|
||||
'test/e2e/tests/**/*.js',
|
||||
'build/docs/ptore2e/**/*.js',
|
||||
'docs/app/e2e/*.scenario.js'
|
||||
],
|
||||
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
},
|
||||
|
||||
baseUrl: 'http://localhost:8000/',
|
||||
|
||||
framework: 'jasmine2',
|
||||
|
||||
onPrepare: function() {
|
||||
/* global angular: false, browser: false, jasmine: false */
|
||||
|
||||
// Disable animations so e2e tests run more quickly
|
||||
var disableNgAnimate = function() {
|
||||
angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
|
||||
$animate.enabled(false);
|
||||
}]);
|
||||
};
|
||||
|
||||
browser.addMockModule('disableNgAnimate', disableNgAnimate);
|
||||
|
||||
var reporters = require('jasmine-reporters');
|
||||
jasmine.getEnv().addReporter(new reporters.JUnitXmlReporter({
|
||||
savePath: 'test_out/docs-e2e-' + exports.config.capabilities.browserName + '-'
|
||||
}));
|
||||
},
|
||||
|
||||
jasmineNodeOpts: {
|
||||
defaultTimeoutInterval: 30000,
|
||||
showColors: false
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,86 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('./protractor-shared-conf').config;
|
||||
|
||||
if (process.env.BROWSER_PROVIDER === 'browserstack') {
|
||||
// Using BrowserStack.
|
||||
config.seleniumAddress = 'http://hub.browserstack.com/wd/hub';
|
||||
config.multiCapabilities = [
|
||||
capabilitiesForBrowserStack({
|
||||
browserName: 'chrome',
|
||||
platform: 'MAC',
|
||||
version: '49'
|
||||
}),
|
||||
capabilitiesForBrowserStack({
|
||||
browserName: 'firefox',
|
||||
version: '47'
|
||||
}),
|
||||
capabilitiesForBrowserStack({
|
||||
browserName: 'safari',
|
||||
platform: 'MAC',
|
||||
version: '9'
|
||||
})
|
||||
];
|
||||
} else {
|
||||
// Using SauceLabs.
|
||||
config.sauceUser = process.env.SAUCE_USERNAME;
|
||||
config.sauceKey = process.env.SAUCE_ACCESS_KEY;
|
||||
config.multiCapabilities = [
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'chrome',
|
||||
platform: 'OS X 10.11',
|
||||
version: '48'
|
||||
}),
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'firefox',
|
||||
version: '47'
|
||||
}),
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'safari',
|
||||
platform: 'OS X 10.11',
|
||||
version: '9'
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
config.allScriptsTimeout = 30000;
|
||||
config.getPageTimeout = 30000;
|
||||
|
||||
exports.config = config;
|
||||
|
||||
|
||||
function capabilitiesForBrowserStack(capabilities) {
|
||||
return {
|
||||
'browserstack.user': process.env.BROWSER_STACK_USERNAME,
|
||||
'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
|
||||
'browserstack.local': 'true',
|
||||
'browserstack.debug': 'true',
|
||||
'browserstack.tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
'tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
|
||||
'name': 'AngularJS E2E',
|
||||
'build': process.env.TRAVIS_BUILD_NUMBER,
|
||||
|
||||
'browserName': capabilities.browserName,
|
||||
'platform': capabilities.platform,
|
||||
'version': capabilities.version,
|
||||
'elementScrollBehavior': 1
|
||||
};
|
||||
}
|
||||
|
||||
function capabilitiesForSauceLabs(capabilities) {
|
||||
return {
|
||||
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
|
||||
'name': 'AngularJS E2E',
|
||||
'build': process.env.TRAVIS_BUILD_NUMBER,
|
||||
|
||||
'browserName': capabilities.browserName,
|
||||
'platform': capabilities.platform,
|
||||
'version': capabilities.version,
|
||||
'elementScrollBehavior': 1,
|
||||
// Allow e2e test sessions to run for a maximum of 35 minutes, instead of the default 30 minutes.
|
||||
'maxDuration': 2100
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Tags a release
|
||||
# so that travis can do the actual release.
|
||||
|
||||
echo "#################################"
|
||||
echo "## Tag angular.js for a release #"
|
||||
|
||||
@@ -27,7 +27,7 @@ function prepare {
|
||||
for repo in "${REPOS[@]}"
|
||||
do
|
||||
echo "-- Cloning bower-$repo"
|
||||
git clone https://github.com/angular/bower-$repo.git $TMP_DIR/bower-$repo --depth=1
|
||||
git clone git@github.com:angular/bower-$repo.git $TMP_DIR/bower-$repo --depth=1
|
||||
done
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const functions = require('firebase-functions');
|
||||
const {Storage} = require('@google-cloud/storage');
|
||||
const gcs = require('@google-cloud/storage')();
|
||||
const path = require('path');
|
||||
|
||||
const storage = new Storage();
|
||||
const gcsBucketId = `${process.env.GCLOUD_PROJECT}.appspot.com`;
|
||||
|
||||
const BROWSER_CACHE_DURATION = 60 * 10;
|
||||
const CDN_CACHE_DURATION = 60 * 60 * 12;
|
||||
|
||||
function sendStoredFile(request, response) {
|
||||
// Request paths will be URI-encoded, so we need to decode them to match the file names in the
|
||||
// storage bucket. Failing to do so will result in a 404 error from the bucket and `index.html`
|
||||
// will be returned instead.
|
||||
// Example of path requiring decoding: `.../input%5Btext%5D.html` --> `.../input[text].html`
|
||||
const requestPath = decodeURI(request.path || '/');
|
||||
const requestPath = request.path || '/';
|
||||
let filePathSegments = requestPath.split('/').filter((segment) => {
|
||||
// Remove empty leading or trailing path parts
|
||||
return segment !== '';
|
||||
@@ -24,7 +19,7 @@ function sendStoredFile(request, response) {
|
||||
const version = filePathSegments[0];
|
||||
const isDocsPath = filePathSegments[1] === 'docs';
|
||||
const lastSegment = filePathSegments[filePathSegments.length - 1];
|
||||
const bucket = storage.bucket(gcsBucketId);
|
||||
const bucket = gcs.bucket(gcsBucketId);
|
||||
|
||||
let downloadSource;
|
||||
let fileName;
|
||||
@@ -200,12 +195,12 @@ const snapshotRegex = /^snapshot(-stable)?\//;
|
||||
* When a new zip file is uploaded into snapshot or snapshot-stable,
|
||||
* delete the previous zip file.
|
||||
*/
|
||||
function deleteOldSnapshotZip(object) {
|
||||
function deleteOldSnapshotZip(object, context) {
|
||||
const bucketId = object.bucket;
|
||||
const filePath = object.name;
|
||||
const contentType = object.contentType;
|
||||
|
||||
const bucket = storage.bucket(bucketId);
|
||||
const bucket = gcs.bucket(bucketId);
|
||||
|
||||
const snapshotFolderMatch = filePath.match(snapshotRegex);
|
||||
|
||||
|
||||
+3084
-1369
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,10 @@
|
||||
{
|
||||
"name": "functions-firebase-code.angularjs.org",
|
||||
"description": "Cloud Functions to serve files from gcs to code.angularjs.org",
|
||||
"engines": {
|
||||
"node": "10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@google-cloud/storage": "^4.7.0",
|
||||
"firebase-admin": "^8.10.0",
|
||||
"firebase-functions": "^3.6.0"
|
||||
"@google-cloud/storage": "^1.1.1",
|
||||
"firebase-admin": "^5.11.0",
|
||||
"firebase-functions": "^1.0.4"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ in functions/index.js that serves the docs from the Firebase Google Cloud Storag
|
||||
functions/index.js also contains a rule that deletes outdated build zip files
|
||||
from the snapshot and snapshot-stable folders when new zip files are uploaded.
|
||||
|
||||
The deployment to the Google Cloud Storage bucket happens automatically via CI.
|
||||
See the .circleci/config.yml file in the repository root.
|
||||
The deployment to the Google Cloud Storage bucket happens automatically via Travis. See the travis.yml
|
||||
file in the repository root.
|
||||
|
||||
See /readme.firebase.docs.md for the firebase deployment to docs.angularjs.org
|
||||
@@ -25,7 +25,7 @@ function init {
|
||||
function prepare {
|
||||
|
||||
echo "-- Cloning code.angularjs.org"
|
||||
git clone https://github.com/angular/code.angularjs.org $REPO_DIR --depth=1
|
||||
git clone git@github.com:angular/code.angularjs.org.git $REPO_DIR --depth=1
|
||||
|
||||
echo "-- Updating code.angularjs.org"
|
||||
|
||||
@@ -63,7 +63,7 @@ function _update_code() {
|
||||
|
||||
function publish {
|
||||
# publish updates the code.angularjs.org Github repository
|
||||
# the deployment to Firebase happens via CI
|
||||
# the deployment to Firebase happens via Travis
|
||||
_update_code
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,8 +10,8 @@
|
||||
"logs": "firebase functions:log"
|
||||
},
|
||||
"dependencies": {
|
||||
"firebase-admin": "^8.10.0",
|
||||
"firebase-functions": "^3.6.0"
|
||||
"firebase-admin": "~5.8.1",
|
||||
"firebase-functions": "^0.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^4.12.0",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,23 +3,18 @@ Firebase for docs.angularjs.org
|
||||
|
||||
# Continuous integration
|
||||
|
||||
The docs are deployed to Google Firebase hosting via a CI deployment config, which expects
|
||||
firebase.json to be in the repository root, which is done by a Grunt task
|
||||
(`firebaseDocsJsonForCI` which is included in `prepareDeploy`).
|
||||
The `firebaseDocsJsonForCI` task modifies the paths in the `firebase.json` and copies it to the
|
||||
repository root.
|
||||
The docs are deployed to Google Firebase hosting via Travis deployment config, which expects
|
||||
firebase.json in the repository root, which is done by a Grunt task (firebaseDocsJsonForTravis)
|
||||
that modifies the paths in the firebase.json and copies it into the repository root.
|
||||
|
||||
See .circleci/config.yml for the complete deployment config and build steps.
|
||||
See travis.yml for the complete deployment config, and scripts/travis/build.sh for the full deployment
|
||||
build steps.
|
||||
|
||||
# Serving locally:
|
||||
|
||||
- Run `yarn grunt package`.
|
||||
This builds the files that will be deployed.
|
||||
|
||||
- Run `yarn grunt prepareDeploy`.
|
||||
- Run `grunt:prepareDeploy`.
|
||||
This copies docs content files into deploy/docs and the partials for Search Engine AJAX
|
||||
Crawling into ./functions/content.
|
||||
It also moves the firebase.json file to the root folder, where the firebase-cli expects it
|
||||
|
||||
- Run `firebase serve --only functions,hosting`
|
||||
Creates a server at localhost:5000 that serves from deploy/docs and uses the local function
|
||||
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "#################################"
|
||||
echo "#### Jenkins Build ############"
|
||||
echo "#################################"
|
||||
|
||||
source scripts/jenkins/init-node.sh
|
||||
|
||||
# Enable tracing and exit on first failure
|
||||
set -xe
|
||||
|
||||
# This is the default set of browsers to use on the CI server unless overridden via env variable
|
||||
if [[ -z "$BROWSERS" ]]
|
||||
then
|
||||
BROWSERS="Chrome"
|
||||
fi
|
||||
|
||||
# CLEAN #
|
||||
rm -f angular.min.js.gzip.size
|
||||
rm -f angular.js.size
|
||||
|
||||
|
||||
# BUILD #
|
||||
yarn grunt ci-checks package --no-color
|
||||
|
||||
mkdir -p test_out
|
||||
|
||||
# UNIT TESTS #
|
||||
yarn grunt test:unit --browsers="$BROWSERS" --reporters=dots,junit --no-colors --no-color
|
||||
|
||||
# END TO END TESTS #
|
||||
yarn grunt test:ci-protractor
|
||||
|
||||
# DOCS APP TESTS #
|
||||
yarn grunt test:docs --browsers="$BROWSERS" --reporters=dots,junit --no-colors --no-color
|
||||
|
||||
# Promises/A+ TESTS #
|
||||
yarn grunt test:promises-aplus --no-color
|
||||
|
||||
|
||||
# CHECK SIZE #
|
||||
gzip -c < build/angular.min.js > build/angular.min.js.gzip
|
||||
echo "YVALUE=`ls -l build/angular.min.js | cut -d" " -f 8`" > angular.min.js.size
|
||||
echo "YVALUE=`ls -l build/angular.min.js.gzip | cut -d" " -f 8`" > angular.min.js.gzip.size
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Install nvm for this shell
|
||||
source ~/.nvm/nvm.sh
|
||||
|
||||
# Use version of node.js found in .nvmrc
|
||||
nvm install
|
||||
|
||||
# clean out and install yarn
|
||||
rm -rf ~/.yarn
|
||||
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.10.1
|
||||
export PATH="$HOME/.yarn/bin:$PATH"
|
||||
|
||||
# Ensure that we have the local dependencies installed
|
||||
yarn install
|
||||
|
||||
echo testing grunt version
|
||||
yarn grunt --version
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "#################################"
|
||||
echo "#### Update master ##############"
|
||||
echo "#################################"
|
||||
|
||||
ARG_DEFS=()
|
||||
|
||||
function init {
|
||||
if [[ ! $VERBOSE ]]; then
|
||||
VERBOSE=false
|
||||
fi
|
||||
VERBOSE_ARG="--verbose=$VERBOSE"
|
||||
}
|
||||
|
||||
function build {
|
||||
cd ../..
|
||||
scripts/jenkins/build.sh
|
||||
cd $SCRIPT_DIR
|
||||
}
|
||||
|
||||
function phase {
|
||||
ACTION_ARG="--action=$1"
|
||||
../code.angularjs.org/publish.sh $ACTION_ARG $VERBOSE_ARG
|
||||
../bower/publish.sh $ACTION_ARG $VERBOSE_ARG
|
||||
}
|
||||
|
||||
function run {
|
||||
build
|
||||
|
||||
# First prepare all scripts (build, test, commit, tag, ...),
|
||||
# so we are sure everything is all right
|
||||
phase prepare
|
||||
# only then publish to github
|
||||
phase publish
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
@@ -36,6 +36,7 @@ function init {
|
||||
|
||||
function build {
|
||||
cd ../..
|
||||
source scripts/jenkins/init-node.sh
|
||||
yarn grunt ci-checks package --no-color
|
||||
|
||||
cd $SCRIPT_DIR
|
||||
@@ -64,4 +65,4 @@ function run {
|
||||
phase publish
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
source $(dirname $0)/../utils.inc
|
||||
@@ -38,4 +38,4 @@ function run {
|
||||
phase publish
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
source $(dirname $0)/../utils.inc
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p "$LOGS_DIR"
|
||||
|
||||
if [ "$JOB" != "ci-checks" ]; then
|
||||
echo "start_browser_provider"
|
||||
./scripts/travis/start_browser_provider.sh
|
||||
fi
|
||||
|
||||
# ci-checks and unit tests do not run against the packaged code
|
||||
if [[ "$JOB" != "ci-checks" ]] && [[ "$JOB" != unit-* ]]; then
|
||||
yarn grunt package
|
||||
fi
|
||||
|
||||
# unit runs the docs tests too which need a built version of the code
|
||||
if [[ "$JOB" = unit-* ]]; then
|
||||
yarn grunt validate-angular-files
|
||||
yarn grunt build
|
||||
fi
|
||||
|
||||
# check this after the package, because at this point the browser_provider
|
||||
# has probably arrived
|
||||
if [ "$JOB" != "ci-checks" ]; then
|
||||
echo "wait_for_browser_provider"
|
||||
./scripts/travis/wait_for_browser_provider.sh
|
||||
fi
|
||||
Executable
+113
@@ -0,0 +1,113 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
readonly THIS_DIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
|
||||
readonly ROOT_DIR="$THIS_DIR/../.."
|
||||
|
||||
export BROWSER_STACK_ACCESS_KEY
|
||||
export SAUCE_ACCESS_KEY
|
||||
|
||||
BROWSER_STACK_ACCESS_KEY=$(echo "$BROWSER_STACK_ACCESS_KEY" | rev)
|
||||
SAUCE_ACCESS_KEY=$(echo "$SAUCE_ACCESS_KEY" | rev)
|
||||
|
||||
# The currently latest version of Safari on Saucelabs (v12) is unstable and disconnects frequently.
|
||||
# TODO: Add `SL_Safari` back, once/if it becomes more stable again.
|
||||
BROWSERS="SL_Chrome,SL_Chrome-1,\
|
||||
SL_Firefox,SL_Firefox-1,\
|
||||
SL_Safari-1,\
|
||||
SL_iOS,SL_iOS-1,\
|
||||
SL_IE_9,SL_IE_10,SL_IE_11,\
|
||||
SL_EDGE,SL_EDGE-1"
|
||||
|
||||
case "$JOB" in
|
||||
"ci-checks")
|
||||
grunt ci-checks
|
||||
|
||||
if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then
|
||||
# validate commit messages of all commits in the PR
|
||||
# convert commit range to 2 dots, as commitplease uses `git log`.
|
||||
# See https://github.com/travis-ci/travis-ci/issues/4596 for more info
|
||||
echo "Validate commit messages in PR:"
|
||||
yarn run commitplease "${TRAVIS_COMMIT_RANGE/.../..}"
|
||||
fi
|
||||
;;
|
||||
"unit-core")
|
||||
grunt test:promises-aplus
|
||||
grunt test:jqlite --browsers="$BROWSERS" --reporters=spec
|
||||
;;
|
||||
"unit-jquery")
|
||||
grunt test:jquery --browsers="$BROWSERS" --reporters=spec
|
||||
grunt test:jquery-2.2 --browsers="$BROWSERS" --reporters=spec
|
||||
grunt test:jquery-2.1 --browsers="$BROWSERS" --reporters=spec
|
||||
;;
|
||||
"unit-modules")
|
||||
grunt test:modules --browsers="$BROWSERS" --reporters=spec
|
||||
;;
|
||||
"docs-app")
|
||||
grunt tests:docs --browsers="$BROWSERS" --reporters=spec
|
||||
grunt test:travis-protractor --specs="docs/app/e2e/**/*.scenario.js"
|
||||
;;
|
||||
"e2e")
|
||||
if [[ $TEST_TARGET == jquery* ]]; then
|
||||
export USE_JQUERY=1
|
||||
fi
|
||||
|
||||
if [[ "$TEST_TARGET" == jquery* ]]; then
|
||||
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
|
||||
else
|
||||
TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
|
||||
fi
|
||||
|
||||
TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
|
||||
grunt test:travis-protractor --specs="$TARGET_SPECS"
|
||||
;;
|
||||
"deploy")
|
||||
export DEPLOY_DOCS
|
||||
export DEPLOY_CODE
|
||||
|
||||
DIST_TAG=$( jq ".distTag" "package.json" | tr -d "\"[:space:]" )
|
||||
|
||||
# upload docs if the branch distTag from package.json is "latest" (i.e. stable branch)
|
||||
if [[ "$DIST_TAG" == latest ]]; then
|
||||
DEPLOY_DOCS=true
|
||||
else
|
||||
DEPLOY_DOCS=false
|
||||
fi
|
||||
|
||||
# upload the build (code + docs) if ...
|
||||
# the commit is tagged
|
||||
# - or the branch is "master"
|
||||
# - or the branch distTag from package.json is "latest" (i.e. stable branch)
|
||||
if [[ "$TRAVIS_TAG" != '' || "$TRAVIS_BRANCH" == master || "$DIST_TAG" == latest ]]; then
|
||||
DEPLOY_CODE=true
|
||||
else
|
||||
DEPLOY_CODE=false
|
||||
fi
|
||||
|
||||
if [[ "$DEPLOY_DOCS" == true || "$DEPLOY_CODE" == true ]]; then
|
||||
grunt prepareDeploy
|
||||
|
||||
if [[ "$DEPLOY_DOCS" == true ]]; then
|
||||
# Install npm dependencies for Firebase functions.
|
||||
(
|
||||
cd "$ROOT_DIR/scripts/docs.angularjs.org-firebase/functions"
|
||||
npm install
|
||||
)
|
||||
fi
|
||||
else
|
||||
echo "Skipping deployment build because conditions have not been met."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Unknown job type. Please set JOB to one of\
|
||||
'ci-checks',\
|
||||
'unit-core',\
|
||||
'unit-jquery',\
|
||||
'unit-modules',\
|
||||
'docs-app',\
|
||||
'e2e',\
|
||||
or\
|
||||
'deploy'."
|
||||
;;
|
||||
esac
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
LOG_FILES=$LOGS_DIR/*
|
||||
|
||||
for FILE in $LOG_FILES; do
|
||||
echo -e "\n\n\n"
|
||||
echo "================================================================================"
|
||||
echo " $FILE"
|
||||
echo "================================================================================"
|
||||
cat $FILE || true
|
||||
done
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# Has to be run from project root directory.
|
||||
|
||||
|
||||
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
|
||||
echo "Using BrowserStack"
|
||||
elif [ "$BROWSER_PROVIDER" == "saucelabs" ]; then
|
||||
echo "Using SauceLabs"
|
||||
else
|
||||
echo "Invalid BROWSER_PROVIDER. Please set env var BROWSER_PROVIDER to 'saucelabs' or 'browserstack'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./lib/${BROWSER_PROVIDER}/start_tunnel.sh
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
# Has to be run from project root directory.
|
||||
|
||||
./lib/${BROWSER_PROVIDER}/teardown_tunnel.sh
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# Wait for Connect to be ready before exiting
|
||||
# Time out if we wait for more than 2 minutes, so that we can print logs.
|
||||
let "counter=0"
|
||||
|
||||
while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do
|
||||
let "counter++"
|
||||
if [ $counter -gt 240 ]; then
|
||||
echo "Timed out after 2 minutes waiting for browser provider ready file"
|
||||
# We must manually print logs here because travis will not run
|
||||
# after_script commands if the failure occurs before the script
|
||||
# phase.
|
||||
./scripts/travis/print_logs.sh
|
||||
exit 5
|
||||
fi
|
||||
sleep .5
|
||||
done
|
||||
@@ -100,7 +100,6 @@
|
||||
"VALIDITY_STATE_PROPERTY": false,
|
||||
"reloadWithDebugInfo": false,
|
||||
"stringify": false,
|
||||
"UNSAFE_restoreLegacyJqLiteXHTMLReplacement": false,
|
||||
|
||||
"NODE_TYPE_ELEMENT": false,
|
||||
"NODE_TYPE_ATTRIBUTE": false,
|
||||
|
||||
+4
-27
@@ -93,7 +93,6 @@
|
||||
hasOwnProperty,
|
||||
createMap,
|
||||
stringify,
|
||||
UNSAFE_restoreLegacyJqLiteXHTMLReplacement,
|
||||
|
||||
NODE_TYPE_ELEMENT,
|
||||
NODE_TYPE_ATTRIBUTE,
|
||||
@@ -343,10 +342,8 @@ function baseExtend(dst, objs, deep) {
|
||||
} else if (isElement(src)) {
|
||||
dst[key] = src.clone();
|
||||
} else {
|
||||
if (key !== '__proto__') {
|
||||
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
|
||||
baseExtend(dst[key], [src], true);
|
||||
}
|
||||
if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
|
||||
baseExtend(dst[key], [src], true);
|
||||
}
|
||||
} else {
|
||||
dst[key] = src;
|
||||
@@ -821,8 +818,8 @@ function arrayRemove(array, value) {
|
||||
* - [`MediaStream`](https://developer.mozilla.org/docs/Web/API/MediaStream)
|
||||
* - [`Set`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)
|
||||
* - [`WeakMap`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)
|
||||
* - [`getter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/
|
||||
* [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)
|
||||
* - ['getter'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)/
|
||||
* [`setter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)`
|
||||
*
|
||||
* @param {*} source The source that will be used to make a copy. Can be any type, including
|
||||
* primitives, `null`, and `undefined`.
|
||||
@@ -1950,26 +1947,6 @@ function bindJQuery() {
|
||||
bindJQueryFired = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement
|
||||
* @module ng
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Restores the pre-1.8 behavior of jqLite that turns XHTML-like strings like
|
||||
* `<div /><span />` to `<div></div><span></span>` instead of `<div><span></span></div>`.
|
||||
* The new behavior is a security fix. Thus, if you need to call this function, please try to adjust
|
||||
* your code for this change and remove your use of this function as soon as possible.
|
||||
|
||||
* Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the
|
||||
* [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details
|
||||
* about the workarounds.
|
||||
*/
|
||||
function UNSAFE_restoreLegacyJqLiteXHTMLReplacement() {
|
||||
JQLite.legacyXHTMLReplacement = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* throw error if the argument is falsy.
|
||||
*/
|
||||
|
||||
@@ -156,7 +156,6 @@ function publishExternalAPI(angular) {
|
||||
'callbacks': {$$counter: 0},
|
||||
'getTestability': getTestability,
|
||||
'reloadWithDebugInfo': reloadWithDebugInfo,
|
||||
'UNSAFE_restoreLegacyJqLiteXHTMLReplacement': UNSAFE_restoreLegacyJqLiteXHTMLReplacement,
|
||||
'$$minErr': minErr,
|
||||
'$$csp': csp,
|
||||
'$$encodeUriSegment': encodeUriSegment,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license AngularJS v"NG_VERSION_FULL"
|
||||
* (c) 2010-2020 Google, Inc. http://angularjs.org
|
||||
* (c) 2010-2018 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
(function(window) {
|
||||
|
||||
+15
-58
@@ -90,16 +90,6 @@
|
||||
* - [`val()`](http://api.jquery.com/val/)
|
||||
* - [`wrap()`](http://api.jquery.com/wrap/)
|
||||
*
|
||||
* jqLite also provides a method restoring pre-1.8 insecure treatment of XHTML-like tags.
|
||||
* This legacy behavior turns input like `<div /><span />` to `<div></div><span></span>`
|
||||
* instead of `<div><span></span></div>` like version 1.8 & newer do. To restore it, invoke:
|
||||
* ```js
|
||||
* angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement();
|
||||
* ```
|
||||
* Note that this only patches jqLite. If you use jQuery 3.5.0 or newer, please read the
|
||||
* [jQuery 3.5 upgrade guide](https://jquery.com/upgrade-guide/3.5/) for more details
|
||||
* about the workarounds.
|
||||
*
|
||||
* ## jQuery/jqLite Extras
|
||||
* AngularJS also provides the following additional methods and events to both jQuery and jqLite:
|
||||
*
|
||||
@@ -179,36 +169,20 @@ var HTML_REGEXP = /<|&#?\w+;/;
|
||||
var TAG_NAME_REGEXP = /<([\w:-]+)/;
|
||||
var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi;
|
||||
|
||||
// Table parts need to be wrapped with `<table>` or they're
|
||||
// stripped to their contents when put in a div.
|
||||
// XHTML parsers do not magically insert elements in the
|
||||
// same way that tag soup parsers do, so we cannot shorten
|
||||
// this by omitting <tbody> or other required elements.
|
||||
var wrapMap = {
|
||||
thead: ['table'],
|
||||
col: ['colgroup', 'table'],
|
||||
tr: ['tbody', 'table'],
|
||||
td: ['tr', 'tbody', 'table']
|
||||
'option': [1, '<select multiple="multiple">', '</select>'],
|
||||
|
||||
'thead': [1, '<table>', '</table>'],
|
||||
'col': [2, '<table><colgroup>', '</colgroup></table>'],
|
||||
'tr': [2, '<table><tbody>', '</tbody></table>'],
|
||||
'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
|
||||
'_default': [0, '', '']
|
||||
};
|
||||
|
||||
wrapMap.optgroup = wrapMap.option;
|
||||
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
||||
wrapMap.th = wrapMap.td;
|
||||
|
||||
// Support: IE <10 only
|
||||
// IE 9 requires an option wrapper & it needs to have the whole table structure
|
||||
// set up in advance; assigning `"<td></td>"` to `tr.innerHTML` doesn't work, etc.
|
||||
var wrapMapIE9 = {
|
||||
option: [1, '<select multiple="multiple">', '</select>'],
|
||||
_default: [0, '', '']
|
||||
};
|
||||
|
||||
for (var key in wrapMap) {
|
||||
var wrapMapValueClosing = wrapMap[key];
|
||||
var wrapMapValue = wrapMapValueClosing.slice().reverse();
|
||||
wrapMapIE9[key] = [wrapMapValue.length, '<' + wrapMapValue.join('><') + '>', '</' + wrapMapValueClosing.join('></') + '>'];
|
||||
}
|
||||
|
||||
wrapMapIE9.optgroup = wrapMapIE9.option;
|
||||
|
||||
function jqLiteIsTextNode(html) {
|
||||
return !HTML_REGEXP.test(html);
|
||||
@@ -229,7 +203,7 @@ function jqLiteHasData(node) {
|
||||
}
|
||||
|
||||
function jqLiteBuildFragment(html, context) {
|
||||
var tmp, tag, wrap, finalHtml,
|
||||
var tmp, tag, wrap,
|
||||
fragment = context.createDocumentFragment(),
|
||||
nodes = [], i;
|
||||
|
||||
@@ -240,30 +214,13 @@ function jqLiteBuildFragment(html, context) {
|
||||
// Convert html into DOM nodes
|
||||
tmp = fragment.appendChild(context.createElement('div'));
|
||||
tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();
|
||||
finalHtml = JQLite.legacyXHTMLReplacement ?
|
||||
html.replace(XHTML_TAG_REGEXP, '<$1></$2>') :
|
||||
html;
|
||||
wrap = wrapMap[tag] || wrapMap._default;
|
||||
tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2];
|
||||
|
||||
if (msie < 10) {
|
||||
wrap = wrapMapIE9[tag] || wrapMapIE9._default;
|
||||
tmp.innerHTML = wrap[1] + finalHtml + wrap[2];
|
||||
|
||||
// Descend through wrappers to the right content
|
||||
i = wrap[0];
|
||||
while (i--) {
|
||||
tmp = tmp.firstChild;
|
||||
}
|
||||
} else {
|
||||
wrap = wrapMap[tag] || [];
|
||||
|
||||
// Create wrappers & descend into them
|
||||
i = wrap.length;
|
||||
while (--i > -1) {
|
||||
tmp.appendChild(window.document.createElement(wrap[i]));
|
||||
tmp = tmp.firstChild;
|
||||
}
|
||||
|
||||
tmp.innerHTML = finalHtml;
|
||||
// Descend through wrappers to the right content
|
||||
i = wrap[0];
|
||||
while (i--) {
|
||||
tmp = tmp.lastChild;
|
||||
}
|
||||
|
||||
nodes = concat(nodes, tmp.childNodes);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license AngularJS v"NG_VERSION_FULL"
|
||||
* (c) 2010-2020 Google, Inc. http://angularjs.org
|
||||
* (c) 2010-2018 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ var minErrConfig = {
|
||||
* non-positive or non-numeric value, removes the max depth limit.
|
||||
* Default: 5
|
||||
*
|
||||
* * `urlErrorParamsEnabled` **{Boolean}** - Specifies whether the generated error url will
|
||||
* * `urlErrorParamsEnabled` **{Boolean}** - Specifies wether the generated error url will
|
||||
* contain the parameters of the thrown error. Disabling the parameters can be useful if the
|
||||
* generated error url is very long.
|
||||
*
|
||||
@@ -82,7 +82,7 @@ function isValidObjectMaxDepth(maxDepth) {
|
||||
* Since data will be parsed statically during a build step, some restrictions
|
||||
* are applied with respect to how minErr instances are created and called.
|
||||
* Instances should have names of the form namespaceMinErr for a minErr created
|
||||
* using minErr('namespace'). Error codes, namespaces and template strings
|
||||
* using minErr('namespace') . Error codes, namespaces and template strings
|
||||
* should all be static strings, not variables or general expressions.
|
||||
*
|
||||
* @param {string} module The namespace to use for the new minErr instance.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @license AngularJS v"NG_VERSION_FULL"
|
||||
* (c) 2010-2020 Google, Inc. http://angularjs.org
|
||||
* (c) 2010-2018 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
(function(window, angular) {
|
||||
|
||||
+33
-34
@@ -205,7 +205,7 @@
|
||||
*
|
||||
* This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the
|
||||
* actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large
|
||||
* arrays or objects can have a negative impact on your application performance.)
|
||||
* arrays or objects can have a negative impact on your application performance)
|
||||
*
|
||||
* <example name="doCheckArrayExample" module="do-check-module">
|
||||
* <file name="index.html">
|
||||
@@ -528,7 +528,7 @@
|
||||
* would result in the whole app "stalling" until all templates are loaded asynchronously - even in the
|
||||
* case when only one deeply nested directive has `templateUrl`.
|
||||
*
|
||||
* Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}.
|
||||
* Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}
|
||||
*
|
||||
* You can specify `templateUrl` as a string representing the URL or as a function which takes two
|
||||
* arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
|
||||
@@ -589,7 +589,7 @@
|
||||
* own templates or compile functions. Compiling these directives results in an infinite loop and
|
||||
* stack overflow errors.
|
||||
*
|
||||
* This can be avoided by manually using `$compile` in the postLink function to imperatively compile
|
||||
* This can be avoided by manually using $compile in the postLink function to imperatively compile
|
||||
* a directive's template instead of relying on automatic template compilation via `template` or
|
||||
* `templateUrl` declaration or manual compilation inside the compile function.
|
||||
* </div>
|
||||
@@ -693,17 +693,17 @@
|
||||
*
|
||||
* * `true` - transclude the content (i.e. the child nodes) of the directive's element.
|
||||
* * `'element'` - transclude the whole of the directive's element including any directives on this
|
||||
* element that are defined at a lower priority than this directive. When used, the `template`
|
||||
* element that defined at a lower priority than this directive. When used, the `template`
|
||||
* property is ignored.
|
||||
* * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template.
|
||||
*
|
||||
* **Multi-slot transclusion** is declared by providing an object for the `transclude` property.
|
||||
* **Mult-slot transclusion** is declared by providing an object for the `transclude` property.
|
||||
*
|
||||
* This object is a map where the keys are the name of the slot to fill and the value is an element selector
|
||||
* used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)
|
||||
* and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).
|
||||
*
|
||||
* For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}.
|
||||
* For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
|
||||
*
|
||||
* If the element selector is prefixed with a `?` then that slot is optional.
|
||||
*
|
||||
@@ -728,7 +728,7 @@
|
||||
* </div>
|
||||
*
|
||||
* If you want to manually control the insertion and removal of the transcluded content in your directive
|
||||
* then you must use this transclude function. When you call a transclude function it returns a jqLite/JQuery
|
||||
* then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery
|
||||
* object that contains the compiled DOM, which is linked to the correct transclusion scope.
|
||||
*
|
||||
* When you call a transclusion function you can pass in a **clone attach function**. This function accepts
|
||||
@@ -813,8 +813,8 @@
|
||||
* The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
|
||||
* `link()` or `compile()` functions. It has a variety of uses.
|
||||
*
|
||||
* * *Accessing normalized attribute names:* Directives like `ngBind` can be expressed in many ways:
|
||||
* `ng:bind`, `data-ng-bind`, or `x-ng-bind`. The attributes object allows for normalized access
|
||||
* * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:
|
||||
* 'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access
|
||||
* to the attributes.
|
||||
*
|
||||
* * *Directive inter-communication:* All directives share the same instance of the attributes
|
||||
@@ -855,24 +855,25 @@
|
||||
<file name="index.html">
|
||||
<script>
|
||||
angular.module('compileExample', [], function($compileProvider) {
|
||||
// Configure new 'compile' directive by passing a directive
|
||||
// factory function. The factory function injects '$compile'.
|
||||
// configure new 'compile' directive by passing a directive
|
||||
// factory function. The factory function injects the '$compile'
|
||||
$compileProvider.directive('compile', function($compile) {
|
||||
// The directive factory creates a link function.
|
||||
// directive factory creates a link function
|
||||
return function(scope, element, attrs) {
|
||||
scope.$watch(
|
||||
function(scope) {
|
||||
// Watch the 'compile' expression for changes.
|
||||
// watch the 'compile' expression for changes
|
||||
return scope.$eval(attrs.compile);
|
||||
},
|
||||
function(value) {
|
||||
// When the 'compile' expression changes
|
||||
// assign it into the current DOM.
|
||||
// when the 'compile' expression changes
|
||||
// assign it into the current DOM
|
||||
element.html(value);
|
||||
|
||||
// Compile the new DOM and link it to the current scope.
|
||||
// NOTE: we only compile '.childNodes' so that we
|
||||
// don't get into an infinite loop compiling ourselves.
|
||||
// compile the new DOM and link it to the current
|
||||
// scope.
|
||||
// NOTE: we only compile .childNodes so that
|
||||
// we don't get into infinite loop compiling ourselves
|
||||
$compile(element.contents())(scope);
|
||||
}
|
||||
);
|
||||
@@ -945,13 +946,13 @@
|
||||
* }
|
||||
* ```
|
||||
* * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add
|
||||
* the cloned elements; only needed for transcludes that are allowed to contain non HTML
|
||||
* elements (e.g. SVG elements). See also the `directive.controller` property.
|
||||
* the cloned elements; only needed for transcludes that are allowed to contain non html
|
||||
* elements (e.g. SVG elements). See also the directive.controller property.
|
||||
*
|
||||
* Calling the linking function returns the element of the template. It is either the original
|
||||
* element passed in, or the clone of the element if the `cloneAttachFn` is provided.
|
||||
*
|
||||
* After linking the view is not updated until after a call to `$digest`, which typically is done by
|
||||
* After linking the view is not updated until after a call to $digest which typically is done by
|
||||
* AngularJS automatically.
|
||||
*
|
||||
* If you need access to the bound view, there are two ways to do it:
|
||||
@@ -959,23 +960,21 @@
|
||||
* - If you are not asking the linking function to clone the template, create the DOM element(s)
|
||||
* before you send them to the compiler and keep this reference around.
|
||||
* ```js
|
||||
* var element = angular.element('<p>{{total}}</p>');
|
||||
* $compile(element)(scope);
|
||||
* var element = $compile('<p>{{total}}</p>')(scope);
|
||||
* ```
|
||||
*
|
||||
* - if on the other hand, you need the element to be cloned, the view reference from the original
|
||||
* example would not point to the clone, but rather to the original template that was cloned. In
|
||||
* this case, you can access the clone either via the `cloneAttachFn` or the value returned by the
|
||||
* linking function:
|
||||
* this case, you can access the clone via the cloneAttachFn:
|
||||
* ```js
|
||||
* var templateElement = angular.element('<p>{{total}}</p>');
|
||||
* var templateElement = angular.element('<p>{{total}}</p>'),
|
||||
* scope = ....;
|
||||
*
|
||||
* var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
|
||||
* // Attach the clone to DOM document at the right place.
|
||||
* //attach the clone to DOM document at the right place
|
||||
* });
|
||||
*
|
||||
* // Now we have reference to the cloned DOM via `clonedElement`.
|
||||
* // NOTE: The `clonedElement` returned by the linking function is the same as the
|
||||
* // `clonedElement` passed to `cloneAttachFn`.
|
||||
* //now we have reference to the cloned DOM via `clonedElement`
|
||||
* ```
|
||||
*
|
||||
*
|
||||
@@ -1026,7 +1025,7 @@
|
||||
*
|
||||
* When the original node and the replace template declare the same directive(s), they will be
|
||||
* {@link guide/compiler#double-compilation-and-how-to-avoid-it compiled twice} because the compiler
|
||||
* does not deduplicate them. In many cases, this is not noticeable, but e.g. {@link ngModel} will
|
||||
* does not deduplicate them. In many cases, this is not noticable, but e.g. {@link ngModel} will
|
||||
* attach `$formatters` and `$parsers` twice.
|
||||
*
|
||||
* See issue [#2573](https://github.com/angular/angular.js/issues/2573).
|
||||
@@ -1501,9 +1500,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
* @description
|
||||
* Register a new directive with the compiler.
|
||||
*
|
||||
* @param {string|Object} name Name of the directive in camel-case (i.e. `ngBind` which will match
|
||||
* as `ng-bind`), or an object map of directives where the keys are the names and the values
|
||||
* are the factories.
|
||||
* @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
|
||||
* will match as <code>ng-bind</code>), or an object map of directives where the keys are the
|
||||
* names and the values are the factories.
|
||||
* @param {Function|Array} directiveFactory An injectable directive factory function. See the
|
||||
* {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
|
||||
* @returns {ng.$compileProvider} Self for chaining.
|
||||
|
||||
@@ -332,7 +332,7 @@
|
||||
* For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after
|
||||
* the items have been processed through the filter.
|
||||
*
|
||||
* Please note that `as [variable name]` is not an operator but rather a part of ngRepeat
|
||||
* Please note that `as [variable name] is not an operator but rather a part of ngRepeat
|
||||
* micro-syntax so it can be used only after all filters (and not as operator, inside an expression).
|
||||
*
|
||||
* For example: `item in items | filter : x | orderBy : order | limitTo : limit as results track by item.id` .
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
var colorSpan = element(by.css('span'));
|
||||
|
||||
it('should check ng-style', function() {
|
||||
expect(colorSpan.getCssValue('color')).toMatch(/rgba\(0, 0, 0, 1\)|rgb\(0, 0, 0\)/);
|
||||
expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
|
||||
element(by.css('input[value=\'set color\']')).click();
|
||||
expect(colorSpan.getCssValue('color')).toMatch(/rgba\(255, 0, 0, 1\)|rgb\(255, 0, 0\)/);
|
||||
expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
|
||||
element(by.css('input[value=clear]')).click();
|
||||
expect(colorSpan.getCssValue('color')).toMatch(/rgba\(0, 0, 0, 1\)|rgb\(0, 0, 0\)/);
|
||||
expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
@@ -54,7 +54,14 @@
|
||||
var ngStyleDirective = ngDirective(function(scope, element, attr) {
|
||||
scope.$watchCollection(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
|
||||
if (oldStyles && (newStyles !== oldStyles)) {
|
||||
forEach(oldStyles, function(val, style) { element.css(style, ''); });
|
||||
if (!newStyles) {
|
||||
newStyles = {};
|
||||
}
|
||||
forEach(oldStyles, function(val, style) {
|
||||
if (newStyles[style] == null) {
|
||||
newStyles[style] = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
if (newStyles) element.css(newStyles);
|
||||
});
|
||||
|
||||
@@ -68,21 +68,15 @@ var requiredDirective = ['$parse', function($parse) {
|
||||
require: '?ngModel',
|
||||
link: function(scope, elm, attr, ctrl) {
|
||||
if (!ctrl) return;
|
||||
// For boolean attributes like required, presence means true
|
||||
var value = attr.hasOwnProperty('required') || $parse(attr.ngRequired)(scope);
|
||||
var value = attr.required || $parse(attr.ngRequired)(scope);
|
||||
|
||||
if (!attr.ngRequired) {
|
||||
// force truthy in case we are on non input element
|
||||
// (input elements do this automatically for boolean attributes like required)
|
||||
attr.required = true;
|
||||
}
|
||||
attr.required = true; // force truthy in case we are on non input element
|
||||
|
||||
ctrl.$validators.required = function(modelValue, viewValue) {
|
||||
return !value || !ctrl.$isEmpty(viewValue);
|
||||
};
|
||||
|
||||
attr.$observe('required', function(newVal) {
|
||||
|
||||
if (value !== newVal) {
|
||||
value = newVal;
|
||||
ctrl.$validate();
|
||||
|
||||
@@ -155,6 +155,7 @@ function $AriaProvider() {
|
||||
* @name $aria
|
||||
*
|
||||
* @description
|
||||
* @priority 200
|
||||
*
|
||||
* The $aria service contains helper methods for applying common
|
||||
* [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
|
||||
|
||||
@@ -814,19 +814,6 @@ describe('angular', function() {
|
||||
expect(isElement(dst.jqObject)).toBeTruthy();
|
||||
expect(dst.jqObject.nodeName).toBeUndefined(); // i.e it is a jqLite/jQuery object
|
||||
});
|
||||
|
||||
it('should not merge the __proto__ property', function() {
|
||||
var src = JSON.parse('{ "__proto__": { "xxx": "polluted" } }');
|
||||
var dst = {};
|
||||
|
||||
merge(dst, src);
|
||||
|
||||
if (typeof dst.__proto__ !== 'undefined') { // eslint-disable-line
|
||||
// Should not overwrite the __proto__ property or pollute the Object prototype
|
||||
expect(dst.__proto__).toBe(Object.prototype); // eslint-disable-line
|
||||
}
|
||||
expect(({}).xxx).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -123,8 +123,6 @@ describe('$anchorScroll', function() {
|
||||
var lastAnchor = anchors.last();
|
||||
var lastAnchorId = 'anchor-5';
|
||||
|
||||
if (browser.params.browser === 'firefox') return;
|
||||
|
||||
// Make sure there is not enough room to scroll the last anchor to the top
|
||||
lastAnchor.getSize().then(function(size) {
|
||||
var tempHeight = size.height + (yOffset / 2);
|
||||
|
||||
@@ -9,12 +9,14 @@ describe('ngRoute promises', function() {
|
||||
expect(element.all(by.tagName('li')).count()).toBe(5);
|
||||
});
|
||||
|
||||
it('should time out if the promise takes long enough', function(done) {
|
||||
it('should time out if the promise takes long enough', function() {
|
||||
// Don't try this at home kids, I'm a protractor dev
|
||||
browser.manage().timeouts().setScriptTimeout(1000);
|
||||
browser.waitForAngular().then(function() {
|
||||
fail('waitForAngular() should have timed out, but didn\'t');
|
||||
}, done);
|
||||
}, function(error) {
|
||||
expect(error.message).toContain('Timed out waiting for asynchronous Angular tasks to finish');
|
||||
});
|
||||
});
|
||||
|
||||
it('should wait for route promises when navigating to another route', function() {
|
||||
|
||||
@@ -9,13 +9,4 @@ describe('Sample', function() {
|
||||
it('should have the interpolated text', function() {
|
||||
expect(element(by.binding('text')).getText()).toBe('Hello, world!');
|
||||
});
|
||||
|
||||
it('should insert the ng-cloak styles', function() {
|
||||
browser.executeScript(`
|
||||
var span = document.createElement('span');
|
||||
span.className = 'ng-cloak foo';
|
||||
document.body.appendChild(span);
|
||||
`);
|
||||
expect(element(by.className('foo')).isDisplayed()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -147,13 +147,6 @@ describe('jqLite', function() {
|
||||
expect(nodes[0].nodeName.toLowerCase()).toBe('option');
|
||||
});
|
||||
|
||||
it('should allow construction of multiple <option> elements', function() {
|
||||
var nodes = jqLite('<option></option><option></option>');
|
||||
expect(nodes.length).toBe(2);
|
||||
expect(nodes[0].nodeName.toLowerCase()).toBe('option');
|
||||
expect(nodes[1].nodeName.toLowerCase()).toBe('option');
|
||||
});
|
||||
|
||||
|
||||
// Special tests for the construction of elements which are restricted (in the HTML5 spec) to
|
||||
// being children of specific nodes.
|
||||
@@ -176,95 +169,6 @@ describe('jqLite', function() {
|
||||
expect(nodes[0].nodeName.toLowerCase()).toBe(name);
|
||||
});
|
||||
});
|
||||
|
||||
describe('security', function() {
|
||||
it('shouldn\'t crash at attempts to close the table wrapper', function() {
|
||||
// jQuery doesn't pass this test yet.
|
||||
if (!_jqLiteMode) return;
|
||||
|
||||
// Support: IE <10
|
||||
// In IE 9 we still need to use the old-style innerHTML assignment
|
||||
// as that's the only one that works.
|
||||
if (msie < 10) return;
|
||||
|
||||
expect(function() {
|
||||
// This test case attempts to close the tags which wrap input
|
||||
// based on matching done in wrapMap, escaping the wrapper & thus
|
||||
// triggering an error when descending.
|
||||
var el = jqLite('<td></td></tr></tbody></table><td></td>');
|
||||
expect(el.length).toBe(2);
|
||||
expect(el[0].nodeName.toLowerCase()).toBe('td');
|
||||
expect(el[1].nodeName.toLowerCase()).toBe('td');
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('shouldn\'t unsanitize sanitized code', function(done) {
|
||||
// jQuery <3.5.0 fail those tests.
|
||||
if (isJQuery2x()) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
var counter = 0,
|
||||
assertCount = 13,
|
||||
container = jqLite('<div></div>');
|
||||
|
||||
function donePartial() {
|
||||
counter++;
|
||||
if (counter === assertCount) {
|
||||
container.remove();
|
||||
delete window.xss;
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
jqLite(document.body).append(container);
|
||||
window.xss = jasmine.createSpy('xss');
|
||||
|
||||
// Thanks to Masato Kinugawa from Cure53 for providing the following test cases.
|
||||
// Note: below test cases need to invoke the xss function with consecutive
|
||||
// decimal parameters for the assertions to be correct.
|
||||
forEach([
|
||||
'<img alt="<x" title="/><img src=url404 onerror=xss(0)>">',
|
||||
'<img alt="\n<x" title="/>\n<img src=url404 onerror=xss(1)>">',
|
||||
'<style><style/><img src=url404 onerror=xss(2)>',
|
||||
'<xmp><xmp/><img src=url404 onerror=xss(3)>',
|
||||
'<title><title /><img src=url404 onerror=xss(4)>',
|
||||
'<iframe><iframe/><img src=url404 onerror=xss(5)>',
|
||||
'<noframes><noframes/><img src=url404 onerror=xss(6)>',
|
||||
'<noscript><noscript/><img src=url404 onerror=xss(7)>',
|
||||
'<foo" alt="" title="/><img src=url404 onerror=xss(8)>">',
|
||||
'<img alt="<x" title="" src="/><img src=url404 onerror=xss(9)>">',
|
||||
'<noscript/><img src=url404 onerror=xss(10)>',
|
||||
'<noembed><noembed/><img src=url404 onerror=xss(11)>',
|
||||
|
||||
'<option><style></option></select><img src=url404 onerror=xss(12)></style>'
|
||||
], function(htmlString, index) {
|
||||
var element = jqLite('<div></div>');
|
||||
|
||||
container.append(element);
|
||||
element.append(jqLite(htmlString));
|
||||
|
||||
window.setTimeout(function() {
|
||||
expect(window.xss).not.toHaveBeenCalledWith(index);
|
||||
donePartial();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow to restore legacy insecure behavior', function() {
|
||||
// jQuery doesn't have this API.
|
||||
if (!_jqLiteMode) return;
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement();
|
||||
|
||||
var elem = jqLite('<div/><span/>');
|
||||
expect(elem.length).toBe(2);
|
||||
expect(elem[0].nodeName.toLowerCase()).toBe('div');
|
||||
expect(elem[1].nodeName.toLowerCase()).toBe('span');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('_data', function() {
|
||||
|
||||
@@ -143,17 +143,6 @@ describe('ngStyle', function() {
|
||||
expect(element.css(postCompStyle)).not.toBe('99px');
|
||||
});
|
||||
|
||||
it('should clear style when the value is false', function() {
|
||||
scope.styleObj = {'height': '99px', 'width': '88px'};
|
||||
scope.$apply();
|
||||
expect(element.css(preCompStyle)).toBe('88px');
|
||||
expect(element.css(postCompStyle)).toBe('99px');
|
||||
scope.styleObj = {'height': false, 'width': false};
|
||||
scope.$apply();
|
||||
expect(element.css(preCompStyle)).not.toBe('88px');
|
||||
expect(element.css(postCompStyle)).not.toBe('99px');
|
||||
});
|
||||
|
||||
it('should set style when the value is zero', function() {
|
||||
scope.styleObj = {'height': '99px', 'width': '88px'};
|
||||
scope.$apply();
|
||||
|
||||
@@ -349,7 +349,7 @@ describe('select', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should only call selectCtrl.writeValue after a digest has occurred', function() {
|
||||
it('should only call selectCtrl.writeValue after a digest has occured', function() {
|
||||
scope.mySelect = 'B';
|
||||
scope.$apply();
|
||||
|
||||
|
||||
@@ -696,13 +696,6 @@ describe('validators', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should override "required" when ng-required="false" is set', function() {
|
||||
var inputElm = helper.compileInput('<input type="text" ng-model="notDefined" required ng-required="false" />');
|
||||
|
||||
expect(inputElm).toBeValid();
|
||||
});
|
||||
|
||||
|
||||
it('should validate only once after compilation when inside ngRepeat', function() {
|
||||
helper.compileInput(
|
||||
'<div ng-repeat="input in [0]">' +
|
||||
@@ -738,7 +731,6 @@ describe('validators', function() {
|
||||
expect(helper.validationCounter.required).toBe(1);
|
||||
});
|
||||
|
||||
|
||||
it('should validate once when inside ngRepeat, and set the "required" error when ngRequired is false by default', function() {
|
||||
$rootScope.isRequired = false;
|
||||
$rootScope.refs = {};
|
||||
@@ -752,15 +744,5 @@ describe('validators', function() {
|
||||
expect($rootScope.refs.input.$error.required).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
it('should validate only once when inside ngIf with required on non-input elements', inject(function($compile) {
|
||||
$rootScope.value = '12';
|
||||
$rootScope.refs = {};
|
||||
helper.compileInput('<div ng-if="true"><span ng-model="value" ng-ref="refs.ctrl" ng-ref-read="ngModel" required validation-spy="required"></span></div>');
|
||||
$rootScope.$digest();
|
||||
|
||||
expect(helper.validationCounter.required).toBe(1);
|
||||
expect($rootScope.refs.ctrl.$error.required).not.toBe(true);
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user