@nx-go/nx-go
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -11,4 +11,10 @@ { | ||
"description": "Create a new Go application" | ||
}, | ||
"library": { | ||
"aliases": ["lib"], | ||
"factory": "./src/schematics/library/schematic", | ||
"schema": "./src/schematics/library/schema.json", | ||
"description": "Create a new Go library" | ||
} | ||
} | ||
} |
{ | ||
"name": "@nx-go/nx-go", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "schematics": "./collection.json", |
@@ -10,5 +10,8 @@ "use strict"; | ||
var _a; | ||
return rxjs_1.from(context.getProjectMetadata((_a = context === null || context === void 0 ? void 0 : context.target) === null || _a === void 0 ? void 0 : _a.project)).pipe(operators_1.map(() => { | ||
const mainFile = `${options.main}`; | ||
return go_utils_1.runGoCommand(context, 'run', [mainFile], { cmd: options.cmd }); | ||
return rxjs_1.from(context.getProjectMetadata((_a = context === null || context === void 0 ? void 0 : context.target) === null || _a === void 0 ? void 0 : _a.project)).pipe(operators_1.map((project) => { | ||
var _a; | ||
const cwd = `${project.root}`; | ||
// We strip the project root from the mail file | ||
const mainFile = (_a = options.main) === null || _a === void 0 ? void 0 : _a.replace(`${cwd}/`, ''); | ||
return go_utils_1.runGoCommand(context, 'run', [mainFile], { cmd: options.cmd, cwd }); | ||
})); | ||
@@ -15,0 +18,0 @@ } |
@@ -5,2 +5,3 @@ export interface ApplicationSchematicSchema { | ||
directory?: string | ||
skipGoMod?: boolean | ||
} |
@@ -25,2 +25,7 @@ { | ||
"alias": "d" | ||
}, | ||
"skipGoMod": { | ||
"type": "boolean", | ||
"description": "Skip creation of go.mod.", | ||
"default": false | ||
} | ||
@@ -27,0 +32,0 @@ }, |
@@ -19,3 +19,3 @@ "use strict"; | ||
projectDirectory, | ||
parsedTags }); | ||
parsedTags, skipGoMod: options.skipGoMod || false }); | ||
} | ||
@@ -28,2 +28,13 @@ function addFiles(options) { | ||
} | ||
function createGoMod(options) { | ||
return (tree, context) => { | ||
if (options.skipGoMod === false) { | ||
const modFile = 'go.mod'; | ||
if (!tree.exists(`${modFile}`)) { | ||
context.logger.info(`Creating ${modFile} in workspace root`); | ||
tree.create(`${modFile}`, `module ${options.name}\n`); | ||
} | ||
} | ||
}; | ||
} | ||
function default_1(options) { | ||
@@ -70,2 +81,3 @@ const normalizedOptions = normalizeOptions(options); | ||
addFiles(normalizedOptions), | ||
createGoMod(normalizedOptions), | ||
]); | ||
@@ -72,0 +84,0 @@ } |
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
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
36656
50
602