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

tools: after nx migration build:local does not work #18675

Closed
layershifter opened this issue Jun 23, 2021 · 3 comments · Fixed by #18673
Closed

tools: after nx migration build:local does not work #18675

layershifter opened this issue Jun 23, 2021 · 3 comments · Fixed by #18673

Comments

@layershifter
Copy link
Member

layershifter commented Jun 23, 2021

Repro steps

  • clone chore(make-styles): migrate to new DX #18673 or run yarn nx workspace-generator migrate-converged-pkg --name='@fluentui/make-styles' (in a case of command please modify tsconfig.json as in PR)
  • it will add build:local to packages/make-styles/package.json#scripts
  • try to run yarn workspace @fluentui/make-styles build:local, a command will fail ❌
$ tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/make-styles/src && yarn docs
office-ui-fabric-react\scripts\typescript\normalize-import.js:40
    throw new Error(`${sourceDir} doesn't exist`);
    ^

Error: office-ui-fabric-react\packages\make-styles\dist\make-styles\src doesn't exist
    at main (office-ui-fabric-react\scripts\typescript\normalize-import.js:40:11)
    at Object.<anonymous> (office-ui-fabric-react\scripts\typescript\normalize-import.js:18:1)
  • notice that for other packages, for example react-image it's passing ✅

Looks that it's related to a generated structure after the build command and a fact that @fluentui/make-styles does not have dependencies from a repo that results in different output in /dist:

yarn workspace @fluentui/react-image tsc -p . --module esnext --emitDeclarationOnly

image

yarn workspace @fluentui/make-styles tsc -p . --module esnext --emitDeclarationOnly

image

@Hotell
Copy link
Contributor

Hotell commented Jun 23, 2021

thanks for excellent report! you find one corner case we didn't think of when implementing hehe

Looks that it's related to a generated structure after the build command and a fact that @fluentui/make-styles does not have dependencies from a repo that results in different output in /dist:

yeah that's the reason. All of this will be mitigated once we start building into root /dist within monorepo

temporary quick fix

// @filename <packageName>/config/api-extractor.local.json
-  "mainEntryPointFilePath": "<projectFolder>/dist/<unscopedPackageName>/src/index.d.ts"
+  "mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
// @filename <packageName>/package.json
-    "build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/<packageName>/src && yarn docs"
+    "build:local": "tsc -p . --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output dist/ && yarn docs"

@layershifter
Copy link
Member Author

@Hotell thanks for suggestions, I applied them in #18673 🚀

@msft-fluent-ui-bot
Copy link
Collaborator

🎉This issue was addressed in #18673, which has now been successfully released as @fluentui/[email protected].:tada:

Handy links:

@Hotell Hotell added this to the June Project Cycle Q2 2021 milestone Jul 13, 2021
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants