Skip to content

Commit 00f7976

Browse files
committed
style: fix js lint errors
1 parent 2ec7944 commit 00f7976

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

genMatrix.js

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
1-
'use strict';
2-
const path = require('path');
3-
const fs = require('fs');
1+
'use strict'
2+
const path = require('path')
3+
const fs = require('fs')
44

55
const testFiles = [
66
'genMatrix.js',
7-
'.github/workflows/build-test.yml',
8-
];
7+
'.github/workflows/build-test.yml'
8+
]
99

10-
const nodeDirRegex = /^\d+$/;
10+
const nodeDirRegex = /^\d+$/
1111

1212
const areTestFilesChanged = (changedFiles) => changedFiles
13-
.some((file) => testFiles.includes(file));
13+
.some((file) => testFiles.includes(file))
1414

1515
// Returns a list of the child directories in the given path
1616
const getChildDirectories = (parent) => fs.readdirSync(parent, { withFileTypes: true })
1717
.filter((dirent) => dirent.isDirectory())
18-
.map(({ name }) => path.resolve(parent, name));
18+
.map(({ name }) => path.resolve(parent, name))
1919

2020
const getNodeVerionDirs = (base) => getChildDirectories(base)
21-
.filter((childPath) => nodeDirRegex.test(path.basename(childPath)));
21+
.filter((childPath) => nodeDirRegex.test(path.basename(childPath)))
2222

2323
// Returns the paths of Dockerfiles that are at: base/*/Dockerfile
2424
const getDockerfilesInChildDirs = (base) => getChildDirectories(base)
25-
.map((childDir) => path.resolve(childDir, 'Dockerfile'));
25+
.map((childDir) => path.resolve(childDir, 'Dockerfile'))
2626

27-
const getAllDockerfiles = (base) => getNodeVerionDirs(base).flatMap(getDockerfilesInChildDirs);
27+
const getAllDockerfiles = (base) => getNodeVerionDirs(base).flatMap(getDockerfilesInChildDirs)
2828

2929
const getAffectedDockerfiles = (filesAdded, filesModified, filesRenamed) => {
3030
const files = [
3131
...filesAdded,
3232
...filesModified,
33-
...filesRenamed,
34-
];
33+
...filesRenamed
34+
]
3535

3636
// If the test files were changed, include everything
3737
if (areTestFilesChanged(files)) {
38-
console.log('Test files changed so scheduling all Dockerfiles');
39-
return getAllDockerfiles(__dirname);
38+
console.log('Test files changed so scheduling all Dockerfiles')
39+
return getAllDockerfiles(__dirname)
4040
}
4141

42-
const modifiedDockerfiles = files.filter((file) => file.endsWith('/Dockerfile'));
42+
const modifiedDockerfiles = files.filter((file) => file.endsWith('/Dockerfile'))
4343

4444
// Get Dockerfiles affected by modified docker-entrypoint.sh files
4545
const entrypointAffectedDockerfiles = files
4646
.filter((file) => file.endsWith('/docker-entrypoint.sh'))
47-
.map((file) => path.resolve(path.dirname(file), 'Dockerfile'));
47+
.map((file) => path.resolve(path.dirname(file), 'Dockerfile'))
4848

4949
return [
5050
...modifiedDockerfiles,
51-
...entrypointAffectedDockerfiles,
52-
];
53-
};
51+
...entrypointAffectedDockerfiles
52+
]
53+
}
5454

5555
const getFullNodeVersionFromDockerfile = (file) => fs.readFileSync(file, 'utf8')
56-
.match(/^ENV NODE_VERSION (\d*\.*\d*\.\d*)/m)[1];
56+
.match(/^ENV NODE_VERSION (\d*\.*\d*\.\d*)/m)[1]
5757

5858
const getDockerfileMatrixEntry = (file) => {
59-
const [variant] = path.dirname(file).split(path.sep).slice(-1);
59+
const [variant] = path.dirname(file).split(path.sep).slice(-1)
6060

61-
const version = getFullNodeVersionFromDockerfile(file);
61+
const version = getFullNodeVersionFromDockerfile(file)
6262

6363
return {
6464
version,
65-
variant,
66-
};
67-
};
65+
variant
66+
}
67+
}
6868

6969
const generateBuildMatrix = (filesAdded, filesModified, filesRenamed) => {
70-
const dockerfiles = [...new Set(getAffectedDockerfiles(filesAdded, filesModified, filesRenamed))];
70+
const dockerfiles = [...new Set(getAffectedDockerfiles(filesAdded, filesModified, filesRenamed))]
7171

72-
const entries = dockerfiles.map(getDockerfileMatrixEntry);
72+
const entries = dockerfiles.map(getDockerfileMatrixEntry)
7373

7474
// Return null if there are no entries so we can skip the matrix step
7575
return entries.length
7676
? { include: entries }
77-
: null;
78-
};
77+
: null
78+
}
7979

80-
module.exports = generateBuildMatrix;
80+
module.exports = generateBuildMatrix

0 commit comments

Comments
 (0)