Skip to content

Setup development environment

yayuyokitano edited this page Sep 21, 2023 · 22 revisions

Setup environment

Firstly, clone the project repository:

> git clone https://github.com/web-scrobbler/web-scrobbler.git
> cd web-scrobbler

Then, install dependencies; they can be installed in a following way:

> npm install

The minimal Node.js version is specified in the .nvmrc file. We recommend using either nvm or fnm which will make it easier for you to manage multiple node versions and switching versions between projects.

Build and pack the extension

Although the extension can be used as an unpacked one w/o any compilation process, it's recommended to build it to apply browser-specific changes. You can build the extension by a following way:

> npm run build firefox
# or
> npm run build chrome
# or (requires xcodebuild)
> npm run build safari

The built extension is located in build/{browser} directory. You can install the extension from this directory using this (Chrome), this (Firefox), or this (Safari) guide.

If you want to pack the extension in a zipball, you can use these commands:

> npm run dist firefox
or
> npm run dist chrome

The target file is located in the root directory of the project.

Test changes before push

Just run these commands in the terminal:

> npm run lint
> npm run test

Make sure these commands exit w/o errors before pushing the code. Otherwise, please fix all issues and run this command again. Note that ESLint is able to fix almost all issues related to JavaScript code.

Note: The lint command may change the source code so make sure to stage any fixed changes.