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

Improve developper experience with scripts and migrations #494

Closed
LoicPoullain opened this issue Jul 26, 2019 · 7 comments
Closed

Improve developper experience with scripts and migrations #494

LoicPoullain opened this issue Jul 26, 2019 · 7 comments

Comments

@LoicPoullain
Copy link
Member

LoicPoullain commented Jul 26, 2019

Previous issue name: Make "foal run" build and run the script

Issue

As mentioned in #467, in development, it is tedious to always have to run npm run build:scripts before foal run xxx.

Solution

Add a configuration key settings.scripts.autoBuild which, when set to true, tells the foal run command to build the script before.

This behavior could be override with the flag --no-build (note: update the three foal run create-user in the tutorial).

foal run --no-build my-script

Each new project will have a .env file with the configuration set to true.

SETTINGS_SCRIPTS_AUTO_BUILD=true

Since this file is not commited, the command foal run won't try to build the scripts on deployed servers.

@LoicPoullain LoicPoullain added this to Backlog in Issue tracking via automation Jul 26, 2019
@LoicPoullain LoicPoullain moved this from Backlog to To Do This Release (August) in Issue tracking Jul 26, 2019
@LoicPoullain
Copy link
Member Author

LoicPoullain commented Jul 26, 2019

Actually we have the same problem with the migrations:

npm run build:app
# Generate the migration file based on the entities changes
npm run migration:generate -- -n name-of-this-migration
# Build the migration files
npm run build:migrations

@LoicPoullain
Copy link
Member Author

Maybe the simpler solution could be to just extend the npm run develop command to the directory scripts and migrations. So the scripts and migrations will be compiled each time a file is changed.

This would also remove tsconfig files (tsconfig.migrations.json and tsconfig.scripts.json).

@LoicPoullain LoicPoullain mentioned this issue Jul 29, 2019
8 tasks
@LoicPoullain LoicPoullain moved this from To Do This Release to Backlog in Issue tracking Nov 25, 2019
@opensas
Copy link
Contributor

opensas commented Feb 7, 2020

Yeap, I agree, I can't think about a case in which I would NOT want the compiled js files to be overwritten. build folder should sctrictly be the product of the rest of the files, so it should always be ok to prune it and regenerate it from sources.
Do you have different tsconfig.xxx.json files just to make it faster? In that case you might consider (and benchmark) using tsc incremental option.

@LoicPoullain
Copy link
Member Author

LoicPoullain commented Feb 7, 2020

Do you have different tsconfig.xxx.json files just to make it faster? In that case you might consider (and benchmark) using tsc incremental option.

Yes the first idea of having three separate tsconfig for the migrations, scripts and application was to make the compilation faster. But I'm not sure this is really true since scripts and migrations do not contain a ton of files. I have in mind to merge these three config files into a single one in Foal version 2 (this year) and so have a single command npm run develop to build the app, scripts and migrations in watch mode.

This would simplify user experience IMO

@opensas
Copy link
Contributor

opensas commented Feb 11, 2020

It would be great to have an out of the box solution for recompiling a ts app as fast as possible in dev mode, there are many options available
On the other hand, it's great to know a version 2 is on the way. I hope you can find some time to tell us your experience developing version1 and your plans for the next version. FInding a way to get feedback from the community about what features they would like to have in foal 2 would be great too
keep up the good work!

@LoicPoullain LoicPoullain changed the title Make "foal run" build and run the script Improve developper experience with scripts and migrations Feb 18, 2020
@LoicPoullain
Copy link
Member Author

@opensas yes I have a draft that describes version 2. I'll open an issue on this when I'll get a chance. The main idea of v2 will be to remove some hacky solutions and technical debts that require some breaking changes.

@LoicPoullain
Copy link
Member Author

Feature added in v2 (version will be released in the summer).

Issue tracking automation moved this from Work In Progress to Done / Closed This Release May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Issue tracking
  
Done / Closed This Release
Development

No branches or pull requests

2 participants