-
Notifications
You must be signed in to change notification settings - Fork 43
Feature: consider moving js-client deploy logic to the CLI #157
Comments
💯 |
Doing this would also allow for better error handling as we could |
Please don't - I want to use the deploy logic of this library within my own application but NOT depend on netlify-cli. I'm running within a cramped VM with 200 MB diskspace (using https://glitch.com), so could NOT use netlify-cli, because installing that package downloads 75MB (mostly due to typescript - Why?!):
Top 5 package sizes in netlify-dev:
That TypeScript is big, ok, but I just see that there is actually the same problem with the current And about netlify-cli, it even downloads all versions of the traffic-mesh-agent (windows, linux, osx), another whooping 90MB! By the way... just looked up the actual implementation of trimStart(): 'use strict';
var callBind = require('es-abstract/helpers/callBind');
var replace = callBind(String.prototype.replace);
/* eslint-disable no-control-regex */
var startWhitespace = /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*/;
/* eslint-enable no-control-regex */
module.exports = function trimStart() {
return replace(this, startWhitespace, '');
}; trimEnd(): 'use strict';
var callBound = require('es-abstract/helpers/callBound');
var $replace = callBound('String.prototype.replace');
/* eslint-disable no-control-regex */
var endWhitespace = /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]*$/;
/* eslint-enable no-control-regex */
module.exports = function trimEnd() {
return $replace(this, endWhitespace, '');
};
Combine those two and you are under 200 bytes:-) It is a crazy world.... |
Thanks for your input @svdoever. See more about package size here netlify/cli#494 |
Currently, CLI works with two instances of Moving the bundling logic to CLI would consolidate them into one, while at the same time simplifying the |
Potentially related: #229 |
This logic has now been moved to the CLI. We now need to remove the logic from this package and release a new major version. |
How we we call the
|
Hi @South-Paw, would spawning the CLI as an external process work? const execa = require('execa');
const { stdout } = await execa.command('netlify deploy', { preferLocal: true });
// do something with stdout You can also pass If that doesn't cover your use case, can you please open a feature request on the CLI repo? |
Hi @erezrokah, thank you for the reply. I'm unsure if spawning a process for the deployment suits the use case? The deploy is in the middle of a GitHub action which also manages the Netlify deploy messages, comments on the PR/Commit, creating GitHub deploy environments. Ideally the action's code would handle all this, so I'd like to avoid spawning new processes to keep the GitHub action's runtime down. Any advice would be appreciated, I'm more than happy to open a feature request if that's the next best step. |
Hi @South-Paw, I actually think using the CLI would provide a better experience. Users won't need to configure You can pass a As for the performance considerations - I think the time it takes to spawn the process should be negligible compared to the time it takes to deploy, but if you experience otherwise it would be great if you can share it. |
I'm trying to figure out how to use the cli in a GitHub action. It's not straightforward, because GitHub says that actions should not rely on any other binaries that aren't preinstalled in their worker boxes. Do you have any ideas, @erezrokah? I think you're right that using the automatic resolution features of the cli would be nice, I'm just not sure how to bundle the cli along with my JavaScript action (I don't want to use a docker action in my situation). |
Hi @IanVS, you can install the CLI as a regular dependency, e.g. via |
Thanks @erezrokah. Do you have any suggestions for bundling a binary out of node_modules into an executable? I've tried https://github.com/vercel/pkg and https://github.com/vercel/ncc without luck so far. Edit: pkg almost worked, but the resulting file is too large for git. I think this approach of bundling the cli is not really a great solution, but I'll keep playing with it. One reason it's difficult is that lazy imports are being used, which aren't being bundled correctly by ncc, and I'm not sure any bundler really can bundle them if they're not static imports. It's a shame that https://github.com/netlify/actions seems to be a dead project with outdated docker files. I'm thinking that there's no good way to build a netlify github action without docker now that deploy has been removed from the js client. And docker actions only run on linux and are slower than javascript actions. |
Yeah, echoing a lot of what I've found after switching over to using netlify/actions @IanVS instead of South-Paw/action-netlify-deploy. The readme's are also out of date, PRs that update them haven't been merged and there are typo's in the scripts and bugs & gaps in the action outputs to top it off! 😆 The netlify/actions & netlify/cli add about 1-2 mins of extra time to an action because they have to build themselves in the workflow every run instead of being packaged and ready to roll as the JavaScript actions that used It would be super to see the Netlify actions repo get some love from the Netlify team (including publishing them to the GH marketplace) OR it would be just as great to have a better replacement for the removal of the |
Hey everyone - I'm just commenting here to see if anyone can point me in the right direction because I went down a rabbit hole this afternoon full of dead ends and this thread affirmed why I was hitting issues (netlify/actions abandoned with bugs, the js client dropping support for deploys). I have a situation where I have a GitHub action that is manually triggered and creates new repositories from a template. I'd like to add another action which piggybacks off that and programmatically sets up a new site in Netlify for those newly created repos. So I don't have a site ID, I want Netlify to just setup the site at a randomly named url via the GitHub action and then I'll put that url in the repo's readme. Anyone have any suggestions on what the best approach is with current Netlify tooling? Thanks! |
At the moment most of the CLI deploy command logic in handled by the
js-client
:js-client/src/deploy/index.js
Line 42 in 9d3945c
This seems out of place for a client that should be wrapping our open-api spec.
Also, it prevents this client from being browser compatible.
It might makes sense to move that logic to the CLI, since we're already implementing some deploy logic in the CLI as a part of edge handlers:
netlify/cli#1244
The text was updated successfully, but these errors were encountered: