Skip to content

Commit

Permalink
Warm up cache for connectconformance (#1111)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Stamm <[email protected]>
  • Loading branch information
timostamm authored Jun 19, 2024
1 parent 91577ad commit 914fc0f
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ $(BUILD)/connect-web: $(GEN)/connect-web $(BUILD)/connect $(BUILD)/connect-confo
@mkdir -p $(@D)
@touch $(@)

$(BUILD)/connect-conformance: $(GEN)/connect-conformance packages/connect-conformance/tsconfig.json $(shell find packages/connect-conformance/src -name '*.ts')
$(BUILD)/connect-conformance: $(BUILD)/connect $(GEN)/connect-conformance packages/connect-conformance/tsconfig.json $(shell find packages/connect-conformance/src -name '*.ts')
npm run -w packages/connect-conformance clean
npm run -w packages/connect-conformance build
@mkdir -p $(@D)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions packages/connect-conformance/bin/connectconformance

This file was deleted.

19 changes: 19 additions & 0 deletions packages/connect-conformance/bin/connectconformance.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env node

// Copyright 2021-2024 The Connect Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

const { run } = require("../dist/cjs/src/conformance.js");

run();
11 changes: 6 additions & 5 deletions packages/connect-conformance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
"version": "1.4.0",
"private": true,
"type": "module",
"main": "./dist/cjs/index.js",
"main": "./dist/cjs/src/index.js",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
"import": "./dist/esm/src/index.js",
"require": "./dist/cjs/src/index.js"
}
},
"bin": {
"connectconformance": "bin/connectconformance"
"connectconformance": "bin/connectconformance.cjs"
},
"scripts": {
"generate": "buf generate buf.build/connectrpc/conformance:v1.0.2",
"clean": "rm -rf ./dist/*",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"postbuild": "connectconformance --version",
"build:cjs": "tsc --project tsconfig.json --module commonjs --verbatimModuleSyntax false --moduleResolution node10 --outDir ./dist/cjs --declaration --declarationDir ./dist/cjs && echo >./dist/cjs/src/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.json --outDir ./dist/esm --declaration --declarationDir ./dist/esm"
},
"dependencies": {
Expand Down
7 changes: 5 additions & 2 deletions packages/connect-conformance/src/conformance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ import { pipeline } from "node:stream/promises";
import { Readable } from "node:stream";
import { execFileSync } from "node:child_process";
import { fetch } from "undici";
import { scripts } from "../package.json";

// Note: if changing this version, the `generate` command inside package.json must also be changed to match.
const version = "v1.0.2";
// Extract conformance runner version from the `generate` script
const [, version] = /conformance:(v\d+\.\d+\.\d+)/.exec(scripts.generate) ?? [
"?",
];

const name = "connectconformance";
const downloadUrl = `https://github.com/connectrpc/conformance/releases/download/${version}`;
Expand Down
5 changes: 4 additions & 1 deletion packages/connect-conformance/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"include": ["src/**/*.ts"],
"extends": "../../tsconfig.base.json"
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"resolveJsonModule": true
}
}

0 comments on commit 914fc0f

Please sign in to comment.