Code Monkey home page Code Monkey logo

Comments (8)

Paratron avatar Paratron commented on May 27, 2024 19

I honestly have no idea how those files ended up there. I did not use TS to create hookrouter, so no idea what generated them 🤔

However - I am working on v2.0 in a separate branch of this repo - this time even based on TS 😁🤫

from hookrouter.

pbondoer avatar pbondoer commented on May 27, 2024 12

I believe it has to do with the fact that they are, in fact, included.

As you can see from looking at the package contents:

$ npm pack hookrouter@latest --dry-run
npm notice
npm notice package: [email protected]
npm notice === Tarball Contents ===
npm notice 804B   dist/_testHelper.js
npm notice 6.1kB  dist/controlledInterceptor.js
npm notice 4.4kB  dist/index.js
npm notice 6.3kB  dist/interceptor.js
npm notice 799B   dist/isNode.js
npm notice 6.1kB  dist/Link.js
npm notice 11.5kB dist/queryParams.js
npm notice 2.3kB  dist/redirect.js
npm notice 44.7kB dist/router.js
npm notice 2.4kB  dist/routes.js
npm notice 1.3kB  dist/routes.test.js
npm notice 607B   dist/test.js
npm notice 3.0kB  dist/title.js
npm notice 1.4kB  package.json
npm notice 282B   dist/_testHelper.d.ts.map
npm notice 415B   dist/_testHelper.js.map
npm notice 104B   dist/index.d.ts.map
npm notice 102B   dist/index.js.map
npm notice 675B   dist/routes.d.ts.map
npm notice 1.8kB  dist/routes.js.map
npm notice 116B   dist/routes.test.d.ts.map
npm notice 1.3kB  dist/routes.test.js.map
npm notice 133B   dist/test.d.ts.map
npm notice 439B   dist/test.js.map
npm notice 1.5kB  README.md
npm notice 300B   dist/_testHelper.d.ts
npm notice 35B    dist/index.d.ts
npm notice 808B   dist/routes.d.ts
npm notice 53B    dist/routes.test.d.ts
npm notice 80B    dist/test.d.ts
npm notice === Tarball Details ===
npm notice name:          hookrouter
npm notice version:       1.2.5
npm notice filename:      hookrouter-1.2.5.tgz
npm notice package size:  32.6 kB
npm notice unpacked size: 100.0 kB
npm notice shasum:        ea1b88fd9f6a48816b17145bfb2b38dfc93df21e
npm notice integrity:     sha512-9OLve2u+JZDCO[...]UrZ4hUYoK0ezw==
npm notice total files:   30

Compare that with the last release:

$ npm pack [email protected] --dry-run
npm notice
npm notice package: [email protected]
npm notice === Tarball Contents ===
npm notice 1.4kB  package.json
npm notice 1.5kB  README.md
npm notice 6.1kB  dist/controlledInterceptor.js
npm notice 4.4kB  dist/index.js
npm notice 6.3kB  dist/interceptor.js
npm notice 799B   dist/isNode.js
npm notice 5.9kB  dist/Link.js
npm notice 11.5kB dist/queryParams.js
npm notice 2.3kB  dist/redirect.js
npm notice 44.7kB dist/router.js
npm notice 3.0kB  dist/title.js
npm notice === Tarball Details ===
npm notice name:          hookrouter
npm notice version:       1.2.3
npm notice filename:      hookrouter-1.2.3.tgz
npm notice package size:  28.9 kB
npm notice unpacked size: 88.0 kB
npm notice shasum:        a65599a1be376b51734caf7c4f7f8aba59bb2c77
npm notice integrity:     sha512-n0mqEBGgXIxYR[...]zexTBfo//tq2Q==
npm notice total files:   11

Looking at the *.d.ts files, we can see they are basically empty type definitions. Deleting them from your node_modules solves the issue, as the TypeScript compiler now correctly gets the types from the @types/hookrouter package. I believe @Paratron should just re-release without including these files, although he has expressed not wanting to support TypeScript.

As a temporary workaround, you can add these lines to .yarnclean and perform yarn autoclean --force:

hookrouter/dist/index.d.ts
hookrouter/dist/index.d.ts.map

Thanks for the awesome project by the way, we use it every day in production here and it's been working great. 🎉

from hookrouter.

rkok avatar rkok commented on May 27, 2024 3

Hacky workaround for npm using a postinstall script:

# package.json

{
  "scripts": {
    "cleanup-hookrouter-types": "rm -f node_modules/hookrouter/dist/index.d.ts* # See https://github.com/Paratron/hookrouter/issues/147",
    "postinstall": "npm run cleanup-hookrouter-types"
  }
}

from hookrouter.

mbaroukh avatar mbaroukh commented on May 27, 2024 2

Hi.

Yes, a new version without those files would be great because 1.2.5 AND 1.2.4 are unusable with typescript without removing those files manually.
As a new user to this library I was surprised and had to downgrade to 1.2.3.
yarn autoclean is a great tip but it works only for yarn users.

from hookrouter.

sstavr avatar sstavr commented on May 27, 2024 1

Hi guys, I've recently upgraded from 1.2.3 to 1.2.5 and getting the same issue here. Is the solution provided by @pbondoer one that is usable in a build/deploy (CI/CD) environment?

UPDATE: I attempted the .yarnclean and it seems to work locally. I'll give this a go by running in our CI environment. I hadn't used yarn clean before, didn't realise it'll run on every yarn install. Cheers.

from hookrouter.

mdaleki avatar mdaleki commented on May 27, 2024

Hey @Paratron,

If you will look at the build output for version 1.2.5, then you will see that it includes code from version 2.0. based on TS. You have somehow created wrong build with code from branch v2-ts. See at routes.js, routes.d.ts, index.js, index.d.ts (which is actually empty)...

It would be great if you can just publish fixed build for 1.2.5 (as 1.2.6) without changes from branch v2-ts

from hookrouter.

MatthewPardini avatar MatthewPardini commented on May 27, 2024

@mbaroukh

Yes, a new version without those files would be great because 1.2.5 AND 1.2.4 are unusable with typescript without removing those files manually.

If you're using yarn, @pbondoer 's solution works. You can add that to your scripts that run and not have to do it manually. Not sure if npm (my preferred package manager anyway) has a similar command. I'm currently on a project using yarn....

from hookrouter.

Seanmclem avatar Seanmclem commented on May 27, 2024

Thanks for the workaround. I'm surprised to see the project basically abandoned. Wish I had time to contribute. Thanks for all the fish

from hookrouter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.