Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if .apifyignore exists, use it instead of .gitignore #172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class PushCommand extends ApifyCommand {
const filePathsToPush = await getActorLocalFilePaths();
const filesSize = await sumFilesSizeInBytes(filePathsToPush);

outputs.info('Local files size is: ' + filesSize);
outputs.info('Local files to be pushed: ' + filePathsToPush);

let sourceType;
let sourceFiles;
let tarballUrl;
Expand Down
28 changes: 23 additions & 5 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,29 @@ const createSourceFiles = async (paths) => {
* Get actor local files, omit files defined in .gitignore and .git folder
* All dot files(.file) and folders(.folder/) are included.
*/
const getActorLocalFilePaths = () => globby(['*', '**/**'], {
ignore: ['.git/**'],
gitignore: true,
dot: true,
});
const getActorLocalFilePaths = () => {

let opt;

if (fs.existsSync('.apifyignore')) {
info('Using .apifyignore for ignore list.');
const ignorelist = fs.readFileSync('.apifyignore', 'UTF-8').split(/\r?\n/).filter( (line) => line !== '');
opt = {
ignore: ['.git/**', ...ignorelist],
gitignore: false,
dot: true,
}

} else {
info('Using .gitignore for ignore list.');
opt = {
ignore: ['.git/**'],
gitignore: true,
dot: true,
}
}
return globby(['*', '**/**'], opt)
};

/**
* Create zip file with all actor files specified with pathsToZip
Expand Down