Automatically set the recognized framework

This commit is contained in:
Elio Struyf
2022-04-21 12:49:56 +02:00
parent f0ed7c0b39
commit 9f6c35b9ec
3 changed files with 12 additions and 4 deletions
+11 -2
View File
@@ -5,7 +5,7 @@ import * as fs from "fs";
import { Notifications } from "../helpers/Notifications";
import { Template } from "./Template";
import { Folders } from "./Folders";
import { Logger, Settings } from "../helpers";
import { FrameworkDetector, Logger, Settings } from "../helpers";
import { SETTING_CONTENT_DEFAULT_FILETYPE, TelemetryEvent } from "../constants";
import { SettingsListener } from '../listeners/dashboard';
@@ -50,7 +50,16 @@ categories: []
Notifications.info("Project initialized successfully.");
}
Telemetry.send(TelemetryEvent.initialization)
Telemetry.send(TelemetryEvent.initialization);
// Check if you can find the framework
const wsFolder = Folders.getWorkspaceFolder();
const framework = FrameworkDetector.get(wsFolder?.fsPath || "");
if (framework) {
SettingsListener.setFramework(framework.name);
}
SettingsListener.getSettings();
} catch (err: any) {
-1
View File
@@ -1,7 +1,6 @@
import { existsSync, readFileSync } from "fs";
import { join, resolve } from "path";
import { FrameworkDetectors } from "../constants/FrameworkDetectors";
import { Extension } from "./Extension";
export class FrameworkDetector {
+1 -1
View File
@@ -53,7 +53,7 @@ export class SettingsListener extends BaseListener {
* Set the current site-generator or framework + related settings
* @param frameworkId
*/
private static setFramework(frameworkId: string | null) {
public static setFramework(frameworkId: string | null) {
Settings.update(SETTING_FRAMEWORK_ID, frameworkId, true);
if (frameworkId) {