File tree Expand file tree Collapse file tree 7 files changed +172
-0
lines changed Expand file tree Collapse file tree 7 files changed +172
-0
lines changed Original file line number Diff line number Diff line change 14
14
features :
15
15
- actionlint
16
16
- google-cloud-cli
17
+ - node
17
18
- postgresql-client
18
19
- shellcheck
19
20
baseImage :
33
34
features :
34
35
- actionlint
35
36
- google-cloud-cli
37
+ - node
36
38
- postgresql-client
37
39
- shellcheck
38
40
continue-on-error : true
Original file line number Diff line number Diff line change
1
+ # node
2
+
3
+ Install [ Node.js] ( https://nodejs.org ) from [ Nodesource's DEB repository] ( https://deb.nodesource.com ) .
4
+
5
+ ## Usage
6
+
7
+ ``` json
8
+ "features" : {
9
+ "ghcr.io/CargoSense/devcontainer-features/node:1" : {}
10
+ }
11
+ ```
12
+
13
+ ## Options
14
+
15
+ | Option ID | Description | Type | Default Value |
16
+ | :----------| :--------------------------------| :-------| :--------------|
17
+ | ` version ` | The Node.js version to install. | string | ` 22 ` |
18
+
19
+ ## OS Support
20
+
21
+ This Feature should work on recent versions of Debian/Ubuntu and Linux distributions using the [ apt] ( https://wiki.debian.org/AptCLI ) management tool.
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " Node.js" ,
3
+ "id" : " node" ,
4
+ "version" : " 1.0.0" ,
5
+ "description" : " Install Node.js from Nodesource's DEB repository." ,
6
+ "options" : {
7
+ "version" : {
8
+ "type" : " string" ,
9
+ "enum" : [
10
+ " 18" ,
11
+ " 20" ,
12
+ " 21" ,
13
+ " 22" ,
14
+ " 23"
15
+ ],
16
+ "default" : " 22" ,
17
+ "description" : " Select or enter a Node.js version."
18
+ }
19
+ },
20
+ "installsAfter" : [
21
+ " ghcr.io/devcontainers/features/common-utils"
22
+ ]
23
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env sh
2
+
3
+ set -e
4
+
5
+ NODE_VERSION=" ${VERSION:- " 22" } "
6
+
7
+ curl_installed=" "
8
+
9
+ if ! type curl > /dev/null 2>&1 ; then
10
+ apt update --yes
11
+ apt install --no-install-recommends --yes curl ca-certificates
12
+
13
+ curl_installed=" true"
14
+ fi
15
+
16
+ curl -fsSL https://deb.nodesource.com/setup_" ${NODE_VERSION} " .x | bash -
17
+
18
+ apt update --yes
19
+ apt install --no-install-recommends --yes nodejs
20
+
21
+ if [ -n " ${curl_installed} " ]; then
22
+ apt purge curl --autoremove --yes
23
+ fi
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # This test file will be executed against an auto-generated devcontainer.json that
4
+ # includes the 'node' Feature with no options.
5
+ #
6
+ # For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md
7
+ #
8
+ # Eg:
9
+ # {
10
+ # "image": "<..some-base-image...>",
11
+ # "features": {
12
+ # "node": {}
13
+ # },
14
+ # "remoteUser": "root"
15
+ # }
16
+ #
17
+ # Thus, the value of all options will fall back to the default value in the
18
+ # Feature's 'devcontainer-feature.json'.
19
+ #
20
+ # These scripts are run as 'root' by default. Although that can be changed
21
+ # with the '--remote-user' flag.
22
+ #
23
+ # This test can be run with the following command:
24
+ #
25
+ # devcontainer features test \
26
+ # --features node \
27
+ # --remote-user root \
28
+ # --skip-scenarios \
29
+ # --base-image mcr.microsoft.com/devcontainers/base:ubuntu \
30
+ # /path/to/this/repo
31
+
32
+ set -e
33
+
34
+ # Optional: Import test library bundled with the devcontainer CLI
35
+ # See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
36
+ # Provides the 'check' and 'reportResults' commands.
37
+ source dev-container-features-test-lib
38
+
39
+ # Feature-specific tests
40
+ # The 'check' command comes from the dev-container-features-test-lib. Syntax is...
41
+ # check <LABEL> <cmd> [args...]
42
+ check " version" bash -c " node --version | grep -E 'v20\..+'"
43
+
44
+ # Report result
45
+ # If any of the checks above exited with a non-zero exit code, the test will fail.
46
+ reportResults
Original file line number Diff line number Diff line change
1
+ {
2
+ "node-20" : {
3
+ "image" : " debian:latest" ,
4
+ "features" : {
5
+ "node" : {
6
+ "version" : " 20"
7
+ }
8
+ }
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # This test file will be executed against an auto-generated devcontainer.json that
4
+ # includes the 'node' Feature with no options.
5
+ #
6
+ # For more information, see: https://github.com/devcontainers/cli/blob/main/docs/features/test.md
7
+ #
8
+ # Eg:
9
+ # {
10
+ # "image": "<..some-base-image...>",
11
+ # "features": {
12
+ # "node": {}
13
+ # },
14
+ # "remoteUser": "root"
15
+ # }
16
+ #
17
+ # Thus, the value of all options will fall back to the default value in the
18
+ # Feature's 'devcontainer-feature.json'.
19
+ #
20
+ # These scripts are run as 'root' by default. Although that can be changed
21
+ # with the '--remote-user' flag.
22
+ #
23
+ # This test can be run with the following command:
24
+ #
25
+ # devcontainer features test \
26
+ # --features node \
27
+ # --remote-user root \
28
+ # --skip-scenarios \
29
+ # --base-image mcr.microsoft.com/devcontainers/base:ubuntu \
30
+ # /path/to/this/repo
31
+
32
+ set -e
33
+
34
+ # Optional: Import test library bundled with the devcontainer CLI
35
+ # See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
36
+ # Provides the 'check' and 'reportResults' commands.
37
+ source dev-container-features-test-lib
38
+
39
+ # Feature-specific tests
40
+ # The 'check' command comes from the dev-container-features-test-lib. Syntax is...
41
+ # check <LABEL> <cmd> [args...]
42
+ check " version" node --version
43
+ check " which node" bash -c " which node | grep /usr/bin/node"
44
+
45
+ # Report result
46
+ # If any of the checks above exited with a non-zero exit code, the test will fail.
47
+ reportResults
You can’t perform that action at this time.
0 commit comments