diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000000..13991e2336e6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +tmp +.circleci + +build diff --git a/DEVELOPERS.md b/DEVELOPERS.md index cc91b6183dfb..3fc7144d7829 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -87,6 +87,26 @@ artifacts. * `docs/` — A directory that contains a standalone version of the docs (same as served in `docs.angularjs.org`). + +#### Docker Based Build + +To build AngularJS using docker, same process as regular build but can run: + +```shell +# Clone your Github repository: +git clone https://github.com//angular.js.git + +# Go to the AngularJS directory: +cd angular.js + +# Run docker (>= v23) build +docker build --target artifact --output type=local,dest=. . + +# Run docker (< v23) build +# DOCKER_BUILDKIT=1 docker build --target artifact --output type=local,dest=. . +``` + + ### Running a Local Development Web Server To debug code, run end-to-end tests, and serve the docs, it is often useful to have a local diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000000..d35a0cc0e4f6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM node:12.22.12-alpine AS base +ARG NEXT_TAG_VERSION v1.x.x +ARG NG1_BUILD_NO_REMOTE_VERSION_REQUESTS 1 + +FROM base AS deps +WORKDIR /app +RUN apk add --no-cache libc6-compat +COPY package.json yarn.lock* ./ +RUN yarn config set registry https://registry.npmjs.org/ +RUN yarn --frozen-lockfile + +FROM base AS builder +WORKDIR /app +RUN apk add curl git openjdk11 +COPY --from=deps /app/node_modules ./node_modules +COPY . . +ENV CI=1 +ENV NODE_ENV=production +ENV NEXT_TAG_VERSION=${NEXT_TAG_VERSION} +ENV NG1_BUILD_NO_REMOTE_VERSION_REQUESTS=${NG1_BUILD_NO_REMOTE_VERSION_REQUESTS} +RUN yarn grunt package + +FROM scratch AS artifact +COPY --from=builder /app/build /build diff --git a/lib/versions/version-info.js b/lib/versions/version-info.js index fbde49e01460..9556fc85b49a 100644 --- a/lib/versions/version-info.js +++ b/lib/versions/version-info.js @@ -10,6 +10,7 @@ var process = require('process'); // We are only interested in whether this environment variable exists, hence the !! var NO_REMOTE_REQUESTS = !!process.env['NG1_BUILD_NO_REMOTE_VERSION_REQUESTS']; var versionSource = NO_REMOTE_REQUESTS ? 'local' : 'remote'; +var ENV_VERSION = process.env['NEXT_TAG_VERSION']; var currentPackage, previousVersions, cdnVersion; @@ -215,12 +216,29 @@ var getSnapshotVersion = function() { return version; }; +/** + * Get the version from env variable in semver format + * @return {SemVer} The env variable + */ +var getPredefinedVersion = function() { + var version = semver.parse(ENV_VERSION); + + if (version && checkBranchPattern(version.version, currentPackage.branchPattern)) { + version.codeName = ''; + version.full = version.version; + version.branch = 'v' + currentPackage.branchPattern.replace('*', 'x'); + return version; + } + + return null; +}; + exports.currentPackage = currentPackage = getPackage(); exports.gitRepoInfo = getGitRepoInfo(); exports.previousVersions = previousVersions = getPreviousVersions(); exports.cdnVersion = cdnVersion = getCdnVersion(); -exports.currentVersion = getTaggedVersion() || getSnapshotVersion(); +exports.currentVersion = getPredefinedVersion() || getTaggedVersion() || getSnapshotVersion(); if (NO_REMOTE_REQUESTS) { console.log('=============================================================================================='); diff --git a/package.json b/package.json index a9f608b0fb7d..f421fe4b6d7d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "angular", "license": "MIT", "branchVersion": "^1.8.0", - "branchPattern": "1.8.*", + "branchPattern": "1.9.*", + "version": "1.9.4", "distTag": "latest", "repository": { "type": "git", diff --git a/src/Angular.js b/src/Angular.js index 9b11090518b2..4e915d495487 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -999,7 +999,7 @@ function copy(source, destination, maxDepth) { return new source.constructor(source.valueOf()); case '[object RegExp]': - var re = new RegExp(source.source, source.toString().match(/[^/]*$/)[0]); + var re = new RegExp(source.source, source.toString().match(/\/([^/]*)$/)[1]); re.lastIndex = source.lastIndex; return re; diff --git a/src/ng/compile.js b/src/ng/compile.js index e48b5a98b6c5..6889bea50ecd 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -2099,7 +2099,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { // first check if there are spaces because it's not the same pattern var trimmedSrcset = trim(value); // ( 999x ,| 999w ,| ,|, ) - var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/; + var srcPattern = /(\s+(?:\d+(?:x\s*|w\s*))?,\s*|,\s+)/; var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/; // split srcset into tuple of uri and descriptor except for the last item @@ -2647,7 +2647,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { sibling.parentNode.removeChild(sibling); } if (notLiveList && sibling === nodeList[idx + 1]) { - nodeList.splice(idx + 1, 1); + splice.call(nodeList, idx + 1, 1); } } } @@ -2794,7 +2794,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { } break; case NODE_TYPE_TEXT: /* Text Node */ - addTextInterpolateDirective(directives, node.nodeValue); + // Don't interpolate `