I am developing a custom pipeline task for Azure DevOps to extend commit lint's functionality. All source files (and node modules) have been packaged inside the .vsix file. However when running the task in a pipeline it returns the following error as it is looking in the global node_modules.
My question is: How can I ensure the extension searches for the dependency locally not the global directory, also I'm not sure if the error lies in vss-extension.json or the file that is importing the package.
The error:
##[error]Cannot find module "/usr/local/lib/node_modules/@commitlint/config-conventional/lib/index.js" from "/home/vsts/work/1/s"
The files section of vss-extension.json
"files": [
{
"path": "BuildTasks/CommitCheck"
},
{
"path": "BuildTasks/CommitCheck/v1/node_modules",
"packagePath": "BuildTasks/CommitCheck/v1/node_modules",
"addressable": true
}
],
The file that is causing the error to occur:
export const configuration = {
extends: ['@commitlint/config-conventional/lib/index.js'],
parserPreset: {
parserOpts: {
headerPattern: /^(chore|fix|feat|docs|ci)\((\w+-?[0-9]*)\): (\w[^\n\s]+ [^\n]+)/,
headerCorrespondence: ['type', 'ticket', 'subject'],
},
},
rules: {
'subject-case': [0, 'never', 'subject-case'],
'body-max-line-length': [0, 'always', 1000],
'header-max-length': [0, 'always', 200],
},
}