Skip to content

Node.js CLI to create pathmap index module from directory structure

Notifications You must be signed in to change notification settings

pentamania/dimic

Repository files navigation

dimic

Node.js CLI to create pathmap index module from directory structure.

From

|-src
  |-assets
    |- font
      |- aldrich.woff
    |- image
      |- player.png
      |- enemy.png

👇 To

// src/assets/index.js
import mod_0 from "./font/aldrich.woff";
import mod_1 from "./image/player.png";
import mod_2 from "./image/enemy.png";
export default {
  font: {
    aldrich: mod_0,
  },
  image: {
    player: mod_1,
    enemy: mod_2,
  },
};

Requirements

Node.js v10.10.0+

Install

npm install dimic -g

Usage

dimic [--options]

Options

Change input(target) directory

dimic -i public/static

Default input directory is src/assets/, but you can change this by --input-dir (-i in short) option.

Change output file name

dimic -o index.ts

Default output file name is index.js, but you can change this by --output-file (-o in short) option.

Watch changes
dimic --watch

Add this option if you want to output file in accordance with directory change. (-w in short)

Filter files

dimic --match *

You can filter files/directories to be mapped by adding --match option.
Use glob pattern to set value.

Default is !_*, which means files/dirs starting from "_" are ignored.

Development

Test

npm run test

About

Node.js CLI to create pathmap index module from directory structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published