1.0.5 • Published 7 years ago

babel-transform-dir v1.0.5

Weekly downloads
20
License
MIT
Repository
github
Last release
7 years ago

Build Status

babel-transform-dir

Transforms javascript files within a directory by babel, and expose a Promise API.

Install

$ npm install babel-transform-dir --save

Usage

|-- lib/   # empty
|-- src/
|     |-- a.js
|     |-- b.js
|-- .babelrc
const transform = require('babel-transform-dir')

// Transform all javascript files in `./src` and write the result to `./lib`
transform('./src', './lib')
.then(() => {
  console.log('done')
})

// Or explicitly specify babel config
readJson('./.babelrc')
.then((babel_config) => {
  return transform('./src', './lib', {
    babel: babel_config,
    // Invokes whenever a file is transformed and written.
    onFile: (file) => {
      console.log(`src/${file} -> lib/${file}`)
    }
  })
})
.then(() => {
  console.log('done')
})

// src/a.js -> lib/a.js
// src/b.js -> lib/b.js
// done

License

MIT

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago