Skip to content

Adding package to project that doesn't already contain typescript fails #8

@seanstern

Description

@seanstern

Sumamry

This package relies on tsc as part of it's build command in package.json.

However, typescript is a part of devDependencies, which means it is not pulled in when one runs npm add in another project.

As a result, the build fails with the fails with the following message (on Windows)

'tsc' is not recognized as an internal or external command, operable program or batch file

Reproduction Steps

  1. Create a new npm package: npm init
  2. Add @chevtek/poker-engine as a dependency: npm add @chevtek/poker-engine

Suggested fix

There are three options you could consider:

  1. If build needs to be run when adding this package to another project, then it's likely typescript needs to be included as part of depenencies.
  2. Alternatively, if you're assuming that consumers of this package should already have typescript as part of their project, it should be specified that typescript is a part of peerDependencies.
  3. Alternatively, you could publish this package based on what's in the build directory (i.e. raw javascript) and include the typings. In this way typescript could be avoided as part of your dependency chain for consumers of this package. To give you a rough idea, consider the approach outlined here.

Additional Notes

I'm going to submit a PR based on option 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions