Skip to content

A collection of helpful JavaScript utility scripts.

Notifications You must be signed in to change notification settings

dalhaan/JavaScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

JavaScript

A collection of helpful JavaScript utility scripts.

  • pathsToAbsolute

pathsToAbsolute

Recursively converts relative path import statments to absolute paths for all descending files of a target directory (relative to the root directory).

Syntax

usage:
  node pathsToAbsolute.js <root directory> <target directory>
parameters:
  root directory - The root directory that imports will be relative to.
  target directory - The target directory.

Example

File structure

/
└─ users
   └─ dalhaan
      └─ project
         └─ src
            └─ components
               └─ MaskedInput
                  └─ index.js
               └─ Flow
                  └─ SignUp
                     └─ index.js
node pathsToAbsolute.js '/users/dalhaan/project/src' '/users/dalhaan/project/src/components'

Flow/SignUp/index.js

Before:

import { MaskedInput } from '../../../MaskedInput';
...

After:

import { MaskedInput } from 'components/MaskedInput';
...

About

A collection of helpful JavaScript utility scripts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published