Skip to content

Conversation

@mkucharz
Copy link
Member

Fix #128

Adding .syncanoignore support in src folder.

@mkucharz mkucharz self-assigned this Feb 13, 2018
@mkucharz mkucharz merged commit 0c8678b into master Feb 13, 2018
@mkucharz mkucharz deleted the fix/uploading_src_files branch February 13, 2018 23:18
Copy link
Contributor

@adamwardecki adamwardecki left a comment

Choose a reason for hiding this comment

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

Please see the comments. Also, this file begs for splitting into smaller modules (aka little refactor ;)).

const fileNameWithPath = file.replace(`${this.getCompiledScriptsFolder()}`, '')
const remoteFile = this.remote.files ? this.remote.files[fileNameWithPath] : null

if (remoteFile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this do the trick?:

if (!remoteFile || (remoteFile && remoteFile.checksum !== md5(fs.readFileSync(file)))) {
  archive.file(file, { name: fileNameWithPath })
}

let ignore = []
try {
ignore = fs.readFileSync(`${this.getCompiledScriptsFolder()}/.syncanoignore`, 'utf8').split('\n')
} catch (err) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a debug log could go into the catch clause

const fileNameWithPath = file.fullPath.replace(`${this.getSrcFolder()}`, '')
debug(`Adding file to archive: ${fileNameWithPath}`)
archive.file(file.fullPath, { name: fileNameWithPath })
const fileNameWithPath = file.replace(`${this.getCompiledScriptsFolder()}`, '')
Copy link
Contributor

Choose a reason for hiding this comment

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

the getCompiledScriptsFolder is used 3 times in the createZip function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants