-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Methods should use config path defined in package.json #13
Comments
This makes sense to me. Let's do it. Could you please respond to my question in #12? Thanks! |
Note, unfortunately this won't be as simple as calling slice because the options and scripts can appear in any order. We'll need to parse things via yargs. |
@kentcdodds sure - that make sense. If you can check file I have provided for #12 & help with this I can quickly add this feature. BTW. nps is such an amazing tool - showed that to mates from my team & they were impressed how easy you can clean package.json xD |
I'm glad you like it! I really enjoy it as well :) |
@kentcdodds Looks like the @ghost account has been deleted. I'm facing the same dilemma and can't seem to set the custom
Codeconst npsUtils = require('nps-utils');
// Reference to config file
const configFile = __filename;
compile: {
description: `Compile Sass and JavaScript for development`,
script: npsUtils.series.nps(`sass.dev --config ${configFile}`, `js.dev --config ${configFile}`)
} I'm only able to get things working if I write things out manually: nps sass.dev --config ${configFile} && nps js.dev --config ${configFile} Thanks for making! 👏 |
I dug into the source code and was able to run my series.nps = function seriesNPS(...scriptNames) {
return series(
...scriptNames
.filter(Boolean)
.map(scriptName => scriptName.trim())
.filter(Boolean)
- .map(scriptName => `nps ${quoteScript(scriptName)}`),
+ .map(scriptName => `nps ${scriptName}`,
)
} It's getting confused by me having to redeclare my |
This will actually be mostly a non-issue when this happens (hopefully soon). |
Will that issue also address the custom Do note that I'm not using // package.json
"scripts": {
"start": "nps --config ./node_modules/package-scripts/package-scripts.js"
}
// package-scripts.js in custom location
const configFile = __filename;
script: sass.dev && js.dev // expected
script: `nps sass.dev --config ${configFile} && nps js.dev --config ${configFile}` // actual |
It wont, but doing that will make solving this issue easier. |
Cool; thanks for the quick replies. Do you want me to open an issue to address this within |
This is already tracked here: sezna/nps#139 |
While refactoring my package.json to use nps I haven noticed that methods like:
ignore custom config path provided via "nps --config". It would be extremely easy to check if env contains config path e.g.
process.argv.slice(3,4)
& reuse it while creating new nps call in following locations (nps-utils/src/index.js):
That would simplify reference of scripts with config in custom location, don't you think?
I'm happy to make pull request but due to #12 I'm not confident that this repo is ready to be forked ;-/
The text was updated successfully, but these errors were encountered: