@koliveira15/nx-sonarqube
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"main": "src/index.js", | ||
@@ -16,9 +16,10 @@ "generators": "./generators.json", | ||
"peerDependencies": { | ||
"@nx/devkit": ">= 16 < 20", | ||
"@phenomnomnominal/tsquery": "5.0.1", | ||
"sonarqube-scanner": ">= 3.1.0 < 4", | ||
"nx": ">= 16 < 20", | ||
"@nx/devkit": ">= 16 < 21", | ||
"@phenomnomnominal/tsquery": "6.1.3", | ||
"sonarqube-scanner": ">= 4.2.5 < 5", | ||
"nx": ">= 16 < 21", | ||
"tslib": ">= 2.3.0 < 3" | ||
}, | ||
"types": "./src/index.d.ts", | ||
"type": "commonjs" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = default_1; | ||
const tslib_1 = require("tslib"); | ||
@@ -19,3 +20,2 @@ const devkit_1 = require("@nx/devkit"); | ||
} | ||
exports.default = default_1; | ||
//# sourceMappingURL=executor.js.map |
@@ -16,3 +16,3 @@ import { ScanExecutorSchema } from '../schema'; | ||
export declare function scanner(options: ScanExecutorSchema, context: ExecutorContext): Promise<{ | ||
success: boolean; | ||
success: void; | ||
}>; | ||
@@ -19,0 +19,0 @@ export declare function getScannerOptions(context: ExecutorContext, options: ScanExecutorSchema, sources: string, lcovPaths: string): { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.projectPackageVersion = exports.getScannerOptions = exports.scanner = exports.determinePaths = void 0; | ||
exports.determinePaths = determinePaths; | ||
exports.scanner = scanner; | ||
exports.getScannerOptions = getScannerOptions; | ||
exports.projectPackageVersion = projectPackageVersion; | ||
const tslib_1 = require("tslib"); | ||
@@ -70,3 +73,3 @@ const devkit_1 = require("@nx/devkit"); | ||
const deps = yield getDependentPackagesForProject(context.projectName); | ||
const projectConfiguration = context.workspace.projects[context.projectName]; | ||
const projectConfiguration = context.projectsConfigurations.projects[context.projectName]; | ||
deps.workspaceLibraries.push({ | ||
@@ -104,4 +107,4 @@ name: context.projectName, | ||
const jestConfig = (0, fs_1.readFileSync)(jestConfigPath, 'utf-8'); | ||
const ast = tsquery_1.tsquery.ast(jestConfig); | ||
const nodes = (0, tsquery_1.tsquery)(ast, 'Identifier[name="coverageDirectory"] ~ StringLiteral', { visitAllChildren: true }); | ||
const astOutput = (0, tsquery_1.ast)(jestConfig); | ||
const nodes = (0, tsquery_1.query)(astOutput, 'PropertyAssignment:has(Identifier[name="coverageDirectory"]) StringLiteral', tsquery_1.ScriptKind.TS); | ||
if (nodes.length) { | ||
@@ -118,10 +121,12 @@ lcovPaths.push((0, devkit_1.joinPathFragments)(nodes[0] | ||
else if (TestRunner.Vitest) { | ||
const viteConfigPath = (0, devkit_1.joinPathFragments)(context.root, dep.projectRoot, 'vite.config.ts'); | ||
if (!(0, fs_1.existsSync)(viteConfigPath)) { | ||
devkit_1.logger.warn(`Skipping ${dep.name} as the vite config file cannot be found`); | ||
const viteConfigExtensions = ['.ts', '.js', '.mts', '.mjs']; | ||
const viteConfigPaths = viteConfigExtensions.map((ext) => (0, devkit_1.joinPathFragments)(context.root, dep.projectRoot, `vite.config${ext}`)); | ||
const viteConfigPath = viteConfigPaths.find((path) => (0, fs_1.existsSync)(path)); | ||
if (!viteConfigPath) { | ||
devkit_1.logger.warn(`Skipping ${dep.name} as no vite config file can be found. Checked extensions: ${viteConfigExtensions.join(', ')}`); | ||
return; | ||
} | ||
const config = (0, fs_1.readFileSync)(viteConfigPath, 'utf-8'); | ||
const ast = tsquery_1.tsquery.ast(config); | ||
const nodes = (0, tsquery_1.tsquery)(ast, 'Identifier[name="reportsDirectory"] ~ StringLiteral', { visitAllChildren: true }); | ||
const astOutput = (0, tsquery_1.ast)(config); | ||
const nodes = (0, tsquery_1.query)(astOutput, 'PropertyAssignment:has(Identifier[name="reportsDirectory"]) StringLiteral', tsquery_1.ScriptKind.TS); | ||
if (nodes.length) { | ||
@@ -148,3 +153,2 @@ lcovPaths.push((0, devkit_1.joinPathFragments)(nodes[0] | ||
} | ||
exports.determinePaths = determinePaths; | ||
function scanner(options, context) { | ||
@@ -158,3 +162,3 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const scannerOptions = getScannerOptions(context, options, paths.sources, paths.lcovPaths); | ||
const success = yield sonarQubeScanner.async({ | ||
const success = yield sonarQubeScanner.scan({ | ||
serverUrl: options.hostUrl, | ||
@@ -168,3 +172,2 @@ options: scannerOptions, | ||
} | ||
exports.scanner = scanner; | ||
function getScannerOptions(context, options, sources, lcovPaths) { | ||
@@ -197,3 +200,2 @@ let scannerOptions = { | ||
} | ||
exports.getScannerOptions = getScannerOptions; | ||
function getDependentPackagesForProject(name) { | ||
@@ -223,3 +225,3 @@ return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
} | ||
version = getPackageJsonVersion(context.workspace.projects[projectName].root); | ||
version = getPackageJsonVersion(context.projectsConfigurations.projects[projectName].root); | ||
if (version) { | ||
@@ -231,3 +233,2 @@ return version; | ||
} | ||
exports.projectPackageVersion = projectPackageVersion; | ||
function getPackageJsonVersion(dir = '') { | ||
@@ -234,0 +235,0 @@ let version = ''; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = default_1; | ||
const tslib_1 = require("tslib"); | ||
@@ -15,3 +16,2 @@ const devkit_1 = require("@nx/devkit"); | ||
} | ||
exports.default = default_1; | ||
function updateGitIgnore(tree) { | ||
@@ -18,0 +18,0 @@ const ignoreFile = '.gitignore'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
33853
523