@nx-go/nx-go
Advanced tools
Comparing version 2.1.0 to 2.2.0
{ | ||
"name": "@nx-go/nx-go", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "generators": "./generators.json", |
@@ -8,3 +8,3 @@ "use strict"; | ||
const mainFile = `${options.main}`; | ||
const output = `-o ${options.outputPath}`; | ||
const output = `-o ${options.outputPath}${process.platform === 'win32' ? '.exe' : ''}`; | ||
return (0, utils_1.runGoCommand)(context, 'build', [output, mainFile]); | ||
@@ -11,0 +11,0 @@ }); |
@@ -7,3 +7,5 @@ "use strict"; | ||
const child_process_1 = require("child_process"); | ||
const find_workspace_root_path_1 = require("../utils/find-workspace-root-path"); | ||
const processProjectGraph = (graph, context) => { | ||
const workspaceRootPath = (0, find_workspace_root_path_1.findNxWorkspaceRootPath)(); | ||
const projectRootLookupMap = new Map(); | ||
@@ -19,3 +21,7 @@ for (const projectName in graph.nodes) { | ||
.filter((f) => (0, path_1.extname)(f.file) === '.go') | ||
.map(({ file }) => ({ projectName, file, dependencies: getGoDependencies(projectRootLookupMap, file) })) | ||
.map(({ file }) => ({ | ||
projectName, | ||
file, | ||
dependencies: getGoDependencies(workspaceRootPath, projectRootLookupMap, file), | ||
})) | ||
.filter((data) => data.dependencies && data.dependencies.length > 0) | ||
@@ -37,15 +43,22 @@ .forEach(({ projectName, file, dependencies }) => { | ||
*/ | ||
const getGoDependencies = (projectRootLookup, file) => { | ||
const getGoDependencies = (workspaceRootPath, projectRootLookup, file) => { | ||
var _a; | ||
const goPackageDataJson = (0, child_process_1.execSync)('go list -json ./' + file, { encoding: 'utf-8' }); | ||
const goPackage = JSON.parse(goPackageDataJson); | ||
const isTestFile = (0, path_1.basename)(file, '.go').endsWith('_test'); | ||
// Use the correct imports list depending if the file is a test file. | ||
const listOfImports = (_a = (!isTestFile ? goPackage.Imports : goPackage.TestImports)) !== null && _a !== void 0 ? _a : []; | ||
return listOfImports | ||
.filter((d) => d.startsWith(goPackage.Module.Path)) | ||
.map((d) => d.substring(goPackage.Module.Path.length + 1)) | ||
.map((rootDir) => projectRootLookup.get(rootDir)) | ||
.filter((projectName) => projectName); | ||
try { | ||
const goPackageDataJson = (0, child_process_1.execSync)('go list -json ./' + file, { encoding: 'utf-8', cwd: workspaceRootPath }); | ||
const goPackage = JSON.parse(goPackageDataJson); | ||
const isTestFile = (0, path_1.basename)(file, '.go').endsWith('_test'); | ||
// Use the correct imports list depending if the file is a test file. | ||
const listOfImports = (_a = (!isTestFile ? goPackage.Imports : goPackage.TestImports)) !== null && _a !== void 0 ? _a : []; | ||
return listOfImports | ||
.filter((d) => d.startsWith(goPackage.Module.Path)) | ||
.map((d) => d.substring(goPackage.Module.Path.length + 1)) | ||
.map((rootDir) => projectRootLookup.get(rootDir)) | ||
.filter((projectName) => projectName); | ||
} | ||
catch (ex) { | ||
console.error(`Error processing ${file}`); | ||
console.error(ex); | ||
return []; // Return an empty array so that we can process other files | ||
} | ||
}; | ||
//# sourceMappingURL=index.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38582
70
568
2