@sap-ux/adp-tooling 0.12.138 → 0.13.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.
@@ -27,6 +27,14 @@ export declare function updateVariant(basePath: string, variant: DescriptorVaria
27
27
  * @throws {Error} Throws an error if the variant could not be retrieved.
28
28
  */
29
29
  export declare function flpConfigurationExists(basePath: string): boolean;
30
+ /**
31
+ * Checks whether TypeScript is supported in the project by verifying the existence of `tsconfig.json`.
32
+ *
33
+ * @param basePath - The base path of the project.
34
+ * @param fs - An optional `mem-fs-editor` instance to check for the file's existence.
35
+ * @returns `true` if `tsconfig.json` exists, otherwise `false`.
36
+ */
37
+ export declare function isTypescriptSupported(basePath: string, fs?: Editor): boolean;
30
38
  /**
31
39
  * Returns the adaptation project configuration, throws an error if not found.
32
40
  *
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getVariant = getVariant;
4
4
  exports.updateVariant = updateVariant;
5
5
  exports.flpConfigurationExists = flpConfigurationExists;
6
+ exports.isTypescriptSupported = isTypescriptSupported;
6
7
  exports.getAdpConfig = getAdpConfig;
7
8
  exports.getWebappFiles = getWebappFiles;
8
9
  const fs_1 = require("fs");
@@ -50,6 +51,17 @@ function flpConfigurationExists(basePath) {
50
51
  throw new Error(`Failed to check if FLP configuration exists: ${error.message}`);
51
52
  }
52
53
  }
54
+ /**
55
+ * Checks whether TypeScript is supported in the project by verifying the existence of `tsconfig.json`.
56
+ *
57
+ * @param basePath - The base path of the project.
58
+ * @param fs - An optional `mem-fs-editor` instance to check for the file's existence.
59
+ * @returns `true` if `tsconfig.json` exists, otherwise `false`.
60
+ */
61
+ function isTypescriptSupported(basePath, fs) {
62
+ const path = (0, path_1.join)(basePath, 'tsconfig.json');
63
+ return fs ? fs.exists(path) : (0, fs_1.existsSync)(path);
64
+ }
53
65
  /**
54
66
  * Returns the adaptation project configuration, throws an error if not found.
55
67
  *
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Executes a build command in the specified project directory.
3
+ *
4
+ * This function uses the `CommandRunner` to run the build process via the command `npm run build`.
5
+ *
6
+ * @param {string} projectPath - The absolute path to the project directory where the build command will be executed.
7
+ * @returns {Promise<void>} Resolves when the build process has completed successfully.
8
+ * @throws {Error} If the build process fails or if an error occurs during cleanup.
9
+ */
10
+ export declare function runBuild(projectPath: string): Promise<void>;
11
+ //# sourceMappingURL=project-builder.d.ts.map
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runBuild = runBuild;
4
+ const nodejs_utils_1 = require("@sap-ux/nodejs-utils");
5
+ /**
6
+ * Executes a build command in the specified project directory.
7
+ *
8
+ * This function uses the `CommandRunner` to run the build process via the command `npm run build`.
9
+ *
10
+ * @param {string} projectPath - The absolute path to the project directory where the build command will be executed.
11
+ * @returns {Promise<void>} Resolves when the build process has completed successfully.
12
+ * @throws {Error} If the build process fails or if an error occurs during cleanup.
13
+ */
14
+ async function runBuild(projectPath) {
15
+ const commandRunner = new nodejs_utils_1.CommandRunner();
16
+ try {
17
+ await commandRunner.run('npm', ['run', 'build'], { cwd: projectPath });
18
+ }
19
+ catch (e) {
20
+ console.error(`Error during build and clean: ${e.message}`);
21
+ throw e;
22
+ }
23
+ }
24
+ //# sourceMappingURL=project-builder.js.map
@@ -12,6 +12,7 @@ export type PromptDefaults = {
12
12
  ft?: boolean;
13
13
  package?: string;
14
14
  transport?: string;
15
+ ts?: boolean;
15
16
  };
16
17
  /**
17
18
  * Prompt the user for the required properties for an adaptation project.
@@ -82,6 +82,13 @@ async function promptGeneratorInput(defaults, logger) {
82
82
  message: 'Enable Fiori tools?',
83
83
  initial: defaults.ft !== false,
84
84
  validate: (input) => input?.length > 0
85
+ },
86
+ {
87
+ type: 'confirm',
88
+ name: 'enableTypeScript',
89
+ message: 'Enable TypeScript?',
90
+ initial: defaults.ts !== false,
91
+ validate: (input) => input?.length > 0
85
92
  }
86
93
  ]);
87
94
  return {
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './types';
2
2
  export * from './prompts';
3
3
  export * from './common';
4
4
  export * from './base/cf';
5
+ export * from './base/project-builder';
5
6
  export * from './base/abap/manifest-service';
6
7
  export * from './base/helper';
7
8
  export * from './preview/adp-preview';
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ __exportStar(require("./types"), exports);
19
19
  __exportStar(require("./prompts"), exports);
20
20
  __exportStar(require("./common"), exports);
21
21
  __exportStar(require("./base/cf"), exports);
22
+ __exportStar(require("./base/project-builder"), exports);
22
23
  __exportStar(require("./base/abap/manifest-service"), exports);
23
24
  __exportStar(require("./base/helper"), exports);
24
25
  __exportStar(require("./preview/adp-preview"), exports);
@@ -152,13 +152,16 @@ class RoutesHandler {
152
152
  let changeFilePath = '';
153
153
  const project = this.util.getProject();
154
154
  const sourcePath = project.getSourcePath();
155
+ const rootPath = this.util.getProject().getRootPath();
155
156
  const projectName = project.getName();
157
+ const isTsSupported = (0, helper_1.isTypescriptSupported)(rootPath);
156
158
  const getPath = (projectPath, fileName, folder = project_access_1.DirName.Coding) => path.join(projectPath, project_access_1.DirName.Changes, folder, fileName).split(path.sep).join(path.posix.sep);
157
159
  for (const file of codeExtFiles) {
158
160
  const fileStr = await file.getString();
159
161
  const change = JSON.parse(fileStr);
160
162
  if (change.selector.controllerName === controllerName) {
161
- const fileName = change.content.codeRef.replace('coding/', '');
163
+ const baseFileName = change.content.codeRef.replace('coding/', '');
164
+ const fileName = isTsSupported ? baseFileName.replace('.js', '.ts') : baseFileName;
162
165
  controllerPath = getPath(sourcePath, fileName);
163
166
  controllerPathFromRoot = getPath(projectName, fileName);
164
167
  changeFilePath = getPath(projectName, file.getName(), '');
@@ -177,7 +180,8 @@ class RoutesHandler {
177
180
  controllerExists,
178
181
  controllerPath: os.platform() === 'win32' ? `/${controllerPath}` : controllerPath,
179
182
  controllerPathFromRoot,
180
- isRunningInBAS
183
+ isRunningInBAS,
184
+ isTsSupported
181
185
  });
182
186
  this.logger.debug(controllerExists
183
187
  ? `Controller exists at '${controllerPath}'`
@@ -197,35 +201,29 @@ class RoutesHandler {
197
201
  handleWriteControllerExt = async (req, res, next) => {
198
202
  try {
199
203
  const data = req.body;
200
- const controllerExtName = (0, sanitize_filename_1.default)(data.controllerName);
201
- const projectId = data.projectId;
204
+ const name = (0, sanitize_filename_1.default)(data.controllerName);
202
205
  const sourcePath = this.util.getProject().getSourcePath();
203
- if (!controllerExtName) {
206
+ const rootPath = this.util.getProject().getRootPath();
207
+ if (!name) {
204
208
  res.status(400 /* HttpStatusCodes.BAD_REQUEST */).send('Controller extension name was not provided!');
205
209
  this.logger.debug('Bad request. Controller extension name was not provided!');
206
210
  return;
207
211
  }
212
+ const isTsSupported = (0, helper_1.isTypescriptSupported)(rootPath);
208
213
  const fullPath = path.join(sourcePath, project_access_1.DirName.Changes, project_access_1.DirName.Coding);
209
- const filePath = path.join(fullPath, `${controllerExtName}.js`);
214
+ const filePath = path.join(fullPath, `${name}.${isTsSupported ? 'ts' : 'js'}`);
210
215
  if (!fs.existsSync(fullPath)) {
211
216
  fs.mkdirSync(fullPath, { recursive: true });
212
217
  }
213
218
  if (fs.existsSync(filePath)) {
214
- res.status(409 /* HttpStatusCodes.CONFLICT */).send(`Controller extension with name "${controllerExtName}" already exists`);
215
- this.logger.debug(`Controller extension with name "${controllerExtName}" already exists`);
219
+ res.status(409 /* HttpStatusCodes.CONFLICT */).send(`Controller extension with name "${name}" already exists`);
220
+ this.logger.debug(`Controller extension with name "${name}" already exists`);
216
221
  return;
217
222
  }
218
- const controllerExtPath = `${projectId}.${controllerExtName}`;
219
- const controllerTemplateFilePath = path.join(__dirname, '../../templates/rta', "controller.ejs" /* TemplateFileName.Controller */);
220
- (0, ejs_1.renderFile)(controllerTemplateFilePath, { controllerExtPath }, {}, (err, str) => {
221
- if (err) {
222
- throw new Error('Error rendering template: ' + err.message);
223
- }
224
- fs.writeFileSync(filePath, str, { encoding: 'utf8' });
225
- });
223
+ generateControllerFile(rootPath, filePath, name);
226
224
  const message = 'Controller extension created!';
227
225
  res.status(201 /* HttpStatusCodes.CREATED */).send(message);
228
- this.logger.debug(`Controller extension with name "${controllerExtName}" was created`);
226
+ this.logger.debug(`Controller extension with name "${name}" was created`);
229
227
  }
230
228
  catch (e) {
231
229
  const sanitizedMsg = (0, sanitize_filename_1.default)(e.message);
@@ -315,4 +313,29 @@ class RoutesHandler {
315
313
  }
316
314
  }
317
315
  exports.default = RoutesHandler;
316
+ /**
317
+ * Generates a controller file for the Adaptation Project based on the project's TypeScript support.
318
+ *
319
+ * This function creates a controller file in the specified `filePath` by rendering a template.
320
+ * It determines whether to use a TypeScript or JavaScript template based on the TypeScript support of the project.
321
+ *
322
+ * @param {string} rootPath - The root directory of the project.
323
+ * @param {string} filePath - The destination path where the generated controller file should be saved.
324
+ * @param {string} name - The name of the controller extension (used in TypeScript templates).
325
+ * @throws {Error} Throws an error if rendering the template fails.
326
+ */
327
+ function generateControllerFile(rootPath, filePath, name) {
328
+ const id = (0, helper_1.getVariant)(rootPath)?.id;
329
+ const isTsSupported = (0, helper_1.isTypescriptSupported)(rootPath);
330
+ const tmplFileName = isTsSupported ? "ts-controller.ejs" /* TemplateFileName.TSController */ : "controller.ejs" /* TemplateFileName.Controller */;
331
+ const tmplPath = path.join(__dirname, '../../templates/rta', tmplFileName);
332
+ const extensionPath = `${id}.${name}`;
333
+ const templateData = isTsSupported ? { name, ns: id } : { extensionPath };
334
+ (0, ejs_1.renderFile)(tmplPath, templateData, {}, (err, str) => {
335
+ if (err) {
336
+ throw new Error(`Error rendering ${isTsSupported ? 'TypeScript' : 'JavaScript'} template: ${err.message}`);
337
+ }
338
+ fs.writeFileSync(filePath, str, { encoding: 'utf8' });
339
+ });
340
+ }
318
341
  //# sourceMappingURL=routes-handler.js.map
package/dist/types.d.ts CHANGED
@@ -76,6 +76,10 @@ export interface AdpWriterConfig {
76
76
  * Optional: if set to true then the generated project will be recognized by the SAP Fiori tools
77
77
  */
78
78
  fioriTools?: boolean;
79
+ /**
80
+ * Optional: if set to true then the generated project will support typescript
81
+ */
82
+ enableTypeScript?: boolean;
79
83
  };
80
84
  }
81
85
  export interface ChangeInboundNavigation {
@@ -253,6 +257,7 @@ export type ParameterRules = {
253
257
  export declare const enum TemplateFileName {
254
258
  Fragment = "fragment.xml",
255
259
  Controller = "controller.ejs",
260
+ TSController = "ts-controller.ejs",
256
261
  Annotation = "annotation.xml"
257
262
  }
258
263
  export declare const enum FlexLayer {
@@ -7,7 +7,7 @@ const mem_fs_1 = require("mem-fs");
7
7
  const mem_fs_editor_1 = require("mem-fs-editor");
8
8
  const options_1 = require("./options");
9
9
  const project_utils_1 = require("./project-utils");
10
- const tmplPath = (0, path_1.join)(__dirname, '../../templates/project');
10
+ const baseTmplPath = (0, path_1.join)(__dirname, '../../templates');
11
11
  /**
12
12
  * Set default values for optional properties.
13
13
  *
@@ -51,7 +51,7 @@ async function generate(basePath, config, fs) {
51
51
  if (fullConfig.customConfig?.adp.environment === 'C' && fullConfig.flp) {
52
52
  (0, options_1.enhanceManifestChangeContentWithFlpConfig)(fullConfig.flp, fullConfig.app.id, fullConfig.app.content);
53
53
  }
54
- (0, project_utils_1.writeTemplateToFolder)((0, path_1.join)(tmplPath, '**/*.*'), (0, path_1.join)(basePath), fullConfig, fs);
54
+ (0, project_utils_1.writeTemplateToFolder)(baseTmplPath, (0, path_1.join)(basePath), fullConfig, fs);
55
55
  await (0, project_utils_1.writeUI5DeployYaml)(basePath, fullConfig, fs);
56
56
  await (0, project_utils_1.writeUI5Yaml)(basePath, fullConfig, fs);
57
57
  return fs;
@@ -69,6 +69,7 @@ async function migrate(basePath, config, fs) {
69
69
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
70
70
  }
71
71
  const fullConfig = setDefaults(config);
72
+ const tmplPath = (0, path_1.join)(baseTmplPath, 'project');
72
73
  // Copy the specified files to target project
73
74
  fs.copyTpl((0, path_1.join)(tmplPath, '**/ui5.yaml'), (0, path_1.join)(basePath), fullConfig, undefined, {
74
75
  globOptions: { dot: true }
@@ -1,5 +1,5 @@
1
1
  import type { UI5Config } from '@sap-ux/ui5-config';
2
- import type { CustomConfig, AdpWriterConfig, Content, CloudApp, InternalInboundNavigation } from '../types';
2
+ import type { AdpWriterConfig, Content, CloudApp, InternalInboundNavigation } from '../types';
3
3
  /**
4
4
  * Generate the configuration for the middlewares required for the ui5.yaml.
5
5
  *
@@ -8,10 +8,12 @@ import type { CustomConfig, AdpWriterConfig, Content, CloudApp, InternalInboundN
8
8
  */
9
9
  export declare function enhanceUI5Yaml(ui5Config: UI5Config, config: AdpWriterConfig): void;
10
10
  /**
11
- * Generate the configuration for the custom tasks required for the ui5.yaml.
11
+ * Generates the configuration for the custom tasks required for the ui5.yaml.
12
12
  *
13
- * @param ui5Config configuration representing the ui5.yaml
14
- * @param config full project configuration
13
+ * Adds a custom task for building TypeScript projects.
14
+ *
15
+ * @param {UI5Config} ui5Config - The UI5 configuration object representing the ui5.yaml.
16
+ * @param {AdpWriterConfig} config - The configuration object containing options for the adaptation project.
15
17
  */
16
18
  export declare function enhanceUI5YamlWithCustomTask(ui5Config: UI5Config, config: AdpWriterConfig & {
17
19
  app: CloudApp;
@@ -22,7 +24,15 @@ export declare function enhanceUI5YamlWithCustomTask(ui5Config: UI5Config, confi
22
24
  * @param ui5Config configuration representing the ui5.yaml
23
25
  * @param config full project configuration
24
26
  */
25
- export declare function enhanceUI5YamlWithCustomConfig(ui5Config: UI5Config, config?: CustomConfig): void;
27
+ export declare function enhanceUI5YamlWithCustomConfig(ui5Config: UI5Config, config: AdpWriterConfig): void;
28
+ /**
29
+ * Enhances a UI5 YAML configuration with the transpile middleware for TypeScript support.
30
+ *
31
+ * @param {UI5Config} ui5Config - The UI5 configuration object representing the ui5.yaml.
32
+ * @param {AdpWriterConfig} config - The configuration object containing options for the adaptation project.
33
+ * @param {boolean} [config.options.enableTypeScript] - Flag indicating if TypeScript support is enabled.
34
+ */
35
+ export declare function enhanceUI5YamlWithTranspileMiddleware(ui5Config: UI5Config, config: AdpWriterConfig): void;
26
36
  /**
27
37
  * Writer configuration with deploy configuration.
28
38
  */
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.enhanceUI5Yaml = enhanceUI5Yaml;
4
4
  exports.enhanceUI5YamlWithCustomTask = enhanceUI5YamlWithCustomTask;
5
5
  exports.enhanceUI5YamlWithCustomConfig = enhanceUI5YamlWithCustomConfig;
6
+ exports.enhanceUI5YamlWithTranspileMiddleware = enhanceUI5YamlWithTranspileMiddleware;
6
7
  exports.hasDeployConfig = hasDeployConfig;
7
8
  exports.enhanceUI5DeployYaml = enhanceUI5DeployYaml;
8
9
  exports.enhanceManifestChangeContentWithFlpConfig = enhanceManifestChangeContentWithFlpConfig;
@@ -23,14 +24,34 @@ function enhanceUI5Yaml(ui5Config, config) {
23
24
  }
24
25
  }
25
26
  /**
26
- * Generate the configuration for the custom tasks required for the ui5.yaml.
27
+ * Generates the configuration for the custom tasks required for the ui5.yaml.
27
28
  *
28
- * @param ui5Config configuration representing the ui5.yaml
29
- * @param config full project configuration
29
+ * Adds a custom task for building TypeScript projects.
30
+ *
31
+ * @param {UI5Config} ui5Config - The UI5 configuration object representing the ui5.yaml.
32
+ * @param {AdpWriterConfig} config - The configuration object containing options for the adaptation project.
30
33
  */
31
34
  function enhanceUI5YamlWithCustomTask(ui5Config, config) {
32
- const tasks = getAdpCloudCustomTasks(config);
33
- ui5Config.addCustomTasks(tasks);
35
+ if (config.options?.enableTypeScript) {
36
+ ui5Config.addCustomTasks([
37
+ {
38
+ name: 'ui5-tooling-transpile-task',
39
+ afterTask: 'replaceVersion',
40
+ configuration: {
41
+ debug: true,
42
+ omitSourceMaps: true,
43
+ omitTSFromBuildResult: true,
44
+ transformModulesToUI5: {
45
+ overridesToOverride: true
46
+ }
47
+ }
48
+ }
49
+ ]);
50
+ }
51
+ if (config.customConfig?.adp?.environment === 'C') {
52
+ const tasks = getAdpCloudCustomTasks(config);
53
+ ui5Config.addCustomTasks(tasks);
54
+ }
34
55
  }
35
56
  /**
36
57
  * Generate custom configuration required for the ui5.yaml.
@@ -39,11 +60,33 @@ function enhanceUI5YamlWithCustomTask(ui5Config, config) {
39
60
  * @param config full project configuration
40
61
  */
41
62
  function enhanceUI5YamlWithCustomConfig(ui5Config, config) {
42
- if (config?.adp) {
43
- const { support } = config.adp;
63
+ const adp = config.customConfig?.adp;
64
+ if (adp) {
65
+ const { support } = adp;
44
66
  ui5Config.addCustomConfiguration('adp', { support });
45
67
  }
46
68
  }
69
+ /**
70
+ * Enhances a UI5 YAML configuration with the transpile middleware for TypeScript support.
71
+ *
72
+ * @param {UI5Config} ui5Config - The UI5 configuration object representing the ui5.yaml.
73
+ * @param {AdpWriterConfig} config - The configuration object containing options for the adaptation project.
74
+ * @param {boolean} [config.options.enableTypeScript] - Flag indicating if TypeScript support is enabled.
75
+ */
76
+ function enhanceUI5YamlWithTranspileMiddleware(ui5Config, config) {
77
+ if (config.options?.enableTypeScript) {
78
+ ui5Config.updateCustomMiddleware({
79
+ name: 'ui5-tooling-transpile-middleware',
80
+ afterMiddleware: 'compression',
81
+ configuration: {
82
+ debug: true,
83
+ transformModulesToUI5: {
84
+ overridesToOverride: true
85
+ }
86
+ }
87
+ });
88
+ }
89
+ }
47
90
  /**
48
91
  * Checks if a writer config has a deploy configuration.
49
92
  *
@@ -13,13 +13,13 @@ export declare function getPackageJSONInfo(): PackageJSON;
13
13
  /**
14
14
  * Writes a given project template files within a specified folder in the project directory.
15
15
  *
16
- * @param {string} templatePath - The root path of the project template.
16
+ * @param {string} baseTmplPath - The root path of the templates folder.
17
17
  * @param {string} projectPath - The root path of the project.
18
18
  * @param {AdpWriterConfig} data - The data to be populated in the template file.
19
19
  * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
20
20
  * @returns {void}
21
21
  */
22
- export declare function writeTemplateToFolder(templatePath: string, projectPath: string, data: AdpWriterConfig, fs: Editor): void;
22
+ export declare function writeTemplateToFolder(baseTmplPath: string, projectPath: string, data: AdpWriterConfig, fs: Editor): void;
23
23
  /**
24
24
  * Writes a ui5.yaml file within a specified folder in the project directory.
25
25
  *
@@ -28,18 +28,28 @@ function getPackageJSONInfo() {
28
28
  /**
29
29
  * Writes a given project template files within a specified folder in the project directory.
30
30
  *
31
- * @param {string} templatePath - The root path of the project template.
31
+ * @param {string} baseTmplPath - The root path of the templates folder.
32
32
  * @param {string} projectPath - The root path of the project.
33
33
  * @param {AdpWriterConfig} data - The data to be populated in the template file.
34
34
  * @param {Editor} fs - The `mem-fs-editor` instance used for file operations.
35
35
  * @returns {void}
36
36
  */
37
- function writeTemplateToFolder(templatePath, projectPath, data, fs) {
37
+ function writeTemplateToFolder(baseTmplPath, projectPath, data, fs) {
38
+ const tmplPath = (0, path_1.join)(baseTmplPath, 'project', '**/*.*');
39
+ const tsConfigPath = (0, path_1.join)(baseTmplPath, 'typescript', 'tsconfig.json');
40
+ const typesVersion = (0, ui5_config_1.getEsmTypesVersion)(data.ui5?.version);
41
+ const typesPackage = (0, ui5_config_1.getTypesPackage)(typesVersion);
38
42
  try {
39
- fs.copyTpl(templatePath, projectPath, data, undefined, {
43
+ fs.copyTpl(tmplPath, projectPath, { ...data, typesPackage, typesVersion }, undefined, {
40
44
  globOptions: { dot: true },
41
45
  processDestinationPath: (filePath) => filePath.replace(/gitignore.tmpl/g, '.gitignore')
42
46
  });
47
+ if (data.options?.enableTypeScript) {
48
+ const id = data.app?.id?.split('.').join('/');
49
+ fs.copyTpl(tsConfigPath, (0, path_1.join)(projectPath, 'tsconfig.json'), { id, typesPackage }, undefined, {
50
+ globOptions: { dot: true }
51
+ });
52
+ }
43
53
  }
44
54
  catch (e) {
45
55
  throw new Error(`Could not write template files to folder. Reason: ${e.message}`);
@@ -59,11 +69,10 @@ async function writeUI5Yaml(projectPath, data, fs) {
59
69
  const baseUi5ConfigContent = fs.read(ui5ConfigPath);
60
70
  const ui5Config = await ui5_config_1.UI5Config.newInstance(baseUi5ConfigContent);
61
71
  ui5Config.setConfiguration({ propertiesFileSourceEncoding: 'UTF-8' });
62
- (0, options_1.enhanceUI5YamlWithCustomConfig)(ui5Config, data?.customConfig);
72
+ (0, options_1.enhanceUI5YamlWithCustomConfig)(ui5Config, data);
73
+ (0, options_1.enhanceUI5YamlWithTranspileMiddleware)(ui5Config, data);
63
74
  (0, options_1.enhanceUI5Yaml)(ui5Config, data);
64
- if (data.customConfig?.adp?.environment === 'C') {
65
- (0, options_1.enhanceUI5YamlWithCustomTask)(ui5Config, data);
66
- }
75
+ (0, options_1.enhanceUI5YamlWithCustomTask)(ui5Config, data);
67
76
  fs.write(ui5ConfigPath, ui5Config.toString());
68
77
  }
69
78
  catch (e) {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aadp-tooling"
11
11
  },
12
- "version": "0.12.138",
12
+ "version": "0.13.0",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -41,6 +41,7 @@
41
41
  "@sap-ux/system-access": "0.5.31",
42
42
  "@sap-ux/ui5-config": "0.26.2",
43
43
  "@sap-ux/odata-service-writer": "0.26.3",
44
+ "@sap-ux/nodejs-utils": "0.1.7",
44
45
  "@sap-ux/i18n": "0.2.1"
45
46
  },
46
47
  "devDependencies": {
@@ -58,6 +59,7 @@
58
59
  "nock": "13.4.0",
59
60
  "rimraf": "5.0.5",
60
61
  "supertest": "6.3.3",
62
+ "cross-env": "^7.0.3",
61
63
  "@sap-ux/store": "1.0.0"
62
64
  },
63
65
  "engines": {
@@ -70,8 +72,8 @@
70
72
  "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
71
73
  "lint": "eslint . --ext .ts",
72
74
  "lint:fix": "eslint . --ext .ts --fix",
73
- "test": "jest FIORI_TOOLS_DISABLE_SECURE_STORE=true --ci --forceExit --detectOpenHandles --colors --testPathPattern=test/unit",
74
- "test-u": "jest FIORI_TOOLS_DISABLE_SECURE_STORE=true --ci --forceExit --detectOpenHandles --colors -u",
75
+ "test": "cross-env FIORI_TOOLS_DISABLE_SECURE_STORE=true jest --ci --forceExit --detectOpenHandles --colors --testPathPattern=test/unit",
76
+ "test-u": "cross-env FIORI_TOOLS_DISABLE_SECURE_STORE=true jest --ci --forceExit --detectOpenHandles --colors -u",
75
77
  "link": "pnpm link --global",
76
78
  "unlink": "pnpm unlink --global"
77
79
  }
@@ -15,7 +15,10 @@
15
15
  "@sap-ux/ui5-proxy-middleware": "^1.3.0",
16
16
  "@sap-ux/deploy-tooling": "^0.11.7"<%}%>,
17
17
  "@ui5/task-adaptation": "^1.3.0",
18
- "@ui5/cli": "^3.9.2"
18
+ "@ui5/cli": "^3.9.2"<%if (locals.options?.enableTypeScript) {%>,
19
+ "<%- typesPackage %>": "<%- typesVersion %>",
20
+ "typescript": "^5.7.3",
21
+ "ui5-tooling-transpile": "^3.6.1"<%}%>
19
22
  },
20
23
  "scripts": {
21
24
  "build": "ui5 build --exclude-task generateFlexChangesBundle generateComponentPreload minify --clean-dest",
@@ -8,7 +8,7 @@ sap.ui.define(
8
8
  // ,OverrideExecution
9
9
  ) {
10
10
  'use strict';
11
- return ControllerExtension.extend("<%= controllerExtPath %>", {
11
+ return ControllerExtension.extend("<%= extensionPath %>", {
12
12
  // metadata: {
13
13
  // // extension can declare the public methods
14
14
  // // in general methods that start with "_" are private
@@ -47,27 +47,27 @@ sap.ui.define(
47
47
  // /**
48
48
  // * Called when a controller is instantiated and its View controls (if available) are already created.
49
49
  // * Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
50
- // * @memberOf {{controllerExtPath}}
50
+ // * @memberOf <%= extensionPath %>
51
51
  // */
52
52
  // onInit: function() {
53
53
  // },
54
54
  // /**
55
55
  // * Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
56
56
  // * (NOT before the first rendering! onInit() is used for that one!).
57
- // * @memberOf {{controllerExtPath}}
57
+ // * @memberOf <%= extensionPath %>
58
58
  // */
59
59
  // onBeforeRendering: function() {
60
60
  // },
61
61
  // /**
62
62
  // * Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here.
63
63
  // * This hook is the same one that SAPUI5 controls get after being rendered.
64
- // * @memberOf {{controllerExtPath}}
64
+ // * @memberOf <%= extensionPath %>
65
65
  // */
66
66
  // onAfterRendering: function() {
67
67
  // },
68
68
  // /**
69
69
  // * Called when the Controller is destroyed. Use this one to free resources and finalize activities.
70
- // * @memberOf {{controllerExtPath}}
70
+ // * @memberOf <%= extensionPath %>
71
71
  // */
72
72
  // onExit: function() {
73
73
  // },
@@ -0,0 +1,18 @@
1
+ import ControllerExtension from "sap/ui/core/mvc/ControllerExtension";
2
+
3
+ /**
4
+ * @namespace <%= ns %>
5
+ * @controller
6
+ */
7
+ export default class <%= name %> extends ControllerExtension {
8
+ overrides = {
9
+ /**
10
+ * Called when a controller is instantiated and its View controls (if available) are already created.
11
+ * Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
12
+ * @memberOf <%= ns %>.<%= name %>
13
+ */
14
+ onInit: () => {
15
+ const view = this.getView();
16
+ },
17
+ };
18
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "module": "es2022",
5
+ "moduleResolution": "node",
6
+ "skipLibCheck": true,
7
+ "allowJs": true,
8
+ "strict": true,
9
+ "strictPropertyInitialization": false,
10
+ "rootDir": "./",
11
+ "outDir": "./dist",
12
+ "baseUrl": "./",
13
+ "typeRoots": ["./node_modules/@types", "./node_modules/<%- typesPackage %>"],
14
+ "paths": {
15
+ "<%= id %>/*": ["./webapp/*"]
16
+ }
17
+ },
18
+ "include": ["./webapp/**/*"]
19
+ }