This is a very brief documentation about setting-up the project and some documentation about libraries used. This is by no means a full explanation about how everything works, just personal notes to my future self in case he doesn't remember what he did here that may also be useful to others.
- Install the IDE of your choice to edit (mainly) Javascript files. I recommend Visual Studio Code.
- Install nvm, which is a
Node.jsversion manager that we use to control which version ofnodewe want to use in the project. This could be omitted, but it's usually a good idea to do this to isolate the project's version and dependencies from the globalnodeinstallation that a user may have. - Go to the project's root folder and run the following command to install the
nodeversion that the project uses:
nvm installThis will pick up the version defined in .nvmrc and install it automatically. This will also mark the version as the active node version for this terminal session.
- While in the root folder, install the project's dependencies:
npm installThis will pick all the dependencies defined in package-lock.json and package.jsonand install them for you.
- Loaded via
.envfile in local, Checkdotenvdependency docs for details: https://www.npmjs.com/package/dotenv - Loaded as environment variables in CI, set them up there
GITHUB_TOKEN: GitHub personal access token with no special scopes. Needed to fetch repo info with@octokit/rest
- Set-up the
nodeversion with nvm for the current terminal session:
nvm useIf the command prompts you to install a new version, just run:
nvm installand it will install and use said version for the current terminal session.
- If you want to avoid having to do the
nvm usestep every time you want to deploy, configure your shell for automatic loading of the.nvmrcfile checking the instructions here. It is recommended to use the recipes that the nvm team provides (you may have to add this fix too forbashshells). - To build the README, just call
npm run generate_readmegenerate_readme is a script defined in package.json
- Read
mustachedocs: https://mustache.github.io/
- Seemed simple enough for our use case (getting posts from Medium).
- Check
rss-parserdocs: https://www.npmjs.com/package/rss-parser
- Review
ESLintdocs: https://eslint.org/docs/user-guide/getting-started - Review
prettierdocs: https://prettier.io/docs/en/install.html- Add configuration in
.prettierrc.json - If using ESLint, add support for
prettier, explained inprettierdocs
- Add configuration in
- Add the scripts to
package.jsonso we can run them in a singlenpm runcommand
- Review
pre-commitdocs: https://www.npmjs.com/package/pre-commit. I could have usedhuskyhttps://www.npmjs.com/package/husky, but this seemed simple enough - Check
lint-stageddocs: https://www.npmjs.com/package/lint-staged - Config
lint-stagedinpackage.jsonso it runs commands injsfiles - Add
pre-commitscript inscriptsblock inpackage.jsonthat invokesnpx lint-staged - Invoke
pre-commitscript inpre-commitblock inpackage.json
- Version management is already bundled in
npmwithnpm-version: https://docs.npmjs.com/cli/version. This can create a commit with metadata changes based on git tags - Bump the version with
npm version [major|minor|patch] - You can set-up
preversion,versionandpostversionscripts to execute tasks in these stages of version generation - You can customize prefix addition in version, or version bump commit message with
.npmrc: https://docs.npmjs.com/misc/config#tag-version-prefix