✨ Send all files at start unless there is more files than the new argument limit
This commit is contained in:
+6
-5
@@ -3,7 +3,7 @@ const slug = require('slug')
|
||||
const Files = require('./files.js')
|
||||
const Chat = require('./chat.js')
|
||||
const JSZip = require('jszip')
|
||||
const glob = require('glob')
|
||||
const globby = require('globby')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
@@ -15,11 +15,11 @@ class Project
|
||||
this.config = _config
|
||||
this.path = _options.path
|
||||
this.watcherSocket = _options.watcherSocket
|
||||
this.exclude = _options.exclude
|
||||
|
||||
this.setName(_options.name)
|
||||
this.setSocket()
|
||||
|
||||
this.excludeRegex = new RegExp(_options.excludeRegex)
|
||||
this.zipNeedsUpdate = true
|
||||
this.files = new Files(this.config, { projectSocket: this.projectSocket })
|
||||
this.chat = new Chat(this.config, { slug: this.slug, watcherSocket: this.watcherSocket })
|
||||
@@ -71,9 +71,10 @@ class Project
|
||||
}
|
||||
|
||||
// Search files with glob
|
||||
const files = glob.sync(this.path + '/**', { dot: true })
|
||||
const globPattern = ['**', ...this.exclude.map((item) => `!${item}`)]
|
||||
const files = globby.sync(globPattern, { dot: true })
|
||||
|
||||
// // Create a zip file
|
||||
// Create a zip file
|
||||
const zip = new JSZip()
|
||||
|
||||
// Add files to zip
|
||||
@@ -82,7 +83,7 @@ class Project
|
||||
const stats = fs.lstatSync(_file)
|
||||
|
||||
// Ignore if folder or exluded
|
||||
if(stats.isFile() && !_file.match(this.excludeRegex))
|
||||
if(stats.isFile())
|
||||
{
|
||||
const basename = path.basename(_file)
|
||||
const relativePath = _file.replace(basename, '').replace(this.path, '')
|
||||
|
||||
Reference in New Issue
Block a user