Skip to content

Commit

Permalink
Windows: fix tar usage (#4)
Browse files Browse the repository at this point in the history
* Use --force-local for tar to fix Windows
* npm publish: use directory, not tarball
* Add package/ to .gitignore
  • Loading branch information
ManasJayanth authored Dec 6, 2021
1 parent 5ed431e commit b3e908d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
9 changes: 6 additions & 3 deletions .ci/steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -o xtrace

function new_section {
new_section () {
set +o xtrace
echo ""
echo ""
Expand All @@ -19,24 +19,27 @@ then
yarn global add verdaccio
fi

VERDACCIO_PID=
if ! lsof -i :4873 &> /dev/null;
then
new_section "Setting up verdaccio"
mkdir -p ~/.config/verdaccio ~/.local/share/verdaccio/storage
cp ./.ci/verdaccio-config.yaml ~/.config/verdaccio/config.yaml
verdaccio&
VERDACCIO_PID="$!"
sleep 1
fi

new_section "Packaging for NPM"
node scripts/package.js
new_section "Publishing to local NPM"
npm publish --registry $REGISTRY_URL $PWD/package.tar.gz
tar -xf $PWD/package.tar.gz
npm publish --registry $REGISTRY_URL $PWD/package

cd esy-test/
export ESY__PREFIX=$HOME/_esy_test/prefix
rm -rf $ESY__PREFIX
mkdir -p $ESY__PREFIX
esy i --npm-registry $REGISTRY_URL
esy b

kill "$VERDACCIO_PID"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
_esy
_esy-package
.log
package.tar.gz
package.tar.gz
package/
12 changes: 9 additions & 3 deletions scripts/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,14 @@ let {
} = manifest;

function tar(filePath, destDir, gzip) {
cp.execSync(`tar -x${gzip ? "z" : ""}f ${filePath} -C ${destDir}`, {
stdio: "inherit",
});
cp.execSync(
`tar ${process.platform == "win32" ? "--force-local" : ""} -x${
gzip ? "z" : ""
}f ${filePath} -C ${destDir}`,
{
stdio: "inherit",
}
);
}

function unzip(filePath, destDir) {
Expand All @@ -142,6 +147,7 @@ function unzip(filePath, destDir) {

let esyPackageDir = path.join(cwd, "_esy-package");
mkdirpSync(esyPackageDir);
console.log("debug", "Created", esyPackageDir);
let pkgPath = esyPackageDir;
download(source)
.then((pathStr) => {
Expand Down

0 comments on commit b3e908d

Please sign in to comment.