in build-scripts/packageExtension.ts [109:159]
findMatchingFiles(folders.sourceTasks).forEach(function(taskName) {
console.log('Processing task ' + taskName)
if (ignoredFolders.some(folderName => folderName === taskName)) {
console.log('Skpping task ' + taskName)
return
}
const taskBuildFolder = path.join(folders.buildTasks, taskName)
const taskPackageFolder = path.join(folders.packageTasks, taskName)
fs.mkdirpSync(taskPackageFolder)
// eslint-disable-next-line @typescript-eslint/no-var-requires
const taskDef = require(path.join(taskBuildFolder, 'task.json'))
if (
!Object.hasOwnProperty.call(taskDef.execution, 'Node') &&
!Object.hasOwnProperty.call(taskDef.execution, 'Node10') &&
!Object.hasOwnProperty.call(taskDef.execution, 'Node14')
) {
console.log('Copying non-node task ' + taskName)
fs.copySync(taskBuildFolder, taskPackageFolder)
return
}
for (const resourceFile of vstsFiles) {
fs.copySync(path.join(taskBuildFolder, resourceFile), path.join(taskPackageFolder, resourceFile), {
overwrite: true
})
}
// we also need lib.json from azure pipelines task lib or else localization will not work properly
fs.copySync(
path.join(folders.repoRoot, 'node_modules/azure-pipelines-task-lib/lib.json'),
path.join(taskPackageFolder, 'lib.json'),
{ overwrite: true }
)
const inputFilename = path.join(taskBuildFolder, taskName + '.runner.js')
console.log('packing node-based task')
const result = esbuild.buildSync({
entryPoints: [inputFilename],
bundle: true,
platform: 'node',
target: ['node10'],
minify: true,
outfile: `${taskPackageFolder}/${taskName}.js`
})
result.warnings.forEach(warning => console.log(warning))
})