Skip to content

Comments

Fix to include only package.json in the source directory#274

Merged
DeviaVir merged 2 commits intomotdotla:masterfrom
abetomo:bugfix_exclude_package_json
May 11, 2017
Merged

Fix to include only package.json in the source directory#274
DeviaVir merged 2 commits intomotdotla:masterfrom
abetomo:bugfix_exclude_package_json

Conversation

@abetomo
Copy link
Contributor

@abetomo abetomo commented May 10, 2017

#272

I restricted package.json, but is there any adverse effect you are concerned about?

fs.mkdirsSync(path.join('__unittest', 'hoge'));
fs.mkdirsSync(path.join('__unittest', 'fuga'));
fs.writeFileSync(path.join('__unittest', 'hoge', 'piyo'));
fs.writeFileSync(path.join('__unittest', 'hoge', 'package.json'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/main.js Outdated
dereference: true, // same meaning as `-L` of `rsync` command
filter: function (src, dest) {
if (!program.prebuiltDirectory && path.basename(src) == 'package.json') {
if (!program.prebuiltDirectory && src == path.join(srcAbsolutePath, 'package.json')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

===?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


// include package.json unless prebuiltDirectory is set
var includeArgs = program.prebuiltDirectory ? '' : '--include package.json ';
var includeArgs = program.prebuiltDirectory ? '' : '--include /package.json ';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure, but the / would make the path invalid, or no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The include and exclude options of rsync are complicated, so I can not explain the exact behavior, but the result was as follows.

src directory

% pwd
/tmp/test
% find /tmp/test -type f
/tmp/test/package.json
/tmp/test/foo/package.json

exclude='foo/*'

include='package.json'

% rm -rf /tmp/bar; rsync -rL --include='package.json' --exclude='foo/*' /tmp/test /tmp/bar
% find /tmp/bar -type f
/tmp/bar/test/package.json
/tmp/bar/test/foo/package.json

include='/package.json'

% rm -rf /tmp/bar; rsync -rL --include='/package.json' --exclude='foo/*' /tmp/test /tmp/bar
% find /tmp/bar -type f
/tmp/bar/test/package.json

exclude='foo'

include='package.json'

% rm -rf /tmp/bar; rsync -rL --include='package.json' --exclude='foo' /tmp/test /tmp/bar  
% find /tmp/bar -type f
/tmp/bar/test/package.json

include='/package.json'

% rm -rf /tmp/bar; rsync -rL --include='/package.json' --exclude='foo' /tmp/test /tmp/bar
% find /tmp/bar -type f
/tmp/bar/test/package.json

Copy link
Collaborator

@DeviaVir DeviaVir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@DeviaVir DeviaVir merged commit b558c3b into motdotla:master May 11, 2017
@abetomo abetomo deleted the bugfix_exclude_package_json branch May 11, 2017 07:33
@DeviaVir DeviaVir mentioned this pull request Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants