Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript configuration for Fiori elements apps #1286

Merged
merged 42 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
143fbec
ts config added on app level
c-kobo Nov 12, 2024
134a2e0
ts config continued
c-kobo Nov 12, 2024
6420345
custom section added
c-kobo Nov 12, 2024
aa4b00c
add sustainability fields and custom calculation handler
c-kobo Nov 12, 2024
028609b
controller extension added
c-kobo Nov 12, 2024
4814bf7
controller extension fixed
c-kobo Nov 12, 2024
e2de80e
fix green flight fee calculation
c-kobo Nov 14, 2024
d28171c
package.json and app specific tsconfig.json updated
c-kobo Nov 15, 2024
798fd76
package.json updated
c-kobo Nov 15, 2024
43292ee
small fixes
c-kobo Nov 15, 2024
d4cffa3
package-lock.json updated
c-kobo Nov 18, 2024
597d169
improve green fee calculation
c-kobo Nov 20, 2024
2b4bdbb
Merge remote-tracking branch 'origin/main' into typescript
c-kobo Nov 20, 2024
8f23fa9
package-lock.json updated
c-kobo Nov 20, 2024
9996b1d
changes from code review pt.1
c-kobo Nov 20, 2024
0597096
package.json updated
c-kobo Nov 20, 2024
994248a
Merge branch 'main' into typescript
chgeo Nov 20, 2024
acb639e
Merge branch 'main' into typescript
chgeo Nov 20, 2024
90af41e
Merge remote-tracking branch 'origin/main' into typescript
c-kobo Nov 26, 2024
4aa950b
package-lock.json updated
c-kobo Nov 26, 2024
7f5daeb
eslint.config.js: ignore app/**/* as it has its own eslintrc rules
c-kobo Nov 26, 2024
521d6f5
Update app/travel_analytics/package.json
c-kobo Nov 26, 2024
a74a984
Update app/travel_processor/package.json
c-kobo Nov 26, 2024
4305a29
fix opa tests pt.1
c-kobo Nov 27, 2024
4324bf9
fix opa tests pt.2
c-kobo Nov 27, 2024
c091a69
fix jest test
c-kobo Nov 28, 2024
e689aa1
Update UI5 core library version to 1.130.2
c-kobo Nov 28, 2024
815edfd
package.json updated
c-kobo Nov 28, 2024
56e6e44
force mocha test exit after successful completion
c-kobo Nov 29, 2024
71c4157
Ignore all .sql files
chgeo Nov 29, 2024
bebc336
Fix csv file
chgeo Nov 29, 2024
5be0146
Fix Java build
chgeo Nov 29, 2024
5dea41c
Use Java 21
chgeo Nov 29, 2024
02d7a98
Fix tsx install, Node 20 instead of 18
chgeo Nov 29, 2024
4f53835
npm up
chgeo Nov 29, 2024
78804ea
Fix java startup in Karama, add logging
chgeo Nov 29, 2024
765dd00
Use ephemeral port for Java
chgeo Nov 29, 2024
818abd1
Use `karma-ui5-transpile` to get TS transpiled
chgeo Nov 29, 2024
d3ab3f2
Remove superfluous test/odata.test.js
chgeo Nov 29, 2024
c0be332
Remove superfluous installs
chgeo Nov 29, 2024
431bba6
Simplify Java build
chgeo Nov 29, 2024
afe7c45
Move Karma stuff
chgeo Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
java-version: [17,20]
java-version: [21]

steps:
- uses: actions/checkout@v4
Expand All @@ -28,17 +28,17 @@ jobs:
java-version: ${{ matrix.java-version }}
distribution: 'sapmachine'

- run: npm ci

- name: Build with Maven
run: mvn -B clean verify

- name: Run integration tests - Manage Travels
working-directory: ./app/travel_processor
run: |
npm ci
npm run test:java -- --ci

- name: Run integration tests - Analyze Bookings
working-directory: ./app/travel_analytics
run: |
npm ci
npm run test:java -- --ci
6 changes: 2 additions & 4 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [22.x, 18.x]
node-version: [22.x, 20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm i @sap/cds-dk typescript tsx
- run: npm i -g @sap/cds-dk typescript tsx
- run: npm ci
- run: npx cds-typer "*"
- run: npm run lint
Expand All @@ -37,13 +37,11 @@ jobs:
- name: Run integration tests - Manage Travels
working-directory: ./app/travel_processor
run: |
npm ci
npm run test:node -- --ci

- name: Run integration tests - Analyze Bookings
working-directory: ./app/travel_analytics
run: |
npm ci
npm run test:node -- --ci

#
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ _out
*.db
connection.properties
default-*.json
schema.sql
*.sql
gen/
node_modules/
target/
Expand Down
4 changes: 4 additions & 0 deletions _i18n/i18n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ ProductPrice=Product Price
ProductID=Product
OverallStatus=Overall Status
GeneralInformation=General Information
GoGreen=Trees-4-Tickets
GreenFee=Green Flight Fee
TreesPlanted=Trees Planted
Sustainability=Sustainability

Booking=Booking
Bookings=Bookings
Expand Down
12 changes: 7 additions & 5 deletions karma-cap-middleware.js → app/.karma/karma-cap-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ function spawnServer(cmd, args, cwd, fnIsReady) {
};

proc.on("close", reject);
proc.stdout.on("data", checkServerReady);
proc.stdout.on("data", (data) => {
process.stdout.write(data.toString())
checkServerReady(data)
});

// clean up sub process
process.on("exit", () => {
if (proc) proc.kill();
if (proc) proc.kill("SIGKILL");
});
});
}
Expand Down Expand Up @@ -52,9 +55,8 @@ async function java() {
if (started) return new URL(`http://localhost:${started.groups.port}`);
};
const serverUrl = await spawnServer(
"mvn",
["spring-boot:run", "-B", "-Dserver.port=0"],
"../../srv",
"mvn", ["spring-boot:run", "-B", "-Dspring-boot.run.jvmArguments=-Dserver.port=0"],
"../..",
isReady
);

Expand Down
34 changes: 34 additions & 0 deletions app/.karma/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const puppeteer = require("puppeteer"),
cap = require("./karma-cap-middleware");

process.env.CHROME_BIN = puppeteer.executablePath();

module.exports = async (config) => {
// start the CAP server (either specify CLI arg --server=node or --server=java)
let capMiddleware;
if (config.server === "node") {
capMiddleware = cap.node();
} else if (config.server === "java") {
capMiddleware = cap.java();
} else {
throw new Error(`Unknown server type: ${config.server}`);
}

config.set({
frameworks: ["ui5"],
preprocessors: {
"webapp/**/*.ts": ["ui5-transpile"],
},
logLevel: "INFO", // log errors only. Change to "DEBUG" for more verbosity
proxies: {
"/base/webapp/": "/",
},
ui5: {
failOnEmptyTestPage: true,
},
plugins: [...config.plugins, await capMiddleware],
middleware: ["cap-proxy"],
browsers: config.ci ? ["ChromeHeadless"] : ["Chrome"],
singleRun: config.ci || config.singleRun || false
});
};
3 changes: 3 additions & 0 deletions app/labels.cds
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ annotate schema.Travel with @title: '{i18n>Travel}' {
Description @title: '{i18n>Description}';
BookingFee @title: '{i18n>BookingFee}' @Measures.ISOCurrency: CurrencyCode_code;
TotalPrice @title: '{i18n>TotalPrice}' @Measures.ISOCurrency: CurrencyCode_code;
GoGreen @title: '{i18n>GoGreen}';
GreenFee @title: '{i18n>GreenFee}' @Measures.ISOCurrency: CurrencyCode_code;
TreesPlanted @title: '{i18n>TreesPlanted}';
TravelStatus @title: '{i18n>TravelStatus}' @Common.Text: TravelStatus.name @Common.TextArrangement: #TextOnly;
to_Customer @title: '{i18n>CustomerID}' @Common.Text: to_Customer.LastName;
to_Agency @title: '{i18n>AgencyID}' @Common.Text: to_Agency.Name;
Expand Down
32 changes: 1 addition & 31 deletions app/travel_analytics/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
const puppeteer = require("puppeteer"),
cap = require("../../karma-cap-middleware");

process.env.CHROME_BIN = puppeteer.executablePath();

module.exports = async (config) => {
// start the CAP server (either specify CLI arg --server=node or --server=java)
let capMiddleware;
if (config.server === "node") {
capMiddleware = cap.node();
} else if (config.server === "java") {
capMiddleware = cap.java();
} else {
throw new Error(`Unknown server type: ${config.server}`);
}

config.set({
frameworks: ["ui5"],
logLevel: "INFO", // log errors only. Change to "DEBUG" for more verbosity
proxies: {
"/base/webapp/": "/",
},
ui5: {
failOnEmptyTestPage: true,
},
plugins: [...config.plugins, await capMiddleware],
middleware: ["cap-proxy"],
browsers: config.ci ? ["ChromeHeadless"] : ["Chrome"],
singleRun: config.ci || config.singleRun || false
});
};
module.exports = require("../.karma/karma.conf.js")
Loading