After forking the repo from GitHub and installing pnpm:
git clone https://github.com/<your-name-here>/soundcloud
cd soundcloud
pnpm install
This repository includes a list of suggested VS Code extensions. It's a good idea to use VS Code and accept its suggestion to install them, as they'll help with development.
Run TypeScript locally to type check and build source files from src/
into output files in lib/
:
pnpm build --watch
You should also see suggestions from TypeScript in your editor.
Prettier is used to format code. It should be applied automatically when you save files in VS Code or make a Git commit.
To manually reformat all files, you can run:
pnpm format:write
This package includes several forms of linting to enforce consistent code quality and styling. Each should be shown in VS Code, and can be run manually on the command-line:
pnpm lint:knip
(knip): Detects unused files, dependencies, and code exportspnpm lint:md
(Markdownlint): Checks Markdown source filespnpm lint:package
(npm-package-json-lint): Lints thepackage.json
filepnpm lint:packages
(pnpm dedupe --check): Checks for unnecessarily duplicated packages in thepnpm-lock.yml
filepnpm lint:spelling
(cspell): Spell checks across all source filespnpm lint
(ESLint with typescript-eslint): Lints JavaScript and TypeScript source files
Vitest is used for tests. You can run it locally on the command-line:
pnpm run test
Add the --coverage
flag to compute test coverage and place reports in the coverage/
directory:
pnpm run test --coverage
Note that console-fail-test is enabled for all test runs.
Calls to console.log
, console.warn
, and other console methods will cause a test to fail.
This repository includes a VS Code launch configuration for debugging unit tests. To launch it, open a test file, then run Debug Current Test File from the VS Code Debug panel (or press F5).
This template's "hydration" script is located in src/hydrate/
.
It needs to be built before it can be run.
Be warned that running the hydration script in a repository -including this one- will modify that repository. To test out the script, you may want to create a new test repository to run on:
cd ..
mkdir temp
cd temp
echo node_modules > .gitignore
git init
npm init --yes
Then, in that directory, you can directly call the hydration script:
node ../soundcloud/lib/hydrate/index.js -- description "Hooray, trying things out locally."
Along with the hydration script itself, end-to-end tests are removed on package setup.
This template's "setup" script is located in script/
.