diff --git a/.github/filters.yml b/.github/filters.yml index a01fb41..e078e25 100644 --- a/.github/filters.yml +++ b/.github/filters.yml @@ -24,4 +24,5 @@ talosctl: ./**/talosctl/** terraform: ./**/terraform/** terraform-mcp-server: ./**/terraform-mcp-server/** tflint: ./**/tflint/** +typescript: ./**/typescript/** zensical: ./**/zensical/** diff --git a/src/typescript/NOTES.md b/src/typescript/NOTES.md new file mode 100644 index 0000000..7708901 --- /dev/null +++ b/src/typescript/NOTES.md @@ -0,0 +1,17 @@ + +## OS Support + +This feature is tested against the following OS versions: + +- ubuntu:noble +- debian:12 +- mcr.microsoft.com/devcontainers/base:ubuntu24.04 +- mcr.microsoft.com/devcontainers/base:debian12 + +Versions older than what are listed above are untested and therefore may not support this feature without additional packages. + +## Changelog + +| Version | Notes | +| --- | --- | +| 1.0.0 | Initial release | diff --git a/src/typescript/devcontainer-feature.json b/src/typescript/devcontainer-feature.json new file mode 100644 index 0000000..7f00482 --- /dev/null +++ b/src/typescript/devcontainer-feature.json @@ -0,0 +1,21 @@ +{ + "name": "TypeScript", + "id": "typescript", + "version": "1.0.0", + "description": "TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.", + "documentationURL": "https://www.typescriptlang.org/docs", + "options": { + "version": { + "default": "latest", + "description": "Select the version to install. Anything that is not 'latest' must be in '#.#.#' format.", + "proposals": [ + "latest", + "6.0.3" + ], + "type": "string" + } + }, + "dependsOn": { + "ghcr.io/devcontainers/features/node": {} + } +} \ No newline at end of file diff --git a/src/typescript/install.sh b/src/typescript/install.sh new file mode 100644 index 0000000..664dec2 --- /dev/null +++ b/src/typescript/install.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e + +if ! command -v node > /dev/null 2>&1; then + echo "ERROR: node not found. This feature requires the 'node' devcontainer feature." >&2 + echo "See: https://github.com/devcontainers/features/tree/main/src/node" >&2 + exit 1 +fi + +VERSION="${VERSION:-latest}" +package_name="typescript" + +npm install -g ${package_name}@${VERSION} + +echo "${package_name} feature installation complete!" diff --git a/test/typescript/scenarios.json b/test/typescript/scenarios.json new file mode 100644 index 0000000..a61d024 --- /dev/null +++ b/test/typescript/scenarios.json @@ -0,0 +1,10 @@ +{ + "typescript_version": { + "image": "mcr.microsoft.com/devcontainers/base:debian12", + "features": { + "typescript": { + "version": "5.9.3" + } + } + } +} \ No newline at end of file diff --git a/test/typescript/test.sh b/test/typescript/test.sh new file mode 100644 index 0000000..81928a1 --- /dev/null +++ b/test/typescript/test.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +# Optional: Import test library bundled with the devcontainer CLI +# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib +# Provides the 'check' and 'reportResults' commands. +source dev-container-features-test-lib + +# Feature-specific tests +# The 'check' command comes from the dev-container-features-test-lib. +echo "" +echo "Running as $(whoami)" +check "typescript location" which tsc +check "typescript version" tsc -v + +# Report result +# If any of the checks above exited with a non-zero exit code, the test will fail. +reportResults diff --git a/test/typescript/typescript_version.sh b/test/typescript/typescript_version.sh new file mode 100644 index 0000000..81928a1 --- /dev/null +++ b/test/typescript/typescript_version.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +# Optional: Import test library bundled with the devcontainer CLI +# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib +# Provides the 'check' and 'reportResults' commands. +source dev-container-features-test-lib + +# Feature-specific tests +# The 'check' command comes from the dev-container-features-test-lib. +echo "" +echo "Running as $(whoami)" +check "typescript location" which tsc +check "typescript version" tsc -v + +# Report result +# If any of the checks above exited with a non-zero exit code, the test will fail. +reportResults