Giter VIP home page Giter VIP logo

broccoli-file-creator's Introduction

Broccoli's File Creator

Build Status

Usage

Create a file named app/main.js with "some content goes here":

let writeFile = require('broccoli-file-creator');
let tree = writeFile('/app/main.js', 'some content goes here');

Documentation

writeFile(filename, content, fileOptions)


filename {String}

The path of the file to create.


content {String|Function|Promise}

The contents to write into the file.

writeFile('filename.txt', 'the-content');
writeFile('filename.txt', Promise.resolve('the-content'));
writeFile('filename.txt', () => 'the-content');
writeFile('filename.txt', () => Promise.resolve('the-content'));

note: If a function is provided, it will only be invoked once, on first build

ZOMG!!! TESTS?!?!!?

I know, right?

Running the tests:

npm install
npm test

License

This project is distributed under the MIT license.

broccoli-file-creator's People

Contributors

locks avatar rwjblue avatar stefanpenner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

broccoli-file-creator's Issues

Writing to deep nested file path throws error.

It happens in the test case too.

I modified the test case to writeFile('/deep/nested/something.js', content) and got this error:

  1) broccoli-file-creator creates the file specified:
     ENOENT: no such file or directory, symlink '/Users/mliu/Workspace/broccoli-file-creator/tmp/creator-cache_path-xjz8jf1O.tmp/deep/nested/something.js' -> '/Users/mliu/Workspace/broccoli-file-creator/tmp/creator-output_path-YgYkUrGV.tmp/deep/nested/something.js'
  Error: ENOENT: no such file or directory, symlink 'tmp/creator-cache_path-xjz8jf1O.tmp/deep/nested/something.js' -> '/Users/mliu/Workspace/broccoli-file-creator/tmp/creator-output_path-YgYkUrGV.tmp/deep/nested/something.js'
      at Error (native)
      at Object.fs.symlinkSync (fs.js:902:18)
      at symlink (node_modules/symlink-or-copy/index.js:82:14)
      at symlinkOrCopySync (node_modules/symlink-or-copy/index.js:58:5)
      at linkFromCache (index.js:43:3)
      at Creator.build (index.js:31:3)
      at node_modules/broccoli-plugin/read_compat.js:61:34
      at lib$rsvp$$internal$$tryCatch (node_modules/rsvp/dist/rsvp.js:493:16)
      at lib$rsvp$$internal$$invokeCallback (node_modules/rsvp/dist/rsvp.js:505:17)
      at node_modules/rsvp/dist/rsvp.js:1001:13
      at lib$rsvp$asap$$flush (node_modules/rsvp/dist/rsvp.js:1198:9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.