Skip to content

Commit

Permalink
FIX: ci: npm@6+win32 bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-js committed Feb 9, 2022
1 parent 56d5bff commit d792fc4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/ci-patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ runKit(async (kit) => {
kit.padLog('Patch npm cache path') // set cache path to `~/.npm/` for all platform (only win32 for now)
kit.RUN_SUDO_NPM([ 'config', '--global', 'set', 'cache', kit.fromHome('.npm/') ])

kit.padLog('Patch install "@dr-js/core" & "@dr-js/dev" globally')
kit.RUN_SUDO_NPM('install --global @dr-js/core@0.4 @dr-js/dev@0.4')

kit.padLog('Patch install "@min-pack/npm" globally')
if (process.platform !== 'win32') kit.RUN_SUDO_NPM('install --global @min-pack/npm@0.1')
else kit.RUN([ 'npx', '-p', 'npm@8', '-c', 'npm i -g @min-pack/npm@0.1' ]) // HACK: bypass npm@6+win32 `npm ERR! Error: EPERM: operation not permitted, rename` error
kit.padLog('Patch install "@dr-js/core" & "@dr-js/dev" & "@min-pack/npm" globally')
if (process.platform === 'win32' && parseInt(process.versions.node) <= 14) { // HACK: bypass npm@6+win32 `npm ERR! Error: EPERM: operation not permitted, rename` error
// check: https://github.com/actions/setup-node/issues/411, https://github.com/npm/cli/issues/4341, https://github.com/npm/template-oss/pull/36
require('@dr-js/core/library/node/fs/Directory.js').createDirectorySync(kit.fromOsTemp('patch-npm-install-global/'))
kit.RUN('curl -sO https://registry.npmjs.org/npm/-/npm-7.24.2.tgz', { cwd: kit.fromOsTemp('patch-npm-install-global/') })
kit.RUN('tar xf npm-7.24.2.tgz', { cwd: kit.fromOsTemp('patch-npm-install-global/') })
kit.RUN('node lib/npm.js install --no-fund --no-audit --global @dr-js/core@0.4 @dr-js/dev@0.4 @min-pack/npm@0.1', { cwd: kit.fromOsTemp('patch-npm-install-global/', 'package/') })
} else kit.RUN_SUDO_NPM('install --no-fund --no-audit --global @dr-js/core@0.4 @dr-js/dev@0.4 @min-pack/npm@0.1')
}, { title: 'ci-patch' })

0 comments on commit d792fc4

Please sign in to comment.