fix: package tool escape path on windows (#169)

* chore: update e2e tests to try npm and macos

This should add more visibility if something is going wrong, like #167.

* test: see if which properly resolves npm on windows

* test: try with execution

* test: try a couple of things including mkdirP and absolute toolpath

* chore: try to pass the name of the packager instead

* chore: remove the test code from the workflow
This commit is contained in:
Cedric van Putten authored and GitHub committed 2022-03-17 18:38:23 +01:00
1 parent 9fce70f380
commit db9b5ce00f
3 files changed
+17 -5

No files matched your search

+14
View File
@@ -23,9 +23,22 @@ jobs:
os:
- ubuntu-latest
- windows-latest
- macos-latest
cache:
- with-cache
- without-cache
packager:
- yarn
include:
- os: ubuntu-latest
cache: without-cache
packager: npm
- os: windows-latest
cache: without-cache
packager: npm
- os: macos-latest
cache: without-cache
packager: npm
runs-on: ${{ matrix.os }}
steps:
- name: 🏗 Setup repo
@@ -38,6 +51,7 @@ jobs:
eas-cache: ${{ matrix.cache == 'with-cache' }}
expo-version: latest
expo-cache: ${{ matrix.cache == 'with-cache' }}
packager: ${{ matrix.packager }}
token: ${{ secrets.EXPO_TOKEN }}
- name: 🧪 EAS installed
+1 -2
View File
@@ -67049,9 +67049,8 @@ exports.resolvePackage = resolvePackage;
*/
async function installPackage(name, version, manager) {
const temp = (0, worker_1.tempPath)(name, version);
const tool = await (0, io_1.which)(manager);
await (0, io_1.mkdirP)(temp);
await (0, exec_1.exec)(tool, ['add', `${name}@${version}`], { cwd: temp });
await (0, exec_1.exec)(manager, ['add', `${name}@${version}`], { cwd: temp });
return (0, worker_1.cacheTool)(temp, name, version);
}
exports.installPackage = installPackage;
+2 -3
View File
@@ -1,5 +1,5 @@
import { exec, getExecOutput } from '@actions/exec';
import { which, mkdirP } from '@actions/io';
import { mkdirP } from '@actions/io';
import { cacheTool, tempPath } from './worker';
@@ -37,10 +37,9 @@ export async function resolvePackage(name: string, range: string): Promise<strin
*/
export async function installPackage(name: string, version: string, manager: string) {
const temp = tempPath(name, version);
const tool = await which(manager);
await mkdirP(temp);
await exec(tool, ['add', `${name}@${version}`], { cwd: temp });
await exec(manager, ['add', `${name}@${version}`], { cwd: temp });
return cacheTool(temp, name, version);
}