feat: build zip from local source - #100
Conversation
metalwarrior665
left a comment
There was a problem hiding this comment.
I think it is pretty close to done (if it works :) ) Just minor remarks
| export const isOutsideDir = (childPath: string, parentPath: string): boolean => | ||
| path.relative(parentPath, childPath).startsWith('..'); | ||
|
|
||
| export const collectFilePaths = async (rootDir: string, skipDirs: Set<string>): Promise<string[]> => { |
There was a problem hiding this comment.
Can we call git to get tracked (+ untracked in working fir) files instead of making our own func?
There was a problem hiding this comment.
Also maybe check what CLI does on apify push
There was a problem hiding this comment.
Yeah good idea with the git tracked. I implemented it. For apify cli I checked we are doing here pretty much the same, the only thing is not supported is actorignore.
| // | ||
| // Result: the collected root IS the Docker context, .actor/ is at that root, and | ||
| // all relative paths (dockerfile, dockerContextDir, changelog) are exactly one | ||
| // level up ("..") instead of three ("../../.."). |
There was a problem hiding this comment.
Uh, that's a lot of workarounding here but i guess no other way now with source files
We also need to keep the original .actor because some files will read from it, e.g. from '../actors/apify_instagram-scraper/.actor/input_schema.json'
There was a problem hiding this comment.
Yeah, flattenMonorepoContext always keeps the og .actor
metalwarrior665
left a comment
There was a problem hiding this comment.
Nice. There shouldn't be any potential breakage of existing code so if you tested this locally, I will just release it.
Closes #93
Closes #94
Adds a build-from-local CLI command that builds an Actor straight from local source files, no git push needed. Files are selected using git ls-files/check-ignore (so .gitignore rules apply automatically), and known secret-file patterns (.env, .pem, .key, etc.) are always dropped. Monorepo actors get their Docker context flattened into a temp dir first. Remaining files are read as text/base64 and uploaded as a SOURCE_FILES actor version, then built on the platform.
Tested locally using npm link