Skip to content

Commit 2cac036

Browse files
feat: add Cloudsmith registry to benchmarks (vltpkg#68)
Add Cloudsmith (npm.cloudsmith.io) as a fourth registry in the benchmark suite alongside npm, vlt, and AWS CodeArtifact. Backend: - Add Cloudsmith registry config to scripts/registry/common.sh - CLOUDSMITH_REGISTRY env var provides the URL (without protocol) - CLOUDSMITH_AUTH_TOKEN env var provides the auth token - Registry URL is prefixed with 'https:' for npm config - Add Cloudsmith to hyperfine commands in registry-clean.sh and registry-lockfile.sh - Add Cloudsmith to REGISTRY_COLORS in generate-chart.js (#2a6fe1) - Add CLOUDSMITH_REGISTRY and CLOUDSMITH_AUTH_TOKEN secrets to CI - Update bench CLI: AVAILABLE_REGISTRIES, usage text, examples Frontend: - Add 'cloudsmith' to PackageManager union type and all data interfaces - Add Cloudsmith icon component (diamond + circle from official logo) - Add Cloudsmith to icon map, display names ('Cloudsmith' / 'npm.cloudsmith.io') - Add to history data package managers list Co-authored-by: baudbot-agent <baudbot-agent@users.noreply.github.com>
1 parent 3fb2544 commit 2cac036

12 files changed

Lines changed: 65 additions & 6 deletions

File tree

.github/workflows/benchmark.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ jobs:
130130
env:
131131
CODEARTIFACT_AUTH_TOKEN: ${{ steps.aws.outputs.token }}
132132
VLT_REGISTRY_AUTH_TOKEN: ${{ secrets.VLT_REGISTRY_AUTH_TOKEN }}
133+
CLOUDSMITH_REGISTRY: ${{ secrets.CLOUDSMITH_REGISTRY }}
134+
CLOUDSMITH_AUTH_TOKEN: ${{ secrets.CLOUDSMITH_AUTH_TOKEN }}
133135
run: |
134136
./bench run \
135137
--fixtures="${{ matrix.fixture }}" \
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { createLucideIcon } from "lucide-react";
2+
3+
export const Cloudsmith = createLucideIcon("Cloudsmith", [
4+
[
5+
"path",
6+
{
7+
d: "m23.99 10.67v2.67l-10.66 10.66h-2.67l-10.66-10.66v-2.67l10.66-10.66h2.67zm-5.74 1.33c0-3.46-2.80-6.26-6.26-6.26-3.46 0-6.26 2.80-6.26 6.26 0 3.46 2.80 6.26 6.26 6.26 3.46 0 6.26-2.80 6.26-6.26z",
8+
fill: "currentColor",
9+
fillRule: "evenodd",
10+
key: "1",
11+
strokeWidth: "0",
12+
},
13+
],
14+
]);

app/src/components/icons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export * from "./astro.tsx";
1515
export * from "./aws.tsx";
1616
export * from "./berry.tsx";
1717
export * from "./bun.tsx";
18+
export * from "./cloudsmith.tsx";
1819
export * from "./deno.tsx";
1920
export * from "./next.tsx";
2021
export * from "./node.tsx";

app/src/hooks/use-history-data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const PACKAGE_MANAGERS = [
2020
"turbo",
2121
"node",
2222
"aws",
23+
"cloudsmith",
2324
];
2425

2526
interface UseHistoryDataReturn {

app/src/lib/get-icons.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
Aws,
55
Berry,
66
Bun,
7+
Cloudsmith,
78
Deno,
89
Next,
910
Node,
@@ -24,6 +25,7 @@ import type { Fixture, PackageManager } from "@/types/chart-data";
2425
const packageManagerMap: Partial<Record<PackageManager, LucideIcon>> = {
2526
aws: Aws,
2627
bun: Bun,
28+
cloudsmith: Cloudsmith,
2729
deno: Deno,
2830
node: Node,
2931
npm: Npm,

app/src/lib/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,13 @@ export function getPackageManagerDisplayName(
465465
if (packageManager === "vlt") return "registry.vlt.io";
466466
if (packageManager === "aws")
467467
return "codeartifact.us-east-1.amazonaws.com";
468+
if (packageManager === "cloudsmith") return "npm.cloudsmith.io";
468469
}
469470
if (packageManager === "berry") return "yarn (berry)";
470471
if (packageManager === "zpm") return "yarn (zpm)";
471472
if (packageManager === "turbo") return "turborepo";
472473
if (packageManager === "aws") return "AWS CodeArtifact";
474+
if (packageManager === "cloudsmith") return "Cloudsmith";
473475
return packageManager;
474476
}
475477

app/src/types/chart-data.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export type PackageManager =
1010
| "nx"
1111
| "turbo"
1212
| "node"
13-
| "aws";
13+
| "aws"
14+
| "cloudsmith";
1415

1516
export type Fixture =
1617
| "next"
@@ -50,6 +51,7 @@ export interface PackageManagerVersions {
5051
turbo?: string;
5152
node?: string;
5253
aws?: string;
54+
cloudsmith?: string;
5355
}
5456

5557
export interface BaseFixtureResult {
@@ -69,6 +71,7 @@ export interface PackageManagerData {
6971
turbo?: number;
7072
node?: number;
7173
aws?: number;
74+
cloudsmith?: number;
7275

7376
npm_stddev?: number;
7477
yarn_stddev?: number;
@@ -82,6 +85,7 @@ export interface PackageManagerData {
8285
turbo_stddev?: number;
8386
node_stddev?: number;
8487
aws_stddev?: number;
88+
cloudsmith_stddev?: number;
8589

8690
npm_fill?: string;
8791
yarn_fill?: string;
@@ -95,6 +99,7 @@ export interface PackageManagerData {
9599
turbo_fill?: string;
96100
node_fill?: string;
97101
aws_fill?: string;
102+
cloudsmith_fill?: string;
98103

99104
npm_count?: number;
100105
yarn_count?: number;
@@ -108,6 +113,7 @@ export interface PackageManagerData {
108113
turbo_count?: number;
109114
node_count?: number;
110115
aws_count?: number;
116+
cloudsmith_count?: number;
111117

112118
npm_dnf?: boolean;
113119
yarn_dnf?: boolean;
@@ -121,6 +127,7 @@ export interface PackageManagerData {
121127
turbo_dnf?: boolean;
122128
node_dnf?: boolean;
123129
aws_dnf?: boolean;
130+
cloudsmith_dnf?: boolean;
124131
}
125132

126133
export type FixtureResult = BaseFixtureResult & PackageManagerData;
@@ -159,6 +166,7 @@ export interface PackageCountData {
159166
turbo?: PackageCountEntry;
160167
node?: PackageCountEntry;
161168
aws?: PackageCountEntry;
169+
cloudsmith?: PackageCountEntry;
162170
}
163171

164172
export interface PackageCountTableRow {

bench

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ AVAILABLE_REGISTRIES=(
4242
npm
4343
vlt
4444
aws
45+
cloudsmith
4546
)
4647

4748
usage() {
@@ -55,7 +56,7 @@ Usage:
5556
Options:
5657
--fixtures Comma or space-separated fixture names (default: next)
5758
--pms Comma or space-separated package managers (default: all)
58-
--registries Comma-separated registries for registry-* variations (default: npm,vlt,aws)
59+
--registries Comma-separated registries for registry-* variations (default: npm,vlt,aws,cloudsmith)
5960
--variation Comma or space-separated benchmark variations (default: clean)
6061
--runs Hyperfine runs (default: scripts/variations/common.sh default)
6162
--warmup Hyperfine warmup runs (default: scripts/variations/common.sh default)
@@ -76,6 +77,7 @@ Examples:
7677
./bench run --variation=registry-clean --fixtures=next
7778
./bench run --variation=registry-lockfile --registries=npm,vlt
7879
CODEARTIFACT_AUTH_TOKEN=<token> ./bench run --variation=registry-clean --fixtures=next --registries=aws
80+
CLOUDSMITH_REGISTRY=<url> CLOUDSMITH_AUTH_TOKEN=<token> ./bench run --variation=registry-clean --fixtures=next --registries=cloudsmith
7981
./bench chart --fixtures=next --variation=clean
8082
./bench process
8183
EOF
@@ -446,7 +448,7 @@ run_bench() {
446448
if [[ -n "$registries_env" ]]; then
447449
echo " registries: $registries_env"
448450
else
449-
echo " registries: npm,vlt,aws (default)"
451+
echo " registries: npm,vlt,aws,cloudsmith (default)"
450452
fi
451453
fi
452454

scripts/generate-chart.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const REGISTRY_COLORS = {
3939
npm: "#cb0606",
4040
vlt: "#000000",
4141
aws: "#ff9900",
42+
cloudsmith: "#2a6fe1",
4243
};
4344

4445
const parseNumeric = (value) => {

scripts/registry/common.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ BENCH_REGISTRY_VLT_URL="https://registry.vlt.io/npm/"
6363
BENCH_REGISTRY_VLT_URL_NPMRC_KEY="${BENCH_REGISTRY_VLT_URL#http*://}"
6464
BENCH_REGISTRY_AWS_URL="https://vlt-451504312483.d.codeartifact.us-east-1.amazonaws.com/npm/code-artifact-benchmark-test/"
6565
BENCH_REGISTRY_AWS_NPMRC_KEY="${BENCH_REGISTRY_AWS_URL#http*://}"
66+
# Cloudsmith registry URL is injected without the protocol prefix
67+
# (e.g. "//example.com/..."), so we prepend "https:" for the registry config.
68+
# The auth .npmrc key uses the URL as-is (without protocol).
69+
BENCH_REGISTRY_CLOUDSMITH_URL="https:${CLOUDSMITH_REGISTRY:-}"
70+
BENCH_REGISTRY_CLOUDSMITH_NPMRC_KEY="${CLOUDSMITH_REGISTRY#//}"
6671

6772
# Registry setup commands run in hyperfine --prepare (untimed, before each run).
6873
# Auth token is written as a literal placeholder so npm resolves it from env.
@@ -75,6 +80,7 @@ BENCH_SETUP_REGISTRY_NPM="npm config set registry \"$BENCH_REGISTRY_NPM_URL\" --
7580
# will allow sharing a public cache regardless of the authorization header.
7681
BENCH_SETUP_REGISTRY_VLT="npm config set registry \"$BENCH_REGISTRY_VLT_URL\" --location=project && npm config set \"//${BENCH_REGISTRY_VLT_URL_NPMRC_KEY}:_authToken=\\\${VLT_REGISTRY_AUTH_TOKEN}:$(head -c 16 /dev/urandom | xxd -p)_\\\${HYPERFINE_ITERATION}\" --location=project"
7782
BENCH_SETUP_REGISTRY_AWS="npm config set registry \"$BENCH_REGISTRY_AWS_URL\" --location=project && npm config set \"//${BENCH_REGISTRY_AWS_NPMRC_KEY}:_authToken=\\\${CODEARTIFACT_AUTH_TOKEN}\" --location=project"
83+
BENCH_SETUP_REGISTRY_CLOUDSMITH="npm config set registry \"$BENCH_REGISTRY_CLOUDSMITH_URL\" --location=project && npm config set \"//${BENCH_REGISTRY_CLOUDSMITH_NPMRC_KEY}:_authToken=\\\${CLOUDSMITH_AUTH_TOKEN}\" --location=project"
7884

7985
# Registry verification helper runs in hyperfine --conclude (untimed, after each run).
8086
BENCH_VERIFY_REGISTRY="npm config get registry && ((grep -m3 '\"resolved\"' package-lock.json 2>/dev/null | sed 's/^[[:space:]]*//') || echo 'no lockfile yet') && echo ''"
@@ -83,28 +89,32 @@ BENCH_VERIFY_REGISTRY="npm config get registry && ((grep -m3 '\"resolved\"' pack
8389
BENCH_CONCLUDE_NPM="{ $BENCH_VERIFY_REGISTRY; } >> $BENCH_OUTPUT_FOLDER/npm-verify.log 2>&1"
8490
BENCH_CONCLUDE_VLT_REG="{ $BENCH_VERIFY_REGISTRY; } >> $BENCH_OUTPUT_FOLDER/vlt-verify.log 2>&1"
8591
BENCH_CONCLUDE_AWS="{ $BENCH_VERIFY_REGISTRY; } >> $BENCH_OUTPUT_FOLDER/aws-verify.log 2>&1"
92+
BENCH_CONCLUDE_CLOUDSMITH="{ $BENCH_VERIFY_REGISTRY; } >> $BENCH_OUTPUT_FOLDER/cloudsmith-verify.log 2>&1"
8693

8794
# Registry commands are timed and should only run installs.
8895
BENCH_COMMAND_NPM="$BENCH_NPM_INSTALL >> $BENCH_OUTPUT_FOLDER/npm-output-\${HYPERFINE_ITERATION}.log 2>&1"
8996
BENCH_COMMAND_VLT_REG="$BENCH_NPM_INSTALL >> $BENCH_OUTPUT_FOLDER/vlt-output-\${HYPERFINE_ITERATION}.log 2>&1"
9097
BENCH_COMMAND_AWS="$BENCH_NPM_INSTALL >> $BENCH_OUTPUT_FOLDER/aws-output-\${HYPERFINE_ITERATION}.log 2>&1"
98+
BENCH_COMMAND_CLOUDSMITH="$BENCH_NPM_INSTALL >> $BENCH_OUTPUT_FOLDER/cloudsmith-output-\${HYPERFINE_ITERATION}.log 2>&1"
9199

92100
# Registry include flags
93101
# If BENCH_INCLUDE_REGISTRY is not set, default to running all registries.
94102
if [ -z "${BENCH_INCLUDE_REGISTRY:-}" ]; then
95-
BENCH_INCLUDE_REGISTRY="npm,vlt,aws"
103+
BENCH_INCLUDE_REGISTRY="npm,vlt,aws,cloudsmith"
96104
fi
97105

98106
BENCH_INCLUDE_REG_NPM=""
99107
BENCH_INCLUDE_REG_VLT=""
100108
BENCH_INCLUDE_REG_AWS=""
109+
BENCH_INCLUDE_REG_CLOUDSMITH=""
101110

102111
for entry in $(echo "$BENCH_INCLUDE_REGISTRY" | tr ',' '\n'); do
103112
case "$entry" in
104113
"") continue ;;
105114
npm) BENCH_INCLUDE_REG_NPM=1 ;;
106115
vlt) BENCH_INCLUDE_REG_VLT=1 ;;
107116
aws) BENCH_INCLUDE_REG_AWS=1 ;;
117+
cloudsmith) BENCH_INCLUDE_REG_CLOUDSMITH=1 ;;
108118
*)
109119
echo "Error: Unknown registry '$entry' in BENCH_INCLUDE_REGISTRY"
110120
exit 1
@@ -122,6 +132,16 @@ if [ -n "$BENCH_INCLUDE_REG_AWS" ] && [ -z "${CODEARTIFACT_AUTH_TOKEN:-}" ]; the
122132
exit 1
123133
fi
124134

135+
if [ -n "$BENCH_INCLUDE_REG_CLOUDSMITH" ] && [ -z "${CLOUDSMITH_AUTH_TOKEN:-}" ]; then
136+
echo "Error: 'cloudsmith' registry was requested, but CLOUDSMITH_AUTH_TOKEN is not set"
137+
exit 1
138+
fi
139+
140+
if [ -n "$BENCH_INCLUDE_REG_CLOUDSMITH" ] && [ -z "${CLOUDSMITH_REGISTRY:-}" ]; then
141+
echo "Error: 'cloudsmith' registry was requested, but CLOUDSMITH_REGISTRY is not set"
142+
exit 1
143+
fi
144+
125145
echo "Registry benchmarks will run: $BENCH_INCLUDE_REGISTRY"
126146

127147
# Clean up & create the results directory

0 commit comments

Comments
 (0)