Closed phocks closed 1 year ago
^example screenshot when it finds an existing directory
Also aunty init
may need an ftp check (though it will be more difficult because we basically would have to tell the user to exit the generation process, change the directory name, and then try again).
ps. PR closes #105
Thanks @drzax these are really helpful and yep @colingourlay's help on this would be great too. I agree we should probably have it check at deploy and release time and just ask the user if they're sure they want to overwrite to the directory each time. I just had concerns because after a project is created and deployed for the 1st time, then the user will have to say Y (yes) they want to overwrite on every subsequent deploy/release.
I'm just spitballing here now having a think .... what if we generated a unique ID for each project when created and put it in the base directory or something, that way we could check that the remote unique ID matches the local unique ID on deploy/upload and then we wouldn't even really need to ask them every time. Would that work?
I would want it to check if the specific branch or tag I'm deploying already exists. So for most release
commands it wouldn't need to ask, but for a branch deploy it would ask on all but the first deploy, but I think that's good — branch deploys should be rare anyway.
Implemented a warning if the FTP check fails when generating a new project due to no network or no credentials.
⣾⢷⡾⢷⡾⣷ aunty
⢿⡾⢷⡾⢷⡿ generate project
? What is your project called? (New Project)
Error: getaddrinfo ENOTFOUND contentftp.abc.net.au
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'XXXXXXXXXXXXXXX'
}
Warning: Unable to check if project name already exists, most likely due to a connection or credentials error. Please check manually before deploying.
? What is your project called? New Project
? What type of project is it? (Use arrow keys)
❯ Basic
Preact
React
Svelte
Okay, I think this is pretty much ready to go. Simplified the process of getting credentials. Talked over all the functionality with @colingourlay
Tested and working.
Hi all, I'm going to open this PR as it basically works as is and could be merged, but I could maybe do with some feedback about developing it more and how to handle some edge cases, also as I'm not too familiar with Yeoman and all its user interaction stuff.
So what it does is this:
When a user generates a new project with
aunty new
it uses Yeoman's validate feature to run a function that lists the contents of the/www/res/sites/news-projects/
FTP directory and checks the folder names against the sluggified project name. If a match is found it doesn't let the user proceed and asks them to choose a different project name.So the edge cases are:
I guess my question is, what do we do when one of these errors happens. My feeling is that maybe we just console.log a warning that the FTP check failed and that there is a small possibility that the project already exists on the server, and then just leave it to the user to check manually or pray that it doesn't exist.
Keen to hear feedback.