Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nx-go/nx-go

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nx-go/nx-go - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

src/utils/find-workspace-root-path.d.ts

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc