Skip to content

Conversation

@trevor-scheer
Copy link
Contributor

@trevor-scheer trevor-scheer commented Sep 16, 2022

Report and solution provided by @matthew-gordon!

@trevor-scheer trevor-scheer merged commit 2dd1d15 into main Sep 16, 2022
@trevor-scheer trevor-scheer deleted the trevor/fix-npx-fix branch September 16, 2022 18:19
trevor-scheer added a commit that referenced this pull request Oct 12, 2022
After a couple iterations, I've decided the best approach to this
is to make sure the project is never built when installed into a
project.

The previous workaround (#83 + #84) was insufficient because
while it dropped the requirement of the host project to have
typescript installed, it still required various @types/ packages
to be installed, so the solution was insufficient.

The hope was to preserve behavior that when this project is
cloned and installed, a build would be done. I don't see
a nice way to accomplish this without also having the effect
of running the build script when this package is installed into
another project.

The `prepare` script was considered as well, but that script
is called both for transitive and local installs which is
what we want to avoid.

The `prepack` script is necessary for CI / publish steps to
ensure the build is completed before publishing to NPM.
(a learning from apollographql/datasource-rest#57)
trevor-scheer added a commit that referenced this pull request Oct 12, 2022
After a couple iterations, I've decided the best approach to this
is to make sure the project is never built when installed into a
project.

The previous workaround (#83 + #84) was insufficient because
while it dropped the requirement of the host project to have
typescript installed, it still required various @types/ packages
to be installed, so the solution was insufficient.

The hope was to preserve behavior that when this project is
cloned and installed, a build would be done. I don't see
a nice way to accomplish this without also having the effect
of running the build script when this package is installed into
another project.

The `prepare` script was considered as well, but that script
is called both for transitive and local installs which is
what we want to avoid.

The `prepack` script is necessary for CI / publish steps to
ensure the build is completed before publishing to NPM.
(a learning from apollographql/datasource-rest#57)
trevor-scheer added a commit to apollo-server-integrations/apollo-server-integration-koa that referenced this pull request Nov 1, 2022
The `postinstall` hook provides a minor convenience for developers
cloning the repo and developing within it, but only as far as
running the build for you whenever you install. The drawback to
using `postinstall` is that compilation runs whenever this package
is installed into another repo, which is totally unnecessary and
often (for JS users) results in failures when tsc or types packages
aren't installed within the project.

See also:
apollographql/typescript-repo-template#84
apollographql/typescript-repo-template#92

Fixes #40
trevor-scheer added a commit to apollo-server-integrations/apollo-server-integration-koa that referenced this pull request Nov 1, 2022
The `postinstall` hook provides a minor convenience for developers
cloning the repo and developing within it, but only as far as
running the build for you whenever you install. The drawback to
using `postinstall` is that compilation runs whenever this package
is installed into another repo, which is totally unnecessary and
often (for JS users) results in failures when tsc or types packages
aren't installed within the project.

See also:
apollographql/typescript-repo-template#84
apollographql/typescript-repo-template#92

Fixes #40
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.

2 participants