-
Notifications
You must be signed in to change notification settings - Fork 3
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
Custom Tasks Workflow #4
Comments
Good ideas! It would be awesome if you could join to the conversation about Monterey integration here. Above proposals certainly have a place in that discussion. |
@zewa666 AnalyzerGathers basic information, such as ImportEngineConfigures and executes all available custom importer steps according to information defined by Example flow:
ImportBase (Custom workflows)Example implementation for metadata file processing. This runs first by default, and you can add any number of your own implementations as well. Built-in steps in execution order (it follows the format of metadata file.) (0. register)
Example for custom hooks:
Providers (Package Management)There is currently one integration with NPM. As I'm not sure how much it's going to be needed, it's been commented out by default in Installed
|
perfect, sounds like there is enough in place to continue experimenting with i18n. I'll come back to you with more insights |
Thanks. I've just sent out updates to github and npm. You can update to v.0.1.0 with npm as well. |
Ok so I gave the thing a bit of a look. So far looks good, yet I have some workflow understanding questions. So before your change I did expand "scripts": {
"install": [
"au i18n-setup"
]
} and placed a file So with your new changes we can actually skip this part right? I'd leave the registry entry without the script section. Then all I'd need to do is create a file class I18NImportHooks {
constructor() {}
executeScripts() {
// setup the main.js of the project here
}
}
module.exports = I18NImportHooks; What I'm not sure now is the following. I'd need a path reference relative to the users scaffolded app. So ideally the constructor could get some metadata injected. The injected meta could provide several info, one of them e.g the absolute path to the scaffolded projects root class I18NImportHooks {
constructor(meta) {
this.meta = meta;
}
executeScripts() {
// setup the main.js of the project here
var projectMainFile = this.meta.projectRoot + "/src/main.js";
}
} So overall did I get your idea right? If so that's great, because this way the registry file doesn't need to do anything besides stating the deps and helping pacman to find the plugin. Everything else can be completely done by the plugin itself without any Gulp tasks or whatever. |
That is correct. If you'd like to do that, you have the freedom to place all of your custom logic within The Example task: configures import, edits translation.json files
Import setup:
After importing package, we might want to use
I've updated ImportEngine to pass a We can extend this later to hold more information, if needed.
The It would normally look similar to this:
Applying above to the
I don't use
Absolutely! :) |
Perfect, great ideas and I'm currently working out my setup script. Prompting the user would be a really nice thing but the initial draft could already work without it. As soon as the setup thingy is done I'm gonna publish that to the plugins repo, as I do see so much value just by that alone. But yeah you had great ideas for tasks like adding new translations or import from existing files. |
Fantastic, I'm looking forward to see your setup in action!
I've looked into that how it is handled by aurelia-cli itself. Well, the good news is that I was able to use their built-in UI class in my experimental setup. I'll come up with some (hopefully) backward-compatible solution next week. |
I did it without breaking changes. Import steps still run in precise order, but they can return promises optionally. This change allows us to be able to pause the import process until a question is answered. There's a new CliBridge class, which is a placeholder for all aurelia-cli features needed in pacman. At this moment, ConsoleUI is the only feature available. ImportEngine has an instance of it, so import-hooks can have access to it. Putting it together, import-hooks could look like this:
I don't use it for built-in steps yet. There are 5 steps, so turning 5 questions on by default would be very annoying in my opinion. :D It might be a better fit for optional input requests (e.g. filename to save to), or choosing from multiple options. Maybe instead of changing |
thats great. So for me this issue can be closed since all things got addressed. Awesome work @martonsagi |
Thank you! |
There is so much overlap between what is done here and what will be done in aurelia-cli package importer that I would suggest to @zewa666 to continue watching the evolution of the aurelia-cli package importer. Since @EisenbergEffect is already participating, we should see a really cool addition to Aurelia. cc: @JeroenVinke |
So the ideal workflow for Aurelia-I18N together with Pacman would be to not only automatically wire up the
aurelia.json
file with its dependencies, but also initially allow the user to choose whether he wants hismain.js
file setup with the plugin initialization + other stuff.I've started playing with that by adding a custom
i18n-setup.js
task into the task folder and wiring up the script section inside the aurelia-i18n registry entry. This is a pretty cool idea btw, but here are some additional thoughts.Auto-detect tasks
It would be nice if during installation, Pacman could inspect the package, look for a specific folder, e.g. tasks, and use all files from in there, which are in a specific format --> e.g. task-[type].js =>
task-install.js
Dependencies
If we go the above mentioned path, the benefit would also be that the package itself can maintain all necessary dev-dependencies. Like in my case I'd need a
gulp-replace
dependency and currently I'd have to install it as part of Pacman, which would get quickly out of hand if everybody does that.Any other ideas how to handle this?
Prompted tasks
Maybe not every task should be executed immediately, so it would be nice to have a way to let the user confirm before execution. So thinking of that maybe the default could be that a generic prompt is always fired and a the user can silently agree to all of them by passing in an additional parameter. E.g.
au pacman i aurelia-i18n --q
--> q for quietScaffolding templates
During initialization of i18n, one part of the story would be to create a default translation file like
locales/en/translation.json
. It would be helpful to prepare said file as a template and just copy it to the target destination during the task run. How and where should those templates be placed. Again I think if we exclude the taskhandling from Pacman and let the package maintain it by itself, we wouldn't have to take care of it, as mentioned in the first point.Custom message
The install process nicely describes what is happening, but it would be great if at the end, each task could output a custom success/error message in order to let the user know what exactly happened.
Ok so a pretty long list, I don't mind if we split it up on several github issues if necessary, just wanted to check back with you first.
The text was updated successfully, but these errors were encountered: