Skip to content

Commit 85866ff

Browse files
authored
chore: add verdaccio local release (#1308)
* chore: add verdaccio local release * chore: local publish with "ci" dist tag
1 parent 8a6e304 commit 85866ff

File tree

5 files changed

+1004
-79
lines changed

5 files changed

+1004
-79
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ codegen/sdk-codegen/smithy-build.json
4040
protocol_tests/*/coverage
4141
protocol_tests/*/dist
4242
protocol_tests/*/types
43+
44+
/verdaccio/*
45+
!/verdaccio/config.yaml

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"test:functional": "jest --config tests/functional/jest.config.js --passWithNoTests",
2020
"test:integration-legacy": "cucumber-js --fail-fast",
2121
"test:integration": "jest --config jest.config.integ.js --passWithNoTests",
22-
"test:protocols": "yarn build:protocols && lerna run test --scope '@aws-sdk/aws-*'"
22+
"test:protocols": "yarn build:protocols && lerna run test --scope '@aws-sdk/aws-*'",
23+
"local-publish": "node ./scripts/verdaccio-publish/index.js"
2324
},
2425
"repository": {
2526
"type": "git",
@@ -70,6 +71,7 @@
7071
"typescript": "~3.8.3",
7172
"webpack": "^4.43.0",
7273
"webpack-cli": "^3.3.12",
74+
"verdaccio": "^4.7.2",
7375
"yarn": "1.22.4"
7476
},
7577
"workspaces": {

scripts/verdaccio-publish/index.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env node
2+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
3+
4+
// Reference: https://github.com/aws/aws-encryption-sdk-javascript/pull/276
5+
6+
const { spawn, execSync } = require("child_process");
7+
const pipeStdIo = { stdio: [process.stdin, process.stdout, process.stderr] };
8+
9+
execSync("rm -rf verdaccio/storage/@aws-sdk");
10+
11+
// Start verdaccio in the background
12+
const verdaccio = spawn(
13+
"npx",
14+
["verdaccio", "-c", "verdaccio/config.yaml"],
15+
pipeStdIo
16+
).on("error", e => {
17+
throw e;
18+
});
19+
20+
// Publish all changed packages the local verdaccio server.
21+
// Anything that has not been changed will match what is in npm
22+
const args = [
23+
"lerna",
24+
"publish",
25+
"prerelease",
26+
"--preid",
27+
"ci",
28+
"--exact",
29+
"--registry",
30+
"http://localhost:4873/",
31+
"--yes",
32+
"--no-changelog",
33+
"--no-git-tag-version",
34+
"--no-push",
35+
"--no-git-reset",
36+
"--ignore-scripts",
37+
"--no-verify-access",
38+
"--dist-tag",
39+
"ci"
40+
];
41+
spawn("npx", args, pipeStdIo).on("close", code => {
42+
// Rollback the changes caused by the version bumping
43+
execSync("git checkout -- clients/*/package.json");
44+
execSync("git checkout -- packages/*/package.json");
45+
execSync("git checkout -- protocol_tests/*/package.json");
46+
47+
// Kill the background verdaccio server
48+
verdaccio.kill();
49+
if (code !== 0) throw Error(`Exit code: ${code}`);
50+
});

verdaccio/config.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#
2+
# This is the default config file. It allows all users to do anything,
3+
# so don't use it on production systems.
4+
#
5+
# Look here for more config file examples:
6+
# https://github.com/verdaccio/verdaccio/tree/master/conf
7+
#
8+
9+
# path to a directory with all packages
10+
storage: ./storage
11+
# path to a directory with plugins to include
12+
plugins: ./plugins
13+
14+
web:
15+
title: Verdaccio
16+
# comment out to disable gravatar support
17+
# gravatar: false
18+
# by default packages are ordercer ascendant (asc|desc)
19+
# sort_packages: asc
20+
21+
auth:
22+
htpasswd:
23+
file: ./htpasswd
24+
# Maximum amount of users allowed to register, defaults to "+inf".
25+
# You can set this to -1 to disable registration.
26+
# max_users: 1000
27+
28+
# a list of other known repositories we can talk to
29+
uplinks:
30+
npmjs:
31+
url: https://registry.npmjs.org/
32+
33+
packages:
34+
"@aws-sdk/*":
35+
# scoped packages
36+
access: $all
37+
publish: $all
38+
unpublish: $all
39+
proxy: npmjs
40+
"@*/*":
41+
# scoped packages
42+
access: $all
43+
publish: $authenticated
44+
unpublish: $authenticated
45+
proxy: npmjs
46+
47+
"**":
48+
# allow all users (including non-authenticated users) to read and
49+
# publish all packages
50+
#
51+
# you can specify usernames/groupnames (depending on your auth plugin)
52+
# and three keywords: "$all", "$anonymous", "$authenticated"
53+
access: $all
54+
55+
# allow all known users to publish/publish packages
56+
# (anyone can register by default, remember?)
57+
publish: $authenticated
58+
unpublish: $authenticated
59+
60+
# if package is not available locally, proxy requests to 'npmjs' registry
61+
proxy: npmjs
62+
63+
# You can specify HTTP/1.1 server keep alive timeout in seconds for incomming connections.
64+
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
65+
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enought.
66+
server:
67+
keepAliveTimeout: 60
68+
69+
middlewares:
70+
audit:
71+
enabled: true
72+
73+
# log settings
74+
logs:
75+
- { type: stdout, format: pretty, level: http }
76+
#- {type: file, path: verdaccio.log, level: info}

0 commit comments

Comments
 (0)