{"id":13064,"library":"dekko","title":"Dekko File System Structure Validator","description":"Dekko is a utility designed to validate the output file and directory structure of front-end build or compilation processes. It provides a chainable, assertion-based API to programmatically check for the existence of files or directories, and their types, often used as part of continuous integration (CI) pipelines to prevent malformed or missing assets from being deployed. The package's latest version is 0.2.1, last published in 2016. Due to its age and lack of updates, it is considered abandoned. It differentiates itself by offering a concise, fluid API for defining file system expectations, integrating with Node.js's `glob` for pattern matching.","status":"abandoned","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/benjycui/dekko","tags":["javascript","test","assert","directory","file","structure"],"install":[{"cmd":"npm install dekko","lang":"bash","label":"npm"},{"cmd":"yarn add dekko","lang":"bash","label":"yarn"},{"cmd":"pnpm add dekko","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally for pattern matching in the main `$` function.","package":"glob","optional":false}],"imports":[{"note":"Dekko uses CommonJS `require` syntax and does not officially support ESM imports. Given its abandoned status, an ESM version is unlikely.","wrong":"import $ from 'dekko';","symbol":"$","correct":"const $ = require('dekko');"},{"note":"The primary export is a function (`$`) which returns a chainable object. Direct instantiation is not intended.","wrong":"dekko('path').isDirectory();","symbol":"Dekko object methods","correct":"$('path').isDirectory().hasFile('file.js');"}],"quickstart":{"code":"const $ = require('dekko');\nconst fs = require('fs');\nconst path = require('path');\n\n// Create a dummy 'dist' directory for demonstration\nconst distPath = path.join(__dirname, 'dist');\nconst libJsPath = path.join(distPath, 'lib.js');\nconst libMinJsPath = path.join(distPath, 'lib.min.js');\n\nif (!fs.existsSync(distPath)) {\n  fs.mkdirSync(distPath);\n}\nfs.writeFileSync(libJsPath, '// library code');\nfs.writeFileSync(libMinJsPath, '// minified library code');\n\ntry {\n  // Assert that 'dist' is a directory and contains specific files\n  $('dist')\n    .isDirectory()\n    .hasFile('lib.js')\n    .hasFile('lib.min.js');\n\n  // Demonstrate a custom assertion\n  $('dist/lib.js').assert('lib.js should not be empty', (filename) => {\n    const content = fs.readFileSync(filename, 'utf8');\n    return content.length > 10;\n  });\n\n  console.log('All dekko assertions passed successfully!');\n\n  // Clean up dummy directory\n  fs.unlinkSync(libJsPath);\n  fs.unlinkSync(libMinJsPath);\n  fs.rmdirSync(distPath);\n\n} catch (error) {\n  console.error('Dekko assertion failed:', error.message);\n  // Clean up dummy directory even if an error occurs\n  if (fs.existsSync(libJsPath)) fs.unlinkSync(libJsPath);\n  if (fs.existsSync(libMinJsPath)) fs.unlinkSync(libMinJsPath);\n  if (fs.existsSync(distPath)) fs.rmdirSync(distPath);\n  process.exit(1);\n}\n","lang":"javascript","description":"This quickstart demonstrates how to use `dekko` to verify a build output directory. It creates a mock `dist` folder, asserts its existence and content, then performs a custom assertion on file size, logging success or failure."},"warnings":[{"fix":"For new projects, consider modern alternatives. If using in an existing CJS project, no fix is strictly needed, but be aware of its unmaintained status. For ESM projects, you might need dynamic `import()` or a build step to handle CJS modules.","message":"Dekko is an abandoned package, with its last commit in 2016 and version 0.2.1. It uses CommonJS modules (`require`) exclusively, which is incompatible with modern ESM-only Node.js projects without a transpilation step or specific `type: 'module'` configurations.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Wrap `dekko` assertions in a `try...catch` block if you need to handle failures gracefully without stopping the process, or ensure your CI environment expects and acts on non-zero exit codes.","message":"By design, `dekko` throws an error and stops execution if any assertion fails. While useful for CI, this can halt scripts unexpectedly if not properly caught or if assertions are not met.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Evaluate the risk of using unmaintained software in your project. If security or future compatibility is a concern, migrate to a actively maintained file system assertion library.","message":"As an unmaintained project, `dekko` will not receive updates for security vulnerabilities, bug fixes, or compatibility with newer Node.js versions or file system behaviors. Its dependency `glob` also evolves, and `dekko`'s embedded version or usage might become outdated.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure the `pattern` argument passed to `$` accurately reflects existing files or directories. Double-check paths and glob syntax.","cause":"The initial `$(pattern)` call did not find any files or directories matching the provided glob pattern.","error":"Error: No items matched the pattern: 'non-existent-dir'"},{"fix":"Apply `.isDirectory()` only to patterns or items expected to be directories. Use `.isFile()` for files, or adjust your glob pattern to target directories specifically.","cause":"The `.isDirectory()` method was called on an item that is a file, not a directory.","error":"Error: Item is not a directory: /path/to/some/file.js"},{"fix":"Verify that the `name` provided to `.hasFile()` matches an existing file within the target directory. Check for typos or incorrect casing.","cause":"The `.hasFile(name)` method was called on a directory that does not contain a sub-file with the specified `name`.","error":"Error: Directory does not contain file: expected-file.txt"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}