title: How to know the directory from which a script is called?
body: <p>I'm running a script defined in my <code>package.json</code> defined like <code>"generate": "node generators/index.js"</code>and it simply runs when I run <code>npm run generate</code>.</p>
  
  <p>My script generates a copy from a template folder that is in the root of my project, the thing is that it's creating the template copies to the same root folder, and what I want it to do is to create the copy in the folder where I'm currently in the terminal.</p>
  
  <p>Eg. I am in <code>bin/data</code> I run my command and I want to create a copy of the folder from my template stored in <code>templates/state</code> so that the copy of this template will be created in <code>bin/data/state</code></p>
  
  <p>I was trying to use the <code>proccess.cwd()</code> method but it creates all in the root path as this is a method that is called in a script stored in root folder.</p>
  
  <p>How can I achieve this?</p>