Skip to content

Commit

Permalink
switch dest to stream-composer and add logging to show bug
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed May 31, 2023
1 parent 78f4369 commit 1872d25
Show file tree
Hide file tree
Showing 7 changed files with 402 additions and 384 deletions.
5 changes: 3 additions & 2 deletions lib/dest/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var lead = require('lead');
var pumpify = require('pumpify');
var composer = require('stream-composer');
var mkdirpStream = require('fs-mkdirp-stream');
var createResolver = require('resolve-options');

Expand All @@ -27,11 +27,12 @@ function dest(outFolder, opt) {

function dirpath(file, callback) {
var dirMode = optResolver.resolve('dirMode', file);
console.log(file.dirname, dirMode);

callback(null, file.dirname, dirMode);
}

var saveStream = pumpify.obj(
var saveStream = composer.pipeline(
prepare(folderResolver, optResolver),
sourcemap(optResolver),
mkdirpStream(dirpath),
Expand Down
1 change: 1 addition & 0 deletions lib/dest/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function prepareWrite(folderResolver, optResolver) {
}

function normalize(file, cb) {
console.log('normalize', file);
if (!Vinyl.isVinyl(file)) {
return cb(new Error('Received a non-Vinyl object in `dest()`'));
}
Expand Down
1 change: 1 addition & 0 deletions lib/dest/sourcemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function sourcemapStream(optResolver) {
var srcMap = optResolver.resolve('sourcemaps', file);

if (!srcMap) {
console.log('no sourcemap')
return callback(null, file);
}

Expand Down
2 changes: 2 additions & 0 deletions lib/dest/write-contents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var fo = require('../../file-operations');
function writeContents(optResolver) {

function writeFile(file, callback) {
console.log('write file', file);
// Write it as a symlink
if (file.isSymbolic()) {
return writeSymbolicLink(file, optResolver, onWritten);
Expand Down Expand Up @@ -40,6 +41,7 @@ function writeContents(optResolver) {
// This is invoked by the various writeXxx modules when they've finished
// writing the contents.
function onWritten(writeErr) {
console.log('onWritten');
var flags = fo.getFlags({
overwrite: optResolver.resolve('overwrite', file),
append: optResolver.resolve('append', file),
Expand Down
2 changes: 2 additions & 0 deletions lib/dest/write-contents/write-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var getCodec = require('../../codecs');
var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING;

function writeBuffer(file, optResolver, onWritten) {
console.log('write buffer');
var flags = fo.getFlags({
overwrite: optResolver.resolve('overwrite', file),
append: optResolver.resolve('append', file),
Expand All @@ -31,6 +32,7 @@ function writeBuffer(file, optResolver, onWritten) {
fo.writeFile(file.path, contents, opt, onWriteFile);

function onWriteFile(writeErr, fd) {
console.log('write done', writeErr);
if (writeErr) {
return fo.closeFd(writeErr, fd, onWritten);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"is-valid-glob": "^1.0.0",
"lazystream": "^1.0.1",
"lead": "^4.0.0",
"pumpify": "^2.0.1",
"remove-bom-stream": "^2.0.0",
"resolve-options": "^2.0.0",
"stream-composer": "^1.0.0",
"streamx": "^2.13.2",
"to-through": "^3.0.0",
"value-or-function": "^4.0.0",
Expand Down
Loading

0 comments on commit 1872d25

Please sign in to comment.