This repository was archived by the owner on Jan 12, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +43
-1
lines changed Expand file tree Collapse file tree 5 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -16,5 +16,6 @@ Prettier is an opinionated code formatter.
16
16
| Options Id | Description | Type | Default Value |
17
17
| -----| -----| -----| -----|
18
18
| version | Select the version to install. | string | latest |
19
+ | plugins | Comma-separated list of prettier plugins to install. | string | |
19
20
20
21
Original file line number Diff line number Diff line change 1
1
{
2
2
"id" : " prettier" ,
3
- "version" : " 1.0 .0" ,
3
+ "version" : " 1.1 .0" ,
4
4
"name" : " Prettier (via npm)" ,
5
5
"documentationURL" : " http://github.com/devcontainers-contrib/features/tree/main/src/prettier" ,
6
6
"description" : " Prettier is an opinionated code formatter." ,
12
12
" latest"
13
13
],
14
14
"type" : " string"
15
+ },
16
+ "plugins" : {
17
+ "default" : " " ,
18
+ "description" : " Comma-separated list of prettier plugins to install." ,
19
+ "type" : " string"
15
20
}
16
21
},
17
22
"installsAfter" : [
Original file line number Diff line number Diff line change @@ -19,6 +19,24 @@ $nanolayer_location \
19
19
--option package=' prettier' --option version=" $VERSION "
20
20
21
21
22
+ PRETTIER_PLUGINS=${PLUGINS:- " " }
23
+
24
+ # Prettier plugins are expected to be installed locally, not globally
25
+ # In particular, VSCode + extensions tend to have issues with this
26
+ if [ -n " ${PRETTIER_PLUGINS} " ]; then
27
+ OIFS=$IFS
28
+ IFS=' ,'
29
+
30
+ for plugin in $PRETTIER_PLUGINS ; do
31
+ if ! npm list ${plugin} > /dev/null; then
32
+ npm install --save-dev prettier ${plugin}
33
+ fi
34
+ done
35
+
36
+ IFS=$OIFS
37
+ fi
38
+
39
+
22
40
23
41
echo ' Done!'
24
42
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 " npm list --parseable --depth 0 | grep prettier-plugin-ini" npm list --parseable --depth 0 | grep " prettier-plugin-ini"
8
+
9
+ reportResults
Original file line number Diff line number Diff line change 4
4
"features" : {
5
5
"prettier" : {}
6
6
}
7
+ },
8
+ "plugin" : {
9
+ "image" : " mcr.microsoft.com/devcontainers/base:debian" ,
10
+ "features" : {
11
+ "prettier" : {
12
+ "version" : " latest" ,
13
+ "plugins" : " prettier-plugin-ini"
14
+ }
15
+ }
7
16
}
8
17
}
You can’t perform that action at this time.
0 commit comments