jsii-release 0.2.736 → 0.2.737
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/bin/publib-npm +10 -40
- package/package.json +1 -1
- package/package.json.bak +1 -1
package/README.md
CHANGED
|
@@ -76,8 +76,6 @@ npx publib-npm [DIR]
|
|
|
76
76
|
|`AWS_SECRET_ACCESS_KEY`|Optional|Secret access key that belongs to the AWS access key.|
|
|
77
77
|
|`AWS_ROLE_TO_ASSUME`|Optional|If AWS CodeArtifact is used as registry, an AWS role ARN to assume before authorizing.|
|
|
78
78
|
|`DISABLE_HTTPS`|Optional|Connect to the registry with HTTP instead of HTTPS (defaults to false).|
|
|
79
|
-
|`NPM_DRYRUN`|Optional| Set to "true" for a dry run.|
|
|
80
|
-
|`NPM_AUTH_TYPE`|Optional| Can be "authToken" (default) or "auth" depending on the type of NPM_TOKEN used for the NPM_REGISTRY.|
|
|
81
79
|
|
|
82
80
|
## Maven
|
|
83
81
|
|
package/bin/publib-npm
CHANGED
|
@@ -11,8 +11,6 @@ set -eu
|
|
|
11
11
|
#
|
|
12
12
|
# NPM_TOKEN (optional): registry authentication token (either from npmjs or a GitHub personal access token), not used for AWS CodeArtifact
|
|
13
13
|
# NPM_REGISTRY (optional): the registry URL (defaults to "registry.npmjs.org")
|
|
14
|
-
# NPM_DRYRUN (optional): Set to "true" for a dry run
|
|
15
|
-
# NPM_AUTH_TYPE (optional): Can be "authToken" (default) or "auth" depending on the type of NPM_TOKEN used for the NPM_REGISTRY
|
|
16
14
|
# AWS_ACCESS_KEY_ID (optional): If AWS CodeArtifact is used as registry, an AWS access key can be spedified.
|
|
17
15
|
# AWS_SECRET_ACCESS_KEY (optional): Secret access key that belongs to the AWS access key.
|
|
18
16
|
# AWS_ROLE_TO_ASSUME (optional): If AWS CodeArtifact is used as registry and need to assume role.
|
|
@@ -22,12 +20,13 @@ set -eu
|
|
|
22
20
|
|
|
23
21
|
dir="${1:-"dist/js"}"
|
|
24
22
|
|
|
23
|
+
|
|
25
24
|
if ! [ -z "${NPM_REGISTRY:-}" ] && [[ $NPM_REGISTRY =~ .codeartifact.*.amazonaws.com ]]; then
|
|
26
25
|
codeartifact_account="$(echo $NPM_REGISTRY | cut -d. -f1 | rev | cut -d- -f1 | rev)"
|
|
27
26
|
codeartifact_subdomain="$(echo $NPM_REGISTRY | cut -d. -f1)"
|
|
28
27
|
codeartifact_domain="$(echo $codeartifact_subdomain | cut -b -$((${#codeartifact_subdomain}-${#codeartifact_account}-1)))"
|
|
29
28
|
codeartifact_region="$(echo $NPM_REGISTRY | cut -d. -f4)"
|
|
30
|
-
export AWS_DEFAULT_REGION="$(echo $codeartifact_region)"
|
|
29
|
+
export AWS_DEFAULT_REGION="$(echo $codeartifact_region)"
|
|
31
30
|
if [ -n "${AWS_ROLE_TO_ASSUME:-}" ]; then
|
|
32
31
|
credentials=`aws sts assume-role --role-session-name "publib-code-artifact" --role-arn ${AWS_ROLE_TO_ASSUME} --output text | sed -n '2 p'`
|
|
33
32
|
export AWS_ACCESS_KEY_ID="$(echo $credentials | cut -d' ' -f2)"
|
|
@@ -40,6 +39,9 @@ elif [ -z "${NPM_TOKEN:-}" ]; then
|
|
|
40
39
|
exit 1
|
|
41
40
|
fi
|
|
42
41
|
|
|
42
|
+
NPM_REGISTRY=${NPM_REGISTRY:-"registry.npmjs.org"}
|
|
43
|
+
echo "//${NPM_REGISTRY%%/}/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
44
|
+
|
|
43
45
|
# this overrides any registry configuration defined externally. For example, yarn sets the registry to the yarn proxy
|
|
44
46
|
# which requires `yarn login`. but since we are logging in through ~/.npmrc, we must make sure we publish directly to npm.
|
|
45
47
|
if ! [ -z "${DISABLE_HTTPS:-}" ]; then
|
|
@@ -55,12 +57,6 @@ if [ -n "${NPM_DIST_TAG:-}" ]; then
|
|
|
55
57
|
echo "Publishing under the following dist-tag: ${NPM_DIST_TAG}"
|
|
56
58
|
fi
|
|
57
59
|
|
|
58
|
-
dry=""
|
|
59
|
-
if [ -n "${NPM_DRYRUN:-}" ]; then
|
|
60
|
-
dry="--dry-run"
|
|
61
|
-
echo "Attempting to dry run publish"
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
60
|
# access level
|
|
65
61
|
access=""
|
|
66
62
|
if [ -n "${NPM_ACCESS_LEVEL:-}" ]; then
|
|
@@ -73,55 +69,29 @@ if [ -n "${NPM_ACCESS_LEVEL:-}" ]; then
|
|
|
73
69
|
echo "Publishing package with access level: ${NPM_ACCESS_LEVEL}"
|
|
74
70
|
fi
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
NPM_AUTH_TYPE="${NPM_AUTH_TYPE:-authToken}"
|
|
78
|
-
if [[ "$NPM_AUTH_TYPE" != "auth" && "$NPM_AUTH_TYPE" != "authToken" ]]; then
|
|
79
|
-
echo "Error: Invalid value for NPM_AUTH_TYPE. Allowed options are 'auth' or 'authToken'."
|
|
80
|
-
exit 1
|
|
81
|
-
fi
|
|
82
|
-
|
|
83
|
-
temp_dir=$(mktemp -d)
|
|
84
|
-
cwd=$(pwd)
|
|
85
|
-
log=$temp_dir/npmlog.txt
|
|
86
|
-
|
|
87
|
-
NPM_REGISTRY=${NPM_REGISTRY:-"registry.npmjs.org"}
|
|
88
|
-
registry_without_protocol="${NPM_REGISTRY#*://}"
|
|
89
|
-
echo "//${registry_without_protocol%%/}/:_$NPM_AUTH_TYPE=$NPM_TOKEN" > "$temp_dir/.npmrc"
|
|
90
|
-
|
|
91
|
-
# move into temporary directory to use generated npmrc file
|
|
92
|
-
cd "$temp_dir"
|
|
72
|
+
log=$(mktemp -d)/npmlog.txt
|
|
93
73
|
|
|
94
|
-
for file in
|
|
95
|
-
npm publish ${tag} ${access} ${file}
|
|
74
|
+
for file in ${dir}/**.tgz; do
|
|
75
|
+
npm publish ${tag} ${access} ${file} 2>&1 | tee ${log}
|
|
96
76
|
exit_code="${PIPESTATUS[0]}"
|
|
97
77
|
|
|
98
78
|
if [ ${exit_code} -ne 0 ]; then
|
|
99
79
|
|
|
100
80
|
# error returned from npmjs
|
|
101
|
-
if grep -q "You cannot publish over the previously published versions"
|
|
81
|
+
if cat ${log} | grep -q "You cannot publish over the previously published versions"; then
|
|
102
82
|
echo "SKIPPING: already published"
|
|
103
83
|
continue
|
|
104
84
|
fi
|
|
105
85
|
|
|
106
86
|
# error returned from github packages
|
|
107
|
-
if grep -q "Cannot publish over existing version"
|
|
87
|
+
if cat ${log} | grep -q "Cannot publish over existing version"; then
|
|
108
88
|
echo "SKIPPING: already published"
|
|
109
89
|
continue
|
|
110
90
|
fi
|
|
111
91
|
|
|
112
|
-
rm "$temp_dir/.npmrc"
|
|
113
|
-
|
|
114
92
|
echo "ERROR"
|
|
115
93
|
exit 1
|
|
116
94
|
fi
|
|
117
95
|
done
|
|
118
96
|
|
|
119
|
-
# move back to original working directory
|
|
120
|
-
cd "$cwd"
|
|
121
|
-
|
|
122
|
-
# clean up temp files and folder
|
|
123
|
-
rm "$log"
|
|
124
|
-
rm "$temp_dir/.npmrc"
|
|
125
|
-
rm -d "$temp_dir"
|
|
126
|
-
|
|
127
97
|
echo "SUCCESS"
|
package/package.json
CHANGED
package/package.json.bak
CHANGED