Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/WebPackWrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { readJsonFromRoot, readJsonFromVisual } from './utils.js'

const config = await readJsonFromRoot('config.json');
const npmPackage = await readJsonFromRoot('package.json');
const visualPackage = await readJsonFromVisual('package.json');

const visualPlugin = "visualPlugin.ts";
const encoding = "utf8";
Expand Down Expand Up @@ -134,17 +135,6 @@ export default class WebPackWrap {
}
}

async getEnvironmentDetails() {
const env = {
nodeVersion: process.versions.node,
osPlatform: await os.platform(),
osVersion: await os.version ?? "undefined",
osReleaseVersion: await os.release(),
toolsVersion: npmPackage.version
};
return env;
}

async configureCustomVisualsWebpackPlugin(visualPackage, options, tsconfig) {
if (options.skipApiCheck) {
ConsoleWriter.warning(`Skipping API check. Tools started with --skipApi flag.`);
Expand All @@ -154,6 +144,7 @@ export default class WebPackWrap {

const api = await WebPackWrap.loadAPIPackage();
const dependenciesPath = typeof this.pbiviz.dependencies === "string" && path.join(process.cwd(), this.pbiviz.dependencies);
const environmentInformation = await this.getEnvironmentInformation(options);
let pluginConfiguration = {
...lodashCloneDeep(visualPackage.pbivizConfig),

Expand All @@ -175,10 +166,25 @@ export default class WebPackWrap {
compression: options.compression,
certificationAudit: options.certificationAudit,
certificationFix: options.certificationFix,
environmentInformation: environmentInformation
};
return pluginConfiguration;
}

async getEnvironmentInformation(options) {
const typescriptVersion = process.versions.typescript ??
visualPackage?.devDependencies?.typescript ??
visualPackage?.dependencies?.typescript;
const environmentInformation = {
typescript: typescriptVersion,
node: process.versions.node,
tools: npmPackage.version,
flags: JSON.stringify(options),
os: await os.platform()
};
return environmentInformation;
}

async configureAPIVersion() {
//(?<=powerbi-visuals-api@) - positive look-behind to find version installed in visual and get 3 level version.
const regexFullVersion = /(?<=powerbi-visuals-api@)((?:\d+\.?){1,3})/g;
Expand Down