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

ts-node 8.0.3 (new formula) #37059

Closed
wants to merge 7 commits into from
Closed

Conversation

Maecenas
Copy link

@Maecenas Maecenas commented Feb 18, 2019

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

Update 1: Fix failed checks by latest commits and by updating ts-node.


I was trying to add new formula ts-node and failed to resolve typescript module. I have tried to add a line of console.log(modules.path); to the head of /usr/local/bin/ts-node, in order to discover the require() method's module looking path. The output is:

[ '/usr/local/Cellar/ts-node/8.0.2/libexec/lib/node_modules/ts-node/dist/node_modules',
  '/usr/local/Cellar/ts-node/8.0.2/libexec/lib/node_modules/ts-node/node_modules',
  '/usr/local/Cellar/ts-node/8.0.2/libexec/lib/node_modules',
  '/usr/local/Cellar/ts-node/8.0.2/libexec/node_modules',
  '/usr/local/Cellar/ts-node/8.0.2/node_modules',
  '/usr/local/Cellar/ts-node/node_modules',
  '/usr/local/Cellar/node_modules',
  '/usr/local/node_modules',
  '/usr/node_modules',
  '/node_modules' ]

And the error occur, even after installing typescript to the /usr/local/Cellar/ts-node/8.0.2/libexec/lib/node_modules/typescript.

/usr/local/Cellar/ts-node
└── 8.0.2
    ├── INSTALL_RECEIPT.json
    ├── LICENSE
    ├── README.md
    ├── bin
    │   └── ts-node -> ../libexec/bin/ts-node
    └── libexec
        ├── bin
        │   ├── ts-node -> ../lib/node_modules/ts-node/dist/bin.js
        │   ├── tsc -> ../lib/node_modules/typescript/bin/tsc
        │   └── tsserver -> ../lib/node_modules/typescript/bin/tsserver
        └── lib
            └── node_modules
                ├── ts-node
                │   ├── LICENSE
                │   ├── README.md
                │   ├── dist
                │   ├── node_modules
                │   ├── package.json
                │   └── register
                └── typescript
                    ├── AUTHORS.md
                    ├── CODE_OF_CONDUCT.md
                    ├── CopyrightNotice.txt
                    ├── LICENSE.txt
                    ├── README.md
                    ├── ThirdPartyNoticeText.txt
                    ├── bin
                    ├── lib
                    └── package.json

13 directories, 17 files

@fxcoudert fxcoudert added the new formula PR adds a new formula to Homebrew/homebrew-core label Feb 18, 2019
@javian
Copy link
Contributor

javian commented Feb 18, 2019

This audit needs to be corrected

09:14:09 ==> FAILED
09:14:09 Error: 2 problems in 1 formula detected
09:14:09 ts-node:
09:14:09   * C: 16: col 5: Use Language::Node for npm install args
09:14:09   * C: 27: col 75: Trailing whitespace detected.

def install
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]
# Adding typescript to library's libexec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you need to do this. Shouldn't npm install install typescript already ?

Copy link
Author

@Maecenas Maecenas Feb 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this as I found that both brew install typescript and npm install typescript -g did not work for ts-node. I'm asking for help for any cases like this (that is, how to resolve external packages via npm install -g). Also, my humble understanding on how Node.js, npm and CommonJS modules work out seems not enough.

Another observation from package.json is that typescript is (perhaps intentionally) listed in peerDependencies and devDependencies.

TypeStrong/ts-node#765
https://github.com/TypeStrong/ts-node/blob/74147523da8853a41b70bf04578125e2d6f84731/package.json#L67-L70

@Maecenas
Copy link
Author

This audit needs to be corrected

09:14:09 ==> FAILED
09:14:09 Error: 2 problems in 1 formula detected
09:14:09 ts-node:
09:14:09   * C: 16: col 5: Use Language::Node for npm install args
09:14:09   * C: 27: col 75: Trailing whitespace detected.

The trailing whitespace is easy to fix. But the other problem is under discussion.

@chrmoritz
Copy link
Contributor

chrmoritz commented Feb 20, 2019

Maybe a better way for solving the typescript peerDependencies issue is to use the same trick we do for babel-cli (and webpack). Just put typescript in a resource and use a install method similar to:

resource "babel-core" do
url "https://registry.npmjs.org/@babel/core/-/core-7.2.2.tgz"
sha256 "b632e5a565b000645d7bc0010331773481cc5dee7d4360360dccaa9e51c4785e"
end
def install
(buildpath/"node_modules/@babel/core").install resource("babel-core")
# declare babel-core as a bundledDependency of babel-cli
pkg_json = JSON.parse(IO.read("package.json"))
pkg_json["dependencies"]["@babel/core"] = resource("babel-core").version
pkg_json["bundledDependencies"] = ["@babel/core"]
IO.write("package.json", JSON.pretty_generate(pkg_json))
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]
end

@Maecenas
Copy link
Author

Maecenas commented Feb 21, 2019

@chrmoritz Thanks! I've commited as you suggested. However, I found ts-node is not be able to work unless to fix ts-node. The minor fix works great on my computer and is awaiting feedback.

Another question I had about pinning resources: would they be auto-updated by bots?

@Maecenas Maecenas changed the title ts-node 8.0.2 (new formula) ts-node 8.0.3 (new formula) Mar 7, 2019
@Maecenas
Copy link
Author

Maecenas commented Mar 7, 2019

@chrmoritz @javian Please review again if you are free. To fix I've proposed and merged a PR, and released a new version 8.0.3 of ts-node.

@stale
Copy link

stale bot commented Mar 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label Mar 28, 2019
@SMillerDev SMillerDev requested a review from javian March 28, 2019 10:18
@stale stale bot removed the stale No recent activity label Mar 28, 2019
@stale
Copy link

stale bot commented Apr 18, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label Apr 18, 2019
@zbeekman
Copy link
Contributor

Can't all of this just be installed via npm install -g ...?

@Homebrew/maintainers sorry if I'm late to the party, but are we accepting node formulas these days?

Node formulae seem to have significant added complexity.

@stale stale bot removed the stale No recent activity label Apr 21, 2019
@Maecenas
Copy link
Author

Thanks for replying!

Can't all of this just be installed via npm install -g ...?

I think so, (and believe that it would even be easier for most of the Formulas). But chances are that global installation for cli tools may cause other unintended problems. One reason I would like to have with homebrew is regular back up of installed packages.

@Homebrew/maintainers sorry if I'm late to the party, but are we accepting node formulas these days? Node formulae seem to have significant added complexity.

I followed the instructions at repo, but it hasn't been updated for some time.

@MikeMcQuaid
Copy link
Member

but are we accepting node formulas these days?

Yes, we are. In this case, though, I don't think this is a good fit for inclusion because it's so specific to NodeJS. https://formulae.brew.sh/formula/alexjs on the other hand is an example of a useful library even if you use no other NodeJS stuff on your machine.

@zbeekman
Copy link
Contributor

Sorry @Maecenas, at this time I don't think we can accept this formula in homebrew-core. You're welcome to create your own tap or search of another third party tap that may want to include it.

Sorry we didn't come to this conclusion earlier.

Thanks so much for your contributions, past, present and future to Homebrew. We REALLY value having a vibrant community with contributors like you! 💛

@zbeekman zbeekman closed this Apr 22, 2019
@lock lock bot added the outdated PR was locked due to age label May 22, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new formula PR adds a new formula to Homebrew/homebrew-core outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants