javascript - Can I use a script alias existing in another node module's package.json? -
i've created node module produces json
file data multiple apis. it's designed able save json
file whatever directory you're within in cmd/terminal
.
i'm able run project, i've developed independently main project it's used within. has been installed in main project can run it's package.json
exists because that's script alias resides.
there other node modules need use json
file, once navigate other modules' root directories in cmd/terminal
node wants use module's package.json
, can't find script alias since doesn't exist there.
adding script alias every module isn't viable solution since project prototype , being added upon.
is there way relevant package.json
referenced , used script alias regardless of i'm running within main project?
am going solving problem wrong? appreciated. first question if i've done wrong asking this, please let me know can improve. in advance.
a little bit late answer nonetheless.
we ended going peteb's approach (thanks) of using appropriate package (the 1 script alias internal it) , feeding external filepath through argument.
this works because existing structure arguments was:
npm run <script> <arg1> <filepath>
although filepath
argument meant pwd
or %cd%
, output of both normal filepath anyway. filepath theoretically work, long don't run other problems warrant looking solution problem elsewhere, length being long filesystem , whatnot.
something might worth mentioning maybe have been better suited environment other nodejs. doesn't using script outside package it's internal possibility , might have been better program external program deal such issues.
i'm not proficient @ nodejs lot of people here on site are, maybe executable containing code invoked .js
file work, if that's @ possible.
Comments
Post a Comment