@sap-ux/fiori-generator-shared 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,3 @@
1
- export declare const YEOMANUI_TARGET_FOLDER_CONFIG_PROP = "ApplicationWizard.TargetFolder";
2
- export declare const LOGGING_LEVEL_CONFIG_PROP = "ApplicationWizard.loggingLevel";
3
- export declare const DEFAULT_PROJECTS_FOLDER: string;
4
1
  export declare const YUI_EXTENSION_ID = "sapos.yeoman-ui";
5
2
  export declare const YUI_MIN_VER_FILES_GENERATED_MSG = "1.16.6";
6
3
  //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -1,14 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.YUI_MIN_VER_FILES_GENERATED_MSG = exports.YUI_EXTENSION_ID = exports.DEFAULT_PROJECTS_FOLDER = exports.LOGGING_LEVEL_CONFIG_PROP = exports.YEOMANUI_TARGET_FOLDER_CONFIG_PROP = void 0;
7
- const os_1 = __importDefault(require("os"));
8
- const path_1 = require("path");
9
- exports.YEOMANUI_TARGET_FOLDER_CONFIG_PROP = 'ApplicationWizard.TargetFolder';
10
- exports.LOGGING_LEVEL_CONFIG_PROP = 'ApplicationWizard.loggingLevel';
11
- exports.DEFAULT_PROJECTS_FOLDER = (0, path_1.join)(os_1.default.homedir(), 'projects');
3
+ exports.YUI_MIN_VER_FILES_GENERATED_MSG = exports.YUI_EXTENSION_ID = void 0;
12
4
  exports.YUI_EXTENSION_ID = 'sapos.yeoman-ui';
13
5
  // From YUI version 1.16.6 the message 'The files have been generated.' is not shown unless a top level dir is created
14
6
  exports.YUI_MIN_VER_FILES_GENERATED_MSG = '1.16.6';
@@ -1,3 +1,4 @@
1
+ import { type HostEnvironmentId } from './types';
1
2
  /**
2
3
  * Determine if the current prompting environment is cli .
3
4
  *
@@ -11,6 +12,6 @@ export declare function isCli(): boolean;
11
12
  */
12
13
  export declare function getHostEnvironment(): {
13
14
  name: string;
14
- technical: string;
15
+ technical: HostEnvironmentId;
15
16
  };
16
17
  //# sourceMappingURL=environment.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  export * from './cap';
2
2
  export * from './constants';
3
3
  export * from './environment';
4
- export * from './logWrapper';
5
4
  export * from './system-utils';
6
5
  export * from './telemetry';
7
- export { getPackageScripts } from './getPackageScripts';
8
- export { getBootstrapResourceUrls, getDefaultTargetFolder } from './helpers';
9
- export { generateReadMe } from './read-me';
6
+ export * from './logging/logWrapper';
7
+ export { getPackageScripts } from './npm-package-scripts/getPackageScripts';
8
+ export { getBootstrapResourceUrls } from './ui5/ui5';
9
+ export { getDefaultTargetFolder, isExtensionInstalled } from './vscode-helpers/vscode-helpers';
10
+ export { generateReadMe } from './read-me/read-me';
10
11
  export { getHostEnvironment } from './environment';
11
- export { isExtensionInstalled } from './installedCheck';
12
- export { PackageJsonScripts, YeomanEnvironment, VSCodeInstance, hostEnvironment } from './types';
12
+ export { YeomanEnvironment, VSCodeInstance, hostEnvironment, HostEnvironmentId } from './types';
13
13
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -14,24 +14,24 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.hostEnvironment = exports.isExtensionInstalled = exports.getHostEnvironment = exports.generateReadMe = exports.getDefaultTargetFolder = exports.getBootstrapResourceUrls = exports.getPackageScripts = void 0;
17
+ exports.hostEnvironment = exports.getHostEnvironment = exports.generateReadMe = exports.isExtensionInstalled = exports.getDefaultTargetFolder = exports.getBootstrapResourceUrls = exports.getPackageScripts = void 0;
18
18
  __exportStar(require("./cap"), exports);
19
19
  __exportStar(require("./constants"), exports);
20
20
  __exportStar(require("./environment"), exports);
21
- __exportStar(require("./logWrapper"), exports);
22
21
  __exportStar(require("./system-utils"), exports);
23
22
  __exportStar(require("./telemetry"), exports);
24
- var getPackageScripts_1 = require("./getPackageScripts");
23
+ __exportStar(require("./logging/logWrapper"), exports);
24
+ var getPackageScripts_1 = require("./npm-package-scripts/getPackageScripts");
25
25
  Object.defineProperty(exports, "getPackageScripts", { enumerable: true, get: function () { return getPackageScripts_1.getPackageScripts; } });
26
- var helpers_1 = require("./helpers");
27
- Object.defineProperty(exports, "getBootstrapResourceUrls", { enumerable: true, get: function () { return helpers_1.getBootstrapResourceUrls; } });
28
- Object.defineProperty(exports, "getDefaultTargetFolder", { enumerable: true, get: function () { return helpers_1.getDefaultTargetFolder; } });
29
- var read_me_1 = require("./read-me");
26
+ var ui5_1 = require("./ui5/ui5");
27
+ Object.defineProperty(exports, "getBootstrapResourceUrls", { enumerable: true, get: function () { return ui5_1.getBootstrapResourceUrls; } });
28
+ var vscode_helpers_1 = require("./vscode-helpers/vscode-helpers");
29
+ Object.defineProperty(exports, "getDefaultTargetFolder", { enumerable: true, get: function () { return vscode_helpers_1.getDefaultTargetFolder; } });
30
+ Object.defineProperty(exports, "isExtensionInstalled", { enumerable: true, get: function () { return vscode_helpers_1.isExtensionInstalled; } });
31
+ var read_me_1 = require("./read-me/read-me");
30
32
  Object.defineProperty(exports, "generateReadMe", { enumerable: true, get: function () { return read_me_1.generateReadMe; } });
31
33
  var environment_1 = require("./environment");
32
34
  Object.defineProperty(exports, "getHostEnvironment", { enumerable: true, get: function () { return environment_1.getHostEnvironment; } });
33
- var installedCheck_1 = require("./installedCheck");
34
- Object.defineProperty(exports, "isExtensionInstalled", { enumerable: true, get: function () { return installedCheck_1.isExtensionInstalled; } });
35
35
  var types_1 = require("./types");
36
36
  Object.defineProperty(exports, "hostEnvironment", { enumerable: true, get: function () { return types_1.hostEnvironment; } });
37
37
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,7 @@
1
1
  import type { IVSCodeExtLogger, LogLevel, IChildLogger as ILogWrapper } from '@vscode-logging/logger';
2
2
  import type { Logger } from 'yeoman-environment';
3
3
  export type { ILogWrapper };
4
+ export declare const LOGGING_LEVEL_CONFIG_PROP = "ApplicationWizard.loggingLevel";
4
5
  /**
5
6
  * Empty Implementation of the Logger, this is not strictly necessary in app gen but
6
7
  * other modules consuming parts of app gen need a dummy implementation (logs to console)
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogWrapper = exports.DefaultLogger = void 0;
3
+ exports.LogWrapper = exports.DefaultLogger = exports.LOGGING_LEVEL_CONFIG_PROP = void 0;
4
4
  exports.createCLILogger = createCLILogger;
5
5
  const logger_1 = require("@vscode-logging/logger");
6
6
  const logform_1 = require("logform");
7
- const i18n_1 = require("./i18n");
8
- const constants_1 = require("./constants");
7
+ const i18n_1 = require("../i18n");
8
+ exports.LOGGING_LEVEL_CONFIG_PROP = 'ApplicationWizard.loggingLevel';
9
9
  /**
10
10
  * Empty Implementation of the Logger, this is not strictly necessary in app gen but
11
11
  * other modules consuming parts of app gen need a dummy implementation (logs to console)
@@ -82,7 +82,7 @@ class LogWrapper {
82
82
  LogWrapper._yoLogger = yoLogger;
83
83
  if (extLogger) {
84
84
  LogWrapper._logLevel = vscode
85
- ? vscode.workspace.getConfiguration().get(constants_1.LOGGING_LEVEL_CONFIG_PROP)
85
+ ? vscode.workspace.getConfiguration().get(exports.LOGGING_LEVEL_CONFIG_PROP)
86
86
  : logLevel ?? 'info';
87
87
  LogWrapper._vscodeLogger = extLogger.getChildLogger({ label: logName });
88
88
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPackageScripts = getPackageScripts;
4
- const i18n_1 = require("./i18n");
4
+ const i18n_1 = require("../i18n");
5
5
  /**
6
6
  * Builds the command for the `start-noflp` script in `package.json`.
7
7
  *
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Defines the structure for the `package.json` scripts section.
3
+ */
4
+ export interface PackageJsonScripts {
5
+ /** The command to start the application. */
6
+ start: string;
7
+ /** The command to start the application with local configuration */
8
+ 'start-local': string;
9
+ /** Optional command to start the application without flp command. */
10
+ 'start-noflp'?: string;
11
+ /** Optional command to start the application with a mock server configuration. */
12
+ 'start-mock'?: string;
13
+ /** Optional command to run tests. */
14
+ 'int-test'?: string;
15
+ /** Optional command to add the variants management script. */
16
+ 'start-variants-management'?: string;
17
+ }
18
+ /**
19
+ * Defines the options for generating `package.json` scripts.
20
+ */
21
+ export interface PackageScriptsOptions {
22
+ /** Specifies whether only a local server is available. If true, certain scripts may display a warning message. */
23
+ localOnly: boolean;
24
+ /** Indicates if a script for using a mock server should be added. Defaults to true. */
25
+ addMock?: boolean;
26
+ /** Indicates if a script for running integration tests should be added. Defaults to false. */
27
+ addTest?: boolean;
28
+ /** The SAP client to be used, if applicable. */
29
+ sapClient?: string;
30
+ /** The flp app ID to be used in URLs. */
31
+ flpAppId?: string;
32
+ /** The path to the file that should be opened with the `start` script. */
33
+ startFile?: string;
34
+ /** The path to the file that should be opened with the `start-local` script. */
35
+ localStartFile?: string;
36
+ /** If true, a script for starting the app without flp will be generated. Defaults to true. */
37
+ generateIndex?: boolean;
38
+ }
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -12,7 +12,7 @@ const path_1 = require("path");
12
12
  */
13
13
  function generateReadMe(destPath, readMe, fs) {
14
14
  // Apply the configuration to generate the README file
15
- const templateSourcePath = (0, path_1.join)(__dirname, '..', 'templates/README.md');
15
+ const templateSourcePath = (0, path_1.join)(__dirname, '../../templates/README.md');
16
16
  const templateDestPath = `${destPath}/README.md`;
17
17
  // copy template
18
18
  fs.copyTpl(templateSourcePath, templateDestPath, readMe);
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Interface representing additional entries for the README file.
3
+ */
4
+ interface AdditionalEntries {
5
+ /** The label for the additional entry. */
6
+ label: string;
7
+ /** The value corresponding to the label of the additional entry. */
8
+ value: string;
9
+ }
10
+ /**
11
+ * Interface representing the configuration for generating a README file.
12
+ * Extends OptionalEntries to include dynamic properties along with the core properties.
13
+ */
14
+ export interface ReadMe {
15
+ /** The name of the application. */
16
+ appName: string;
17
+ /** The title of the application. */
18
+ appTitle: string;
19
+ /** The namespace of the application. */
20
+ appNamespace: string;
21
+ /** The description of the application. */
22
+ appDescription: string;
23
+ /** The UI5 theme used in the application. */
24
+ ui5Theme: string;
25
+ /** The name of generator used. */
26
+ generatorName: string;
27
+ /** The version of the generator used. */
28
+ generatorVersion: string;
29
+ /** The ui5 version used in the application. */
30
+ ui5Version: string;
31
+ /** The floorplan template name used to generate the application. */
32
+ template: string;
33
+ /** The date when the generator was run. */
34
+ generationDate?: string;
35
+ /** The service URL of the application */
36
+ serviceUrl?: string;
37
+ /** The service type for the application. */
38
+ serviceType?: string;
39
+ /** The platform on which the generator was run. */
40
+ generatorPlatform?: string;
41
+ /** The filename of the metadata file */
42
+ metadataFilename?: string;
43
+ /** Flag indicating whether code assistance is enabled. */
44
+ enableCodeAssist?: boolean;
45
+ /** Flag indicating whether TypeScript is enabled. */
46
+ enableTypeScript?: boolean;
47
+ /** Flag indicating whether ESLint is enabled. */
48
+ enableEslint?: boolean;
49
+ /** Flag indicating whether to show mock data info. */
50
+ showMockDataInfo?: boolean;
51
+ /** Text used to launch the application */
52
+ launchText?: string;
53
+ /** Additional custom entries for the application. */
54
+ additionalEntries?: AdditionalEntries[];
55
+ }
56
+ export {};
57
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
package/dist/types.d.ts CHANGED
@@ -1,58 +1,3 @@
1
- /**
2
- * Interface representing additional entries for the README file.
3
- */
4
- interface AdditionalEntries {
5
- /** The label for the additional entry. */
6
- label: string;
7
- /** The value corresponding to the label of the additional entry. */
8
- value: string;
9
- }
10
- /**
11
- * Interface representing the configuration for generating a README file.
12
- * Extends OptionalEntries to include dynamic properties along with the core properties.
13
- */
14
- export interface ReadMe {
15
- /** The name of the application. */
16
- appName: string;
17
- /** The title of the application. */
18
- appTitle: string;
19
- /** The namespace of the application. */
20
- appNamespace: string;
21
- /** The description of the application. */
22
- appDescription: string;
23
- /** The UI5 theme used in the application. */
24
- ui5Theme: string;
25
- /** The name of generator used. */
26
- generatorName: string;
27
- /** The version of the generator used. */
28
- generatorVersion: string;
29
- /** The ui5 version used in the application. */
30
- ui5Version: string;
31
- /** The floorplan template name used to generate the application. */
32
- template: string;
33
- /** The date when the generator was run. */
34
- generationDate?: string;
35
- /** The service URL of the application */
36
- serviceUrl?: string;
37
- /** The service type for the application. */
38
- serviceType?: string;
39
- /** The platform on which the generator was run. */
40
- generatorPlatform?: string;
41
- /** The filename of the metadata file */
42
- metadataFilename?: string;
43
- /** Flag indicating whether code assistance is enabled. */
44
- enableCodeAssist?: boolean;
45
- /** Flag indicating whether TypeScript is enabled. */
46
- enableTypeScript?: boolean;
47
- /** Flag indicating whether ESLint is enabled. */
48
- enableEslint?: boolean;
49
- /** Flag indicating whether to show mock data info. */
50
- showMockDataInfo?: boolean;
51
- /** Text used to launch the application */
52
- launchText?: string;
53
- /** Additional custom entries for the application. */
54
- additionalEntries?: AdditionalEntries[];
55
- }
56
1
  /**
57
2
  * Interface for the yeoman environment.
58
3
  */
@@ -72,56 +17,12 @@ export interface VSCodeInstance {
72
17
  executeCommand: (command: string, ...rest: any[]) => Promise<void>;
73
18
  };
74
19
  }
75
- /**
76
- * Defines the structure for the `package.json` scripts section.
77
- */
78
- export interface PackageJsonScripts {
79
- /** The command to start the application. */
80
- start: string;
81
- /** The command to start the application with local configuration */
82
- 'start-local': string;
83
- /** Optional command to start the application without flp command. */
84
- 'start-noflp'?: string;
85
- /** Optional command to start the application with a mock server configuration. */
86
- 'start-mock'?: string;
87
- /** Optional command to run tests. */
88
- 'int-test'?: string;
89
- /** Optional command to add the variants management script. */
90
- 'start-variants-management'?: string;
91
- }
92
- /**
93
- * Defines the options for generating `package.json` scripts.
94
- */
95
- export interface PackageScriptsOptions {
96
- /** Specifies whether only a local server is available. If true, certain scripts may display a warning message. */
97
- localOnly: boolean;
98
- /** Indicates if a script for using a mock server should be added. Defaults to true. */
99
- addMock?: boolean;
100
- /** Indicates if a script for running integration tests should be added. Defaults to false. */
101
- addTest?: boolean;
102
- /** The SAP client to be used, if applicable. */
103
- sapClient?: string;
104
- /** The flp app ID to be used in URLs. */
105
- flpAppId?: string;
106
- /** The path to the file that should be opened with the `start` script. */
107
- startFile?: string;
108
- /** The path to the file that should be opened with the `start-local` script. */
109
- localStartFile?: string;
110
- /** If true, a script for starting the app without flp will be generated. Defaults to true. */
111
- generateIndex?: boolean;
112
- }
20
+ type HostEnvironment = 'vscode' | 'bas' | 'cli';
21
+ export type HostEnvironmentId = 'VSCode' | 'SBAS' | 'CLI';
113
22
  export declare const hostEnvironment: {
114
- vscode: {
115
- name: string;
116
- technical: string;
117
- };
118
- bas: {
119
- name: string;
120
- technical: string;
121
- };
122
- cli: {
23
+ [key in HostEnvironment]: {
123
24
  name: string;
124
- technical: string;
25
+ technical: HostEnvironmentId;
125
26
  };
126
27
  };
127
28
  export declare enum ApiHubType {
@@ -10,11 +10,4 @@ export declare function getBootstrapResourceUrls(isEdmxProjectType: boolean, fra
10
10
  uShellBootstrapResourceUrl: string;
11
11
  uiBootstrapResourceUrl: string;
12
12
  };
13
- /**
14
- * Determines the target folder for the project.
15
- *
16
- * @param vscode - the vscode instance
17
- * @returns The default path, if it can be determined otherwise undefined.
18
- */
19
- export declare function getDefaultTargetFolder(vscode: any): string | undefined;
20
- //# sourceMappingURL=helpers.d.ts.map
13
+ //# sourceMappingURL=ui5.d.ts.map
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBootstrapResourceUrls = getBootstrapResourceUrls;
4
- exports.getDefaultTargetFolder = getDefaultTargetFolder;
5
- const fs_1 = require("fs");
6
- const constants_1 = require("./constants");
7
4
  /**
8
5
  * Get the resource URLs for the UShell bootstrap and UI5 bootstrap based on project type and UI5 framework details.
9
6
  *
@@ -26,27 +23,4 @@ function getBootstrapResourceUrls(isEdmxProjectType, frameworkUrl, version) {
26
23
  const uiBootstrapResourceUrl = isEdmxProjectType || !frameworkUrl ? `..${relativeUiPath}` : `${frameworkUrl}${versionPath}${relativeUiPath}`;
27
24
  return { uShellBootstrapResourceUrl, uiBootstrapResourceUrl };
28
25
  }
29
- /**
30
- * Determines the target folder for the project.
31
- *
32
- * @param vscode - the vscode instance
33
- * @returns The default path, if it can be determined otherwise undefined.
34
- */
35
- function getDefaultTargetFolder(vscode) {
36
- // CLI use will not define vscode
37
- if (!vscode) {
38
- return undefined;
39
- }
40
- const targetFolder = vscode.workspace?.getConfiguration().get(constants_1.YEOMANUI_TARGET_FOLDER_CONFIG_PROP);
41
- if (targetFolder) {
42
- return targetFolder;
43
- }
44
- const workspace = vscode.workspace;
45
- // If this is not a workspace default to the first folder (`rootPath` is deprecated)
46
- if (workspace.workspaceFolders?.length > 0 && workspace.workspaceFolders[0].uri.scheme === 'file') {
47
- return workspace.workspaceFolders[0].uri.fsPath;
48
- }
49
- // Otherwise use <home-dir>/projects,
50
- return (0, fs_1.existsSync)(constants_1.DEFAULT_PROJECTS_FOLDER) ? constants_1.DEFAULT_PROJECTS_FOLDER : undefined;
51
- }
52
- //# sourceMappingURL=helpers.js.map
26
+ //# sourceMappingURL=ui5.js.map
@@ -1,3 +1,11 @@
1
+ export declare const YEOMANUI_TARGET_FOLDER_CONFIG_PROP = "ApplicationWizard.TargetFolder";
2
+ /**
3
+ * Determines the target folder for the project.
4
+ *
5
+ * @param vscode - the vscode instance
6
+ * @returns The default path, if it can be determined otherwise undefined.
7
+ */
8
+ export declare function getDefaultTargetFolder(vscode: any): string | undefined;
1
9
  /**
2
10
  * Check for an installed extension, optionally specifying a minimum version.
3
11
  * Note, this does not check for activation state of specified extension.
@@ -8,4 +16,4 @@
8
16
  * @returns true if the extension is installed and the version is >= minVersion (if provided), false otherwise
9
17
  */
10
18
  export declare function isExtensionInstalled(vscode: any, extensionId: string, minVersion?: string): boolean;
11
- //# sourceMappingURL=installedCheck.d.ts.map
19
+ //# sourceMappingURL=vscode-helpers.d.ts.map
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.YEOMANUI_TARGET_FOLDER_CONFIG_PROP = void 0;
7
+ exports.getDefaultTargetFolder = getDefaultTargetFolder;
8
+ exports.isExtensionInstalled = isExtensionInstalled;
9
+ const fs_1 = require("fs");
10
+ const os_1 = __importDefault(require("os"));
11
+ const path_1 = require("path");
12
+ const semver_1 = require("semver");
13
+ exports.YEOMANUI_TARGET_FOLDER_CONFIG_PROP = 'ApplicationWizard.TargetFolder';
14
+ const DEFAULT_PROJECTS_FOLDER = (0, path_1.join)(os_1.default.homedir(), 'projects');
15
+ /**
16
+ * Determines the target folder for the project.
17
+ *
18
+ * @param vscode - the vscode instance
19
+ * @returns The default path, if it can be determined otherwise undefined.
20
+ */
21
+ function getDefaultTargetFolder(vscode) {
22
+ // CLI use will not define vscode
23
+ if (!vscode) {
24
+ return undefined;
25
+ }
26
+ const targetFolder = vscode.workspace?.getConfiguration().get(exports.YEOMANUI_TARGET_FOLDER_CONFIG_PROP);
27
+ if (targetFolder) {
28
+ return targetFolder;
29
+ }
30
+ const workspace = vscode.workspace;
31
+ // If this is not a workspace default to the first folder (`rootPath` is deprecated)
32
+ if (workspace.workspaceFolders?.length > 0 && workspace.workspaceFolders[0].uri.scheme === 'file') {
33
+ return workspace.workspaceFolders[0].uri.fsPath;
34
+ }
35
+ // Otherwise use <home-dir>/projects,
36
+ return (0, fs_1.existsSync)(DEFAULT_PROJECTS_FOLDER) ? DEFAULT_PROJECTS_FOLDER : undefined;
37
+ }
38
+ /**
39
+ * Check for an installed extension, optionally specifying a minimum version.
40
+ * Note, this does not check for activation state of specified extension.
41
+ *
42
+ * @param vscode - vscode instance
43
+ * @param extensionId - the id of the extension to find
44
+ * @param minVersion - the minimum version of the specified extension, lower versions will not be returned. Must be a valid SemVer string.
45
+ * @returns true if the extension is installed and the version is >= minVersion (if provided), false otherwise
46
+ */
47
+ function isExtensionInstalled(vscode, extensionId, minVersion) {
48
+ const foundExt = vscode?.extensions?.getExtension(extensionId);
49
+ if (foundExt) {
50
+ const extVersion = (0, semver_1.coerce)(foundExt.packageJSON.version);
51
+ if (extVersion) {
52
+ // Check installed ver is >= minVersion or return true if minVersion is not specified
53
+ return !(minVersion && (0, semver_1.lt)(extVersion, minVersion));
54
+ }
55
+ }
56
+ return false;
57
+ }
58
+ //# sourceMappingURL=vscode-helpers.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fiori-generator-shared",
3
3
  "description": "Commonly used shared functionality and types to support the fiori generator.",
4
- "version": "0.7.6",
4
+ "version": "0.7.7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isExtensionInstalled = isExtensionInstalled;
4
- const semver_1 = require("semver");
5
- /**
6
- * Check for an installed extension, optionally specifying a minimum version.
7
- * Note, this does not check for activation state of specified extension.
8
- *
9
- * @param vscode - vscode instance
10
- * @param extensionId - the id of the extension to find
11
- * @param minVersion - the minimum version of the specified extension, lower versions will not be returned. Must be a valid SemVer string.
12
- * @returns true if the extension is installed and the version is >= minVersion (if provided), false otherwise
13
- */
14
- function isExtensionInstalled(vscode, extensionId, minVersion) {
15
- const foundExt = vscode?.extensions?.getExtension(extensionId);
16
- if (foundExt) {
17
- const extVersion = (0, semver_1.coerce)(foundExt.packageJSON.version);
18
- if (extVersion) {
19
- // Check installed ver is >= minVersion or return true if minVersion is not specified
20
- return !(minVersion && (0, semver_1.lt)(extVersion, minVersion));
21
- }
22
- }
23
- return false;
24
- }
25
- //# sourceMappingURL=installedCheck.js.map
File without changes