Skip to content

Commit

Permalink
Merge branch 'main' into strict-jetstream
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Nov 9, 2024
2 parents 4f34f87 + e234d22 commit a1b356b
Show file tree
Hide file tree
Showing 494 changed files with 9,110 additions and 12,357 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/consistency_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ on:
jobs:
install:
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [ 1.45.x ]
module: [ core, jetstream, kv, obj, services, transport-deno, transport-node ]
deno-version: [2.0.x]
module: [
core,
jetstream,
kv,
obj,
services,
transport-deno,
transport-node,
]

steps:
- name: Git Checkout Sources
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@ name: nats-core release
on:
push:
paths:
- 'core/**'
- '.github/workflows/core.yml'
tags: [ 'core/*' ]
- "core/**"
- ".github/workflows/core.yml"
tags: ["core/*"]
branches:
- '*'
- "*"
jobs:
test:
name: Test core changes with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.45.x]
node-version: [ 22.x ]
deno-version: [2.0.x]
node-version: [22.x]
permissions:
contents: read
id-token: write
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/deno_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
jobs:
install:
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [ 1.45.x ]
module: [ core, jetstream, kv, obj, services, transport-deno ]
deno-version: [2.0.x]
module: [core, jetstream, kv, obj, services, transport-deno]

steps:
- name: Git Checkout Sources
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/jetstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ name: jetstream release
on:
push:
paths:
- 'jetstream/**'
- '.github/workflows/jetstream.yml'
tags: [ 'jetstream/*' ]
- "jetstream/**"
- ".github/workflows/jetstream.yml"
tags: ["jetstream/*"]
branches:
- '*'
- "*"
jobs:
test:
name: test jetstream with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.45.x]
deno-version: [2.0.x]

steps:
- name: Git Checkout Core
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/kv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ name: kv release
on:
push:
paths:
- 'kv/**'
- '.github/workflows/kv.yml'
tags: [ 'kv/*' ]
- "kv/**"
- ".github/workflows/kv.yml"
tags: ["kv/*"]
branches:
- '*'
- "*"
jobs:
test:
name: test kv with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.45.x]
deno-version: [2.0.x]

steps:
- name: Git Checkout Core
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/node_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ on:
jobs:
node-tests-workspace:
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [ 1.45.x ]
node-version: [ 22.x ]
deno-version: [2.0.x]
node-version: [22.x]

steps:
- name: Git Checkout Sources
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/obj.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ name: obj release
on:
push:
paths:
- 'obj/**'
- '.github/workflows/obj.yml'
tags: [ 'obj/*' ]
- "obj/**"
- ".github/workflows/obj.yml"
tags: ["obj/*"]
branches:
- '*'
- "*"
jobs:
test:
name: test obj with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.45.x]
deno-version: [2.0.x]

steps:
- name: Git Checkout Core
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ name: services release
on:
push:
paths:
- 'services/**'
- '.github/workflows/services.yml'
tags: [ 'services/*' ]
- "services/**"
- ".github/workflows/services.yml"
tags: ["services/*"]
branches:
- '*'
- "*"
jobs:
test:
name: test services with released dependencies
runs-on: ubuntu-latest-4-cores
environment: CI
strategy:
matrix:
deno-version: [1.45.x]
deno-version: [2.0.x]

steps:
- name: Git Checkout Core
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Test Modules
on:
push:
tags:
- '*'
- "*"
branches:
- '*'
- "*"
pull_request:
branches: [main]
types: [opened]
Expand All @@ -17,4 +17,3 @@ jobs:
uses: ./.github/workflows/deno_checks.yml
test-node:
uses: ./.github/workflows/node_checks.yml

18 changes: 8 additions & 10 deletions .github/workflows/transport-node-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: test transport-node with local modules
on:
push:
paths:
- 'core/**'
- 'jetstream/**'
- 'kv/**'
- 'obj/**'
- 'services/**'
- "core/**"
- "jetstream/**"
- "kv/**"
- "obj/**"
- "services/**"
branches:
- '*'
- "*"
pull_request:
branches: [main]
types: [opened]
Expand All @@ -18,12 +18,11 @@ jobs:
test:
strategy:
matrix:
deno-version: [ 1.45.x ]
node-version: [ 22.x ]
deno-version: [2.0.x]
node-version: [22.x]

name: test node transport with local dependencies
runs-on: ubuntu-latest-4-cores
environment: CI

steps:
- name: Git Checkout Core
Expand Down Expand Up @@ -52,7 +51,6 @@ jobs:
run: |
deno task disable-npm-workspace
- name: Test Node Transport with specified dependencies
working-directory: transport-node
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version_bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_USER_NAME: ${{ github.actor }}
GIT_USER_EMAIL: ${{ github.actor}}@users.noreply.github.com
GIT_USER_EMAIL: ${{ github.actor}}@users.noreply.github.com
10 changes: 10 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# TODO

## BUGS

- ObjectStore should report the number of entries in it.

- no_wait for Consumer args.no_wait = opts.no_wait || false; if (args.no_wait &&
args.expires) { args.expires = 0; }
- headers_only is needed in Consumer

- add a test for next/fetch/consume where message size smaller than availablle

- doc
33 changes: 19 additions & 14 deletions bin/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,31 @@
* limitations under the License.
*/
import { cli } from "https://deno.land/x/[email protected]/mod.ts";
import { bundle } from "https://deno.land/x/[email protected]/mod.ts";
import * as esbuild from "npm:[email protected]";
// Import the Wasm build on platforms where running subprocesses is not
// permitted, such as Deno Deploy, or when running without `--allow-run`.
// import * as esbuild from "https://deno.land/x/[email protected]/wasm.js";

import { denoPlugins } from "jsr:@luca/esbuild-deno-loader@^0.11.0";

const root = cli({
use: "bundle javascript/typescript",
run: async (_cmd, _args, flags) => {
const src = flags.value<string>("src");
const out = flags.value<string>("out");
const type = flags.value<boolean>("module") ? "module" : "classic";
try {
const r = URL.canParse(src)
? await bundle(new URL(src), { type })
: await bundle(src, { type });
await Deno.writeTextFile(out, r.code);
console.log(`wrote ${out}`);
return 0;
} catch (err) {
console.log(`failed to bundle: ${err.message}`);
console.log(err.stack);
return 1;
}

const result = await esbuild.build({
plugins: [...denoPlugins()],
entryPoints: [src],
outfile: out,
bundle: true,
format: "esm",
});

console.log(result.outputFiles || out);

esbuild.stop();
return 0;
},
});

Expand Down
36 changes: 30 additions & 6 deletions bin/check-dep-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type PackageJSON = {
name: string;
version: string;
dependencies: Record<string, string>;
devDependencies: Record<string, string>;
};
type DenoJSON = {
name: string;
Expand Down Expand Up @@ -207,6 +208,15 @@ class NodeModule extends BaseModule {
return null;
}

hasDev(module: string): SemVer | null {
if (this.data.devDependencies) {
return NodeModule.parseVersion(
this.data.devDependencies[module],
);
}
return null;
}

static parseVersion(v: string): SemVer | null {
if (v) {
return v.startsWith("^") || v.startsWith("~")
Expand All @@ -220,12 +230,26 @@ class NodeModule extends BaseModule {
if (this.data.dependencies) {
const have = this.has(module);
if (have && version.compare(have) !== 0) {
this.data.dependencies[module] = `~${version.string()}`;
let prefix = this.data.dependencies[module].charAt(0);
if (prefix !== "^" && prefix !== "~") {
prefix = "";
}
this.data.dependencies[module] = `${prefix}${version.string()}`;
this.changed = true;
return true;
}
}
return false;
if (this.data.devDependencies) {
const have = this.hasDev(module);
if (have && version.compare(have) !== 0) {
let prefix = this.data.devDependencies[module].charAt(0);
if (prefix !== "^" && prefix !== "~") {
prefix = "";
}
this.data.devDependencies[module] = `${prefix}${version.string()}`;
this.changed = true;
}
}
return this.changed;
}

store(dir: string): Promise<void> {
Expand Down Expand Up @@ -279,15 +303,15 @@ for (const dir of dirs) {
}
const nmm = await NodeModule.load(d);
if (nmm) {
if (nmm.has(moduleName)) {
if (nmm.has(moduleName) || nmm.hasDev(moduleName)) {
nmm.update(moduleName, v);
await nmm.store(d);
}
const onuid = nmm.has("@nats-io/nuid");
const onuid = nmm.has("@nats-io/nuid") || nmm.hasDev("@nats-io/nuid");
if (onuid) {
nuid = nuid.max(onuid);
}
const onkeys = nmm.has("@nats-io/nkeys");
const onkeys = nmm.has("@nats-io/nkeys") || nmm.hasDev("@nats-io/nkeys");
if (onkeys) {
nkeys = nkeys.max(onkeys);
}
Expand Down
Loading

0 comments on commit a1b356b

Please sign in to comment.