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

fix: allow npm publish #130

Merged
merged 1 commit into from
Oct 11, 2021
Merged

fix: allow npm publish #130

merged 1 commit into from
Oct 11, 2021

Conversation

MrChocolatine
Copy link
Member

@MrChocolatine MrChocolatine commented Sep 10, 2021

Fix

Allow to npm publish (#130)

Before this change, executing the command npm publish was resulting in:

See the errors log
yarn run prepack
yarn run v1.22.11
$ ember ts:precompile

tests/test-helper.ts:3:25 - error TS7016: Could not find a declaration file for module 'dummy/app'.
'/ember-cli-embedded/develop/tests/dummy/app/app.js' implicitly has an 'any' type.

3 import Application from 'dummy/app'
                          ~~~~~~~~~~~

tests/unit/initializers/embedded-test.ts:5:28 - error TS7016: Could not find a declaration file for module 'dummy/initializers/embedded'.
'/ember-cli-embedded/develop/app/initializers/embedded.js' implicitly has an 'any' type.

5 import { initialize } from 'dummy/initializers/embedded'
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/unit/instance-initializers/embedded-test.ts:5:28 - error TS7016: Could not find a declaration file for module 'dummy/instance-initializers/embedded'.
'/ember-cli-embedded/develop/app/instance-initializers/embedded.js' implicitly has an 'any' type.

5 import { initialize } from 'dummy/instance-initializers/embedded'
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 3 errors.


Command failed with exit code 1: 
tsc --allowJs false --noEmit false --rootDir /fake_path/ember-cli-embedded/develop --isolatedModules false --declaration --declarationDir /ember-cli-embedded/develop/e-c-ts-precompile-10839 --emitDeclarationOnly --pretty true
tests/test-helper.ts:3:25 - error TS7016: Could not find a declaration file for module 'dummy/app'.
'/ember-cli-embedded/develop/tests/dummy/app/app.js' implicitly has an 'any' type.

3 import Application from 'dummy/app'
                          ~~~~~~~~~~~

tests/unit/initializers/embedded-test.ts:5:28 - error TS7016: Could not find a declaration file for module 'dummy/initializers/embedded'.
'/ember-cli-embedded/develop/app/initializers/embedded.js' implicitly has an 'any' type.

5 import { initialize } from 'dummy/initializers/embedded'
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/unit/instance-initializers/embedded-test.ts:5:28 - error TS7016: Could not find a declaration file for module 'dummy/instance-initializers/embedded'.
'/ember-cli-embedded/develop/app/instance-initializers/embedded.js' implicitly has an 'any' type.

5 import { initialize } from 'dummy/instance-initializers/embedded'
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 3 errors.

Side notes

Help asked on Ember.js Discord to see if there was a better solution than declaring an empty ambiant module dummy/*:
https://discord.com/channels/480462759797063690/484421406659182603/885928438542794752

Also on the repository ember-cli-typescript:
typed-ember/ember-cli-typescript#1448

The PR will eventually change depending on the answers I receive.

  • https://discord.com/channels/480462759797063690/484421406659182603/888036425348550656

    dfreeman: Unfortunately I don't have time to write up a full response on the issue you opened right now, but the short answer is that ts:precompile sets allowJs: false when it runs
    dfreeman: IMO (speaking only for myself and not any of the rest of the typed-ember folks) we shouldn't be setting allowJs: true in the default blueprint in the first place
    dfreeman: but I think that's the root of your problem
    dfreeman: either adding a .d.ts file alongside tests/dummy/app/app.js or actually converting that file to TS should solve your problem
    dfreeman: the declare module you suggested should also be fine

@MrChocolatine MrChocolatine force-pushed the fix-publishing-on-npm branch 3 times, most recently from 2c6b7f2 to da5f89e Compare September 16, 2021 16:17
@MrChocolatine MrChocolatine changed the title fix: declare empty ambiant module for dummy/* fix: allow npm publish Sep 16, 2021
@MrChocolatine MrChocolatine marked this pull request as ready for review September 16, 2021 16:20
@MrChocolatine MrChocolatine requested a review from a team September 16, 2021 16:20
jherdman added a commit to PrecisionNutrition/unit-utils that referenced this pull request Oct 4, 2021
jherdman added a commit to PrecisionNutrition/unit-utils that referenced this pull request Oct 4, 2021
@MrChocolatine MrChocolatine merged commit 511a21c into master Oct 11, 2021
@MrChocolatine MrChocolatine deleted the fix-publishing-on-npm branch October 11, 2021 15:44
@MrChocolatine MrChocolatine mentioned this pull request Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants