Skip to content

Commit 30b35b3

Browse files
authored
Merge branch 'main' into remote-analytics
2 parents b487b02 + c0b53fb commit 30b35b3

File tree

116 files changed

+2939
-3739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2939
-3739
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# This files defines code ownership.
22

33
# General content
4-
* @smahati
5-
# node.js/ @smahati
6-
# java/ @smahati
4+
* @renejeglinsky
5+
node.js/ @smahati
6+
java/ @smahati
77

88
# Infra
99
.github/ @chgeo @swaldmann

.github/cds-snippet-checker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"main": "check-cds-snippets.js",
77
"author": "SAP SE (https://www.sap.com)",
88
"license": "SEE LICENSE IN LICENSE",
9-
"repository": "cap-js/docs",
9+
"repository": "capire/docs",
1010
"homepage": "https://cap.cloud.sap/",
1111
"scripts": {
1212
"check": "node check-cds-snippets.js"

.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+
/>

.github/java-snippet-checker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"main": "check-java-snippets.js",
77
"author": "SAP SE (https://www.sap.com)",
88
"license": "SEE LICENSE IN LICENSE",
9-
"repository": "cap-js/docs",
9+
"repository": "capire/docs",
1010
"homepage": "https://cap.cloud.sap/",
1111
"scripts": {
1212
"check": "node check-java-snippets.js"

.github/workflows/PR-SAP.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ concurrency:
99
group: pr-sap-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1010
cancel-in-progress: true
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
build-sap:
1417
runs-on: ubuntu-latest

.github/workflows/PR.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ concurrency:
88
group: pr-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
99
cancel-in-progress: true
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
build:
1316
runs-on: ubuntu-latest

.vitepress/config.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ const config = defineConfig({
4343
logo: '/cap-logo.svg',
4444
outline: [2,3],
4545
socialLinks: [
46-
{ icon: 'github', link: 'https://github.com/cap-js/docs' }
46+
{ icon: 'github', link: 'https://github.com/capire/docs' }
4747
],
4848
editLink: {
49-
pattern: 'https://github.com/cap-js/docs/edit/main/:path'
49+
pattern: 'https://github.com/capire/docs/edit/main/:path'
5050
},
5151
footer: {
5252
message: `
@@ -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.1.1',
110-
java_cds4j: '4.1.1'
109+
java_services: '4.2.0',
110+
java_cds4j: '4.2.0'
111111
},
112112
gotoLinks: []
113113
}
@@ -200,7 +200,9 @@ import { promises as fs } from 'node:fs'
200200
config.buildEnd = async ({ outDir, site }) => {
201201
const sitemapURL = new URL(siteURL.href)
202202
sitemapURL.pathname = path.join(sitemapURL.pathname, 'sitemap.xml')
203-
await fs.writeFile(path.resolve(outDir, 'robots.txt'), `Sitemap: ${sitemapURL}\n`)
203+
console.debug('✓ writing robots.txt with sitemap URL', sitemapURL.href) // eslint-disable-line no-console
204+
const robots = (await fs.readFile(path.resolve(__dirname, 'robots.txt'))).toString().replace('{{SITEMAP}}', sitemapURL.href)
205+
await fs.writeFile(path.join(outDir, 'robots.txt'), robots)
204206

205207
// disabled by default to avoid online fetches during local build
206208
if (process.env.VITE_CAPIRE_EXTRA_ASSETS) {

.vitepress/robots.txt

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Based on https://www.sap.com/robots.txt
2+
3+
User-agent: *
4+
Disallow: /
5+
6+
# Search Engines
7+
8+
User-agent: Googlebot
9+
Allow: /
10+
11+
User-agent: Googlebot-Image
12+
Allow: /
13+
14+
User-agent: Googlebot-News
15+
Allow: /
16+
17+
User-agent: Googlebot-Video
18+
Allow: /
19+
20+
User-agent: GoogleOther
21+
Allow: /
22+
23+
User-agent: Storebot-Google
24+
Allow: /
25+
26+
User-agent: Bingbot
27+
Allow: /
28+
29+
User-agent: 360Spider
30+
Allow: /
31+
32+
User-agent: Baiduspider
33+
Allow: /
34+
35+
User-agent: coccocbot
36+
Allow: /
37+
38+
User-agent: Daum
39+
Allow: /
40+
41+
User-agent: DuckDuckBot
42+
Allow: /
43+
44+
User-agent: Ecosia_bot
45+
Allow: /
46+
47+
User-agent: MojeekBot
48+
Allow: /
49+
50+
User-agent: Yeti
51+
Allow: /
52+
53+
User-agent: SeznamBot
54+
Allow: /
55+
56+
User-agent: Sogou web spider
57+
Allow: /
58+
59+
User-agent: Yahoo! Slurp
60+
Allow: /
61+
62+
User-agent: YandexAccessibilityBot
63+
Allow: /
64+
65+
User-agent: YandexMobileBot
66+
Allow: /
67+
68+
User-agent: Yandex
69+
Allow: /
70+
71+
# AI and Chat Agents
72+
73+
User-agent: Amazonbot
74+
Allow: /
75+
76+
User-agent: ClaudeBot
77+
Allow: /
78+
79+
User-agent: CCBot
80+
Allow: /
81+
82+
User-agent: Google-Extended
83+
Allow: /
84+
85+
User-agent: FacebookBot
86+
Allow: /
87+
88+
User-agent: MistralAI-User
89+
Allow: /
90+
91+
User-agent: GPTBot
92+
Allow: /
93+
94+
User-agent: ChatGPT-User
95+
Allow: /
96+
97+
User-agent: PerplexityBot
98+
Allow: /
99+
100+
User-agent: Perplexity-User
101+
Allow: /
102+
103+
# Fetcher and other
104+
105+
User-agent: AdsBot-Google
106+
Allow: /
107+
108+
User-agent: AdsBot-Google-Mobile
109+
Allow: /
110+
111+
User-agent: AhrefsBot
112+
Allow: /
113+
114+
User-agent: Google-Safety
115+
Allow: /
116+
117+
User-agent: Mediapartners-Google
118+
Allow: /
119+
120+
User-agent: facebookexternalhit
121+
Allow: /
122+
123+
User-agent: Google-Read-Aloud
124+
Allow: /
125+
126+
User-agent: Hatena
127+
Allow: /
128+
129+
User-agent: linkedinbot
130+
Allow: /
131+
132+
User-agent: Pinterestbot
133+
Allow: /
134+
135+
User-agent: SchemaBot
136+
Allow: /
137+
138+
User-agent: Slackbot-LinkExpanding
139+
Allow: /
140+
141+
User-agent: Telegram
142+
Allow: /
143+
144+
User-agent: Twitterbot
145+
Allow: /
146+
147+
User-agent: SiteAuditBot
148+
Allow: /
149+
150+
User-agent: Chrome-Lighthouse
151+
Allow: /
152+
153+
User-agent: Google-InspectionTool
154+
Allow: /
155+
156+
User-agent: BingPreview
157+
Allow: /
158+
159+
User-agent: archive.org_bot
160+
Allow: /
161+
162+
Sitemap: {{SITEMAP}}

.vitepress/theme/components/WasThisHelpful.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
<p class="more-feedback" v-if="feedbackSelected">
4646
More to say?
47-
<a href="https://github.com/cap-js/docs/issues" target="_blank">
47+
<a href="https://github.com/capire/docs/issues" target="_blank">
4848
Report an issue.
4949
</a>
5050
</p>

0 commit comments

Comments
 (0)