Comments (3)
Hey @buremba, that's a good idea really, and can inspire for more ideas around that. Unfortunately this is not planned in our roadmap due to limitations on SAO. We use SAO for compiling the templates in the files and moving etc and it does not support such dynamic structure. (I guess it won't be because its archived already by the owner of the project
Still, I think we can do a workaround here, we already have extend.js
for the plugins which allows them to pass conditional values and ignore files conditionally.
We can add some field like files
with type Array<{ path: string; filename: string; content: string; encoding: string; }>
which can be created dynamically by the answers to the prompts.
Then, we should create those files inside the plugin file (already stored in a temporary directory after cloning). This way we can trick SAO to handle those files like the regular plugin files (compiling and moving to the target).
As the result, we can create files dynamically.
While doing so, we might need to check and update our code for handling prompts, for dynamic files we might want to support wider range of prompt types
Currently, this is not planned but hypothetically it looks like something achievable
from superplate.
Thanks for the quick answer @aliemir! I understand the limitation and I feel like this is not Refine/Superplate's focus and the solution that you suggested makes sense.
What would you think about implementing something more generic such as a post_hook
in ArrayPromptOptions
? It can be a function with the following signature:
{ choice: Choice; path: string; }
Superplate can call this callback function/hook when the user selects a choice and the template files are generated automatically. That way, the post_hook
can generate files or do something else as it's just a function. My assumption is that this is easier to implement and also generic enough to cover different use cases. WDYT?
from superplate.
Hey @buremba sorry for the late response post_hook
is a better generic to handle post_hook
to enable wider range of use cases maybe? (Just thinking out loud
Thanks again for the issue, I'll definitely try to spare some time for this. This can provide a great flexibility to plugins
from superplate.
Related Issues (20)
- Tailwind 3 support HOT 3
- Issue with storybook
- Type Error on Project Build HOT 3
- sudo not working.
- Error while bootstrapping application with superplate-cli HOT 5
- ERROR SAOError: Failed to install packages HOT 7
- pm is not defined HOT 1
- Test suite failed to run Cannot find module '@test' HOT 1
- Firebase Support
- Not able to generate CRA project HOT 1
- superplate-cli has encountered an error when refine-nextjs HOT 3
- Error installing/creating refine chakra nextjs example HOT 2
- Login method of the AuthProvider when creating a refine project using the CLI HOT 1
- can't download any packages with refine HOT 16
- Cannot find module './package.json'
- ERROR ReferenceError: ejs:51 HOT 2
- Add support for material ui HOT 2
- Bad format of package.json commands HOT 2
- is this boilerplate suitable to make npm library or npm packages in react js HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superplate.