Giter Club home page Giter Club logo

Comments (2)

RIP21 avatar RIP21 commented on August 23, 2024 1

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.

harrysolovay avatar harrysolovay commented on August 23, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.