refactor(docs-infra): move deploy-to-firebase.js into a dedicated directory (#43963)

This commit moves the `aio/scripts/deploy-to-firebase.js` script into a
new directory, `aio/scripts/deploy-to-firebase/`. This will make it
easier to break it up into multiple smaller files to better organize the
code (without polluting the `aio/scripts/` directory).

PR Close #43963
This commit is contained in:
George Kalpakas
2021-10-29 14:17:11 +03:00
committed by Alex Rickabaugh
parent 6b8cdc9339
commit f8ab6e9eb3
5 changed files with 9 additions and 12 deletions
@@ -6,4 +6,4 @@ TODO (gkalpak): Add docs. Mention:
Relevant files: `aio/aio-builds-setup/scripts/test.sh` Relevant files: `aio/aio-builds-setup/scripts/test.sh`
- Deploying from CI. - Deploying from CI.
Relevant files: `.circleci/config.yml`, `scripts/ci/deploy.sh`, `aio/scripts/build-artifacts.sh`, Relevant files: `.circleci/config.yml`, `scripts/ci/deploy.sh`, `aio/scripts/build-artifacts.sh`,
`aio/scripts/deploy-to-firebase.js` `aio/scripts/deploy-to-firebase/index.js`
+1 -1
View File
@@ -57,7 +57,7 @@
"redirects-test": "node tests/deployment/unit/test", "redirects-test": "node tests/deployment/unit/test",
"firebase-utils-test": "node tools/firebase-test-utils/test", "firebase-utils-test": "node tools/firebase-test-utils/test",
"tools-lint": "eslint tools/firebase-test-utils && eslint tools/ng-packages-installer", "tools-lint": "eslint tools/firebase-test-utils && eslint tools/ng-packages-installer",
"tools-test": "yarn docs-test && yarn boilerplate:test && jasmine tools/ng-packages-installer/index.spec.js && jasmine scripts/deploy-to-firebase.spec.js && yarn firebase-utils-test", "tools-test": "yarn docs-test && yarn boilerplate:test && jasmine tools/ng-packages-installer/index.spec.js && jasmine scripts/deploy-to-firebase/**/*.spec.js && yarn firebase-utils-test",
"preserve-and-sync": "yarn docs", "preserve-and-sync": "yarn docs",
"serve-and-sync": "run-p \"docs-watch --watch-only\" \"start {@}\" --", "serve-and-sync": "run-p \"docs-watch --watch-only\" \"start {@}\" --",
"boilerplate:add": "node ./tools/examples/example-boilerplate add", "boilerplate:add": "node ./tools/examples/example-boilerplate add",
@@ -244,7 +244,7 @@ function deploy(data) {
siteId, siteId,
} = data; } = data;
cd(`${__dirname}/..`); cd(`${__dirname}/../..`);
console.log('\n\n\n==== Run pre-deploy actions. ====\n'); console.log('\n\n\n==== Run pre-deploy actions. ====\n');
preDeployActions.forEach(fn => fn(data)); preDeployActions.forEach(fn => fn(data));
@@ -8,7 +8,7 @@ const {
computeMajorVersion, computeMajorVersion,
getLatestCommit, getLatestCommit,
getMostRecentMinorBranch, getMostRecentMinorBranch,
} = require('./deploy-to-firebase'); } = require('./index');
describe('deploy-to-firebase:', () => { describe('deploy-to-firebase:', () => {
@@ -389,11 +389,11 @@ describe('deploy-to-firebase:', () => {
it('integration - should run the main script without error', () => { it('integration - should run the main script without error', () => {
// NOTE: // NOTE:
// This test executes a new instance of the `deploy-to-firebase.js` script on a separate process // This test executes a new instance of the `deploy-to-firebase` script on a separate process
// and thus does not share the `getRemoteRefs()` cache. To improve stability, we retrieve the // and thus does not share the `getRemoteRefs()` cache. To improve stability, we retrieve the
// latest commit from master ignoring any cached entries. // latest commit from master ignoring any cached entries.
const latestCommitOnMaster = getLatestCommit('master', {retrieveFromCache: false}); const latestCommitOnMaster = getLatestCommit('master', {retrieveFromCache: false});
const cmd = `"${process.execPath}" "${__dirname}/deploy-to-firebase" --dry-run`; const cmd = `"${process.execPath}" "${__dirname}" --dry-run`;
const env = { const env = {
CI_REPO_OWNER: 'angular', CI_REPO_OWNER: 'angular',
CI_REPO_NAME: 'angular', CI_REPO_NAME: 'angular',
+3 -6
View File
@@ -2,12 +2,9 @@
This folder is used for extra files that should be included in deployments to firebase. This folder is used for extra files that should be included in deployments to firebase.
After the AIO application had been built and before it is deployed all files and folders After the AIO application had been built and before it is deployed all files and folders inside the folder with the same name as the current deployment mode (next, stable, archive) will be copied to the `dist` folder.
inside the folder with the same name as the current deployment mode (next, stable, archive)
will be copied to the `dist` folder.
See the `scripts/deploy-to-firebase.js` script for more details. See the `scripts/deploy-to-firebase/index.js` script for more details.
**Note:** **Note:**
The `deploy-to-firebase.js` script always expects there to be a folder for the current deployment The script always expects there to be a folder for the current deployment mode (even if it is empty).
mode (even if it is empty).