Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make auth-syncserver build script work on Windows environments #107

Merged
merged 3 commits into from
May 23, 2024

Conversation

brentkeller
Copy link
Collaborator

@brentkeller brentkeller commented May 17, 2024

Solves

Running pnpm build results in a failure for the @localfirst/auth-syncserver package on Windows environments. This is the error that's encountered:

packages/auth-syncserver postbuild$ tsc -p tsconfig.build.json --emitDeclarationOnly && cp src/*.html dist
│ 'cp' is not recognized as an internal or external command,
│ operable program or batch file.
└─ Failed in 2.1s at C:\dev\xdev\local-first-auth\packages\auth-syncserver
C:\dev\xdev\local-first-auth\packages\auth-syncserver:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @localfirst/[email protected] postbuild: `tsc -p tsconfig.build.json --emitDeclarationOnly && cp src/*.html dist`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

Description

A pre-cursor to this was to update the pnpm-lock.yaml file to the latest version, which is what I get when running pnpm install against the main branch.

I searched for suggestions on a cross-platform way to copy files in npm scripts and was guided towards shx by this question. This is a wrapper around ShellJS which is a collection of Unix commands implemented in node.js.

It's possible that we'd consider an alternative like copyfiles but I figured it was worth trying out something that could offer multiple commands for our future needs.

Testing

Verify that pnpm build still successfully copies the *.html files to the auth-syncserver build out.

This is what I get by running `pnpm install` using pnpm v9.1.1
The `cp` step of `postbuild` fails on Windows environments. Using `shx` we can have a cross-platform cp-compatible command to copy the files
@HerbCaudill HerbCaudill merged commit 9945e99 into main May 23, 2024
1 check passed
@HerbCaudill HerbCaudill deleted the cross-platform-scripts branch May 23, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants