-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Rewrite Makefile using NPS Scripts. Closes #2352 #3195
Conversation
Not sure where to configure |
efde20d
to
d6680e7
Compare
Not sure why CI is failing. Travis failed because a test timed out:
And appveyor appears to be having an issue executing Mocha from the CLI, possibly due to a difference in the way
Don't have Windows machine near to test. |
you could try |
travis test may be flake. you could try to increase the timeout to like 3000ms for that test |
I'm not sure where the netlify configuration lives |
OK, we're waiting on @Munter for information about the netlify failure, but since everything else is passing I can review this. 😝 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome, thanks!
I just have a couple tweaks, but everything looks really solid. great work
@@ -1,176 +0,0 @@ | |||
BROWSERIFY := "node_modules/.bin/browserify" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of this red is the best part of the PR
package-scripts.js
Outdated
return `${prefix} ${MOCHA} ${params}`; | ||
} | ||
|
||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would absolutely love it if we added description fields to everything here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kk — check over them in case anything is off. 👍
package-scripts.js
Outdated
build: `browserify ./browser-entry --plugin ./scripts/dedefine --ignore 'fs' --ignore 'glob' --ignore 'path' --ignore 'supports-color' > mocha.js`, | ||
lint: { | ||
default: 'nps lint.code lint.markdown', | ||
code: 'eslint . bin/*', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even though we're not running this on AppVeyor, it should still work on windows. please use double quotes around globs: 'eslint . "bin/*"'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. If anyone has access to a Windows machine too it'd be awesome to do a dry run and be sure these commands work as expected.
package-scripts.js
Outdated
prebuildDocs: 'rm -rf docs/_dist && node scripts/docs-update-toc.js', | ||
buildDocs: 'nps prebuildDocs && bundle exec jekyll build --source ./docs --destination ./docs/_site --config ./docs/_config.yml --safe --drafts && nps postbuildDocs', | ||
postbuildDocs: 'buildProduction docs/_site/index.html --outroot docs/_dist --canonicalroot https://mochajs.org/ --optimizeimages --svgo --inlinehtmlimage 9400 --inlinehtmlscript 0 --asyncscripts && cp docs/_headers docs/_dist/_headers && node scripts/netlify-headers.js >> docs/_dist/_headers', | ||
prewatchDocs: 'node scripts/docs-update-toc.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember if nps
supports pre-
and post-
scripts. does it? when we were running this with npm
, prewatchDocs
would get run before watchDocs
when doing npm run watchDocs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think it does, but the pre
and post
commands are explicitly inserted into the nps commands for that. I did move prepublishOnly
back to package.json
as I suspect it wouldn't trigger on npm publish
if it was in package-scripts.js
package-scripts.js
Outdated
} | ||
}, | ||
browser: { | ||
default: 'nps ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would prefer one of a multiline template string or array w/ join
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise for other multiline strings in this file
package-scripts.js
Outdated
const MOCHA = `node ${path.join('bin', 'mocha')}`; | ||
const TM_BUNDLE = 'JavaScript\\ mocha.tmbundle'; | ||
|
||
function test (testName, params) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a little comment explaining what this does
The Netlify build configuration currently only resides in their admin panel. This configuration file should hopefully override those settings to allow outside contributors to make refactoring changes Refs #3195
The Netlify build configuration currently only resides in their admin panel. This configuration file should hopefully override those settings to allow outside contributors to make refactoring changes Refs #3195
@TedYav I've just merged a netlify.toml config file on |
c91569c
to
1ae7483
Compare
I'm going to rebase and squash my commits. Hopefully Travis failure was a one off and we should be good to go. Let me know if anything else is desired (i.e. updating docs to say |
1ae7483
to
f8b0029
Compare
I noticed another commit dropped TextMate integration. I can eliminate the TM command to even this up. Also can merge master into this branch to fix conflicts if desired. |
f8b0029
to
45ba261
Compare
Thanks. super awesome! |
The Netlify build configuration currently only resides in their admin panel. This configuration file should hopefully override those settings to allow outside contributors to make refactoring changes Refs mochajs#3195
Addresses #2352
Updated version of #3194
Commit has correct Git credentials this time and Travis / Appveyor configs are now properly updated.
Description of the Change
Where possible, I tried to exactly duplicate the design of the Makefile using
nps
. I've tested it by runningbuild
andtest
commands, as well as granular testing of individual commands against a vanilla repo to ensure it's running the same commands.Important notes:
==> [<ACTION> :: <SUBACTION>]
output from makefile asnps
does this automaticallymake .PHONY
as this appeared to be a hack for GNU make. I'm not sure if some kind of file watching capability is desired. Perhaps this can be added back if needed.SRC_FILES
variable) from Makefile as I didn't see a big reason to include this innps build
commandCOVERAGE
environment variable to true. I removed the ability to set this via a command line flag as it created issues whennps
spawns child processesmake
is nownps build
make
but were not inpackage.json
will be brokennpm run <xxx>
commands are nownpm start <xxx>
ornps <xxx>
nps <xxx>
ifnps
is in user's path. However,npm start <xxx>
will work regardless.Alternate Designs
Possible modifications:
npsUtils.concurrently.nps
to run tests in parallel. This has pros and cons.nps
if neededNYC
,MOCHA
, etc, though I imagine these may be useful in case a developer wants to temporarily direct these scripts to use a different installationWhy should this be in core?
Discussed this briefly with @boneskull on Gitter back in early 2016. Didn't get around to doing it till now (my bad).
Benefits
Makefile gone!
Possible Drawbacks
Any code that depends on
make
commands will need to be updated.Applicable issues
This should not be a breaking change, unless there is some code I'm not aware of that depends on make commands (possibly some CI type operations)