build: improve npm build

Add go.mod to node_modules folder, that way Go compiler doesn't
need to scan the node_module directories for any Go code.

Change-Id: I747909416490c847d6b4bfa3438fea66660fcd53
This commit is contained in:
Egon Elbre 2022-07-01 11:42:22 +03:00
parent 05e165283f
commit 97e6e5a6a3
10 changed files with 107 additions and 90 deletions

View File

@ -35,10 +35,6 @@ pipeline {
// pre-check that we cannot do at a later stage reliably
sh 'check-large-files'
// add a stub go.mod file to node projects to prevent go build ./... from scanning them
sh 'mkdir -p web/satellite/node_modules web/storagenode/node_modules web/multinode/node_modules'
sh 'touch web/satellite/node_modules/go.mod web/storagenode/node_modules/go.mod web/multinode/node_modules/go.mod'
}
}
stage('Build Web') {

View File

@ -35,10 +35,6 @@ pipeline {
// pre-check that we cannot do at a later stage reliably
sh 'check-large-files'
// add a stub go.mod file to node projects to prevent go build ./... from scanning them
sh 'mkdir -p web/satellite/node_modules web/storagenode/node_modules web/multinode/node_modules'
sh 'touch web/satellite/node_modules/go.mod web/storagenode/node_modules/go.mod web/multinode/node_modules/go.mod'
}
}
stage('Gerrit status') {
@ -93,7 +89,8 @@ pipeline {
}
}
}
stage('Build Web') {
stage('Build and Lint Web') {
// The build code depends on the following assets being loaded.
parallel {
stage('web/satellite') {
@ -158,6 +155,8 @@ pipeline {
sh 'npm ci --prefer-offline --no-audit'
sh 'npm run build'
sh script: 'npm audit', returnStatus: true
sh 'npm run check'
sh 'npm run lint'
}
}
}
@ -192,17 +191,7 @@ pipeline {
sh './scripts/check-package-lock.sh'
}
}
stage('Lint Admin UI') {
when {
changeset "satellite/admin/ui"
}
steps {
dir("satellite/admin/ui") {
sh 'npm run check'
sh 'npm run lint'
}
}
}
stage('Tests') {
environment {
STORJ_TEST_HOST = '127.0.0.20;127.0.0.21;127.0.0.22;127.0.0.23;127.0.0.24;127.0.0.25'

View File

@ -6,3 +6,6 @@ node_modules
/package
.env
.env.*
# Stub for Go to avoid scanning node_modules.
!node_modules/go.mod

View File

@ -0,0 +1,5 @@
module storj.io/storj/satellite/admin/ui/node_modules
go 1.17
// Stub module to prevent Go from scanning node_modules directory.

View File

@ -24,3 +24,6 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
# Stub for Go to avoid scanning node_modules.
!node_modules/go.mod

5
web/multinode/node_modules/go.mod vendored Normal file
View File

@ -0,0 +1,5 @@
module storj.io/storj/web/multinode/node_modules
go 1.17
// Stub module to prevent Go from scanning node_modules directory.

View File

@ -30,3 +30,6 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
# Stub for Go to avoid scanning node_modules.
!node_modules/go.mod

5
web/satellite/node_modules/go.mod vendored Normal file
View File

@ -0,0 +1,5 @@
module storj.io/storj/web/satellite/node_modules
go 1.17
// Stub module to prevent Go from scanning node_modules directory.

View File

@ -24,3 +24,6 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
# Stub for Go to avoid scanning node_modules.
!node_modules/go.mod

5
web/storagenode/node_modules/go.mod vendored Normal file
View File

@ -0,0 +1,5 @@
module storj.io/storj/web/storagenode/node_modules
go 1.17
// Stub module to prevent Go from scanning node_modules directory.