Node Package Starter
A starter project for node packages
1. Git setup
- Clone into a desired directory
git clone git@github.com:drupsys/node_package_starter.git <package-name>
- Run
sudo rm -r .git && git init
to remove old git repository and create a new one - Open https://github.com create new repository with your package name
- Add remote to your git setup with
git remote add origin git@github.com:<username>/<repository>.git
as instructed on the blank repository's page
2. NPM setup
- Run
npm init
and fill in project details - Run
git add .
,git commit -m "Initial Commit"
andgit push -u origin master
- Run
npm install
to install dependencies
3. Circle Ci setup
- Open https://circleci.com/add-projects/gh/ find the git your package's git repository and press setup project
- Choose
Linux
OS, Platform2.0
, LanguageNode
- In the
Next Steps
section go straight to step 5 and pressStart Building
- The build should fail on the tests section
- Circle Ci will need npm access token in order to push packages to your npm account, use the following tutorial to set it up https://circleci.com/docs/1.0/npm-continuous-deployment/
4. Folder setup
The following folder structure is needed in the root of the package for the
circle ci
deployment pipeline to work
src/
├── tests/
│ ├── some_folder/
│ ├── test_a.spec.ts
│ └── ...
├── some_folder/
├── file_a.ts
Tests should be stored in
unit
/func
folders within thetests
folder, each test file must end with*.spec.ts
src/
├── tests/
│ ├── unit/
│ ├── func/
...
All other typescript files must be placed in the
src
folder or other folders withing thesrc
folder but not inside thetests
folder