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-defuss

v1.0.6

Published

Checks out git projects from sub-directories. Originally for jump-starting defuss projects from templates.

Downloads

502

Readme

defuss

Project Scaffolder

create-defuss is a simple, lightweight CLI tool and Node.js library that enables Git sparse checkouts for subdirectories of GitHub repositories. Originally created to help jump-start projects using defuss templates, it can be used for any Git repository.

💡 Did you know? With just one command, you can checkout a specific subdirectory from a GitHub repository without cloning the entire project.


🚀 Getting Started

You're just one step away from checking out one of defuss simple example projects:

Create a new defuss + Astro project:

[‼️] Make sure git is installed on your computer!

npx create-defuss https://github.com/kyr0/defuss/tree/main/examples/with-astro-ts

This will download only the code from the with-astro-ts subdirectory into the (new) folder local folder.

Create a new defuss + Vite project:

[‼️] Make sure git is installed on your computer!

npx create-defuss https://github.com/kyr0/defuss/tree/main/examples/with-vite-ts

This will download only the code from the with-vite-ts subdirectory into the (new) folder local folder.

Downloading into a custom local folder

npx create-defuss https://github.com/kyr0/defuss/tree/main/examples/with-vite-ts ./my-custom-defuss-project

This will download only the code from the with-vite-ts subdirectory into the (new) folder local folder my-custom-defuss-project.

⚙️ API usage

You can also use create-defuss as library. It's super simple:

import { performSparseCheckout } from "create-defuss"

// pass in the Git url and desired destination folder (relative to the current working directory)
performSparseCheckout("git_url", "dest_folder")

🚀 How does defuss-vite work?

create-defuss is an NPM package with a bin entry in package.json. This, combined with a "shebang" line (#!/someshell) makes it executable using npx as a CLI (command line interface). It uses Git sparse checkout to efficiently download files from a specific subdirectory of a GitHub repository. It avoids downloading the entire repository, saving bandwidth and time. Also, monorepo maintainers can spare on creating extra "template" repositories for their example code.

Inside the project, you'll find the following relevant files:

/
├── src/cli.ts
├── src/git.ts
├── package.json

🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action | | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | npm build | Build a new version of the plugin. | | npm publish | Publish a new version of the defuss-vite integration package. |