-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add self-link script as part of the pretest setup #14
Conversation
Thanks for this @Andarist! Unfortunately this is unix only and wouldn't work on Windows. Would you be willing to adapt this to a more portable solution? If not I'd like to at least document the differences in build steps between platforms. |
I could probably try to unify it. Ideally I'd hide in a simple CLI tool using node APIs (I have no idea how to write powershell scripts, node APIs should take care of platform differences for me). Do you have an idea for the API of such a tool? |
I'm starting to use it a lot... it's awesome. We can probably just do a small script at the root called const { existsSync } = require('fs')
const { join } = require('path')
const { execFileSync } = require('child_process')
const pkgPath = join('node_modules', process.env.npm_package_name)
if (!existsSync(pkgPath)) {
execFileSync('npm', ['link'])
execFileSync('npm', ['link', process.env.npm_package_name])
} And then in {
"scripts": {
"pretest": "node .bootstrap.js && npm run build",
"test": "ava"
}
} |
I was worried about the fact that Gonna prepare this thing some time later and adjust the PR! |
@Andarist great. Double build shouldn't be a problem but you could maybe make if (!existsSync(pkgPath)) {
execFileSync('npm', ['link'])
execFileSync('npm', ['link', process.env.npm_package_name])
process.exitCode = 1
} |
I was thinking about it (although werent sure if |
It's not but npm scripts are run with
¯\_(ツ)_/¯ an error code for what's not technically an error, yeah, but it'd do the trick for a wee script like this I think. |
7731f2b
to
786f5a1
Compare
So I've created https://github.com/Andarist/npm-self-link as a simple tool to help with that task (I need to reuse it in 2 other macros). I've amended this PR to use it and I've invited u to collaboration on the tool (both on github & npm) I see that you run your tests on node@6 too and I've used async/await syntax in the tool - gonna add a transpilation step some time later today to account for node@6. |
@Andarist sounds good! node 6 EoLs in April so I'd want to support it until then. |
8d3be5b
to
361eda3
Compare
After a serious of fast broken releases 😅 I've added node@6 support to |
Thanks @Andarist! |
This should link (if needed) automatically before running tests