MCPcopy
hub / github.com/ampproject/amphtml / ensureUpdatedPackages

Function ensureUpdatedPackages

build-system/task-runner/amp-task-runner.js:71–81  ·  view source on GitHub ↗

* 1. Updates root-level packages during local development. (Skipped during CI * because they're guaranteed to be fresh.) * 2. Updates task-level subpackages if a package.json file exists in the task * directory. * @param {string} taskSourceFileName

(taskSourceFileName)

Source from the content-addressed store, hash-verified

69 * @param {string} taskSourceFileName
70 */
71function ensureUpdatedPackages(taskSourceFileName) {
72 if (!isCiBuild()) {
73 updatePackages();
74 }
75 const taskSourceFilePath = getTaskSourceFilePath(taskSourceFileName);
76 const packageFile = path.join(taskSourceFilePath, 'package.json');
77 const hasSubpackages = fs.pathExistsSync(packageFile);
78 if (hasSubpackages) {
79 updateSubpackages(taskSourceFilePath);
80 }
81}
82
83/**
84 * Runs an AMP task with logging and timing after installing its subpackages.

Callers 1

createTaskFunction · 0.85

Calls 4

isCiBuildFunction · 0.85
updatePackagesFunction · 0.85
getTaskSourceFilePathFunction · 0.85
updateSubpackagesFunction · 0.85

Tested by

no test coverage detected