@sap-ux/fiori-migration-writer 0.0.5 → 0.0.6

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.
Files changed (108) hide show
  1. package/dist/ProjectMigrator.d.ts +20 -8
  2. package/dist/ProjectMigrator.js +121 -123
  3. package/dist/adapters/ui5-config-adapter.js +64 -18
  4. package/dist/adapters/ui5-config-helpers.js +3 -10
  5. package/dist/components/extension.d.ts +3 -1
  6. package/dist/components/extension.js +5 -4
  7. package/dist/config/backend-i18n.d.ts +27 -6
  8. package/dist/config/backend-i18n.js +5 -11
  9. package/dist/config/flp/intent.d.ts +6 -3
  10. package/dist/config/flp/intent.js +6 -4
  11. package/dist/config/flp/sandbox.d.ts +3 -1
  12. package/dist/config/flp/sandbox.js +17 -12
  13. package/dist/config/launch-config.d.ts +4 -3
  14. package/dist/config/launch-config.js +5 -16
  15. package/dist/config/manifest-update.d.ts +21 -1
  16. package/dist/config/manifest-update.js +7 -12
  17. package/dist/config/package-json.d.ts +3 -1
  18. package/dist/config/package-json.js +15 -9
  19. package/dist/config/ui5-yaml.d.ts +9 -4
  20. package/dist/config/ui5-yaml.js +14 -10
  21. package/dist/data/sap-libraries.d.ts +3 -1
  22. package/dist/data/sap-libraries.js +4 -3
  23. package/dist/data/ui5-version.js +1 -1
  24. package/dist/files/project-files.d.ts +4 -3
  25. package/dist/files/project-files.js +10 -16
  26. package/dist/files/webapp.d.ts +5 -2
  27. package/dist/files/webapp.js +30 -35
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +2 -2
  30. package/dist/migration-process/configuration.d.ts +3 -1
  31. package/dist/migration-process/configuration.js +3 -2
  32. package/dist/migration-process/legacy-helpers.d.ts +3 -1
  33. package/dist/migration-process/legacy-helpers.js +19 -32
  34. package/dist/migration-process/legacy.d.ts +3 -1
  35. package/dist/migration-process/legacy.js +66 -79
  36. package/dist/migration-process/migration-phases.d.ts +6 -1
  37. package/dist/migration-process/migration-phases.js +26 -14
  38. package/dist/migration-process/setup.d.ts +9 -6
  39. package/dist/migration-process/setup.js +19 -10
  40. package/dist/migration-process/validation.d.ts +5 -2
  41. package/dist/migration-process/validation.js +6 -4
  42. package/dist/migration-types.d.ts +5 -2
  43. package/dist/project/adaptation-project.js +1 -0
  44. package/dist/project/project-data.js +1 -1
  45. package/dist/project/project-detection.d.ts +3 -1
  46. package/dist/project/project-detection.js +10 -4
  47. package/dist/project/project-extension.d.ts +1 -1
  48. package/dist/project/project-extension.js +3 -1
  49. package/dist/project/project-info.d.ts +3 -1
  50. package/dist/project/project-info.js +6 -3
  51. package/dist/project/regular-project.js +17 -9
  52. package/dist/template/application.d.ts +2 -0
  53. package/dist/template/application.js +11 -9
  54. package/dist/template/assembly.js +4 -4
  55. package/dist/template/base.d.ts +2 -0
  56. package/dist/template/base.js +2 -30
  57. package/dist/template/details.d.ts +3 -1
  58. package/dist/template/details.js +7 -5
  59. package/dist/template/template-helpers.d.ts +3 -1
  60. package/dist/template/template-helpers.js +6 -5
  61. package/dist/template/theme.d.ts +3 -1
  62. package/dist/template/theme.js +3 -2
  63. package/dist/types/mem-fs-types.d.ts +1 -1
  64. package/dist/utils/Project.d.ts +17 -14
  65. package/dist/utils/Project.js +94 -72
  66. package/dist/utils/checkForMigration.d.ts +4 -3
  67. package/dist/utils/checkForMigration.js +11 -8
  68. package/dist/utils/file-access.d.ts +36 -34
  69. package/dist/utils/file-access.js +61 -93
  70. package/dist/utils/file-discovery.d.ts +5 -2
  71. package/dist/utils/file-discovery.js +6 -4
  72. package/dist/utils/file-system-utils.d.ts +15 -5
  73. package/dist/utils/file-system-utils.js +34 -11
  74. package/dist/utils/fs-adapter.d.ts +5 -63
  75. package/dist/utils/fs-adapter.js +6 -111
  76. package/dist/utils/manifest-and-version-utils.d.ts +3 -1
  77. package/dist/utils/manifest-and-version-utils.js +6 -3
  78. package/dist/utils/migration-utils.d.ts +3 -1
  79. package/dist/utils/migration-utils.js +5 -4
  80. package/dist/utils/project-access-adapters.d.ts +3 -1
  81. package/dist/utils/project-access-adapters.js +3 -2
  82. package/dist/utils/project-discovery.d.ts +6 -2
  83. package/dist/utils/project-discovery.js +44 -18
  84. package/dist/utils/project-readers/adaptation-project-utils.d.ts +5 -2
  85. package/dist/utils/project-readers/adaptation-project-utils.js +21 -16
  86. package/dist/utils/project-readers/backend-utils.d.ts +3 -1
  87. package/dist/utils/project-readers/backend-utils.js +4 -3
  88. package/dist/utils/project-readers/extension-project-utils.d.ts +5 -2
  89. package/dist/utils/project-readers/extension-project-utils.js +15 -11
  90. package/dist/utils/project-readers/manifest-reader.d.ts +3 -1
  91. package/dist/utils/project-readers/manifest-reader.js +3 -2
  92. package/dist/utils/project-readers/manifest-utils.d.ts +5 -2
  93. package/dist/utils/project-readers/manifest-utils.js +9 -6
  94. package/dist/utils/project-readers/package-reader.d.ts +3 -1
  95. package/dist/utils/project-readers/package-reader.js +3 -2
  96. package/dist/utils/project-readers/reuse-lib-utils.d.ts +7 -3
  97. package/dist/utils/project-readers/reuse-lib-utils.js +13 -7
  98. package/dist/utils/project-readers/webapp-path-resolver.d.ts +3 -1
  99. package/dist/utils/project-readers/webapp-path-resolver.js +24 -19
  100. package/dist/utils/service.d.ts +3 -2
  101. package/dist/utils/service.js +10 -6
  102. package/dist/utils/template/template-post-processors.d.ts +3 -1
  103. package/dist/utils/template/template-post-processors.js +4 -3
  104. package/dist/utils/template/template-renderer.d.ts +3 -1
  105. package/dist/utils/template/template-renderer.js +3 -2
  106. package/dist/utils/template-generators/file-handlers.d.ts +5 -2
  107. package/dist/utils/template-generators/file-handlers.js +59 -32
  108. package/package.json +4 -4
@@ -1,4 +1,5 @@
1
1
  import type { Data } from 'ejs';
2
+ import type { Editor } from 'mem-fs-editor';
2
3
  import type { Manifest, SapAppSourceTemplate } from '../project-spec-types.js';
3
4
  import type { TemplateProperties, SapUxLayer } from '../types.js';
4
5
  /**
@@ -27,13 +28,14 @@ export declare function determineMessage(error: Error, filename?: string, useMes
27
28
  /**
28
29
  * Generate template file using EJS and template utilities
29
30
  *
31
+ * @param fs - mem-fs editor
30
32
  * @param templateData
31
33
  * @param projectRoot
32
34
  * @param templateRoot
33
35
  * @param templateName
34
36
  * @param templateProps
35
37
  */
36
- export declare function generateTemplate(templateData: Data, projectRoot: string, templateRoot: string, templateName: string, templateProps: TemplateProperties): Promise<void>;
38
+ export declare function generateTemplate(fs: Editor, templateData: Data, projectRoot: string, templateRoot: string, templateName: string, templateProps: TemplateProperties): Promise<void>;
37
39
  /**
38
40
  * Creates the sourceTemplate manifest.json entry.
39
41
  * This will respect the existing values if they are defined and not an empty string
@@ -67,13 +67,14 @@ export function determineMessage(error, filename, useMessage) {
67
67
  /**
68
68
  * Generate template file using EJS and template utilities
69
69
  *
70
+ * @param fs - mem-fs editor
70
71
  * @param templateData
71
72
  * @param projectRoot
72
73
  * @param templateRoot
73
74
  * @param templateName
74
75
  * @param templateProps
75
76
  */
76
- export async function generateTemplate(templateData, projectRoot, templateRoot, templateName, templateProps) {
77
+ export async function generateTemplate(fs, templateData, projectRoot, templateRoot, templateName, templateProps) {
77
78
  // Import template utilities
78
79
  const { resolveTemplatePaths, resolveTemplateData, renderTemplate, applyFileSpecificHandlers } = await import('./template/index.js');
79
80
  // 1. Resolve paths
@@ -82,12 +83,12 @@ export async function generateTemplate(templateData, projectRoot, templateRoot,
82
83
  const resolvedData = resolveTemplateData(templateData, templateProps);
83
84
  // 3. Render template (mem-fs handles directory creation implicitly)
84
85
  const { isRendered = true, opts = {} } = templateProps;
85
- let content = renderTemplate(templateRoot, fullTemplateName, resolvedData, opts, isRendered);
86
+ let content = renderTemplate(fs, templateRoot, fullTemplateName, resolvedData, opts, isRendered);
86
87
  // 4. Apply file-specific handlers
87
- content = await applyFileSpecificHandlers(templateName, content, projectRoot, targetFile, templateData);
88
+ content = await applyFileSpecificHandlers(fs, templateName, content, projectRoot, targetFile, templateData);
88
89
  // 5. Write file (mem-fs handles directory creation implicitly)
89
90
  // Do not catch - let errors propagate to caller for proper handling
90
- writeFile(targetFile, content);
91
+ writeFile(fs, targetFile, content);
91
92
  }
92
93
  /**
93
94
  * Creates the sourceTemplate manifest.json entry.
@@ -1,3 +1,4 @@
1
+ import type { Editor } from 'mem-fs-editor';
1
2
  /**
2
3
  * Find all manifest.json files in given workspace roots
3
4
  *
@@ -12,9 +13,10 @@ export declare function findAllManifest(roots: string[]): Promise<string[]>;
12
13
  *
13
14
  * Uses modern @sap-ux/project-access hasDependency
14
15
  *
16
+ * @param fs - mem-fs editor
15
17
  * @param projectPath - Path to project root
16
18
  * @param dependencyName - Dependency name to check
17
19
  * @returns true if project has the dependency
18
20
  */
19
- export declare function isFioriToolsProject(projectPath: string, dependencyName: string): Promise<boolean>;
21
+ export declare function isFioriToolsProject(fs: Editor, projectPath: string, dependencyName: string): Promise<boolean>;
20
22
  //# sourceMappingURL=project-access-adapters.d.ts.map
@@ -40,14 +40,15 @@ export async function findAllManifest(roots) {
40
40
  *
41
41
  * Uses modern @sap-ux/project-access hasDependency
42
42
  *
43
+ * @param fs - mem-fs editor
43
44
  * @param projectPath - Path to project root
44
45
  * @param dependencyName - Dependency name to check
45
46
  * @returns true if project has the dependency
46
47
  */
47
- export async function isFioriToolsProject(projectPath, dependencyName) {
48
+ export async function isFioriToolsProject(fs, projectPath, dependencyName) {
48
49
  try {
49
50
  const packageJsonPath = join(projectPath, 'package.json');
50
- const packageJson = await readJSON(packageJsonPath);
51
+ const packageJson = await readJSON(fs, packageJsonPath);
51
52
  return hasDependency(packageJson, dependencyName);
52
53
  }
53
54
  catch {
@@ -1,16 +1,20 @@
1
+ import type { Editor } from 'mem-fs-editor';
1
2
  import type { ProjectAppPath, ProjectFolder } from '../types.js';
2
3
  /**
3
4
  * Find all maven project(s) by locating pom.xml in the VS code workspace(s)
4
5
  *
6
+ * @param fs
5
7
  * @param wsFolders
6
8
  */
7
- export declare function findAllWebIDEProjectFolders(wsFolders: readonly ProjectFolder[] | string[]): Promise<string[]>;
9
+ export declare function findAllWebIDEProjectFolders(fs: Editor, wsFolders: readonly ProjectFolder[] | string[]): Promise<string[]>;
8
10
  /**
9
11
  * Get Pom project paths as labels for use in project picker
12
+ * Uses a broader scan (including src/ dirs) to find all WebIDE projects.
10
13
  *
11
14
  * @param workspaceRoots
15
+ * @param fsEditor - optional mem-fs editor; a fresh one is created when omitted
12
16
  */
13
- export declare function getWebIDEProjectPathsAsLabels(workspaceRoots: ProjectFolder[]): Promise<ProjectAppPath[]>;
17
+ export declare function getWebIDEProjectPathsAsLabels(workspaceRoots: ProjectFolder[], fsEditor?: Editor): Promise<ProjectAppPath[]>;
14
18
  /**
15
19
  * Find projects by manifest.json in workspace roots
16
20
  *
@@ -1,14 +1,16 @@
1
1
  import { basename, dirname, join, sep } from 'node:path';
2
2
  import fg from 'fast-glob';
3
+ import { createMemFsEditor } from './fs-adapter.js';
3
4
  import { DirName, FileName } from '../project-spec-types.js';
4
5
  import { isFioriToolsProject, findAllManifest } from './project-access-adapters.js';
5
6
  import { isProjectFolderArray } from '../types/project-folder.js';
6
7
  /**
7
8
  * Find all maven project(s) by locating pom.xml in the VS code workspace(s)
8
9
  *
10
+ * @param fs
9
11
  * @param wsFolders
10
12
  */
11
- export async function findAllWebIDEProjectFolders(wsFolders) {
13
+ export async function findAllWebIDEProjectFolders(fs, wsFolders) {
12
14
  let wsRoots;
13
15
  if (isProjectFolderArray(wsFolders)) {
14
16
  wsRoots = wsFolders.filter((folder) => folder.uri.scheme === 'file').map((folder) => folder.uri.fsPath);
@@ -16,10 +18,10 @@ export async function findAllWebIDEProjectFolders(wsFolders) {
16
18
  else {
17
19
  wsRoots = wsFolders || [];
18
20
  }
19
- // Process all workspace roots in parallel
21
+ // Process all workspace roots in parallel, skipping src/ to avoid nested test suites
20
22
  const projectArrays = await Promise.all(wsRoots.map(async (root) => {
21
23
  try {
22
- return await findWebIDEProject(root);
24
+ return await findWebIDEProject(fs, root, true);
23
25
  }
24
26
  catch {
25
27
  // Continue scanning other roots even if one fails
@@ -32,23 +34,28 @@ export async function findAllWebIDEProjectFolders(wsFolders) {
32
34
  /**
33
35
  * Find all maven project(s) by locating pom.xml in the VS code workspace root
34
36
  *
37
+ * @param fs
35
38
  * @param wsRoot
39
+ * @param skipSrcDirs - If true, skip scanning src/ directories (used for getProjectRoots)
36
40
  * @returns Array of project paths
37
41
  */
38
- async function findWebIDEProject(wsRoot) {
42
+ async function findWebIDEProject(fs, wsRoot, skipSrcDirs = true) {
39
43
  const projects = [];
44
+ const ignore = [
45
+ '.git',
46
+ 'node_modules',
47
+ '**/node_modules/**',
48
+ 'dist',
49
+ '**/dist/**',
50
+ `**/${DirName.Webapp}/**`,
51
+ '**/Web/MDKModule/**'
52
+ ];
53
+ if (skipSrcDirs) {
54
+ ignore.push(`**/${DirName.Sapux}/**`); // GH #14290 — skip src/ to avoid nested test suites
55
+ }
40
56
  const entries = await fg([`**/${FileName.Pom}`, `**/${FileName.NeoApp}`], {
41
57
  cwd: wsRoot,
42
- ignore: [
43
- '.git',
44
- 'node_modules',
45
- '**/node_modules/**',
46
- 'dist',
47
- '**/dist/**',
48
- `**/${DirName.Sapux}/**`,
49
- `**/${DirName.Webapp}/**`,
50
- '**/Web/MDKModule/**'
51
- ] // GH #14290
58
+ ignore
52
59
  });
53
60
  // Process all entries in parallel
54
61
  const results = await Promise.all(entries.map(async (entry) => {
@@ -56,8 +63,8 @@ async function findWebIDEProject(wsRoot) {
56
63
  const dir = dirname(file);
57
64
  // Check for neo-app.json or pom.xml file present
58
65
  // Check both tooling packages (await in series is intentional - short-circuit on first match)
59
- const fioriToolsProject = (await isFioriToolsProject(dir, '@sap-ux/ui5-tooling')) ||
60
- (await isFioriToolsProject(dir, '@sap/ux-ui5-tooling'));
66
+ const fioriToolsProject = (await isFioriToolsProject(fs, dir, '@sap-ux/ui5-tooling')) ||
67
+ (await isFioriToolsProject(fs, dir, '@sap/ux-ui5-tooling'));
61
68
  return !fioriToolsProject ? dir : null;
62
69
  }));
63
70
  // Filter out nulls and duplicates
@@ -67,12 +74,31 @@ async function findWebIDEProject(wsRoot) {
67
74
  }
68
75
  /**
69
76
  * Get Pom project paths as labels for use in project picker
77
+ * Uses a broader scan (including src/ dirs) to find all WebIDE projects.
70
78
  *
71
79
  * @param workspaceRoots
80
+ * @param fsEditor - optional mem-fs editor; a fresh one is created when omitted
72
81
  */
73
- export async function getWebIDEProjectPathsAsLabels(workspaceRoots) {
82
+ export async function getWebIDEProjectPathsAsLabels(workspaceRoots, fsEditor) {
83
+ const fs = fsEditor ?? createMemFsEditor();
74
84
  const result = [];
75
- let roots = await findAllWebIDEProjectFolders(workspaceRoots);
85
+ let wsRoots;
86
+ if (isProjectFolderArray(workspaceRoots)) {
87
+ wsRoots = workspaceRoots.filter((folder) => folder.uri.scheme === 'file').map((folder) => folder.uri.fsPath);
88
+ }
89
+ else {
90
+ wsRoots = workspaceRoots || [];
91
+ }
92
+ // Use broader scan (skipSrcDirs=false) to also find nested WebIDE projects in src/
93
+ const projectArrays = await Promise.all(wsRoots.map(async (root) => {
94
+ try {
95
+ return await findWebIDEProject(fs, root, false);
96
+ }
97
+ catch {
98
+ return [];
99
+ }
100
+ }));
101
+ let roots = projectArrays.flat();
76
102
  if (workspaceRoots.length > 1) {
77
103
  roots = [...new Set(roots)];
78
104
  }
@@ -2,19 +2,22 @@
2
2
  * Utilities for detecting and processing adaptation projects
3
3
  * Handles both legacy WebIDE and Fiori Tools adaptation projects
4
4
  */
5
+ import type { Editor } from 'mem-fs-editor';
5
6
  /**
6
7
  * Check if project is a migratable adaptation project
7
8
  * Checks both legacy WebIDE (.che/project.json) and Fiori Tools (.adp/config.json) formats
8
9
  *
10
+ * @param fs - mem-fs editor
9
11
  * @param projectRoot - Root path of the project
10
12
  * @returns Adaptation project configuration or undefined
11
13
  */
12
- export declare function checkMigratableAdaptationProject(projectRoot: string): Promise<any>;
14
+ export declare function checkMigratableAdaptationProject(fs: Editor, projectRoot: string): Promise<any>;
13
15
  /**
14
16
  * Check if project is a Fiori Tools adaptation project
15
17
  *
18
+ * @param fs - mem-fs editor
16
19
  * @param projectRoot - Root path of the project
17
20
  * @returns True if .adp/config.json exists
18
21
  */
19
- export declare function isFioriToolsAdaptationProject(projectRoot: string): Promise<boolean>;
22
+ export declare function isFioriToolsAdaptationProject(fs: Editor, projectRoot: string): boolean;
20
23
  //# sourceMappingURL=adaptation-project-utils.d.ts.map
@@ -9,28 +9,29 @@ import { sapWattCommonSetting } from '../../types.js';
9
9
  * Check if project is a migratable adaptation project
10
10
  * Checks both legacy WebIDE (.che/project.json) and Fiori Tools (.adp/config.json) formats
11
11
  *
12
+ * @param fs - mem-fs editor
12
13
  * @param projectRoot - Root path of the project
13
14
  * @returns Adaptation project configuration or undefined
14
15
  */
15
- export async function checkMigratableAdaptationProject(projectRoot) {
16
+ export async function checkMigratableAdaptationProject(fs, projectRoot) {
16
17
  let adaptationProject;
17
18
  // Check for legacy WebIDE adaptation project settings
18
- adaptationProject = await checkCheProjectSettings(projectRoot);
19
+ adaptationProject = await checkCheProjectSettings(fs, projectRoot);
19
20
  // Check for Fiori Tools adaptation project
20
- const adpConfig = await checkFioriToolsAdaptation(projectRoot);
21
+ const adpConfig = await checkFioriToolsAdaptation(fs, projectRoot);
21
22
  if (adpConfig) {
22
23
  adaptationProject = adpConfig;
23
24
  }
24
25
  // Legacy projects may contain only manifest.appdescr_variant without a project settings file.
25
26
  if (!adaptationProject) {
26
- const reference = await readManifestReference(projectRoot);
27
+ const reference = await readManifestReference(fs, projectRoot);
27
28
  if (reference) {
28
29
  adaptationProject = { appvariant: reference, reference };
29
30
  }
30
31
  }
31
32
  // Read manifest.appdescr_variant reference if available
32
33
  if (adaptationProject) {
33
- const ref = await readManifestReference(projectRoot);
34
+ const ref = await readManifestReference(fs, projectRoot);
34
35
  if (ref !== undefined) {
35
36
  adaptationProject.reference = ref;
36
37
  }
@@ -40,14 +41,15 @@ export async function checkMigratableAdaptationProject(projectRoot) {
40
41
  /**
41
42
  * Check for legacy WebIDE adaptation project settings in .che/project.json
42
43
  *
44
+ * @param fs - mem-fs editor
43
45
  * @param projectRoot - Root path of the project
44
46
  * @returns Adaptation project settings or undefined
45
47
  */
46
- async function checkCheProjectSettings(projectRoot) {
48
+ async function checkCheProjectSettings(fs, projectRoot) {
47
49
  try {
48
50
  const cheProjectJsonPath = join(projectRoot, '.che', 'project.json');
49
- if (await fileExists(cheProjectJsonPath)) {
50
- const projectJson = await readJSON(cheProjectJsonPath);
51
+ if (fileExists(fs, cheProjectJsonPath)) {
52
+ const projectJson = await readJSON(fs, cheProjectJsonPath);
51
53
  if (projectJson?.attributes?.[sapWattCommonSetting]) {
52
54
  try {
53
55
  const settings = JSON.parse(projectJson.attributes[sapWattCommonSetting]?.[0]);
@@ -69,13 +71,14 @@ async function checkCheProjectSettings(projectRoot) {
69
71
  /**
70
72
  * Check for Fiori Tools adaptation project (.adp/config.json)
71
73
  *
74
+ * @param fs - mem-fs editor
72
75
  * @param projectRoot - Root path of the project
73
76
  * @returns Adaptation project config with isAdp flag or undefined
74
77
  */
75
- async function checkFioriToolsAdaptation(projectRoot) {
78
+ async function checkFioriToolsAdaptation(fs, projectRoot) {
76
79
  try {
77
- if (await isFioriToolsAdaptationProject(projectRoot)) {
78
- const config = await readJSON(join(projectRoot, '.adp', 'config.json'));
80
+ if (isFioriToolsAdaptationProject(fs, projectRoot)) {
81
+ const config = await readJSON(fs, join(projectRoot, '.adp', 'config.json'));
79
82
  if (config) {
80
83
  config.isAdp = true;
81
84
  return config;
@@ -90,14 +93,15 @@ async function checkFioriToolsAdaptation(projectRoot) {
90
93
  /**
91
94
  * Read reference from manifest.appdescr_variant
92
95
  *
96
+ * @param fs - mem-fs editor
93
97
  * @param projectRoot - Root path of the project
94
98
  * @returns Reference string or undefined
95
99
  */
96
- async function readManifestReference(projectRoot) {
100
+ async function readManifestReference(fs, projectRoot) {
97
101
  try {
98
102
  const manifestAppdescrPath = join(projectRoot, 'webapp', 'manifest.appdescr_variant');
99
- if (await fileExists(manifestAppdescrPath)) {
100
- const manifestAppdescr = await readJSON(manifestAppdescrPath);
103
+ if (fileExists(fs, manifestAppdescrPath)) {
104
+ const manifestAppdescr = await readJSON(fs, manifestAppdescrPath);
101
105
  return manifestAppdescr?.reference ?? '';
102
106
  }
103
107
  }
@@ -109,11 +113,12 @@ async function readManifestReference(projectRoot) {
109
113
  /**
110
114
  * Check if project is a Fiori Tools adaptation project
111
115
  *
116
+ * @param fs - mem-fs editor
112
117
  * @param projectRoot - Root path of the project
113
118
  * @returns True if .adp/config.json exists
114
119
  */
115
- export async function isFioriToolsAdaptationProject(projectRoot) {
120
+ export function isFioriToolsAdaptationProject(fs, projectRoot) {
116
121
  const adpConfigJsonPath = join(projectRoot, '.adp', 'config.json');
117
- return fileExists(adpConfigJsonPath);
122
+ return fileExists(fs, adpConfigJsonPath);
118
123
  }
119
124
  //# sourceMappingURL=adaptation-project-utils.js.map
@@ -2,6 +2,7 @@
2
2
  * Utilities for backend/destination configuration
3
3
  * Handles neo-app.json and destination settings
4
4
  */
5
+ import type { Editor } from 'mem-fs-editor';
5
6
  import type { NeoappDestination } from '../../types.js';
6
7
  /**
7
8
  * Get client number from destination name if it ends with 3 digits
@@ -26,11 +27,12 @@ export declare function getNeoAppData(neoAppJson: any, destination: string, isUi
26
27
  /**
27
28
  * Read destination info from neo-app.json file
28
29
  *
30
+ * @param fs - mem-fs editor
29
31
  * @param projectRoot - Root path of the project
30
32
  * @param destinationIn - Initial destination (may be empty)
31
33
  * @returns Destination info or undefined if no neo-app.json found
32
34
  */
33
- export declare function getDestinationFromNeoApp(projectRoot: string, destinationIn: string): Promise<{
35
+ export declare function getDestinationFromNeoApp(fs: Editor, projectRoot: string, destinationIn: string): Promise<{
34
36
  destination: string;
35
37
  neoAppUI5Version?: string;
36
38
  neoappDestinations?: NeoappDestination[];
@@ -72,15 +72,16 @@ export function getNeoAppData(neoAppJson, destination, isUiAdaptation = false) {
72
72
  /**
73
73
  * Read destination info from neo-app.json file
74
74
  *
75
+ * @param fs - mem-fs editor
75
76
  * @param projectRoot - Root path of the project
76
77
  * @param destinationIn - Initial destination (may be empty)
77
78
  * @returns Destination info or undefined if no neo-app.json found
78
79
  */
79
- export async function getDestinationFromNeoApp(projectRoot, destinationIn) {
80
+ export async function getDestinationFromNeoApp(fs, projectRoot, destinationIn) {
80
81
  try {
81
82
  const neoAppJsonPath = join(projectRoot, TemplateFileName.NeoApp);
82
- if (await fileExists(neoAppJsonPath)) {
83
- const neoAppJson = await readJSON(neoAppJsonPath);
83
+ if (fileExists(fs, neoAppJsonPath)) {
84
+ const neoAppJson = await readJSON(fs, neoAppJsonPath);
84
85
  if (neoAppJson?.routes) {
85
86
  const { destination, neoAppUI5Version, neoappDestinations } = getNeoAppData(neoAppJson, destinationIn);
86
87
  return { destination, neoAppUI5Version, neoappDestinations };
@@ -2,22 +2,25 @@
2
2
  * Utilities for detecting and processing extension projects
3
3
  * Handles both legacy WebIDE and new format extension projects
4
4
  */
5
+ import type { Editor } from 'mem-fs-editor';
5
6
  import type { Manifest } from '../../project-spec-types.js';
6
7
  /**
7
8
  * Read project extension settings from configuration files
8
9
  * Checks both .che/project.json (WebIDE) and .project.json (legacy) formats
9
10
  *
11
+ * @param fs - mem-fs editor
10
12
  * @param projectRoot - Root path of the project
11
13
  * @returns Extension settings or undefined
12
14
  */
13
- export declare function readProjectExtensionSettings(projectRoot: string): Promise<unknown>;
15
+ export declare function readProjectExtensionSettings(fs: Editor, projectRoot: string): Promise<unknown>;
14
16
  /**
15
17
  * Check if project is an extension project
16
18
  *
19
+ * @param fs - mem-fs editor
17
20
  * @param projectRoot - Root path of the project
18
21
  * @returns True if extension settings found
19
22
  */
20
- export declare function checkIfProjectExtension(projectRoot: string): Promise<boolean>;
23
+ export declare function checkIfProjectExtension(fs: Editor, projectRoot: string): Promise<boolean>;
21
24
  /**
22
25
  * Get module name for extension project
23
26
  *
@@ -9,18 +9,19 @@ import { sapWattCommonSetting } from '../../types.js';
9
9
  * Read project extension settings from configuration files
10
10
  * Checks both .che/project.json (WebIDE) and .project.json (legacy) formats
11
11
  *
12
+ * @param fs - mem-fs editor
12
13
  * @param projectRoot - Root path of the project
13
14
  * @returns Extension settings or undefined
14
15
  */
15
- export async function readProjectExtensionSettings(projectRoot) {
16
+ export async function readProjectExtensionSettings(fs, projectRoot) {
16
17
  try {
17
18
  // Try .che/project.json first
18
- const cheSettings = await readCheProjectExtensionSettings(projectRoot);
19
+ const cheSettings = await readCheProjectExtensionSettings(fs, projectRoot);
19
20
  if (cheSettings) {
20
21
  return cheSettings;
21
22
  }
22
23
  // Fallback to .project.json
23
- const legacySettings = await readLegacyProjectExtensionSettings(projectRoot);
24
+ const legacySettings = await readLegacyProjectExtensionSettings(fs, projectRoot);
24
25
  if (legacySettings) {
25
26
  return legacySettings;
26
27
  }
@@ -33,17 +34,18 @@ export async function readProjectExtensionSettings(projectRoot) {
33
34
  /**
34
35
  * Read extension settings from .che/project.json
35
36
  *
37
+ * @param fs - mem-fs editor
36
38
  * @param projectRoot - Root path of the project
37
39
  * @returns Extension settings or undefined
38
40
  */
39
- async function readCheProjectExtensionSettings(projectRoot) {
41
+ async function readCheProjectExtensionSettings(fs, projectRoot) {
40
42
  const projectJsonPath = join(projectRoot, '.che', 'project.json');
41
- const exists = await fileExists(projectJsonPath);
43
+ const exists = fileExists(fs, projectJsonPath);
42
44
  if (!exists) {
43
45
  return undefined;
44
46
  }
45
47
  try {
46
- const projectJson = await readJSON(projectJsonPath);
48
+ const projectJson = await readJSON(fs, projectJsonPath);
47
49
  if (projectJson?.attributes?.[sapWattCommonSetting]?.[0]) {
48
50
  const settings = JSON.parse(projectJson.attributes[sapWattCommonSetting][0]);
49
51
  return settings?.extensibility;
@@ -57,16 +59,17 @@ async function readCheProjectExtensionSettings(projectRoot) {
57
59
  /**
58
60
  * Read extension settings from .project.json (legacy format)
59
61
  *
62
+ * @param fs - mem-fs editor
60
63
  * @param projectRoot - Root path of the project
61
64
  * @returns Extension settings or undefined
62
65
  */
63
- async function readLegacyProjectExtensionSettings(projectRoot) {
66
+ async function readLegacyProjectExtensionSettings(fs, projectRoot) {
64
67
  const projectJsonPath = join(projectRoot, '.project.json');
65
- if (!(await fileExists(projectJsonPath))) {
68
+ if (!fileExists(fs, projectJsonPath)) {
66
69
  return undefined;
67
70
  }
68
71
  try {
69
- const projectJson = await readJSON(projectJsonPath);
72
+ const projectJson = await readJSON(fs, projectJsonPath);
70
73
  return projectJson?.extensibility;
71
74
  }
72
75
  catch (error) {
@@ -77,11 +80,12 @@ async function readLegacyProjectExtensionSettings(projectRoot) {
77
80
  /**
78
81
  * Check if project is an extension project
79
82
  *
83
+ * @param fs - mem-fs editor
80
84
  * @param projectRoot - Root path of the project
81
85
  * @returns True if extension settings found
82
86
  */
83
- export async function checkIfProjectExtension(projectRoot) {
84
- const extensionProject = await readProjectExtensionSettings(projectRoot);
87
+ export async function checkIfProjectExtension(fs, projectRoot) {
88
+ const extensionProject = await readProjectExtensionSettings(fs, projectRoot);
85
89
  return !!extensionProject;
86
90
  }
87
91
  /**
@@ -1,3 +1,4 @@
1
+ import type { Editor } from 'mem-fs-editor';
1
2
  import type { Manifest } from '../../project-spec-types.js';
2
3
  /**
3
4
  * Get manifest.json file path
@@ -9,8 +10,9 @@ export declare function getManifestPath(projectRoot: string, webappPath: string)
9
10
  /**
10
11
  * Get manifest.json content
11
12
  *
13
+ * @param fs - mem-fs editor
12
14
  * @param projectRoot
13
15
  * @param webappPath
14
16
  */
15
- export declare function getManifestJson(projectRoot: string, webappPath: string): Promise<Manifest>;
17
+ export declare function getManifestJson(fs: Editor, projectRoot: string, webappPath: string): Manifest;
16
18
  //# sourceMappingURL=manifest-reader.d.ts.map
@@ -16,11 +16,12 @@ export function getManifestPath(projectRoot, webappPath) {
16
16
  /**
17
17
  * Get manifest.json content
18
18
  *
19
+ * @param fs - mem-fs editor
19
20
  * @param projectRoot
20
21
  * @param webappPath
21
22
  */
22
- export async function getManifestJson(projectRoot, webappPath) {
23
+ export function getManifestJson(fs, projectRoot, webappPath) {
23
24
  const manifestPath = getManifestPath(projectRoot, webappPath);
24
- return readJSON(manifestPath);
25
+ return readJSON(fs, manifestPath);
25
26
  }
26
27
  //# sourceMappingURL=manifest-reader.js.map
@@ -2,6 +2,7 @@
2
2
  * Utilities for manifest.json parsing and analysis
3
3
  * Handles FE version detection, floor plan determination, and semantic objects
4
4
  */
5
+ import type { Editor } from 'mem-fs-editor';
5
6
  import type { Manifest } from '../../project-spec-types.js';
6
7
  import { FioriElementsVersion } from '../../project-spec-types.js';
7
8
  /**
@@ -21,10 +22,11 @@ export declare function getSemanticObjectAction(manifest: Manifest): string | un
21
22
  /**
22
23
  * Extract FLP intent from HTML file (flpSandbox.html or similar)
23
24
  *
25
+ * @param fs - mem-fs editor
24
26
  * @param htmlFilePath - Path to HTML file
25
27
  * @returns FLP intent string or undefined
26
28
  */
27
- export declare function getFlpIntentFromHtml(htmlFilePath: string): Promise<string | undefined>;
29
+ export declare function getFlpIntentFromHtml(fs: Editor, htmlFilePath: string): string | undefined;
28
30
  /**
29
31
  * Error thrown when project type is not supported for migration
30
32
  */
@@ -50,10 +52,11 @@ export declare function getMainEntity(manifest: Manifest): string;
50
52
  /**
51
53
  * Get first backend configuration from ui5.yaml
52
54
  *
55
+ * @param fs - mem-fs editor
53
56
  * @param projectRoot - Root path of the project
54
57
  * @returns Backend configuration object
55
58
  */
56
- export declare function getFirstBackend(projectRoot: string): {
59
+ export declare function getFirstBackend(fs: Editor, projectRoot: string): {
57
60
  destination?: string;
58
61
  sapClient?: string;
59
62
  scp?: boolean;
@@ -4,7 +4,8 @@
4
4
  */
5
5
  import { join } from 'node:path';
6
6
  import { parse } from 'yaml';
7
- import { fileExists, readFile } from '../../index.js';
7
+ import { fileExists } from '../../index.js';
8
+ import { readFile } from '../../utils/file-access.js';
8
9
  import { FioriElementsVersion } from '../../project-spec-types.js';
9
10
  import { FLOOR_PLAN } from '../../types.js';
10
11
  import { i18nText } from '../../i18n.js';
@@ -121,15 +122,16 @@ function extractFlpIntentFromConfig(htmlContent) {
121
122
  /**
122
123
  * Extract FLP intent from HTML file (flpSandbox.html or similar)
123
124
  *
125
+ * @param fs - mem-fs editor
124
126
  * @param htmlFilePath - Path to HTML file
125
127
  * @returns FLP intent string or undefined
126
128
  */
127
- export async function getFlpIntentFromHtml(htmlFilePath) {
129
+ export function getFlpIntentFromHtml(fs, htmlFilePath) {
128
130
  try {
129
- if (!(await fileExists(htmlFilePath))) {
131
+ if (!fileExists(fs, htmlFilePath)) {
130
132
  return undefined;
131
133
  }
132
- const htmlContent = readFile(htmlFilePath);
134
+ const htmlContent = readFile(fs, htmlFilePath);
133
135
  return extractFlpIntentFromConfig(htmlContent);
134
136
  }
135
137
  catch {
@@ -218,13 +220,14 @@ export function getMainEntity(manifest) {
218
220
  /**
219
221
  * Get first backend configuration from ui5.yaml
220
222
  *
223
+ * @param fs - mem-fs editor
221
224
  * @param projectRoot - Root path of the project
222
225
  * @returns Backend configuration object
223
226
  */
224
- export function getFirstBackend(projectRoot) {
227
+ export function getFirstBackend(fs, projectRoot) {
225
228
  let result = {};
226
229
  try {
227
- const yamlJSON = parse(readFile(join(projectRoot, 'ui5.yaml')));
230
+ const yamlJSON = parse(readFile(fs, join(projectRoot, 'ui5.yaml')));
228
231
  const proxyMiddleware = yamlJSON?.server?.customMiddleware.filter((customMiddleware) => {
229
232
  return (customMiddleware?.name === 'fiori-tools-proxy' ||
230
233
  customMiddleware?.name === 'ui5-middleware-simpleproxy' // used in tool-suite beta
@@ -1,3 +1,4 @@
1
+ import type { Editor } from 'mem-fs-editor';
1
2
  /**
2
3
  * Get package.json file path
3
4
  *
@@ -7,7 +8,8 @@ export declare function getPackageJsonPath(projectRoot: string): string;
7
8
  /**
8
9
  * Get package.json content
9
10
  *
11
+ * @param fs - mem-fs editor
10
12
  * @param filePath
11
13
  */
12
- export declare function getPackageJson(filePath: string): Promise<any>;
14
+ export declare function getPackageJson(fs: Editor, filePath: string): any;
13
15
  //# sourceMappingURL=package-reader.d.ts.map
@@ -15,9 +15,10 @@ export function getPackageJsonPath(projectRoot) {
15
15
  /**
16
16
  * Get package.json content
17
17
  *
18
+ * @param fs - mem-fs editor
18
19
  * @param filePath
19
20
  */
20
- export async function getPackageJson(filePath) {
21
- return readJSON(getPackageJsonPath(filePath));
21
+ export function getPackageJson(fs, filePath) {
22
+ return readJSON(fs, getPackageJsonPath(filePath));
22
23
  }
23
24
  //# sourceMappingURL=package-reader.js.map