saojs / sao

⚔ Futuristic scaffolding tool
https://sao.vercel.app
MIT License
1.05k stars 61 forks source link

Best approach for upgrading a template? #132

Open niftylettuce opened 5 years ago

niftylettuce commented 5 years ago

Let's say someone upgrades to a newer version of a CLI of Sao, e.g. lad (see https://github.com/ladjs/lad) via npm install -g lad@latest. They then want to upgrade their template. What would be the best approach? Just a git clone and then apply the diff between template directory and the user's project dir?

egoist commented 5 years ago

For an already generated project it's hard to upgrade automatically since you may have changed many files 🤔

niftylettuce commented 5 years ago

@egoist Maybe we do something like this https://react-native-community.github.io/upgrade-helper/?from=0.59.8&to=0.60.3? and https://facebook.github.io/react-native/docs/upgrading

Also https://github.com/react-native-community/cli/blob/48626dd239e01d9d060f0d47661013610a0dcd0a/packages/cli/src/commands/upgrade/upgrade.ts and https://github.com/react-native-community/cli/blob/48626dd239e01d9d060f0d47661013610a0dcd0a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.ts

niftylettuce commented 5 years ago

It would be incredible for sao to have a package (possibly one even built-in) that lets you do this by plugging the package into your CLI.

niftylettuce commented 5 years ago

This would be the BEST feature for Sao by far compared to ANY other template/scaffolding too.

niftylettuce commented 5 years ago

Also would gladly donate to you to help build something like this 😄

niftylettuce commented 5 years ago

I found your Patreon, now a supporter.

egoist commented 5 years ago

Thanks, I'll take a look at the react-native solution, this is definitely a missing feature for every scaffolding tool.

niftylettuce commented 4 years ago

Let me know!

shaunwarman commented 4 years ago

Codemods would work well. JSCodeShift is a solid tool. Good example usage with jest.

niftylettuce commented 4 years ago

Would be awesome to have this 🙌

niftylettuce commented 4 years ago

I am awarding a $200 bug bounty for this issue.

egoist commented 4 years ago

I will create a website like https://react-native-community.github.io/upgrade-helper to show the diffs between two versions of a generator

niftylettuce commented 4 years ago

@egoist Hey! I also shared this with @shaunwarman - but I think having a CLI tool like this would be great:

https://github.com/willmendesneto/update-yeoman-generator/blob/9946691c89a70a5916b929c7c2f38b26a9536445/lib/run.js

egoist commented 4 years ago

Yes, a separate CLI tool like that is also planned.

niftylettuce commented 4 years ago

Any update here @egoist ?

shaunwarman commented 4 years ago

Checking in again @egoist , I should have bandwidth to dive in and help, but unsure if you have some ideas / todos for this new CLI tool