Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dekko

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dekko

To test whether files and directory structure are valid.

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24K
decreased by-23.41%
Maintainers
1
Weekly downloads
 
Created
Source

dekko

npm package NPM downloads Dependency Status

Nowadays, front-end engineers need to build or compile their code before deploying or publishing. However, building/compiling is not as stable as we thought. Many factors will affect the output, such as configuration and our own code and even some dependencies. Some outputed file will be empty and even missing, so we need to check them before deploying/publishing.

It's inconvenient to check those files manually, so here comes dekko which is a tool to test whether outputed files or directory structure is valid.

Usage

npm i --save-dev dekko
const $ = require('dekko');

$('dist')
  .isDirectory()
  .hasFile('lib.js')
  .hasFile('lib.min.js');

API

$(pattern[, options]): Object

pattern and options in parameters are the same as glob's. If pattern doesn't match any files with the options, dekko will throw an error which will stop CI.

This function will return a dekko object with the following methods.

.isFile(): Object

If every item in dekko object is a file, nothing will happen. Otherwise, dekko will throw an error.

.isDirectory(): Object

If every item in dekko object is a directory, nothing will happen. Otherwise, dekko will throw an error.

.hasFile(name: string): Object

If every item in dekko object has a sub-file with this name, nothing will happen. Otherwise, dekko will throw an error.

.hasDirectory(name: string): Object

If every item in dekko object has a sub-directory with this name, nothing will happen. Otherwise, dekko will throw an error.

.assert(message: string, pred: Function): Object

Sometimes, built-in utility functions are not enough. Then we can use .assert, if every item in dekko object pass the pred function, nothing will happen. Otherwise, dekko will throw an error with message.

pred(filename: string): boolean

dekko will pass filename to pred one by one. true means that file is valid, and false means invalid.

.filter(cond): Object

.filter works like Array.prototype.filter, and it return a new dekko object with filtered items.

License

MIT

Keywords

FAQs

Package last updated on 12 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc