Skip to content

Commit

Permalink
Fix courtesy push by enablin npmci command for serverbuild (#20228)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriiBobreshev authored Jul 30, 2024
1 parent a8ec37e commit 2f95c3e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
15 changes: 11 additions & 4 deletions make-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ var getCommonPackInfo = function (modOutDir) {
}
exports.getCommonPackInfo = getCommonPackInfo;

var buildNodeTask = function (taskPath, outDir) {
var buildNodeTask = function (taskPath, outDir, isServerBuild) {
var originalDir = shell.pwd().toString();
cd(taskPath);
var packageJsonPath = rp('package.json');
Expand All @@ -173,13 +173,20 @@ var buildNodeTask = function (taskPath, outDir) {
} else if (devDeps >= 1) {
fail('The package.json should not contain dev dependencies other than typescript. Move the dev dependencies into a package.json file under the Tests sub-folder. Offending package.json: ' + packageJsonPath);
}

run('npm install');
if (isServerBuild) {
run('npm ci');
} else {
run('npm install');
}
}

if (test('-f', rp(path.join('Tests', 'package.json')))) {
cd(rp('Tests'));
run('npm install');
if (isServerBuild) {
run('npm ci');
} else {
run('npm install');
}
cd(taskPath);
}

Expand Down
10 changes: 5 additions & 5 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ CLI.serverBuild = async function(/** @type {{ task: string }} */ argv) {
await util.installNodeAsync('20');
ensureTool('node', '--version', `v${node20Version}`);
for (const taskName of allTasksNode20) {
await buildTaskWrapped(taskName, allTasksNode20.length, 20);
await buildTaskWrapped(taskName, allTasksNode20.length, 20, !writeUpdatedsFromGenTasks);
}
}
if (allTasksDefault.length > 0) {
await util.installNodeAsync('10');
ensureTool('node', '--version', `v${node10Version}`);
for (const taskName of allTasksDefault) {
await buildTaskWrapped(taskName, allTasksNode20.length, 10);
await buildTaskWrapped(taskName, allTasksNode20.length, 10, !writeUpdatedsFromGenTasks);
}
}

Expand All @@ -263,7 +263,7 @@ function getNodeVersion (taskName) {

}

async function buildTaskAsync(taskName, taskListLength, nodeVersion) {
async function buildTaskAsync(taskName, taskListLength, nodeVersion, isServerBuild = false) {
let isGeneratedTask = false;
banner(`Building task ${taskName} using Node.js ${nodeVersion}`);
const removeNodeModules = taskListLength > 1;
Expand Down Expand Up @@ -348,7 +348,7 @@ async function buildTaskAsync(taskName, taskListLength, nodeVersion) {

// npm install and compile
if ((mod.type === 'node' && mod.compile == true) || test('-f', path.join(modPath, 'tsconfig.json'))) {
buildNodeTask(modPath, modOutDir);
buildNodeTask(modPath, modOutDir, isServerBuild);
}

// copy default resources and any additional resources defined in the module's make.json
Expand Down Expand Up @@ -410,7 +410,7 @@ async function buildTaskAsync(taskName, taskListLength, nodeVersion) {

// build Node task
if (shouldBuildNode) {
buildNodeTask(taskPath, outDir);
buildNodeTask(taskPath, outDir, isServerBuild);
}

// remove the hashes for the common packages, they change every build
Expand Down

0 comments on commit 2f95c3e

Please sign in to comment.