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

Main entry point build/index.js does not exist #27

Closed
paulyoung opened this issue Mar 14, 2019 · 9 comments · Fixed by #29
Closed

Main entry point build/index.js does not exist #27

paulyoung opened this issue Mar 14, 2019 · 9 comments · Fixed by #29

Comments

@paulyoung
Copy link

Please forgive me if I misunderstand how this package is intended to be used, but I encountered an error when using a tool called nixfromnpm due to the fact that the main field of package.json points to a nonexistent file.

"main": "build/index.js",

building
  Checking dependencies of jest-watch-typeahead
    ansi-escapes@^3.0.0 -> OK (found version 3.2.0)
    chalk@^2.4.1 -> OK (found version 2.4.2)
    jest-watcher@^23.1.0 -> OK (found version 23.4.0)
    slash@^2.0.0 -> OK (found version 2.0.0)
    string-length@^2.0.0 -> OK (found version 2.0.0)
    strip-ansi@^5.0.0 -> OK (found version 5.1.0)
  installing
  Main entry point build/index.js does not exist

I see the same issue on unpkg: https://unpkg.com/jest-watch-typeahead@0.2.1

Cannot find "/build/index.js" in jest-watch-typeahead@0.2.1

I thought that maybe there was something like an npm prepare script that both nixfromnpm and unpkg aren't running but it doesn't seem like it from looking in package.json.

I think what may be happening is that build/ is not being published because of the .gitignore file, and that this project also needs a .npmignore file.

@paulyoung
Copy link
Author

Or since the files attribute is being used, perhaps it's a conscious choice not to use .npmignore but maybe "build/" is not working as intended there?

"files": [
"build/",

@paulyoung
Copy link
Author

Or the prepublish script is not being run since it is deprecated?

@paulyoung
Copy link
Author

In any case, there's no build/index.js here:

$ npm pack
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> jest-watch-typeahead@0.2.1 prepublish /Users/paulyoung/projects/jest-community/jest-watch-typeahead
> yarn build

yarn run v1.13.0
$ babel src --ignore **/*.test.js,integration -d build
Successfully compiled 9 files with Babel.
✨  Done in 0.60s.
npm notice
npm notice 📦  jest-watch-typeahead@0.2.1
npm notice === Tarball Contents ===
npm notice 1.9kB package.json
npm notice 1.1kB CHANGELOG.md
npm notice 101B  filename.js
npm notice 1.1kB LICENSE
npm notice 1.6kB README.md
npm notice 101B  testname.js
npm notice 1.2kB build/file_name_plugin/plugin.js
npm notice 3.0kB build/file_name_plugin/prompt.js
npm notice 1.7kB build/lib/pattern_mode_helpers.js
npm notice 563B  build/lib/scroll.js
npm notice 4.5kB build/lib/utils.js
npm notice 1.2kB build/test_name_plugin/plugin.js
npm notice 2.6kB build/test_name_plugin/prompt.js
npm notice 1.9kB build/test_utils/pluginTester.js
npm notice 13B   build/types/Config.js
npm notice === Tarball Details ===
npm notice name:          jest-watch-typeahead
npm notice version:       0.2.1
npm notice filename:      jest-watch-typeahead-0.2.1.tgz
npm notice package size:  6.5 kB
npm notice unpacked size: 22.6 kB
npm notice shasum:        15f3092a924e7cc3c3535776143d4eeb0d2ff9e2
npm notice integrity:     sha512-Jo1Rj5uMac10F[...]TO+XfWbbvrguA==
npm notice total files:   15
npm notice
jest-watch-typeahead-0.2.1.tgz

@rogeliog
Copy link
Member

This is a great point! Even though this package is meant to be used as jest-watch-typeahead/filename and jest-watch-typeahead/testname we should include make sure that if we define a main file we are including it.

@SimenB should we make filename.js the main file? And make jest-watch-typeahead/filename and jest-watch-typeahead equivalent?

@SimenB
Copy link
Member

SimenB commented Mar 14, 2019

Yeah, that makes sense to me!

@rogeliog
Copy link
Member

@paulyoung PR is more than welcome!

@jeysal
Copy link
Member

jeysal commented May 2, 2019

Just stumbled across this trying to register "jest-watch-typeahead" as a watch plugin.
My suggestion would be to still require the user to be explicit about it (most people will want both and might wonder why only filename works for them if they registered "jest-watch-typeahead") and make the entry point throw with a helpful message telling you how to configure it correctly :)
I can take care of this when I have some spare time soon.

@SimenB
Copy link
Member

SimenB commented May 2, 2019

Yeah, I think I agree with that. Throwing and asking user to be explicit makes sense to me

@SimenB
Copy link
Member

SimenB commented May 5, 2019

Published in 0.3.1 🙂

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 a pull request may close this issue.

4 participants