Skip to content

Commit 952e72a

Browse files
committed
Merge remote-tracking branch 'origin/main' into hana-tms
2 parents b1da4f8 + b5e46e7 commit 952e72a

File tree

38 files changed

+898
-329
lines changed

38 files changed

+898
-329
lines changed

.github/eslint-plugin/index.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/usr/bin/env node
2+
3+
// eslint plugin rule utility
4+
// ============================
5+
// node index.js generate-menu
6+
// generates the _menu.md file to make sure all rules are included.
7+
// node index.js generate-js-stub <rule-name>
8+
// generates a stub markdown file for a new JS rule with name <rule-name>.
9+
10+
import * as fs from 'node:fs'
11+
import * as path from 'node:path'
12+
13+
const RULES_BASE_PATH = path.join('tools', 'cds-lint', 'rules');
14+
const EXAMPLES_BASE_PATH = path.join('tools', 'cds-lint', 'examples');
15+
const MENU_FILE_NAME = '_menu.md';
16+
17+
/**
18+
* Get a list of all rule description files.
19+
* @returns {string[]} An array of rule description file names.
20+
*/
21+
const getRuleDescriptionFiles = () =>
22+
fs.readdirSync(RULES_BASE_PATH)
23+
.filter(file => file.endsWith('.md'))
24+
.filter(file => !['index.md', MENU_FILE_NAME].includes(file))
25+
.sort()
26+
27+
/**
28+
* Generates the menu markdown file
29+
* by completely overriding its current contents.
30+
* The menu contains links to all rule description files
31+
* in alphabetical order.
32+
*/
33+
function generateMenuMarkdown () {
34+
const rules = getRuleDescriptionFiles();
35+
const menu = rules.map(rule => {
36+
const clean = rule.replace('.md', '');
37+
return `# [${clean}](${clean})`
38+
}).join('\n');
39+
const menuFilePath = path.join(RULES_BASE_PATH, '_menu.md')
40+
fs.writeFileSync(menuFilePath, menu);
41+
console.info(`generated menu to ${menuFilePath}`)
42+
}
43+
44+
/**
45+
* Generates a stub markdown file for a new JS rule.
46+
* The passed ruleName will be placed in the stub template
47+
* where $RULE_NAME is defined.
48+
* @param {string} ruleName - The name of the rule.
49+
*/
50+
function generateJsRuleStub (ruleName) {
51+
if (!ruleName) {
52+
console.error('Please provide a rule name, e.g. "no-shared-handler-variables" as second argument');
53+
process.exit(1);
54+
}
55+
const stubFilePath = path.join(RULES_BASE_PATH, ruleName + '.md');
56+
if (fs.existsSync(stubFilePath)) {
57+
console.error(`file ${stubFilePath} already exists, will not overwrite`);
58+
process.exit(2);
59+
}
60+
const stub = fs.readFileSync(path.join(import.meta.dirname, 'js-rule-stub.md'), 'utf-8').replaceAll('$RULE_NAME', ruleName);
61+
fs.writeFileSync(stubFilePath, stub);
62+
console.info(`generated stub to ${stubFilePath}`);
63+
const correctPath = path.join(EXAMPLES_BASE_PATH, ruleName, 'correct', 'srv');
64+
fs.mkdirSync(correctPath, { recursive: true });
65+
const incorrectPath = path.join(EXAMPLES_BASE_PATH, ruleName, 'incorrect', 'srv');
66+
fs.mkdirSync(incorrectPath, { recursive: true });
67+
console.info(`generated example directories in ${path.join(EXAMPLES_BASE_PATH, ruleName)}`);
68+
fs.writeFileSync(path.join(correctPath, 'admin-service.js'), '// correct example\n');
69+
fs.writeFileSync(path.join(incorrectPath, 'admin-service.js'), '// incorrect example\n');
70+
}
71+
72+
function main (argv) {
73+
switch (argv[0]) {
74+
case 'generate-menu':
75+
generateMenuMarkdown();
76+
break;
77+
case 'generate-js-stub':
78+
generateJsRuleStub(argv[1]);
79+
generateMenuMarkdown();
80+
break;
81+
default:
82+
console.log(`Unknown command: ${argv[0]}. Use one of: generate-menu, generate-stub`);
83+
}
84+
}
85+
86+
main(process.argv.slice(2));
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
status: released
3+
---
4+
5+
<script setup>
6+
import PlaygroundBadge from '../components/PlaygroundBadge.vue'
7+
</script>
8+
9+
# $RULE_NAME
10+
11+
## Rule Details
12+
13+
DETAILS
14+
15+
#### Version
16+
This rule was introduced in `@sap/eslint-plugin-cds x.y.z`.
17+
18+
## Examples
19+
20+
### &nbsp; Correct example
21+
22+
DESCRIPTION OF CORRECT EXAMPLE
23+
24+
::: code-group
25+
<<< ../examples/$RULE_NAME/correct/srv/admin-service.js#snippet{js:line-numbers} [srv/admin-service.js]
26+
:::
27+
<PlaygroundBadge
28+
name="$RULE_NAME"
29+
kind="correct"
30+
:files="['srv/admin-service.js']"
31+
/>
32+
33+
### &nbsp; Incorrect example
34+
35+
DESCRIPTION OF INCORRECT EXAMPLE
36+
37+
::: code-group
38+
<<< ../examples/$RULE_NAME/incorrect/srv/admin-service.js#snippet{js:line-numbers} [srv/admin-service.js]
39+
:::
40+
<PlaygroundBadge
41+
name="$RULE_NAME"
42+
kind="incorrect"
43+
:files="['srv/admin-service.js']"
44+
/>

.vitepress/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ config.rewrites = rewrites
106106
// Add custom capire info to the theme config
107107
config.themeConfig.capire = {
108108
versions: {
109-
java_services: '4.2.0',
110-
java_cds4j: '4.2.0'
109+
java_services: '4.3.1',
110+
java_cds4j: '4.3.0'
111111
},
112112
gotoLinks: []
113113
}

about/index.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,16 @@ Keeping pace with a rapidly changing world of volatile cloud technologies and pl
378378
## What about AI? <UnderConstruction/>
379379

380380
- AI provides tremendous boosts to productivity → for example:
381-
- **Coding Assists** → for example, by [Copilot](https://en.wikipedia.org/wiki/Microsoft_Copilot) in `.cds`, `.js`, even `.md` sources
381+
- **Coding Assists** → for example, by [GitHub Copilot](https://github.com/features/copilot) in `.cds`, `.js`, even `.md` sources
382382
- **Code Analysis** → detecting [bad practices](bad-practices) → guiding to [best practices](best-practices)
383383
- **Code Generation** → for example, for tests, test data, ...
384384
- **Project Scaffolding** → for quick head starts
385-
- **Search & Learning Assists** → like Maui, ...
385+
- **Search & Learning Assists** → like SAP Joule, ...
386386
- But this doesn't replace the need for **Human Intelligence**!
387387
- There's a different between a GPT-generated one-off thesis and long-lived enterprise software, which needs to adapt and scale to new requirements.
388-
- **CAP itself** is a major contribution to AI → its simple, clear concepts, uniform ways to implement and consume services, capire, its openness and visibility in the public world, ...
388+
389+
By **embracing and advocating standard tooling** like VS Code and GitHub Actions, CAP ensures its projects are day-one beneficiaries of new AI features rolled out there.
390+
391+
**CAP itself** is a major contribution to AI → its simple, clear concepts, uniform ways to implement and consume services make it easier for AIs and humans alike to reason about the system.
392+
393+
Its openness and public visibility helped influence the very first AI models — even the original ChatGPT knew some CAP, and its baked-in knowledge of it has since improved dramatically.

0 commit comments

Comments
 (0)