Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

broccoli-file-creator

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broccoli-file-creator - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

63

index.js
'use strict';
var fs = require('fs');
var path = require('path');
var Plugin = require('broccoli-plugin');
var mkdirp = require('mkdirp');
const fs = require('fs');
const path = require('path');
const Plugin = require('broccoli-plugin');
const mkdirp = require('mkdirp');
module.exports = Creator;
Creator.prototype = Object.create(Plugin.prototype);
Creator.prototype.constructor = Creator;
module.exports = function(filename, content, options) {
return new Creator(filename, content, options);
};
function Creator (filename, content, _options) {
var options = _options || {
encoding: 'utf8'
};
class Creator extends Plugin {
constructor (filename, content, _options) {
const options = _options || {
encoding: 'utf8'
};
if (!(this instanceof Creator)) {
return new Creator(filename, content, options);
}
super([], {
annotation: options.annotation || constructor.name + filename,
persistentOutput: true
});
Plugin.call(this, [/* no inputTrees */], {
annotation: options.annotation || this.constructor.name + ' ' + filename,
persistentOutput: true
});
this.content = content;
this.filename = filename;
this.fileOptions = options;
delete options.annotation;
this._built = false;
}
this.content = content;
this.filename = filename;
this.fileOptions = options;
build() {
if (this._built) {
return;
}
this._built = false;
}
const outputFilePath = path.join(this.outputPath, this.filename);
mkdirp.sync(path.dirname(outputFilePath));
fs.writeFileSync(outputFilePath, this.content, this.fileOptions);
Creator.prototype.build = function () {
if (this._built) {
return;
this._built = true;
}
};
var outputFilePath = path.join(this.outputPath, this.filename);
mkdirp.sync(path.dirname(outputFilePath));
fs.writeFileSync(outputFilePath, this.content, this.fileOptions);
this._built = true;
};
module.exports.Class = Creator;
{
"name": "broccoli-file-creator",
"version": "1.2.0",
"version": "2.0.0",
"description": "Broccoli plugin to create a file.",

@@ -32,3 +32,6 @@ "main": "index.js",

"rimraf": "~2.2.6"
},
"engines": {
"node": "^4.5 || 6.* || >= 7.*"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc