Comments (2)
Hehe. Quite obvious solution, my point was to make it as an executable so you can call like rescript format
but if it's impossible I'll consider a PR cause it would be neat thing :)
Calling stuff from scripts making it non reusable... Anyway I can create my own cli tool and make it to npm if so needed, anyway. I try to keep dependencies list as small as possible :)
Thanks for a quick response.
from rescripts.
@RIP21 thank you for the kind words!
In response to your question: yes and no. I'll explain:
You can't configure Rescripts to take in custom commands via the CLI (such as a rescripts format
command). If you want this functionality, I encourage you to PR the codebase 💯 what you can do is create a Rescript called format
which triggers the necessary code:
rescript-format.js
module.exports = config => {
format() // trigger the formatting
return config
}
... and then use that Rescript in your config:
module.exports = [
require.resolve('./path/to/rescript-format.js')
]
You can also tell the Rescript to spawn a new child process if your formatter is an executable.
My favorite solution though would be to move the formatting code into a scripts
folder, give it executable permissions, and trigger it directly from your package.json
. It's a more common pattern––plus––it makes it clear that it's not a built-in property of react-scripts
or rescripts
, and other developers working on your project can more easily locate the relevant code.
Please let me know if you have any more questions :)
from rescripts.
Related Issues (20)
- Compatibility with custom react-scripts forks HOT 1
- Show error output for rescript config errors HOT 3
- Global configuration not taken into account HOT 1
- Dev server hangs when trying to add another entry point HOT 4
- react-dev-utils need to be updated HOT 1
- .babelrc.js export function does not work HOT 3
- Adding ".babelrc" breaks typescript support in react HOT 1
- Allow react-scripts v4 without npm warning
- Typescript update to 4.X? HOT 1
- Install the last version of react-dev-utils to fix a vulnerability HOT 2
- No matching version for @rescripts/rescript-use-eslint-config dependency in @rescripts/rescript-env HOT 7
- How do I extend the jest config? HOT 1
- Setting a static name for the files generated by build HOT 2
- Webpack config HOT 4
- how to config webpack devServer' before(app) HOT 6
- PostCSS config not working HOT 1
- [Question] Multiple entry points + shared/common chunks howto example for noobs HOT 1
- Is there any way how to easily change paths? HOT 3
- How to add a devserver before or after hook? HOT 1
- How to get React Fast Refresh to work HOT 3
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 rescripts.