@sap-ux/fiori-migration-writer 0.0.15 → 1.0.0
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.
- package/dist/BulkProjectMigrator.d.ts +1 -1
- package/dist/BulkProjectMigrator.js +2 -10
- package/dist/ProjectMigrator.d.ts +1 -1
- package/dist/ProjectMigrator.js +9 -4
- package/dist/config/backend.d.ts +3 -2
- package/dist/config/backend.js +1 -1
- package/dist/config/launch-config.js +1 -1
- package/dist/config/neoapp.d.ts +1 -1
- package/dist/config/neoapp.js +1 -1
- package/dist/config/package-json.js +1 -1
- package/dist/data/ui5-version.d.ts +1 -1
- package/dist/files/project-files.d.ts +1 -1
- package/dist/migration-types.d.ts +6 -69
- package/dist/migration-types.js +0 -11
- package/dist/project/adaptation-project.d.ts +1 -1
- package/dist/project/project-data.js +2 -1
- package/dist/project/project-extension.d.ts +2 -1
- package/dist/project/reuse-library.d.ts +2 -1
- package/dist/project-spec-types.d.ts +0 -27
- package/dist/template/data.d.ts +1 -1
- package/dist/template/data.js +2 -1
- package/dist/utils/Project.d.ts +2 -1
- package/dist/utils/Project.js +1 -1
- package/dist/utils/migration-utils.d.ts +9 -6
- package/dist/utils/migration-utils.js +9 -6
- package/dist/utils/template-generators/file-handlers.js +2 -1
- package/package.json +3 -3
|
@@ -8,7 +8,7 @@ export declare class BulkProjectMigrator {
|
|
|
8
8
|
* @param vscode
|
|
9
9
|
* @param internalToggle
|
|
10
10
|
*/
|
|
11
|
-
migrate(projects: MigrationUIProjectInfo[], ui5SnapshotUrl
|
|
11
|
+
migrate(projects: MigrationUIProjectInfo[], ui5SnapshotUrl?: string, vscode?: any, internalToggle?: boolean): Promise<MigrationUIProjectInfo[]>;
|
|
12
12
|
/**
|
|
13
13
|
* Migrate a single project
|
|
14
14
|
*
|
|
@@ -2,6 +2,7 @@ import { ProjectMigrator } from './ProjectMigrator.js';
|
|
|
2
2
|
import { URI } from 'vscode-uri';
|
|
3
3
|
import { i18nText } from './i18n.js';
|
|
4
4
|
import { createMemFsEditor } from './utils/fs-adapter.js';
|
|
5
|
+
import { commitFileSystemChanges } from './files/file-system.js';
|
|
5
6
|
// Telemetry stub - @sap-ux/telemetry is an optional dependency for performance measurement
|
|
6
7
|
// This provides a no-op implementation for open-source usage
|
|
7
8
|
const uxTelemetryPerf = {
|
|
@@ -64,16 +65,7 @@ export class BulkProjectMigrator {
|
|
|
64
65
|
// Commit changes to disk for this project
|
|
65
66
|
if (result) {
|
|
66
67
|
try {
|
|
67
|
-
await
|
|
68
|
-
fs.commit((err) => {
|
|
69
|
-
if (err) {
|
|
70
|
-
reject(err);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
resolve();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
});
|
|
68
|
+
await commitFileSystemChanges(fs);
|
|
77
69
|
}
|
|
78
70
|
catch (error) {
|
|
79
71
|
// Handle both callback errors and synchronous throws from fs.commit
|
|
@@ -9,7 +9,7 @@ export interface MigrateOptions {
|
|
|
9
9
|
/** Base URI for backend services */
|
|
10
10
|
baseUri: string;
|
|
11
11
|
/** URL for UI5 snapshot version */
|
|
12
|
-
ui5SnapshotUrl
|
|
12
|
+
ui5SnapshotUrl?: string;
|
|
13
13
|
/** Optional partial project information */
|
|
14
14
|
importProjectInfo?: Partial<ImportProjectInfo>;
|
|
15
15
|
/** Optional VS Code context */
|
package/dist/ProjectMigrator.js
CHANGED
|
@@ -5,11 +5,11 @@ import { ui5VersionRequestInfo } from '@sap-ux/ui5-info';
|
|
|
5
5
|
import { getAppProgrammingLanguage } from '@sap-ux/project-access';
|
|
6
6
|
import { enableTypescript, ui5TSSupport } from '@sap-ux/ui5-application-writer';
|
|
7
7
|
import { UI5Config } from '@sap-ux/ui5-config';
|
|
8
|
-
import { join } from 'node:path';
|
|
8
|
+
import { join, resolve } from 'node:path';
|
|
9
9
|
// Migration-specific functions
|
|
10
10
|
import { determineSourceTemplateType, checkForErrors, createMigrationErrorMessage, prepareConfigurationData, setupProjectStructure, generateAppSettings, applyAllTemplates, postProcessMigration } from './migration-process/index.js';
|
|
11
11
|
// File operations
|
|
12
|
-
import { copyAdaptationFiles, copyLibraryFiles } from './files/index.js';
|
|
12
|
+
import { copyAdaptationFiles, copyLibraryFiles, commitFileSystemChanges } from './files/index.js';
|
|
13
13
|
// Template functions
|
|
14
14
|
import { assembleTemplateData } from './template/index.js';
|
|
15
15
|
// Project functions
|
|
@@ -27,7 +27,9 @@ export class ProjectMigrator {
|
|
|
27
27
|
* @returns Promise with fs editor, migration result, and messages
|
|
28
28
|
*/
|
|
29
29
|
static async migrate(options) {
|
|
30
|
-
const { projectRoot, baseUri: baseUriOpt, ui5SnapshotUrl: ui5SnapshotUrlOpt, importProjectInfo: importProjectInfoOpt, vscode: vscodeOpt, internalToggle: internalToggleOpt = false, fs: fsOpt, strict: strictOpt = false } = options;
|
|
30
|
+
const { projectRoot: projectRootInput, baseUri: baseUriOpt, ui5SnapshotUrl: ui5SnapshotUrlOpt, importProjectInfo: importProjectInfoOpt, vscode: vscodeOpt, internalToggle: internalToggleOpt = false, fs: fsOpt, strict: strictOpt = false } = options;
|
|
31
|
+
// Resolve relative paths to absolute to avoid issues with path traversal
|
|
32
|
+
const projectRoot = resolve(projectRootInput);
|
|
31
33
|
// Create a new isolated editor instance for this migration if not provided
|
|
32
34
|
// This enables concurrent migrations without shared state corruption
|
|
33
35
|
const ownsEditor = !fsOpt;
|
|
@@ -42,6 +44,9 @@ export class ProjectMigrator {
|
|
|
42
44
|
// Load or fetch project information
|
|
43
45
|
const { projectInfo, messages: projectInfoMessages } = await loadOrFetchProjectInfo(projectRoot, importProjectInfoOpt, editor);
|
|
44
46
|
messages = messages.concat(projectInfoMessages);
|
|
47
|
+
// Ensure projectInfo.rootPath uses the resolved absolute path
|
|
48
|
+
// This is critical when importProjectInfo is provided with a relative rootPath
|
|
49
|
+
projectInfo.rootPath = projectRoot;
|
|
45
50
|
projectInfo.baseUri = baseUriOpt;
|
|
46
51
|
// Resolve UI5 versions for migration
|
|
47
52
|
const ui5Versions = await resolveUI5VersionsForMigration(projectInfo, ui5SnapshotUrlOpt);
|
|
@@ -70,7 +75,7 @@ export class ProjectMigrator {
|
|
|
70
75
|
// Commit only when we own the editor; otherwise the caller commits (matches other writers).
|
|
71
76
|
if (ownsEditor && migrationResult.result) {
|
|
72
77
|
try {
|
|
73
|
-
await
|
|
78
|
+
await commitFileSystemChanges(migrationResult.fs);
|
|
74
79
|
}
|
|
75
80
|
catch (error) {
|
|
76
81
|
migrationResult.result = false;
|
package/dist/config/backend.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FioriToolsProxyConfigBackend } from '@sap-ux/ui5-config';
|
|
2
|
+
import type { Message, NeoappDestination, TemplateData } from '../types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Updates YAML backends by removing default /sap backend if no datasource exists
|
|
4
5
|
* and adding backends for service paths that don't start with /sap
|
|
@@ -20,5 +21,5 @@ export declare function updateYamlBackends(proxyConfigInput: any, templateData:
|
|
|
20
21
|
* @param strict - Enable strict validation mode (WARNING becomes ERROR)
|
|
21
22
|
* @returns Array of updated backend configurations
|
|
22
23
|
*/
|
|
23
|
-
export declare function updateNeoYamlBackends(neoappDestinations: NeoappDestination[], proxyBackend:
|
|
24
|
+
export declare function updateNeoYamlBackends(neoappDestinations: NeoappDestination[], proxyBackend: FioriToolsProxyConfigBackend[], templateData: TemplateData, messages: Message[], destination: string | undefined, firstNeoAppDestination?: string, strict?: boolean): FioriToolsProxyConfigBackend[];
|
|
24
25
|
//# sourceMappingURL=backend.d.ts.map
|
package/dist/config/backend.js
CHANGED
|
@@ -63,7 +63,7 @@ export function updateNeoYamlBackends(neoappDestinations, proxyBackend, template
|
|
|
63
63
|
};
|
|
64
64
|
if (destination === backend.destination || firstNeoAppDestination === backend.destination) {
|
|
65
65
|
//destination from the webview
|
|
66
|
-
backend.url = templateData.ui5Yaml?.proxyHost;
|
|
66
|
+
backend.url = templateData.ui5Yaml?.proxyHost ?? '';
|
|
67
67
|
backend.destination = templateData.ui5Yaml?.destination;
|
|
68
68
|
if (templateData.ui5Yaml?.client !== '') {
|
|
69
69
|
backend.client = templateData.ui5Yaml?.client;
|
|
@@ -5,7 +5,7 @@ import { basename, join, sep as pathSep } from 'node:path';
|
|
|
5
5
|
import { isAppStudio } from '@sap-ux/btp-utils';
|
|
6
6
|
import { FioriElementsVersion } from '../project-spec-types.js';
|
|
7
7
|
import { createLaunchConfig } from '@sap-ux/launch-config';
|
|
8
|
-
import { ODataVersion } from '
|
|
8
|
+
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
9
9
|
/**
|
|
10
10
|
* Generate and write VS Code launch configuration for the migrated project
|
|
11
11
|
*
|
package/dist/config/neoapp.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { ManifestNamespace } from '../project-spec-types.js';
|
|
5
5
|
import { FioriElementsVersion } from '../project-spec-types.js';
|
|
6
6
|
import type { NeoappDestination } from '../types.js';
|
|
7
|
-
import { ODataVersion } from '
|
|
7
|
+
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
8
8
|
/**
|
|
9
9
|
* Result of neo-app and OData version processing
|
|
10
10
|
*/
|
package/dist/config/neoapp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FioriElementsVersion } from '../project-spec-types.js';
|
|
2
|
-
import { ODataVersion } from '
|
|
2
|
+
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
3
3
|
/**
|
|
4
4
|
* Process neo-app configuration and determine OData version
|
|
5
5
|
* Handles destination extraction, UI5 version, and OData version determination
|
|
@@ -8,7 +8,7 @@ import { FioriElementsVersion } from '../project-spec-types.js';
|
|
|
8
8
|
import { propertyEditorTaskProjectTypes, isGenerateIndex } from '../utils/common.js';
|
|
9
9
|
import { determineSapUxLayer } from '../utils/migration-utils.js';
|
|
10
10
|
import { MigrationTypes } from '../utils/constants.js';
|
|
11
|
-
import { ODataVersion } from '
|
|
11
|
+
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
12
12
|
const TEST_FILES = [
|
|
13
13
|
{ type: 'suite', path: 'test/testsuite.qunit.html' },
|
|
14
14
|
{ type: 'suite', path: 'test/qunit.runner.testsuite.html' },
|
|
@@ -6,5 +6,5 @@ import type { ImportProjectInfo } from '../types.js';
|
|
|
6
6
|
* @param ui5SnapshotUrl - Optional snapshot URL to use for UI5 version resolution
|
|
7
7
|
* @returns Resolved UI5 versions object
|
|
8
8
|
*/
|
|
9
|
-
export declare function resolveUI5VersionsForMigration(projectInfo: ImportProjectInfo, ui5SnapshotUrl
|
|
9
|
+
export declare function resolveUI5VersionsForMigration(projectInfo: ImportProjectInfo, ui5SnapshotUrl?: string): Promise<any>;
|
|
10
10
|
//# sourceMappingURL=ui5-version.d.ts.map
|
|
@@ -12,7 +12,7 @@ import type { ImportProjectInfo, Message } from '../types.js';
|
|
|
12
12
|
* @param snapshotUrl - URL for UI5 snapshot version
|
|
13
13
|
* @returns Result object with fs editor, success status and messages
|
|
14
14
|
*/
|
|
15
|
-
export declare function copyAdaptationFiles(fs: Editor, projectInfo: ImportProjectInfo, snapshotUrl
|
|
15
|
+
export declare function copyAdaptationFiles(fs: Editor, projectInfo: ImportProjectInfo, snapshotUrl?: string): Promise<{
|
|
16
16
|
fs: Editor;
|
|
17
17
|
result: boolean;
|
|
18
18
|
messages: Message[];
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import type { FioriElementsVersion, SapAppSourceTemplate, Manifest } from './project-spec-types.js';
|
|
2
2
|
import type { MigrationTypes, postMigrationAction } from './utils/constants.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { Annotations } from '@sap-ux/axios-extension';
|
|
3
|
+
import type { UI5FlexLayer } from '@sap-ux/project-access';
|
|
4
|
+
import type { Annotations, ODataVersion } from '@sap-ux/axios-extension';
|
|
5
5
|
import type { Editor } from 'mem-fs-editor';
|
|
6
6
|
export type { ProjectFolder } from './types/project-folder.js';
|
|
7
7
|
export { isProjectFolderArray } from './types/project-folder.js';
|
|
8
|
-
/**
|
|
9
|
-
* OData versions supported by the catalog service
|
|
10
|
-
*/
|
|
11
|
-
export declare const ODataVersion: {
|
|
12
|
-
readonly v2: "2";
|
|
13
|
-
readonly v4: "4";
|
|
14
|
-
};
|
|
15
|
-
export type ODataVersion = (typeof ODataVersion)[keyof typeof ODataVersion];
|
|
16
8
|
/**
|
|
17
9
|
* package.json script entries (commands and tasks)
|
|
18
10
|
*/
|
|
@@ -20,11 +12,6 @@ export type Script = {
|
|
|
20
12
|
name: string;
|
|
21
13
|
command: string;
|
|
22
14
|
};
|
|
23
|
-
export declare const SapUxLayer: {
|
|
24
|
-
readonly VENDOR: "VENDOR";
|
|
25
|
-
readonly CUSTOMER_BASE: "CUSTOMER_BASE";
|
|
26
|
-
};
|
|
27
|
-
export type SapUxLayer = (typeof SapUxLayer)[keyof typeof SapUxLayer];
|
|
28
15
|
/** package.json interface */
|
|
29
16
|
export interface PackageJson {
|
|
30
17
|
name: string;
|
|
@@ -45,7 +32,7 @@ export interface PackageJson {
|
|
|
45
32
|
localStartFile?: string;
|
|
46
33
|
runTasks?: Script[];
|
|
47
34
|
enableEslint: boolean;
|
|
48
|
-
sapuxLayer?:
|
|
35
|
+
sapuxLayer?: UI5FlexLayer;
|
|
49
36
|
}
|
|
50
37
|
export declare const DatasourceType: {
|
|
51
38
|
readonly FILE: "File";
|
|
@@ -76,14 +63,6 @@ export type NeoappDestination = {
|
|
|
76
63
|
name: string;
|
|
77
64
|
entryPath?: string;
|
|
78
65
|
};
|
|
79
|
-
export interface BackendConfig {
|
|
80
|
-
path: string;
|
|
81
|
-
url?: string;
|
|
82
|
-
client?: string;
|
|
83
|
-
destination?: string;
|
|
84
|
-
destinationInstance?: string;
|
|
85
|
-
pathPrefix?: string;
|
|
86
|
-
}
|
|
87
66
|
export interface EntityConfig {
|
|
88
67
|
mainEntity?: {
|
|
89
68
|
entityName: string;
|
|
@@ -212,7 +191,6 @@ export type TemplateMap = {
|
|
|
212
191
|
export interface TemplateData<P extends ProjectMigrate = ProjectMigrate, S extends Service = Service> {
|
|
213
192
|
project: Partial<P>;
|
|
214
193
|
service: Partial<S>;
|
|
215
|
-
readMe?: Partial<ReadMe>;
|
|
216
194
|
ui5Yaml?: Partial<Ui5Yaml> & Partial<Ui5MockYaml>;
|
|
217
195
|
packageJson?: Partial<PackageJsonMigrate>;
|
|
218
196
|
appId?: string;
|
|
@@ -267,6 +245,8 @@ export interface Project {
|
|
|
267
245
|
* SECURITY: This interface contains sensitive authentication data.
|
|
268
246
|
* The `password` field must NEVER be logged, included in error messages,
|
|
269
247
|
* or transmitted to telemetry systems.
|
|
248
|
+
*
|
|
249
|
+
* @deprecated Not used by the migration writer. Will be removed in a future release.
|
|
270
250
|
*/
|
|
271
251
|
export interface Credentials {
|
|
272
252
|
/** Username for authentication */
|
|
@@ -289,21 +269,6 @@ export declare const ApiHubType: {
|
|
|
289
269
|
readonly apiHubEnterprise: "API_HUB_ENTERPRISE";
|
|
290
270
|
};
|
|
291
271
|
export type ApiHubType = (typeof ApiHubType)[keyof typeof ApiHubType];
|
|
292
|
-
/**
|
|
293
|
-
* Defines the api hub service properties or enterprise and non-enterprise versions
|
|
294
|
-
*/
|
|
295
|
-
export interface ApiHubConfig {
|
|
296
|
-
apiHubKey: string;
|
|
297
|
-
apiHubType: ApiHubType;
|
|
298
|
-
}
|
|
299
|
-
export interface CapService {
|
|
300
|
-
projectPath: string;
|
|
301
|
-
serviceName: string;
|
|
302
|
-
appPath?: string;
|
|
303
|
-
serviceCdsPath?: string;
|
|
304
|
-
capType?: CapType;
|
|
305
|
-
capCdsInfo?: CdsUi5PluginInfo;
|
|
306
|
-
}
|
|
307
272
|
export declare const SapSystemSourceType: {
|
|
308
273
|
readonly SCP: "SCP";
|
|
309
274
|
readonly ON_PREM: "ON_PREM";
|
|
@@ -320,40 +285,12 @@ export interface Service {
|
|
|
320
285
|
edmx: string;
|
|
321
286
|
annotations?: Annotations[];
|
|
322
287
|
version?: ODataVersion;
|
|
323
|
-
capService?: CapService;
|
|
324
288
|
source: DatasourceType;
|
|
325
289
|
sapSystemSource?: SapSystemSourceType;
|
|
326
290
|
localEdmxFilePath?: string;
|
|
327
291
|
destinationAuthType?: string;
|
|
328
|
-
apiHubConfig?: ApiHubConfig;
|
|
329
292
|
ignoreCertError?: boolean;
|
|
330
293
|
}
|
|
331
|
-
/** README.txt base definition */
|
|
332
|
-
export interface ReadMe {
|
|
333
|
-
genDate: string;
|
|
334
|
-
genPlatform: string;
|
|
335
|
-
dataSourceLabel: string;
|
|
336
|
-
metadataFilename?: string;
|
|
337
|
-
serviceUrl: string;
|
|
338
|
-
projectName: string;
|
|
339
|
-
projectTitle: string;
|
|
340
|
-
projectNamespace: string;
|
|
341
|
-
projectDescription: string;
|
|
342
|
-
ui5Theme: string;
|
|
343
|
-
projectUI5Version: string;
|
|
344
|
-
enableCodeAssist: boolean;
|
|
345
|
-
enableEslint: boolean;
|
|
346
|
-
enableTypeScript: boolean;
|
|
347
|
-
showMockDataInfo?: boolean;
|
|
348
|
-
genId: string;
|
|
349
|
-
genVersion: string;
|
|
350
|
-
templateLabel: string;
|
|
351
|
-
additionalEntries?: {
|
|
352
|
-
label: string;
|
|
353
|
-
value: string;
|
|
354
|
-
}[];
|
|
355
|
-
launchText?: string;
|
|
356
|
-
}
|
|
357
294
|
interface Ui5YamlProps {
|
|
358
295
|
ui5Version: string;
|
|
359
296
|
ui5Url: string;
|
|
@@ -388,7 +325,7 @@ export interface UI5ConfigOptions {
|
|
|
388
325
|
localUI5Version?: string;
|
|
389
326
|
ui5Version?: string;
|
|
390
327
|
ui5Theme: string;
|
|
391
|
-
ui5SnapshotUrl
|
|
328
|
+
ui5SnapshotUrl?: string;
|
|
392
329
|
ui5VersionRequestInfo: any;
|
|
393
330
|
}
|
|
394
331
|
/**
|
package/dist/migration-types.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
export { isProjectFolderArray } from './types/project-folder.js';
|
|
2
|
-
/**
|
|
3
|
-
* OData versions supported by the catalog service
|
|
4
|
-
*/
|
|
5
|
-
export const ODataVersion = {
|
|
6
|
-
v2: '2',
|
|
7
|
-
v4: '4'
|
|
8
|
-
};
|
|
9
|
-
export const SapUxLayer = {
|
|
10
|
-
VENDOR: 'VENDOR',
|
|
11
|
-
CUSTOMER_BASE: 'CUSTOMER_BASE'
|
|
12
|
-
};
|
|
13
2
|
// Common constants defs used throughout
|
|
14
3
|
export const DatasourceType = {
|
|
15
4
|
FILE: 'File',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Helper functions for processing adaptation project configuration
|
|
3
3
|
*/
|
|
4
|
-
import type { Package } from '
|
|
4
|
+
import type { Package } from '@sap-ux/project-access';
|
|
5
5
|
import type { ImportProjectInfo, NeoappDestination } from '../types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Configuration for processing adaptation project
|
|
@@ -5,7 +5,8 @@ import { SapUiLibs } from '../index.js';
|
|
|
5
5
|
import { defaultMinUi5Version, minUi5VersionV4Template } from '@sap-ux/ui5-info';
|
|
6
6
|
import { getManifestVersion } from '@sap-ux/ui5-application-writer';
|
|
7
7
|
import { getUI5Version, stripSpaces } from '../utils/index.js';
|
|
8
|
-
import {
|
|
8
|
+
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
9
|
+
import { DatasourceType } from '../types.js';
|
|
9
10
|
/**
|
|
10
11
|
* Prepare sanitized project names and namespaces
|
|
11
12
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Manifest
|
|
1
|
+
import type { Manifest } from '../project-spec-types.js';
|
|
2
2
|
import type { ImportProjectInfo, NeoappDestination } from '../types.js';
|
|
3
|
+
import type { Package } from '@sap-ux/project-access';
|
|
3
4
|
/**
|
|
4
5
|
* Configuration for processing project extension
|
|
5
6
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Helper functions for processing reuse library projects
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Package } from '@sap-ux/project-access';
|
|
5
|
+
import type { Manifest } from '../project-spec-types.js';
|
|
5
6
|
import type { ImportProjectInfo, ProjectFolder } from '../types.js';
|
|
6
7
|
/**
|
|
7
8
|
* Process reuse library project to build projectInfo
|
|
@@ -48,22 +48,6 @@ export declare const DirName: {
|
|
|
48
48
|
readonly Sapux: "src";
|
|
49
49
|
};
|
|
50
50
|
export type DirName = (typeof DirName)[keyof typeof DirName];
|
|
51
|
-
/**
|
|
52
|
-
* Package.json structure
|
|
53
|
-
*/
|
|
54
|
-
export interface Package {
|
|
55
|
-
name?: string;
|
|
56
|
-
version?: string;
|
|
57
|
-
description?: string;
|
|
58
|
-
scripts?: Record<string, string>;
|
|
59
|
-
dependencies?: Record<string, string>;
|
|
60
|
-
devDependencies?: Record<string, string>;
|
|
61
|
-
ui5?: {
|
|
62
|
-
dependencies?: string[];
|
|
63
|
-
};
|
|
64
|
-
sapux?: string[] | boolean;
|
|
65
|
-
[key: string]: unknown;
|
|
66
|
-
}
|
|
67
51
|
/**
|
|
68
52
|
* UI5 routing target from manifest.json
|
|
69
53
|
*/
|
|
@@ -75,15 +59,4 @@ export interface SapUi5RoutingTarget {
|
|
|
75
59
|
viewLevel?: number;
|
|
76
60
|
transition?: string;
|
|
77
61
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Middleware proxy configuration for ui5.yaml
|
|
80
|
-
*/
|
|
81
|
-
export interface MiddlewareProxy {
|
|
82
|
-
name?: string;
|
|
83
|
-
path: string;
|
|
84
|
-
url?: string;
|
|
85
|
-
destination?: string;
|
|
86
|
-
destinationInstance?: string;
|
|
87
|
-
client?: string;
|
|
88
|
-
}
|
|
89
62
|
//# sourceMappingURL=project-spec-types.d.ts.map
|
package/dist/template/data.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export interface AddV4MockMiddlewareConfig {
|
|
|
58
58
|
projectInfo: ImportProjectInfo;
|
|
59
59
|
projectData: Partial<ProjectMigrate>;
|
|
60
60
|
ui5Version: string | undefined;
|
|
61
|
-
ui5SnapshotUrl
|
|
61
|
+
ui5SnapshotUrl?: string;
|
|
62
62
|
ui5VersionRequestInfo: any;
|
|
63
63
|
ui5Yaml: Ui5Yaml;
|
|
64
64
|
}
|
package/dist/template/data.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DirName } from '../project-spec-types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
3
|
+
import { FLOOR_PLAN } from '../types.js';
|
|
3
4
|
import { escapeDoubleQuotes } from '../utils/index.js';
|
|
4
5
|
/**
|
|
5
6
|
* Creates Ui5Yaml configuration object
|
package/dist/utils/Project.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Package } from '@sap-ux/project-access';
|
|
3
|
+
import type { Manifest } from '../project-spec-types.js';
|
|
3
4
|
import type { ImportProjectInfo, Message, MigratableFolder, ProjectFolder } from '../types.js';
|
|
4
5
|
import { MigrationTypes } from './constants.js';
|
|
5
6
|
import { getFirstBackend } from './project-readers/index.js';
|
package/dist/utils/Project.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createMemFsEditor } from './fs-adapter.js';
|
|
|
3
3
|
import { getReuseLibs, findAllProjectRoots, ReuseLibType } from './file-discovery.js';
|
|
4
4
|
import { DirName } from '../project-spec-types.js';
|
|
5
5
|
import { legacyPath, findAllWebIDEProjectFolders, findProjectsByManifest } from './common.js';
|
|
6
|
-
import { ODataVersion } from '
|
|
6
|
+
import { ODataVersion } from '@sap-ux/axios-extension';
|
|
7
7
|
import { MigrationTypes } from './constants.js';
|
|
8
8
|
import { URI } from 'vscode-uri';
|
|
9
9
|
import { processProjectExtension } from '../project/project-extension.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Data } from 'ejs';
|
|
2
2
|
import type { Editor } from 'mem-fs-editor';
|
|
3
3
|
import type { Manifest, SapAppSourceTemplate } from '../project-spec-types.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { UI5FlexLayer } from '@sap-ux/project-access';
|
|
5
|
+
import type { TemplateProperties } from '../types.js';
|
|
5
6
|
/**
|
|
6
7
|
* Filter out only SAP libs
|
|
7
8
|
*
|
|
@@ -18,11 +19,13 @@ export declare class MigrationError extends Error {
|
|
|
18
19
|
private setMessage;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
|
-
* Determine error message based on error type
|
|
22
|
+
* Determine error message based on error type.
|
|
23
|
+
* Always returns a non-empty string with fallback to error.message.
|
|
22
24
|
*
|
|
23
|
-
* @param error
|
|
24
|
-
* @param filename
|
|
25
|
-
* @param useMessage
|
|
25
|
+
* @param error - The error object
|
|
26
|
+
* @param filename - Optional filename context for file-specific errors
|
|
27
|
+
* @param useMessage - Whether to use the raw error message
|
|
28
|
+
* @returns A user-friendly error message, or the original error message as fallback
|
|
26
29
|
*/
|
|
27
30
|
export declare function determineMessage(error: Error, filename?: string, useMessage?: boolean): string;
|
|
28
31
|
/**
|
|
@@ -60,7 +63,7 @@ export declare function generateToolsId(): string;
|
|
|
60
63
|
* @param isInternal - Whether the project is internal (SAP-developed)
|
|
61
64
|
* @returns SAP UX layer identifier
|
|
62
65
|
*/
|
|
63
|
-
export declare function determineSapUxLayer(isInternal: boolean):
|
|
66
|
+
export declare function determineSapUxLayer(isInternal: boolean): UI5FlexLayer;
|
|
64
67
|
/**
|
|
65
68
|
* Format a string url parameter from the input arguments. Accepts empty string as input arguments.
|
|
66
69
|
*
|
|
@@ -42,11 +42,13 @@ export class MigrationError extends Error {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Determine error message based on error type
|
|
45
|
+
* Determine error message based on error type.
|
|
46
|
+
* Always returns a non-empty string with fallback to error.message.
|
|
46
47
|
*
|
|
47
|
-
* @param error
|
|
48
|
-
* @param filename
|
|
49
|
-
* @param useMessage
|
|
48
|
+
* @param error - The error object
|
|
49
|
+
* @param filename - Optional filename context for file-specific errors
|
|
50
|
+
* @param useMessage - Whether to use the raw error message
|
|
51
|
+
* @returns A user-friendly error message, or the original error message as fallback
|
|
50
52
|
*/
|
|
51
53
|
export function determineMessage(error, filename, useMessage) {
|
|
52
54
|
let errorMessage = '';
|
|
@@ -62,7 +64,8 @@ export function determineMessage(error, filename, useMessage) {
|
|
|
62
64
|
else if (error.message.includes('EPERM')) {
|
|
63
65
|
errorMessage = i18nText(filename ? 'ERROR_PERMISSION_FILE' : 'ERROR_PERMISSION', { filename });
|
|
64
66
|
}
|
|
65
|
-
|
|
67
|
+
// Fallback to original error message if no specific message was determined
|
|
68
|
+
return errorMessage || error.message || error.toString();
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
68
71
|
* Generate template file using EJS and template utilities
|
|
@@ -128,7 +131,7 @@ export function generateToolsId() {
|
|
|
128
131
|
* @returns SAP UX layer identifier
|
|
129
132
|
*/
|
|
130
133
|
export function determineSapUxLayer(isInternal) {
|
|
131
|
-
return
|
|
134
|
+
return isInternal ? 'VENDOR' : 'CUSTOMER_BASE';
|
|
132
135
|
}
|
|
133
136
|
/**
|
|
134
137
|
* Format a string url parameter from the input arguments. Accepts empty string as input arguments.
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { readFile, fileExists, readJSON, deleteFile } from '../file-access.js';
|
|
7
7
|
import { createMemFsEditor } from '../fs-adapter.js';
|
|
8
|
+
import { commitFileSystemChanges } from '../../files/file-system.js';
|
|
8
9
|
import mergeWith from 'lodash/mergeWith.js';
|
|
9
10
|
import { MigrationTypes } from '../constants.js';
|
|
10
11
|
/**
|
|
@@ -107,7 +108,7 @@ export async function handlePackageJsonFile(projectRoot, targetFile, templateCon
|
|
|
107
108
|
// When we created the editor ourselves, persist staged side effects (e.g. Gruntfile.js deletion).
|
|
108
109
|
// When the caller passed an editor, they own the commit (migration flow commits once at the end).
|
|
109
110
|
if (ownsEditor) {
|
|
110
|
-
await
|
|
111
|
+
await commitFileSystemChanges(fs);
|
|
111
112
|
}
|
|
112
113
|
return JSON.stringify(mergedContent, null, 2);
|
|
113
114
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Afiori-migration-writer"
|
|
12
12
|
},
|
|
13
|
-
"version": "0.0
|
|
13
|
+
"version": "1.0.0",
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"files": [
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"yaml": "2.9.1",
|
|
40
40
|
"@sap-ux/adp-tooling": "1.2.0",
|
|
41
41
|
"@sap-ux/axios-extension": "2.1.6",
|
|
42
|
-
"@sap-ux/btp-utils": "2.0.8",
|
|
43
42
|
"@sap-ux/i18n": "1.0.7",
|
|
44
43
|
"@sap-ux/launch-config": "1.0.28",
|
|
45
44
|
"@sap-ux/nodejs-utils": "1.0.14",
|
|
@@ -47,7 +46,8 @@
|
|
|
47
46
|
"@sap-ux/store": "2.0.8",
|
|
48
47
|
"@sap-ux/ui5-application-writer": "2.1.7",
|
|
49
48
|
"@sap-ux/ui5-config": "1.0.11",
|
|
50
|
-
"@sap-ux/ui5-info": "1.0.7"
|
|
49
|
+
"@sap-ux/ui5-info": "1.0.7",
|
|
50
|
+
"@sap-ux/btp-utils": "2.0.8"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@jest/globals": "30.5.2",
|