chore(windows): make install portable to windows (#4779)

* chore(install)
- make preinstall hook windows portable
- make link-packages script use junction symlinks for windows

* use npx

* run preinstll in appveyor

* remove win32 check, pin dep (and update .npmrc)
This commit is contained in:
Ben Kucera
2019-07-22 12:30:52 -04:00
committed by GitHub
parent dd81ca5e3e
commit ec25c7dff8
4 changed files with 5 additions and 9 deletions

1
.npmrc
View File

@@ -1,3 +1,4 @@
loglevel=warn
progress=false
package-lock=false
save-exact=true

View File

@@ -64,6 +64,7 @@ install:
# clean cache to prevent install permission issues
- npm cache clean --force
# install root modules only, and retry automatically if install fails
- npm run preinstall
- npm install --ignore-scripts || npm install --ignore-scripts || npm install --ignore-scripts
- .\node_modules\.bin\print-arch
# because we skipped scripts, we need to do

View File

@@ -31,7 +31,7 @@
"dev-debug": "node ./scripts/debug.js dev",
"docker": "./scripts/run-docker-local.sh",
"effective:circle:config": "circleci config process circle.yml | sed /^#/d",
"preinstall": "rm -rf node_modules/@packages || true",
"preinstall": "npx shx rm -rf node_modules/@packages",
"postinstall": "echo 'root postinstall' && npm run link && npm run all install && npm run build",
"install-filtered": "npm run all install -- --package $(node ./scripts/check-deps.js --list)",
"jscodeshift": "jscodeshift -t ./node_modules/js-codemod/transforms/arrow-function-arguments.js",
@@ -151,6 +151,7 @@
"proxyquire": "2.1.0",
"ramda": "0.24.1",
"shelljs": "0.8.3",
"shx": "0.3.2",
"sinon": "7.3.2",
"snap-shot-it": "7.8.0",
"stop-only": "3.0.1",

View File

@@ -32,18 +32,11 @@ function makeLinks () {
const basename = path.basename(dirname)
const destinationLink = path.join(pathToPackages, basename)
// const registerPath = path.join(destinationFolder, 'register.js')
// const fullMain = path.resolve(dirname, json.main)
// debug('full name', fullMain)
// const relativePathToMain = path.relative(destinationFolder, fullMain)
// debug('relative path to main', relativePathToMain)
const relativePathToDest = path.relative(path.dirname(destinationLink), dirname)
console.log(destinationLink, '->', relativePathToDest)
return fs.symlink(relativePathToDest, destinationLink)
return fs.symlink(relativePathToDest, destinationLink, 'junction')
})
})
}