Skip to content

Commit ec25c7d

Browse files
authored
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)
1 parent dd81ca5 commit ec25c7d

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
loglevel=warn
22
progress=false
33
package-lock=false
4+
save-exact=true

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ install:
6464
# clean cache to prevent install permission issues
6565
- npm cache clean --force
6666
# install root modules only, and retry automatically if install fails
67+
- npm run preinstall
6768
- npm install --ignore-scripts || npm install --ignore-scripts || npm install --ignore-scripts
6869
- .\node_modules\.bin\print-arch
6970
# because we skipped scripts, we need to do

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"dev-debug": "node ./scripts/debug.js dev",
3232
"docker": "./scripts/run-docker-local.sh",
3333
"effective:circle:config": "circleci config process circle.yml | sed /^#/d",
34-
"preinstall": "rm -rf node_modules/@packages || true",
34+
"preinstall": "npx shx rm -rf node_modules/@packages",
3535
"postinstall": "echo 'root postinstall' && npm run link && npm run all install && npm run build",
3636
"install-filtered": "npm run all install -- --package $(node ./scripts/check-deps.js --list)",
3737
"jscodeshift": "jscodeshift -t ./node_modules/js-codemod/transforms/arrow-function-arguments.js",
@@ -151,6 +151,7 @@
151151
"proxyquire": "2.1.0",
152152
"ramda": "0.24.1",
153153
"shelljs": "0.8.3",
154+
"shx": "0.3.2",
154155
"sinon": "7.3.2",
155156
"snap-shot-it": "7.8.0",
156157
"stop-only": "3.0.1",

scripts/link-packages.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,11 @@ function makeLinks () {
3232
const basename = path.basename(dirname)
3333

3434
const destinationLink = path.join(pathToPackages, basename)
35-
// const registerPath = path.join(destinationFolder, 'register.js')
36-
// const fullMain = path.resolve(dirname, json.main)
37-
38-
// debug('full name', fullMain)
39-
// const relativePathToMain = path.relative(destinationFolder, fullMain)
40-
41-
// debug('relative path to main', relativePathToMain)
4235
const relativePathToDest = path.relative(path.dirname(destinationLink), dirname)
4336

4437
console.log(destinationLink, '->', relativePathToDest)
4538

46-
return fs.symlink(relativePathToDest, destinationLink)
39+
return fs.symlink(relativePathToDest, destinationLink, 'junction')
4740
})
4841
})
4942
}

0 commit comments

Comments
 (0)