initial commit

This commit is contained in:
2024-12-25 22:22:16 -06:00
commit bf7d020bfc
24 changed files with 4347 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
module.exports = {
env: {
node: true,
commonjs: true,
es2021: true,
},
extends: ['airbnb', 'prettier'],
parserOptions: {
ecmaVersion: 'latest',
},
ignorePatterns: ['**/node_modules', '**/dist'],
};
+2
View File
@@ -0,0 +1,2 @@
# These are supported funding model platforms
github: [jwetzell]
+6
View File
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
+25
View File
@@ -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
+26
View File
@@ -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 }}
+25
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
node_modules
+1
View File
@@ -0,0 +1 @@
git-tag-version=false
+1
View File
@@ -0,0 +1 @@
v22.12.0
+3
View File
@@ -0,0 +1,3 @@
*.md
*.min.*
dist
+8
View File
@@ -0,0 +1,8 @@
module.exports = {
trailingComma: 'es5',
tabWidth: 2,
semi: true,
singleQuote: true,
bracketSameLine: true,
printWidth: 120,
};
+21
View File
@@ -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.
+4
View File
@@ -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/)
+4045
View File
File diff suppressed because it is too large Load Diff
+28
View File
@@ -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"
}
}
+1
View File
@@ -0,0 +1 @@
dist
+43
View File
@@ -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"
}
}
View File
+29
View File
@@ -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);
});
});
});
+30
View File
@@ -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);
});
});
});
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"declaration": false,
"outDir": "./dist/cjs"
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"declaration": false,
"outDir": "./dist/esm"
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"moduleResolution": "Node",
"lib": ["ESNext"],
"target": "ESNext",
"esModuleInterop": true,
"isolatedModules": true,
"rootDir": "src/",
"strict": true
},
"include": ["src/"]
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"emitDeclarationOnly": true,
"declaration": true,
"outDir": "./dist/types"
}
}