git clone git://github.com/ildella/pocket-cli.git
cd pocket-cli
npm install
In order to communicate with the Pocket API, we always need to send both the consumer key, unique to the pocket-cli app, and the user token, which is obtained trough a oauth exchange.
We need to run a proxy that securely stores the uniquer pocket-cli consumer key to access the Pocket API.
To try it in dev, create a fresh API key from Pocket Store it in a file called .env in the project root, like this
POCKET='<your api key here...>'
The proxy server can be started locally:
wt serve src/server/auth-proxy.js --port 4040
./bin/pocket-cli
To use locally the current branch:
npm link
To link it to a different bin:
sudo ln -s "$HOME/n/bin/pocket-cli" /usr/local/bin/pocket-cli-dev
I have a quite strict policy on dependencies.
$ yarn list --prod
[email protected] /home/ildella/projects/personal/pocket-cli
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]
├── [email protected]
└── [email protected]
I do not use most common command line library or framework like commander, inquirer, chalk. I also do not use lodash or similar libraries.
What I rely on:
- Axios - http client
- Colorette - a dependency free ansii coloring
- Luxon - a dependency free, immutable momentjs
Docs: https://docs.travis-ci.com/user/deployment/npm/
Install travis locally:
sudo apt install ruby ruby-dev
sudo gem install travis --no-document
Generate a new GitHub Access Token with the scopes as specified in "Repositories on https://travis-ci.org" section.
Now, authenticate to Travis and setup the project. This whole thing should be done only once.
travis login --github-token GITHUB_ACCESS_TOKEN
Generate a new NPM access token which will be used and encrypted in this interactive shell:
travis setup npm
This will generate or upgrade the .travis.yml
file in the project. The relevant portion is
deploy:
provider: npm
email: [email protected]
api_key:
secure: xxxxxxxxxxxxxx
on:
tags: true
repo: ildella/pocket-cli
skip_cleanup: 'true'
This will publish to npm each tag that we push to GitHub like this:
git tag v0.x.x
git push origin v0.x.x
To release as a snap installer:
sudo apt install snapcraft
snapcraft