mirror of
https://github.com/jwetzell/ddp-js.git
synced 2026-07-26 09:58:41 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
commonjs: true,
|
||||||
|
es2021: true,
|
||||||
|
},
|
||||||
|
extends: ['airbnb', 'prettier'],
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
},
|
||||||
|
ignorePatterns: ['**/node_modules', '**/dist'],
|
||||||
|
};
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
github: [jwetzell]
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: 'npm'
|
||||||
|
directory: '/'
|
||||||
|
schedule:
|
||||||
|
interval: 'weekly'
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
name: Check @jwetzell/ddp builds
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'packages/ddp/**'
|
||||||
|
jobs:
|
||||||
|
build-webui:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: 'package-lock.json'
|
||||||
|
|
||||||
|
- name: Install Node.js dependencies
|
||||||
|
run: npm ci --workspace @jwetzell/ddp
|
||||||
|
|
||||||
|
- run: npm run build --workspace @jwetzell/ddp
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
name: Publish @jwetzell/ddp to npmjs
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'ddp/*'
|
||||||
|
jobs:
|
||||||
|
publish-lib:
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||||
|
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: 'package-lock.json'
|
||||||
|
|
||||||
|
- name: Install Node.js dependencies
|
||||||
|
run: npm ci --workspace @jwetzell/ddp
|
||||||
|
|
||||||
|
- name: Publish to NPM
|
||||||
|
run: npm publish --provenance --access=public --workspace @jwetzell/ddp
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
name: Run @jwetzell/ddp tests
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'packages/ddp/**'
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: './package-lock.json'
|
||||||
|
|
||||||
|
- name: Install Node.js dependencies
|
||||||
|
run: npm ci --workspace @jwetzell/ddp
|
||||||
|
|
||||||
|
- run: npm run test --workspace @jwetzell/ddp
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
*.md
|
||||||
|
*.min.*
|
||||||
|
dist
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
trailingComma: 'es5',
|
||||||
|
tabWidth: 2,
|
||||||
|
semi: true,
|
||||||
|
singleQuote: true,
|
||||||
|
bracketSameLine: true,
|
||||||
|
printWidth: 120,
|
||||||
|
};
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Joel Wetzell
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# ddp-js
|
||||||
|
Collection of [DDP](http://www.3waylabs.com/ddp/) things written in JS/TS
|
||||||
|
|
||||||
|
- [ddp encoding/decoding library](./packages/ddp/)
|
||||||
Generated
+4045
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "ddp",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"author": {
|
||||||
|
"name": "Joel Wetzell",
|
||||||
|
"email": "me@jwetzell.com",
|
||||||
|
"url": "https://jwetzell.com"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jwetzell/ddp-js.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint:check": "eslint ./",
|
||||||
|
"format:check": "prettier ./ --check",
|
||||||
|
"format:write": "prettier ./ --write"
|
||||||
|
},
|
||||||
|
"workspaces": [
|
||||||
|
"packages/*"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"prettier": "3.4.2",
|
||||||
|
"eslint": "8.48.0",
|
||||||
|
"eslint-config-airbnb": "19.0.4",
|
||||||
|
"eslint-config-prettier": "9.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
dist
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"name": "@jwetzell/ddp",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "./dist/cjs/index.js",
|
||||||
|
"module": "./dist/esm/index.js",
|
||||||
|
"types": "./dist/types/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./dist/esm/index.js",
|
||||||
|
"require": "./dist/cjs/index.js",
|
||||||
|
"types": "./dist/types/index.d.ts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"prebuild": "rimraf dist",
|
||||||
|
"build": "npm run build:cjs && npm run build:esm && npm run build:types",
|
||||||
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
||||||
|
"build:esm": "tsc -p tsconfig.esm.json",
|
||||||
|
"build:types": "tsc -p tsconfig.types.json",
|
||||||
|
"prepublishOnly": "npm run build",
|
||||||
|
"pretest": "npm run build",
|
||||||
|
"test": "node --test --experimental-test-coverage"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"author": {
|
||||||
|
"name": "Joel Wetzell",
|
||||||
|
"email": "me@jwetzell.com",
|
||||||
|
"url": "https://jwetzell.com"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jwetzell/ddp-js.git"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "22.10.1",
|
||||||
|
"rimraf": "6.0.1",
|
||||||
|
"typescript": "5.7.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
const { deepEqual, throws } = require('assert');
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
const ddp = require('../dist/cjs/index');
|
||||||
|
|
||||||
|
const goodTests = [
|
||||||
|
];
|
||||||
|
|
||||||
|
const badTests = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
describe('DDP Message Decoding Pass', () => {
|
||||||
|
goodTests.forEach((messageTest) => {
|
||||||
|
it(messageTest.description, () => {
|
||||||
|
const decoded = ddp.decode(messageTest.bytes);
|
||||||
|
deepEqual(decoded, messageTest.expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('DDP Message Decoding Throws', () => {
|
||||||
|
badTests.forEach((messageTest) => {
|
||||||
|
it(messageTest.description, () => {
|
||||||
|
throws(() => {
|
||||||
|
ddp.decode(messageTest.bytes);
|
||||||
|
}, messageTest.throwsMessage);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
const { deepEqual, throws } = require('assert');
|
||||||
|
const { describe, it } = require('node:test');
|
||||||
|
const ddp = require('../dist/cjs/index');
|
||||||
|
|
||||||
|
const goodTests = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
const badTests = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
describe('DDP Message Encoding Pass', () => {
|
||||||
|
goodTests.forEach((messageTest) => {
|
||||||
|
it(messageTest.description, () => {
|
||||||
|
const encoded = ddp.encode(messageTest.message);
|
||||||
|
deepEqual(encoded, messageTest.expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('DDP Message Encoding Throws', () => {
|
||||||
|
badTests.forEach((messageTest) => {
|
||||||
|
it(messageTest.description, () => {
|
||||||
|
throws(() => {
|
||||||
|
ddp.encode(messageTest.message);
|
||||||
|
}, messageTest.throwsMessage);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "CommonJS",
|
||||||
|
"declaration": false,
|
||||||
|
"outDir": "./dist/cjs"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "ESNext",
|
||||||
|
"declaration": false,
|
||||||
|
"outDir": "./dist/esm"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"lib": ["ESNext"],
|
||||||
|
"target": "ESNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"rootDir": "src/",
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"include": ["src/"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "./dist/types"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user