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

dotfs

v0.1.2

Published

Set file paths in dot notation

Downloads

3

Readme

Welcome to DotFS

Welcome to DotFS, a way to browse your filesystem using dot notation (ish). So instead of requiring a file like

require('../../../sampleFolder/anotherFolder/data/package.json, you can require a file like

df.req('back.back.back.sampleFolder.anotherFolder.data.package.json').


Getting Started

Install

To install DotFS, make sure you have NodeJS on your computer. Navigate to your project folder and runs

npm install dotfs --save

Use

To use DotFS, require it like this:

var df = require('dotfs')

You can use any variable for DotFS, but we're going to use df for our examples

Usage

Keywords

To begin with, there are 4 keywords you should know.

current ➡️ ➡️ ➡️ this keeps you in your current directory

back ➡️ ➡️ ➡️ this moves you back one directory

beginning ➡️ ➡️ ➡️ this brings you to the root of your directory

Your route must begin with ones of these keywords (for now). If DotFS doesn't find that your route starts with one of these keywords, it will fill in with a default. The default is set to beginning.

Folders 📁 📁 📁

Folders are supported in DotFS, but not entirely in Node, so be careful. The find function is really the only one you would want to use folders with.

To target a folder, end your path with .folder or if that's too much to type, just end it with .f

Example: df.find(current.path.example.f)

returns './path/example/'

Usage

Right now, DotFS has three functions: find, req, and log.

Find function

example : df.find('path.here')

Find will convert your path from DotFS notation to traditional path notation.

df.find('current.src.img.local.test.jpg');

returns './src/img/local/test.jpg'

Req function

example : df.req('path.here')

Req will require the file

df.req('back.back.style.mainApp.style.css');

returns require('../../style/mainApp/style.css');

Req basically does require(something) but in DotFS notation.

Log function*

example : df.log('path.here')

log console.logs the conents of the file you request

This will console log the contents of './current/next/folder/almost/there/setup.json'


Limitations

-As of 0.1.2 and below, you can only use absolute paths for df.req and df.log (fix coming soon)

-DotFS currently only supports the...translation of routes. Basically this means that your route might be easer to view/understand, but doesn't make it any quicker for you. We're working on create shorcuts right now, so that if you started your route with 'shorcut1', it would automatically reroute to '/path/to/shorcut1'.

-You have to use dot notation in quotes (sadly 😢) (for now)

Version history

0.1.2 -- Most current version - So, I found a bug 😞 -- using the df.req or df.log function would not work with relative paths because my code is trying to get that file from it's relative path. This includes some better error management for that. Fix coming soon!

0.1 - 0.1.1 Support for folders! 📁 📁 📁 Yay! Just end your path with .f or .folder

0.0.6 Includes new function called log. df.log('path') to console log the contents of the file;

0.0.5 - Working version. Includes find and req functions.

0.0.1 - 0.0.4 - Do not use DotFS with these versions. They don't do anything. 😀

Coming Soon

-Use relative paths for df.log and df.req

-Custom shortcuts

-Change phrases for back, current and beginning

-Maybe actually use dot notation instead of a string (probably not)

-Logic in the paths so back3 would return ../../../ instead of having to do back.back.back