Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Hacked node-speaker exports and other imports here to get examples wo…
…rking
  • Loading branch information
cjheath committed Sep 8, 2020
commit 74538a769f3b50cefc42d4125d82e2b7f4ad7b41
2 changes: 1 addition & 1 deletion examples/fm_receiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* (SDR - audio card) but it should be functional.
*/

import { open } from '..'
import { open } from '../lib'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing .. to ../lib shouldn't be necessary to run the examples, as long as you've ran npm run build first and you have compiled files in dist 🤔

Copy link
Owner

@mildsunrise mildsunrise Sep 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw! these examples are meant to be run with ts-node or similar

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. New to the ecosystem and didn't have any build instructions :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also; opening in vscode is disappointing; that guesses that the build instructions are just to run tsc, so "Start Debugging" doesn't work

import Speaker from 'speaker'

async function main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/fm_tone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Transmit a tone through FM radio.
*/

import { open } from '..'
import { open } from '../lib'

async function main() {
const fs = 2e6
Expand Down
18 changes: 5 additions & 13 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
},
"dependencies": {
"@types/node": "^13.13.15",
"@types/usb": "^1.5.1",
"@types/usb": "^1.5.2",
"usb": "^1.6.3"
},
"devDependencies": {
"@types/jest": "^23.3.14",
"coveralls": "^3.1.0",
"jest": "^26.4.2",
"speaker": "^0.5.2",
"speaker": "https://github.com/cjheath/node-speaker.git",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain a bit more what changes you need / made in your fork?

Copy link
Author

@cjheath cjheath Sep 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ts-jest": "^26.2.0",
"ts-node": "^9.0.0",
"typedoc": "^0.17.0-3",
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"emitDecoratorMetadata": true
},
"include": [
"lib"
"lib",
"examples"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK that would cause examples to be compiled and distributed with the NPM package... I think examples don't need to be published, just the actual library code

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, probably not sensible for a library module. But some instructions on building the examples would be good, also the ability to build them without installing. Guess I don't understand why they import from ".." if there's no code there?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they import from '..' because that's the module itself :) so according to package.json, that resolves to dist/index.js

as per running / building examples, you're just supposed to run them with ts-node rather than building. I'll put a README in the examples folder

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea :) thanks!

]
}