@sap-ux/repo-app-import-sub-generator 1.1.31 → 1.1.32

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.
@@ -7,6 +7,7 @@ import { t } from '../utils/i18n.js';
7
7
  import { extractZip } from '../utils/download-utils.js';
8
8
  import { EventName } from '../telemetryEvents/index.js';
9
9
  import { getDefaultTargetFolder, generateAppGenInfo, sendTelemetry, TelemetryHelper, isCli, setYeomanEnvConflicterForce } from '@sap-ux/fiori-generator-shared';
10
+ import { getFloorplanLabel } from '@sap-ux/fiori-app-sub-generator';
10
11
  import { AppDownloadType, PromptNames } from './types.js';
11
12
  import { getPrompts } from '../prompts/prompts.js';
12
13
  import { generate } from '@sap-ux/fiori-elements-writer';
@@ -22,7 +23,7 @@ import { generate as generateDeployConfig } from '@sap-ux/abap-deploy-config-wri
22
23
  import { PromptState } from '../prompts/prompt-state.js';
23
24
  import { getAppConfig, getAdtDeployConfig } from './app-config-quick-deploy.js';
24
25
  import { getAbapRepoAppConfig, getAbapRepoDeployConfig, writeServiceMetadata } from './app-config-abap-repo.js';
25
- import { makeValidJson, processDebugArtifacts, addPackageJsonIfNotFound } from '../utils/file-helpers.js';
26
+ import { makeValidJson, cleanupArtifacts, addPackageJsonIfNotFound } from '../utils/file-helpers.js';
26
27
  import { replaceWebappFiles, validateAndUpdateManifestUI5Version } from '../utils/updates.js';
27
28
  import { getYUIDetails } from '../prompts/prompt-helpers.js';
28
29
  import { isValidPromptState, validateQfaJsonFile } from '../utils/validators.js';
@@ -127,7 +128,7 @@ export default class extends Generator {
127
128
  if (serviceProvider) {
128
129
  await writeServiceMetadata(serviceProvider, webappPath, this.fs);
129
130
  }
130
- processDebugArtifacts(webappPath, this.fs);
131
+ cleanupArtifacts(webappPath, this.fs);
131
132
  const appConfig = getAbapRepoAppConfig(webappPath, this.answers.selectedApp, this.fs);
132
133
  // If package.json does not exist in the extracted app, add a minimal one with the appId as the package name.
133
134
  addPackageJsonIfNotFound(this.projectPath, appConfig, this.fs);
@@ -201,7 +202,7 @@ export default class extends Generator {
201
202
  generatorName: generatorName,
202
203
  generatorVersion: this.rootGeneratorVersion(),
203
204
  ui5Version: config.ui5?.version ?? '',
204
- template: config.template.type,
205
+ template: getFloorplanLabel(config.template.type, config.service.version),
205
206
  serviceUrl: config.service.url,
206
207
  launchText: t('readMe.launchText')
207
208
  };
@@ -17,17 +17,16 @@ export declare function makeValidJson(filePath: string, fs: Editor): QfaJsonConf
17
17
  */
18
18
  export declare function readManifest(manifestFilePath: string, fs: Editor): Manifest;
19
19
  /**
20
- * Removes debug, preload, and source map files from the extracted project path.
20
+ * Removes build artefacts from the extracted project that should not be present in a local development project.
21
+ * Handles debug files (-dbg.js), preload bundles, source maps, and transpiled JS files for TypeScript apps.
21
22
  * For -dbg.js files, copies the unminified content to the corresponding .js file first.
22
- * These files are build artefacts that cause issues with the UI5 CLI build if left in place.
23
23
  *
24
24
  * @param {string} extractedProjectPath - The path where the app files are extracted.
25
25
  * @param {Editor} fs - The file system editor.
26
26
  */
27
- export declare function processDebugArtifacts(extractedProjectPath: string, fs: Editor): void;
27
+ export declare function cleanupArtifacts(extractedProjectPath: string, fs: Editor): void;
28
28
  /**
29
29
  * Writes a minimal package.json to the project path if one does not already exist.
30
- * Sets `sapux: true` for all apps except freestyle templates.
31
30
  *
32
31
  * @param {string} projectPath - The project root path.
33
32
  * @param {AbapRepoAppConfig} appConfig - The app configuration.
@@ -43,37 +43,49 @@ export function readManifest(manifestFilePath, fs) {
43
43
  return manifest;
44
44
  }
45
45
  /**
46
- * Removes debug, preload, and source map files from the extracted project path.
46
+ * Removes build artefacts from the extracted project that should not be present in a local development project.
47
+ * Handles debug files (-dbg.js), preload bundles, source maps, and transpiled JS files for TypeScript apps.
47
48
  * For -dbg.js files, copies the unminified content to the corresponding .js file first.
48
- * These files are build artefacts that cause issues with the UI5 CLI build if left in place.
49
49
  *
50
50
  * @param {string} extractedProjectPath - The path where the app files are extracted.
51
51
  * @param {Editor} fs - The file system editor.
52
52
  */
53
- export function processDebugArtifacts(extractedProjectPath, fs) {
53
+ export function cleanupArtifacts(extractedProjectPath, fs) {
54
54
  const dbgSuffix = '-dbg.';
55
- PromptState.admZip?.getEntries().forEach((entry) => {
55
+ const entries = PromptState.admZip?.getEntries() ?? [];
56
+ const tsEntryNames = new Set(entries.filter((e) => e.entryName.endsWith('.ts') && !e.entryName.endsWith('.d.ts')).map((e) => e.entryName));
57
+ entries.forEach((entry) => {
56
58
  const name = entry.entryName;
59
+ // Replace debug variants (e.g. component-dbg.js) with their non-debug counterpart
57
60
  if (name.includes(dbgSuffix)) {
58
- // copies contents of -dbg.js to .js file and removes the -dbg.js file
59
61
  const extractedDebugPath = join(extractedProjectPath, name.replace(dbgSuffix, '.'));
60
62
  const debugPath = join(extractedProjectPath, name);
61
63
  fs.write(extractedDebugPath, entry.getData().toString('utf8'));
62
64
  fs.delete(debugPath);
63
- RepoAppDownloadLogger.logger?.debug(`processDebugArtifacts: Copied "${debugPath}" -> "${extractedDebugPath}" and removed debug file`);
65
+ RepoAppDownloadLogger.logger?.debug(`cleanupArtifacts: Copied "${debugPath}" -> "${extractedDebugPath}" and removed debug file`);
66
+ return;
64
67
  }
65
- else if (name.endsWith('-preload.js') || name.endsWith('.js.map')) {
68
+ // Remove preload bundles and source maps — not needed for local development
69
+ if (name.endsWith('-preload.js') || name.endsWith('.js.map')) {
66
70
  const filePath = join(extractedProjectPath, name);
67
71
  if (fs.exists(filePath)) {
68
72
  fs.delete(filePath);
69
- RepoAppDownloadLogger.logger?.debug(`processDebugArtifacts: Removed file: "${filePath}"`);
73
+ RepoAppDownloadLogger.logger?.debug(`cleanupArtifacts: Removed preload/map file: "${filePath}"`);
74
+ }
75
+ return;
76
+ }
77
+ // Remove transpiled .js files that have a .ts counterpart — TypeScript source takes precedence
78
+ if (tsEntryNames.size > 0 && name.endsWith('.js') && tsEntryNames.has(`${name.slice(0, -3)}.ts`)) {
79
+ const filePath = join(extractedProjectPath, name);
80
+ if (fs.exists(filePath)) {
81
+ fs.delete(filePath);
82
+ RepoAppDownloadLogger.logger?.debug(`cleanupArtifacts: Removed transpiled file: "${filePath}"`);
70
83
  }
71
84
  }
72
85
  });
73
86
  }
74
87
  /**
75
88
  * Writes a minimal package.json to the project path if one does not already exist.
76
- * Sets `sapux: true` for all apps except freestyle templates.
77
89
  *
78
90
  * @param {string} projectPath - The project root path.
79
91
  * @param {AbapRepoAppConfig} appConfig - The app configuration.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/repo-app-import-sub-generator",
3
3
  "description": "Generator to download LROP Fiori applications deployed from an ABAP repository.",
4
- "version": "1.1.31",
4
+ "version": "1.1.32",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,8 +30,9 @@
30
30
  "@sap-ux/inquirer-common": "1.0.20",
31
31
  "@sap-ux/project-access": "2.1.6",
32
32
  "@sap-ux/odata-service-inquirer": "3.0.22",
33
- "@sap-ux/fiori-elements-writer": "3.0.47",
34
- "@sap-ux/fiori-freestyle-writer": "3.0.42",
33
+ "@sap-ux/fiori-elements-writer": "3.0.48",
34
+ "@sap-ux/fiori-freestyle-writer": "3.0.43",
35
+ "@sap-ux/fiori-app-sub-generator": "1.1.0",
35
36
  "@sap-ux/logger": "1.0.2",
36
37
  "@sap-ux/project-input-validator": "1.0.10",
37
38
  "@sap-ux/launch-config": "1.0.11",