Giter Club home page Giter Club logo

Comments (5)

kentcdodds avatar kentcdodds commented on June 7, 2024 1

Hmmm, that could get really annoying. Let's just document it and let people do whatever you want. I'm good to accept a PR for this. The relevant code is here and here. I think that we should probably have an intermediary function that we call there which will look up the pre/post scripts for the given script. Here are a few variations of what should work I think:

{
  prefoo: 'echo prefoo', // thinking I'd be ok without this one...
  foo: 'echo foo',
  postfoo: 'echo postfoo', // and this one... I think if you want pre/post, make in an object with pre/post. Thoughts?
  bar: {
    pre: 'echo prebar',
    default: 'echo bar',
    post: 'echo postbar',
  },
  baz: {
    default: {
      pre: 'echo prebaz',
      script: 'echo baz',
      post: 'echo postbaz',
    },
    foobar: {
      pre: 'echo prefoobar',
      script: 'echo foobar',
      post: 'echo postfoobar',
    }
  }
}

from nps.

kentcdodds avatar kentcdodds commented on June 7, 2024

One thing I'd be worried about is people would expect things to work the same way that normal lifecycle hooks work (like install). So someone may try to make a prepublish script expecting it to run when they run npm publish but it wouldn't. Any ideas of how to combat that?

from nps.

DavidWells avatar DavidWells commented on June 7, 2024

Hmmmm perhaps for odd cases like that we console.log a warning if they have one of 'wierd' npm script commands.

warning 'commandXYZ' won't run like npm scripts. See issue [link to long npm github thread]

I can't remember which work not how you'd expect. I'm sure you do though =)

from nps.

rrag avatar rrag commented on June 7, 2024

@kentcdodds

I think if you want pre/post, make in an object with pre/post. Thoughts?

I agree

I want to sign up for this, but here is a change I wish to propose. Thoughts?

{
    prefoo: 'echo prefoo', // thinking I'd be ok without this one...
    foo: 'echo foo',
    postfoo: 'echo postfoo', // and this one... I think if you want pre/post, make in an object with pre/post. Thoughts?
    bar: {
      pre: 'echo prebar',
-     default: 'echo bar',
+     script: 'echo bar',
      post: 'echo postbar',
    },
    baz: {
      default: {
        pre: 'echo prebaz',
        script: 'echo baz',
        post: 'echo postbaz',
      },
      foobar: {
        pre: 'echo prefoobar',
        script: 'echo foobar',
        post: 'echo postfoobar',
      },
    },
  }

from nps.

kentcdodds avatar kentcdodds commented on June 7, 2024

We've decided to not do this. See #83 for more info.

from nps.

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.