broccoli-output-wrapper
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -20,3 +20,4 @@ "use strict"; | ||
'symlinkSync', | ||
'utimesSync' | ||
'utimesSync', | ||
'outputFileSync' | ||
]); | ||
@@ -41,2 +42,6 @@ function handleFs(target, propertyName, node, relativePath, ...fsArguments) { | ||
return symlinkOrCopySync(srcPath, outputPath); | ||
case 'outputFileSync': | ||
const content = fsArguments[0]; | ||
fsArguments.shift(); | ||
return fs_extra_1.outputFileSync(outputPath, content, ...fsArguments); | ||
case 'rmdirSync': | ||
@@ -43,0 +48,0 @@ if (fsArguments[0] && fsArguments[0].recursive) { |
{ | ||
"name": "broccoli-output-wrapper", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Output wrapper is a library to write output file to outputpath.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -26,2 +26,3 @@ # broccoli-output-wrapper | ||
We have polyfilled `recursive: true` option to perform a recursive directory removal. In recursive mode, errors are not reported if path does not exist, and operations are retried on failure. Default: false | ||
* [symlinkOrCopySync](https://github.com/broccolijs/node-symlink-or-copy#node-symlink-or-copy) | ||
* [symlinkOrCopySync](https://github.com/broccolijs/node-symlink-or-copy#node-symlink-or-copy) | ||
* [outputFileSync](https://github.com/jprichardson/node-fs-extra/blob/master/docs/outputFile-sync.md) |
import * as fs from 'fs'; | ||
import { isAbsolute, resolve } from 'path'; | ||
import { readFileSync, existsSync, readdirSync, lstatSync, statSync, writeFileSync, appendFileSync, rmdirSync, mkdirSync, symlinkSync, utimesSync } from 'fs'; | ||
import { removeSync } from 'fs-extra'; | ||
import { removeSync, outputFileSync } from 'fs-extra'; | ||
const symlinkOrCopySync = require('symlink-or-copy').sync; | ||
@@ -22,3 +22,4 @@ | ||
'symlinkSync', | ||
'utimesSync' | ||
'utimesSync', | ||
'outputFileSync' | ||
]); | ||
@@ -46,2 +47,6 @@ | ||
return symlinkOrCopySync(srcPath, outputPath); | ||
case 'outputFileSync': | ||
const content = fsArguments[0]; | ||
fsArguments.shift(); | ||
return outputFileSync(outputPath, content, ...fsArguments); | ||
case 'rmdirSync': | ||
@@ -48,0 +53,0 @@ if (fsArguments[0] && fsArguments[0].recursive) { |
@@ -37,3 +37,3 @@ const buildOutputWrapper = require('../src'); | ||
expect(() => output.writevSync('test.md', 'test')).to.throw( | ||
/^Operation writevSync is not allowed to use. Allowed operations are readFileSync,existsSync,lstatSync,readdirSync,statSync,writeFileSync,appendFileSync,rmdirSync,mkdirSync,unlinkSync,symlinkOrCopySync,symlinkSync,utimesSync$/ | ||
/^Operation writevSync is not allowed to use. Allowed operations are readFileSync,existsSync,lstatSync,readdirSync,statSync,writeFileSync,appendFileSync,rmdirSync,mkdirSync,unlinkSync,symlinkOrCopySync,symlinkSync,utimesSync,outputFileSync$/ | ||
); | ||
@@ -68,2 +68,7 @@ }); | ||
it('can create file with outputFileSync', function () { | ||
output.outputFileSync(`asset/test.md`, `test`); | ||
expect(output.readFileSync('asset/test.md', 'utf-8')).to.be.equal('test'); | ||
}); | ||
it(`should throw if the dir strutcture doesn't exist and attempt to write`, function() { | ||
@@ -70,0 +75,0 @@ expect(() => output.writeFileSync('test/test.md', 'test')).to.throw( |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14065
250
27