Skip to content

Commit

Permalink
Merge pull request #20 from The-Nefarious-Developer/typescript
Browse files Browse the repository at this point in the history
sap-cap-typescript-node
  • Loading branch information
NickChecan authored Oct 25, 2024
2 parents ecdd9be + be181eb commit 57b8a64
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
with:
filters: |
sap-cap-javascript-node: ./**/sap-cap-javascript-node/**
sap-cap-typescript-node: ./**/sap-cap-typescript-node/**
test:
needs: [detect-changes]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Ths repository generates the following devcontainer templates:
| Template | Image |
|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| sap-cap-javascript-node | [ghcr.io/the-nefarious-developer/sap-cap-javascript-node:{VERSION}](https://github.com/The-Nefarious-Developer/devcontainer-images/pkgs/container/sap-cap-javascript-node) |
| sap-cap-typescript-node | [ghcr.io/the-nefarious-developer/sap-cap-typescript-node:{VERSION}](https://github.com/The-Nefarious-Developer/devcontainer-images/pkgs/container/sap-cap-typescript-node) |

## Content

Expand Down
22 changes: 22 additions & 0 deletions src/sap-cap-typescript-node/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/The-Nefarious-Developer/devcontainer-templates/tree/main/src/sap-cap-typescript-node
{
"name": "SAP CAP",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "ghcr.io/the-nefarious-developer/sap-cap-typescript-node:${templateOption:imageVariant}"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
4 changes: 4 additions & 0 deletions src/sap-cap-typescript-node/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata.

* **Image**: ghcr.io/the-nefarious-developer/sap-cap-typescript-node:20-bullseye ([source](https://github.com/The-Nefarious-Developer/devcontainer-images))
* **Applies devcontainer.json contents from image**: Yes ([source](https://github.com/The-Nefarious-Developer/devcontainer-images/blob/main/src/sap-cap-typescript-node/.devcontainer/devcontainer.json))
39 changes: 39 additions & 0 deletions src/sap-cap-typescript-node/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"id": "sap-cap-typescript-node",
"version": "1.0.0",
"name": "SAP CAP",
"description": "Develop CAP based projects with Typescript for SAP BTP Cloud Foundry.",
"documentationURL": "https://github.com/The-Nefarious-Developer/devcontainer-templates/tree/main/src/sap-cap-typescript-node",
"publisher": "The Nefarious Developer",
"licenseURL": "https://github.com/The-Nefarious-Developer/devcontainer-templates/blob/main/LICENSE",
"options": {
"imageVariant": {
"type": "string",
"description": "Upstream Node version (use -bookworm, -bullseye variants on local arm64/Apple Silicon):",
"proposals": [
"22-bookworm",
"22-bullseye",
"20-bookworm",
"20-bullseye",
"18-bookworm",
"20-bullseye",
"18-bullseye"
],
"default": "22-bookworm"
}
},
"platforms": [
"Node.js",
"JavaScript",
"TypeScript",
"SAP",
"BTP",
"CloudFoundry"
],
"keywords": [
"SAP",
"CAP",
"BTP",
"CloudFoundry"
]
}
17 changes: 17 additions & 0 deletions test/sap-cap-typescript-node/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
# shellcheck disable=SC1091
source "$(dirname "$0")/../test-utils/harness.sh"

# setup "sap-cap-typescript-node" "22-bookworm"
setup "sap-cap-typescript-node" "$VARIANT"

run_test "Node version is correct" "node -v" "${IMAGE_TAG:0:2}"
run_test "NPM is present" "npm --help" "npm <command>"
run_test "CloudFoundry CLI is present" "cf --version" "cf version 8"
run_test "CAP Development Toolkit is present" "cds version" "@cap-js/asyncapi"
run_test "Typescript is present" "tsc -v" "Version"
run_test "ts-node is present is present" "ts-node -v" "v"
run_test "CAP Typescript Plugin is present" "cds-tsx" ""
run_test "Container defaults to non-root user" "whoami" "node"
run_test "Non-root user is able to sudo" "sudo whoami" "root"

0 comments on commit 57b8a64

Please sign in to comment.