GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add new compiler option --rootDir by mhegazy · Pull Request #2772 · microsoft/TypeScript

Conversation

@mhegazy

@mhegazy Mohamed Hegazy (mhegazy) commented Apr 15, 2015

Copy link
Copy Markdown
Contributor

The new option fixes #2644, which is a reactivation of #287, and has been in discussion in #2034.

Background

The current behavior of the compiler when using --outDir is to duplicate the input structure in the output under the value of --outDir. the root of the input is computed as the longest common path of all source (.ts and not .d.ts) files. so an input of FolderA\FolderB\1.ts and FolderA\FolderB\2.ts would result in computing the commonSourceRoot to FolderA\FolderB\. now if a new file FolderA\3.ts is added to the input, the commonSourceRoot will pop out to FolderA\.

This is generally undesirable and can be confusing. it also does not allow for folders that do not contain .ts files to be replicated in the output.

--rootDir flag

The new flag is used to customize the commonSourceRoot instead of automatically calculating it.

The same rules apply, i.e. all source files (.ts) should be under the rootDir, otherwise the output generation may not be correct.

The name rootDir is meant to resemble outDir as both flags go together.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

RichardJECooke and ryanguill reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
Mohamed Hegazy (mhegazy) added 5 commits April 14, 2015 15:05
@mhegazy
Move commonSourceDirectory computation to its own function
e7895c5
@mhegazy
Add rootDir option
261adff
@mhegazy
Add rootDir tests
99c0adb
@mhegazy
Accept baselines
a2e888d
@mhegazy
Add source maps to rootdir tests
16bbedc
@msftclas Microsoft Contribution License Agreements (msftclas) added the cla-not-required label Apr 15, 2015
@mhegazy
Merge branch 'master' into rootDir
af661ae
Conflicts:
	tests/baselines/reference/APISample_compile.types
	tests/baselines/reference/APISample_linter.types
	tests/baselines/reference/APISample_transform.types
	tests/baselines/reference/APISample_watcher.types
DanielRosenwasser
DanielRosenwasser reviewed Apr 16, 2015
View reviewed changes
Comment thread src/compiler/diagnosticMessages.json Outdated

@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) Apr 16, 2015

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Use lowercase 'r' for 'RootDir', use single quotes :

"under 'rootDir' '{1}'. 'rootDir' is expected..."

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Mohamed Hegazy (mhegazy) added 2 commits April 16, 2015 16:35
@mhegazy
Respond to code review comments
b6ef323
@mhegazy
Merge branch 'master' into rootDir
8964b8e
Conflicts:
	tests/baselines/reference/APISample_compile.types
	tests/baselines/reference/APISample_linter.types
	tests/baselines/reference/APISample_transform.types
	tests/baselines/reference/APISample_watcher.types
DanielRosenwasser
DanielRosenwasser reviewed Apr 17, 2015
View reviewed changes
Comment thread src/compiler/program.ts Outdated

@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) Apr 17, 2015

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

soruceFiles -> sourceFiles

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@basarat Basarat Ali Syed (basarat) Apr 17, 2015

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

why so soruce?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Mohamed Hegazy (mhegazy) added 4 commits April 19, 2015 13:24
@mhegazy
Fix typo
b3fcae8
@mhegazy
Merge branch 'master' into rootDir
021f309
@mhegazy
Respond to code review commmetns
08a8692
@mhegazy
Merge branch 'master' into rootDir
ed2e105
@DanielRosenwasser

Daniel Rosenwasser (DanielRosenwasser) commented Apr 20, 2015

Copy link
Copy Markdown
Member

👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Mohamed Hegazy (mhegazy) added a commit that referenced this pull request Apr 20, 2015
@mhegazy
Merge pull request #2772 from Microsoft/rootDir
7f8e21b
Add new compiler option --rootDir
@mhegazy
Mohamed Hegazy (mhegazy) merged commit 7f8e21b into master Apr 20, 2015
@mhegazy
Mohamed Hegazy (mhegazy) deleted the rootDir branch April 20, 2015 21:42
@mhegazy Mohamed Hegazy (mhegazy) mentioned this pull request Apr 20, 2015
TypeScript needs a baseDir option #287
Closed
@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) mentioned this pull request Apr 21, 2015
Generation of javascript files with --outDir is foolish. #812
Closed
@msprotz Jonathan Protzenko (defunct account, use @protz now) (msprotz) mentioned this pull request Apr 27, 2015
Incorrect sourceMaps for api/ and lib/ directories microsoft/TouchDevelop#19
Closed
@NekR

Arthur Stolyar (NekR) commented Apr 30, 2015

Copy link
Copy Markdown

Is this in beta already or will be only in release?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhegazy

Mohamed Hegazy (mhegazy) commented Apr 30, 2015

Copy link
Copy Markdown
Contributor Author

Should be in 1.5-beta

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NekR

Arthur Stolyar (NekR) commented Apr 30, 2015

Copy link
Copy Markdown

Mohamed Hegazy (@mhegazy) filed here #2974

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MicahZoltu Micah Zoltu (MicahZoltu) mentioned this pull request May 2, 2015
Adds support for TS 1.5 rootDir. TypeStrong/tsconfig#3
Merged
This was referenced May 5, 2015
Expose new compiler flags in the .targets file #3034
Closed
Update tsconfig.json schema on SchemaStore for new commandline options for TypeScript 1.5 #3046
Closed
@msssk Mangala Khalsa (msssk) mentioned this pull request Jun 5, 2015
Build process is not creating 'src' folder dojo/loader#11
Closed
@RasPelikan RasPelikan mentioned this pull request Oct 15, 2015
Modified 'isTargetRelativePathBasedOnSource' algorithm to use TypeScr… axmor/typecs#86
Merged
@blackening blackening mentioned this pull request Nov 1, 2015
Subfolder structure is lost without file at lowest level. blackening/broccoli-typescript-incremental#1
Closed
@enlight Vadim Macagon (enlight) mentioned this pull request Nov 27, 2015
Compiler outputs files to the wrong directory structure #5809
Closed
@mhegazy Mohamed Hegazy (mhegazy) mentioned this pull request Dec 10, 2015
Backslash in reference path causes Visual studio 2013 to drop js in wrong directory #2152
Closed
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Empty parent directories are not preserved with --outDir

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@mhegazy @DanielRosenwasser @NekR @basarat @msftclas
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.