File tree 8 files changed +109
-0
lines changed
devcontainer-features/npm-playwright
8 files changed +109
-0
lines changed Original file line number Diff line number Diff line change
1
+ # npm-playwright devcontainer feature
2
+
3
+ This feature will be install playwright via npm with os dependencies and browser binaries
4
+
5
+ ## Example Usage
6
+
7
+ Install latest version
8
+
9
+ ``` json
10
+ "features" : {
11
+ "ghcr.io/ebizbase/devcontainer-features/npm-playwright:1" : {}
12
+ }
13
+ ```
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " npm-playwright" ,
3
+ "$schema" : " ../../node_modules/nx/schemas/project-schema.json" ,
4
+ "sourceRoot" : " devcontainer-features/npm-playwright/src" ,
5
+ "projectType" : " application" ,
6
+ "tags" : [],
7
+ "targets" : {
8
+ "test" : {
9
+ "executor" : " @ebizbase/nx-internal:test-devcontainer-feature"
10
+ },
11
+ "publish" : {
12
+ "executor" : " @ebizbase/nx-internal:publish-devcontainer-feature"
13
+ }
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "id" : " npm-playwright" ,
3
+ "version" : " 0.0.0" ,
4
+ "name" : " Playwright (via npm)" ,
5
+ "description" : " Install playwright via npm with os dependencies and browser binaries" ,
6
+ "documentationURL" : " https://github.com/ebizbase/dev-infras/tree/main/devcontainer-features/npm-playwright/README.md" ,
7
+ "options" : {
8
+ "debug" : {
9
+ "type" : " boolean" ,
10
+ "default" : false ,
11
+ "description" : " Enable debug mode (Internal use)"
12
+ }
13
+ },
14
+ "dependsOn" : {
15
+ "ghcr.io/devcontainers/features/common-utils" : {},
16
+ "ghcr.io/devcontainers/features/node" : {}
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -e
3
+
4
+ DEBUG=${DEBUG:- false}
5
+
6
+ debug () {
7
+ if [[ ${DEBUG} == true ]]; then
8
+ echo " $1 " >> /tmp/npm-playwright.log
9
+ fi
10
+ }
11
+
12
+ if [[ -n ${_REMOTE_USER_HOME} ]]; then
13
+ USER_HOME=" ${_REMOTE_USER_HOME} "
14
+ elif [[ ${_REMOTE_USER} == " root" ]]; then
15
+ USER_HOME=" /root"
16
+ # Check if user already has a home directory other than /home/${USERNAME}
17
+ elif [[ " /home/${_REMOTE_USER} " != $( getent passwd " ${_REMOTE_USER} " | cut -d: -f6) ]]; then
18
+ USER_HOME=$( getent passwd " ${_REMOTE_USER} " | cut -d: -f6)
19
+ else
20
+ USER_HOME=" /home/${_REMOTE_USER} "
21
+ fi
22
+
23
+ debug " ==============================="
24
+ debug " REMOTE_USER: ${_REMOTE_USER} "
25
+ debug " USER_GROUP: ${_REMOTE_USER} "
26
+ debug " USER_HOME: ${USER_HOME} "
27
+ debug " ==============================="
28
+
29
+ PLAYWRIGHT_BROWSERS_PATH=" ${USER_HOME} /.cache/ms-playwright" npx --yes playwright install --with-deps
30
+ chown -R ${_REMOTE_USER} :${_REMOTE_USER} " ${USER_HOME} /.cache"
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ source dev-container-features-test-lib
6
+
7
+ check " LOG" cat /tmp/npm-playwright.log
8
+ check " Should have os dependencies" dpkg -l | grep xserver-common && dpkg -l | grep x11-common && dpkg -l | grep xvfb
9
+ check " Should browser binary avaiable in cache directory" ls -al /home/vscode/.cache/ms-playwright
10
+
11
+ reportResults
Original file line number Diff line number Diff line change
1
+ {
2
+ "default" : {
3
+ "image" : " mcr.microsoft.com/devcontainers/base:ubuntu" ,
4
+ "remoteUser" : " vscode" ,
5
+ "features" : {
6
+ "npm-playwright" : {
7
+ "debug" : true
8
+ }
9
+ }
10
+ }
11
+ }
Original file line number Diff line number Diff line change 47
47
}
48
48
]
49
49
},
50
+ "devcontainer-features/npm-playwright" : {
51
+ "package-name" : " npm-playwright" ,
52
+ "extra-files" : [
53
+ {
54
+ "type" : " json" ,
55
+ "path" : " src/npm-playwright/devcontainer-feature.json" ,
56
+ "jsonpath" : " $.version"
57
+ }
58
+ ]
59
+ },
50
60
"devcontainer-images/base-devcontainer" : {
51
61
"release-type" : " node" ,
52
62
"extra-files" : [
Original file line number Diff line number Diff line change 6
6
"devcontainer-features/powerlevel10k" : " 1.0.0" ,
7
7
"devcontainer-features/omz-plugin" : " 1.0.0" ,
8
8
"devcontainer-features/install-npm-package-globally" : " 1.0.0" ,
9
+ "devcontainer-features/npm-playwright" : " 1.0.0" ,
9
10
"devcontainer-images/base-devcontainer" : " 1.0.0" ,
10
11
"devcontainer-images/node-devcontainer" : " 1.0.0" ,
11
12
"devcontainer-images/nx-devcontainer" : " 0.0.0" ,
You can’t perform that action at this time.
0 commit comments