diff --git a/.github/workflows/publish-makeosc.yml b/.github/workflows/publish-makeosc.yml
deleted file mode 100644
index bebf258..0000000
--- a/.github/workflows/publish-makeosc.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Publish makeosc to npmjs
-on:
- push:
- tags:
- - 'makeosc/*'
-jobs:
- publish:
- 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=makeosc
- - name: Publish to NPM
- run: npm publish --provenance --access=public --workspace=makeosc
diff --git a/.github/workflows/publish-readosc.yml b/.github/workflows/publish-readosc.yml
deleted file mode 100644
index d762dfa..0000000
--- a/.github/workflows/publish-readosc.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Publish readosc to npmjs
-on:
- push:
- tags:
- - 'readosc/*'
-jobs:
- publish:
- 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=readosc
- - name: Publish to NPM
- run: npm publish --provenance --access=public --workspace=readosc
diff --git a/.github/workflows/publish-sendosc.yml b/.github/workflows/publish-sendosc.yml
deleted file mode 100644
index efffa06..0000000
--- a/.github/workflows/publish-sendosc.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Publish sendosc to npmjs
-on:
- push:
- tags:
- - 'sendosc/*'
-jobs:
- publish:
- 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=sendosc
- - name: Publish to NPM
- run: npm publish --provenance --access=public --workspace=sendosc
diff --git a/README.md b/README.md
index db3d761..d6305ea 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
# osc-js
-Collection of OSC things written in JS/TS
+Typescript implementation of OSC things written in TS and distributed as both ESM and CJS modules
-- [osc encoding/decoding library](./packages/osc/)
-- [cli for sending osc messages](./apps/sendosc/)
\ No newline at end of file
+- [osc encoding/decoding library](./packages/osc/)
\ No newline at end of file
diff --git a/apps/makeosc/.gitignore b/apps/makeosc/.gitignore
deleted file mode 100644
index 53c37a1..0000000
--- a/apps/makeosc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dist
\ No newline at end of file
diff --git a/apps/makeosc/README.md b/apps/makeosc/README.md
deleted file mode 100644
index d29f5c6..0000000
--- a/apps/makeosc/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-# makeosc
-
-Simple NodeJS script for generating OSC bytes output to stdout.
-
-## Usage
-
-```
-Usage: makeosc [options]
-
-simple util to make osc buffers
-
-Options:
- -V, --version output the version number
- --address
OSC address
- --args osc args (default: [])
- --slip slip encode message (default: false)
- --types osc arg types (choices: "s", "i", "f", "b", default: [])
- -h, --help display help for command
-```
-
-- using npx `npx makeosc@latest --address /hello`
-- install using `npm install -g makeosc@latest` and run `makeosc --address /hello`
-
-## Notes
-
-- `--types` option is a space seperate list of type characters that will determine what the corresponding argument type will be set to
- - optional
- - uses type codes from the OSC spec
-- `--args` option is a space-separated list of arguments. If a corresponding type is not found in the `--types` option it will default to string (`s`).
- - blobs (`b`) are to be entered as hex string representing the buffer to be sent so the ASCII string `hello` would be `68656c6c6f`
-- the default protocol is UDP but can be changed to TCP using the `--protocol` flag
-
-## Examples
-
-- `makeosc --address /test --args 1.0`
-- `makeosc --address /this/is/sent/via/tcp`
-- `makeosc --address /test/with/types --args 1 2.0 three --types i f`
- - note that `types` is not the same length as `args` so the remaining argument (`three`) will default to string
-- `makeosc --address /blob --args 68656c6c6f --types b`
diff --git a/apps/makeosc/package.json b/apps/makeosc/package.json
deleted file mode 100644
index 46d0626..0000000
--- a/apps/makeosc/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "makeosc",
- "version": "0.1.0",
- "description": "Simple NodeJS utility for generating osc buffers",
- "main": "src/main.js",
- "bin": {
- "makeosc": "src/main.js"
- },
- "files": [
- "src/"
- ],
- "author": {
- "name": "Joel Wetzell",
- "email": "me@jwetzell.com",
- "url": "https://jwetzell.com"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/jwetzell/osc-js.git"
- },
- "license": "MIT",
- "dependencies": {
- "@jwetzell/osc": "1.7.0",
- "commander": "14.0.3",
- "slip": "1.0.2"
- }
-}
diff --git a/apps/makeosc/src/main.js b/apps/makeosc/src/main.js
deleted file mode 100755
index fe7990d..0000000
--- a/apps/makeosc/src/main.js
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env node
-
-const { Option, program } = require('commander');
-const slip = require('slip');
-const osc = require('@jwetzell/osc');
-const { argToTypedArg } = require('./utils');
-const packageInfo = require('../package.json');
-
-program.name(packageInfo.name);
-program.version(packageInfo.version);
-program.description('simple util to make osc buffers');
-program.addOption(new Option('--address ', 'OSC address').makeOptionMandatory());
-program.addOption(new Option('--args ', 'osc args').default([]));
-program.addOption(new Option('--slip', 'slip encode message').default(false));
-program.addOption(new Option('--types ', 'osc arg types').choices(['s', 'i', 'f', 'b']).default([]));
-program.addOption(
- new Option('-f --format ', 'output format').choices(['bytes', 'json', 'f', 'b']).default('bytes')
-);
-program.action((options) => {
- const { address, args, types, format } = options;
-
- const typedArgs = args?.map((rawArg, index) => {
- const argType = types[index] || 's';
-
- return {
- type: argType,
- value: argToTypedArg(rawArg, argType),
- };
- });
-
- const oscMsg = {
- address,
- args: typedArgs,
- };
-
- if (format === 'json') {
- process.stdout.write(JSON.stringify(oscMsg));
- } else if (format === 'bytes') {
- let oscMsgBuffer = osc.messageToBuffer(oscMsg);
- if (options.slip) {
- oscMsgBuffer = slip.encode(oscMsgBuffer);
- }
- process.stdout.write(oscMsgBuffer);
- }
-});
-program.parse();
-
-process.stdout.on('error', (err) => {
- if (err.code === 'EPIPE') {
- process.exit(0);
- }
-});
diff --git a/apps/makeosc/src/utils.js b/apps/makeosc/src/utils.js
deleted file mode 100644
index 9242e21..0000000
--- a/apps/makeosc/src/utils.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const oscTypeConverterMap = {
- s: {
- fromString: (string) => string,
- },
- f: {
- fromString: (string) => Number.parseFloat(string),
- },
- i: {
- fromString: (string) => Number.parseInt(string, 10),
- },
- b: {
- fromString: (string) => Buffer.from(string, 'hex'),
- },
-};
-
-function argToTypedArg(rawArg, type = 's') {
- const typeConverter = oscTypeConverterMap[type];
- if (typeConverter === undefined) {
- throw new Error('osc type error: unknown type '.concat(type));
- }
-
- if (typeConverter.fromString === undefined) {
- throw new Error('osc type error: no string converter for type '.concat(type));
- }
-
- return typeConverter.fromString(rawArg);
-}
-
-module.exports = {
- argToTypedArg,
-};
diff --git a/apps/readosc/.gitignore b/apps/readosc/.gitignore
deleted file mode 100644
index 53c37a1..0000000
--- a/apps/readosc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dist
\ No newline at end of file
diff --git a/apps/readosc/README.md b/apps/readosc/README.md
deleted file mode 100644
index 9467637..0000000
--- a/apps/readosc/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-# readosc
-
-Simple NodeJS script for parsing OSC bytes from stdin.
-
-## Usage
-
-```
-Usage: readosc [options]
-
-simple util to read osc packets from stdin
-
-Options:
- -V, --version output the version number
- -h, --help display help for command
-```
-
-- using npx `npx readosc@latest`
-- install using `npm install -g readosc@latest` and run `readosc`
diff --git a/apps/readosc/package.json b/apps/readosc/package.json
deleted file mode 100644
index 889ae52..0000000
--- a/apps/readosc/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "readosc",
- "version": "0.2.0",
- "description": "Simple NodeJS utility for parsing osc buffers from stdin",
- "main": "src/main.js",
- "bin": {
- "readosc": "src/main.js"
- },
- "files": [
- "src/"
- ],
- "author": {
- "name": "Joel Wetzell",
- "email": "me@jwetzell.com",
- "url": "https://jwetzell.com"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/jwetzell/osc-js.git"
- },
- "license": "MIT",
- "dependencies": {
- "@jwetzell/osc": "1.7.0",
- "commander": "14.0.3",
- "slip": "1.0.2"
- }
-}
diff --git a/apps/readosc/src/main.js b/apps/readosc/src/main.js
deleted file mode 100755
index ca3a5ac..0000000
--- a/apps/readosc/src/main.js
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env node
-
-const { program, Option } = require('commander');
-const osc = require('@jwetzell/osc');
-const packageInfo = require('../package.json');
-const slip = require('slip');
-
-program.name(packageInfo.name);
-program.version(packageInfo.version);
-program.description('simple util to read osc packets from stdin');
-program.addOption(new Option('--slip', 'slip encode message').default(false));
-program.action((options) => {
- const slipDecoder = new slip.Decoder({
- onMessage: (msg) =>{
- const [message, bytesAfterMessage] = osc.messageFromBuffer(msg);
- printOSCMessage(message)
- },
- maxMessageSize: 209715200,
- bufferSize: 2048
- });
- process.stdin.on('data', (data) => {
- try {
- if (options.slip){
- slipDecoder.decode(data)
- } else {
- let remainingBytes = data;
- while (remainingBytes.length > 0) {
- try {
- const [message, bytesAfterMessage] = osc.messageFromBuffer(remainingBytes);
- remainingBytes = bytesAfterMessage;
- printOSCMessage(message)
- } catch (error) {
- console.error({ error: error.toString() });
- }
- }
- }
- } catch (error) {
- console.error({ error: error.toString() });
- }
- });
-});
-program.parse();
-
-function printOSCMessage(oscMessage) {
- console.log(JSON.stringify(oscMessage));
-}
diff --git a/apps/sendosc/.gitignore b/apps/sendosc/.gitignore
deleted file mode 100644
index 53c37a1..0000000
--- a/apps/sendosc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dist
\ No newline at end of file
diff --git a/apps/sendosc/README.md b/apps/sendosc/README.md
deleted file mode 100644
index fd4c8cb..0000000
--- a/apps/sendosc/README.md
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-# sendosc
-
-Simple NodeJS script for sending OSC via TCP or UDP originally inspired by this [c++ utility](https://github.com/yoggy/sendosc) of the same name.
-
-## Usage
-
-```
-Usage: sendosc [options]
-
-simple util to sendosc
-
-Options:
- -V, --version output the version number
- --protocol Network protocol (choices: "tcp", "udp", default: "udp")
- --host the host to send osc to
- --port the port to send osc to
- --address OSC address
- --args osc args (default: [])
- --slip slip encode message (default: false)
- --types osc arg types (choices: "s", "i", "f", "b", default: [])
- -h, --help display help for command
-```
-
-- using npx `npx sendosc@latest --host 127.0.0.1 --port 9999 --address /hello`
-- install using `npm install -g sendosc@latest` and run `sendosc --host 127.0.0.1 --port 9999 --address /hello`
-
-## Notes
-
-- `--types` option is a space seperate list of type characters that will determine what the corresponding argument type will be set to
- - optional
- - uses type codes from the OSC spec
-- `--args` option is a space-separated list of arguments. If a corresponding type is not found in the `--types` option it will default to string (`s`).
- - blobs (`b`) are to be entered as hex string representing the buffer to be sent so the ASCII string `hello` would be `68656c6c6f`
-- the default protocol is UDP but can be changed to TCP using the `--protocol` flag
-
-## Examples
-
-- `sendosc --host 127.0.0.1 --port 8000 --address /test --args 1.0`
-- `sendosc --protocol tcp --host 127.0.0.1 --port 8000 --address /this/is/sent/via/tcp`
-- `sendosc --host 127.0.0.1 --port 8000 --address /test/with/types --args 1 2.0 three --types i f`
- - note that `types` is not the same length as `args` so the remaining argument (`three`) will default to string
-- `sendosc --host 127.0.0.1 --port 8000 --address /blob --args 68656c6c6f --types b`
diff --git a/apps/sendosc/package.json b/apps/sendosc/package.json
deleted file mode 100644
index b16da17..0000000
--- a/apps/sendosc/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "sendosc",
- "version": "1.0.1",
- "description": "Simple NodeJS utility for sending osc",
- "main": "src/main.js",
- "bin": {
- "sendosc": "src/main.js"
- },
- "files": [
- "src/"
- ],
- "author": {
- "name": "Joel Wetzell",
- "email": "me@jwetzell.com",
- "url": "https://jwetzell.com"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/jwetzell/osc-js.git"
- },
- "license": "MIT",
- "dependencies": {
- "@jwetzell/osc": "1.7.0",
- "commander": "14.0.3",
- "slip": "1.0.2"
- }
-}
diff --git a/apps/sendosc/src/main.js b/apps/sendosc/src/main.js
deleted file mode 100755
index 086ea86..0000000
--- a/apps/sendosc/src/main.js
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env node
-
-const { Option, program } = require('commander');
-const dgram = require('dgram');
-const net = require('net');
-const slip = require('slip');
-const osc = require('@jwetzell/osc');
-const { argToTypedArg } = require('./utils');
-const packageInfo = require('../package.json');
-
-program.name(packageInfo.name);
-program.version(packageInfo.version);
-program.description('simple util to sendosc');
-program.addOption(new Option('--protocol ', 'Network protocol').choices(['tcp', 'udp']).default('udp'));
-program.addOption(new Option('--host ', 'the host to send osc to').makeOptionMandatory());
-program.addOption(new Option('--port ', 'the port to send osc to').makeOptionMandatory());
-program.addOption(new Option('--address ', 'OSC address').makeOptionMandatory());
-program.addOption(new Option('--args ', 'osc args').default([]));
-program.addOption(new Option('--slip', 'slip encode message').default(false));
-program.addOption(new Option('--types ', 'osc arg types').choices(['s', 'i', 'f', 'b']).default([]));
-program.action((options) => {
- const { host, port, address, args, types } = options;
-
- const typedArgs = args?.map((rawArg, index) => {
- const argType = types[index] || 's';
-
- return {
- type: argType,
- value: argToTypedArg(rawArg, argType),
- };
- });
-
- let oscMsgBuffer = osc.messageToBuffer({
- address,
- args: typedArgs,
- });
-
- if (options.slip) {
- oscMsgBuffer = slip.encode(oscMsgBuffer);
- }
-
- if (options.protocol === 'tcp') {
- const client = net.Socket();
- client.on('error', (error) => {
- console.error(error);
- });
- client.connect(port, host, () => {
- client.write(oscMsgBuffer, () => {
- client.destroy();
- });
- });
- } else if (options.protocol === 'udp') {
- const client = dgram.createSocket('udp4');
- client.send(oscMsgBuffer, port, host, (error) => {
- if (error) {
- console.error(error);
- }
- client.close();
- });
- }
-});
-program.parse();
diff --git a/apps/sendosc/src/utils.js b/apps/sendosc/src/utils.js
deleted file mode 100644
index 9242e21..0000000
--- a/apps/sendosc/src/utils.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const oscTypeConverterMap = {
- s: {
- fromString: (string) => string,
- },
- f: {
- fromString: (string) => Number.parseFloat(string),
- },
- i: {
- fromString: (string) => Number.parseInt(string, 10),
- },
- b: {
- fromString: (string) => Buffer.from(string, 'hex'),
- },
-};
-
-function argToTypedArg(rawArg, type = 's') {
- const typeConverter = oscTypeConverterMap[type];
- if (typeConverter === undefined) {
- throw new Error('osc type error: unknown type '.concat(type));
- }
-
- if (typeConverter.fromString === undefined) {
- throw new Error('osc type error: no string converter for type '.concat(type));
- }
-
- return typeConverter.fromString(rawArg);
-}
-
-module.exports = {
- argToTypedArg,
-};
diff --git a/package-lock.json b/package-lock.json
index 428fd52..623334b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,7 +8,6 @@
"name": "osc",
"version": "0.0.0",
"workspaces": [
- "apps/*",
"packages/*"
],
"devDependencies": {
@@ -23,6 +22,7 @@
},
"apps/makeosc": {
"version": "0.1.0",
+ "extraneous": true,
"license": "MIT",
"dependencies": {
"@jwetzell/osc": "1.7.0",
@@ -35,6 +35,7 @@
},
"apps/readosc": {
"version": "0.2.0",
+ "extraneous": true,
"license": "MIT",
"dependencies": {
"@jwetzell/osc": "1.7.0",
@@ -47,6 +48,7 @@
},
"apps/sendosc": {
"version": "1.0.1",
+ "extraneous": true,
"license": "MIT",
"dependencies": {
"@jwetzell/osc": "1.7.0",
@@ -1068,15 +1070,6 @@
"node": ">=20.19.0"
}
},
- "node_modules/commander": {
- "version": "14.0.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",
- "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==",
- "license": "MIT",
- "engines": {
- "node": ">=20"
- }
- },
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
@@ -1702,10 +1695,6 @@
"node": "20 || >=22"
}
},
- "node_modules/makeosc": {
- "resolved": "apps/makeosc",
- "link": true
- },
"node_modules/minimatch": {
"version": "10.2.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz",
@@ -1961,10 +1950,6 @@
],
"license": "MIT"
},
- "node_modules/readosc": {
- "resolved": "apps/readosc",
- "link": true
- },
"node_modules/resolve-pkg-maps": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
@@ -2086,10 +2071,6 @@
"node": ">=10"
}
},
- "node_modules/sendosc": {
- "resolved": "apps/sendosc",
- "link": true
- },
"node_modules/shebang-command": {
"version": "2.0.0",
"dev": true,
@@ -2109,12 +2090,6 @@
"node": ">=8"
}
},
- "node_modules/slip": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/slip/-/slip-1.0.2.tgz",
- "integrity": "sha512-XrcHe3NAcyD3wO+O4I13RcS4/3AF+S9RvGNj9JhJeS02HyImwD2E3QWLrmn9hBfL+fB6yapagwxRkeyYzhk98g==",
- "license": "(MIT OR GPL-2.0)"
- },
"node_modules/synckit": {
"version": "0.11.12",
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.11.12.tgz",
diff --git a/package.json b/package.json
index 6fb4e02..a6243ff 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,6 @@
"format:write": "prettier ./ --write"
},
"workspaces": [
- "apps/*",
"packages/*"
],
"devDependencies": {