npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

create-duffel-app

v1.8.2

Published

Scaffolding a full-stack app with duffel SDK setup

Downloads

68

Readme

create-duffel-app

Work in progress!

TODO:

  • [ ] Improve README.md (this file and the ones inside the templates)
  • [ ] Audit package.json
  • [ ] Open-source
  • [ ] Add Python template (and possibly others!)

A scaffolding script to bootstrap a fullstack duffel app

The script will guide you through setting up a minimal fullstack application with Duffel API. At the end of the script, you will have:

  • A ready-to-go client and server that can talk to each other locally
  • A Duffel API SDK installed and configured with the provided access token
  • A code example demonstrating how to make a simple flight search using the Duffel API SDK

Boilerplate source:

Getting started

Get the right NodeJS version

If you use nvm, run nvm use. If you use asdf, run asdf install.

Install Yarn

Like all Duffel front-ends, this project uses yarn. If you don't already have it, nstall it globally with npm install --global yarn.

Start developing

yarn dev

This will start a typescript watcher that will regenerate index.js. The scaffold can be run by running node index.js or by linking the package with yarn, just like the following section.

Testing the generated app

Scaffold the sample app by running

# Within the create-duffel-app folder
yarn build && yarn link

# grant permission
chmod +x .yarn/bin/create-duffel-app

# Then on the destination folder
yarn create duffel-app

This will create an app with two folders: client and server. Then to run the server:

# - If express option is selected
yarn start:dev
# - if flask option is selected
chmod +x ./bin/setup.sh && ./bin/setup.sh
flask run

After this, the server will be running at http://localhost:3001.

Then to run the client, open a separate terminal and run

yarn start

Committing to the repository

To be able to publish the correct version to npm, this project is currently following Angular conventional commit message guidelines which is based on conventional commits. This commit message guideline allows the semantic-release GitHub action to be triggered.

CommitLint to the rescue

Before creating a commit you should run a husky hook which will check if the commit structure is valid or not. If you don't want to create the commit manually, you can use yarn commit which will use commitzen to help you out creating the message.

Client CI

Every time a commit is merged to main, a GitHub Action is run to analyse the commit messages with semantic-release and automatically update the current version to be deployed by following semantic versioning. When the deployment is complete, the action updates the package version, using Duffel's machine user (@duffel-bot) as the author, and this change will be automatically approved by the GitHub Action via the [autoapprove workflow] (../.github/workflows/autoapprove.yml).

Continuous Integration

  1. Developer opens pull request to main
  2. Pull request is merged
  3. GitHub Actions are triggered and the commits are analysed
    • if there's a breaking change, bump the major version
    • if there's a feature commit, bump the minor version
    • if there's a fix, bump the patch version
  4. Deploy the new version a. Publish to npm b. Create and push a git tag c. Publish a GitHub release with the relevant commits and descriptions
  5. After the release is published then a pull request is automatically created and approved via a GitHub Action to bump the package version