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

files/dirs that start with a dot (.) do not get copied or transpiled by default #13399

Closed
ORESoftware opened this issue Jan 10, 2017 · 2 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@ORESoftware
Copy link

ORESoftware commented Jan 10, 2017

TypeScript Version: 2.1.4

Code

/lib
/test
    /.suman
    /test-src

if I build this project with tsc and use the outDir option, the .suman directory won't get moved/transpiled, presumably because it starts with a dot .

based on the above project structure, the resulting incorrect build would look like:

/dist
   /lib
   /test
       /test-src  

above we can see that the .suman dir is missing from the test dir

if I rename the .suman directory to suman like so:

/lib
/test
    /suman    // renamed from .suman to suman
    /test-src

then it will get moved to the outDir, because it no longer starts with a dot .

so the expected result actually happens, which is of course:

/dist
   /lib
   /test
       /suman
       /test-src

here is my config, which shows that I want to include my test dir, in the build.

{
  "compilerOptions": {
    "compileOnSave": true,
    "target": "es5",
    "noImplicitAny": false,
    "removeComments": true,
    "preserveConstEnums": true,
    "outDir": "dist",
    "allowJs": true,
    "allowUnreachableCode": true,
    "lib": ["es2015", "dom"]
  },
  "include": [
    "./**/*"
  ],
  "exclude": [
    "node_modules"
  ]
}

Expected behavior:

I would expect it would include files/directories that start with a dot, unless you exclude files/dirs that start with a dot

Actual behavior:

TS/tsc seems to exclude files/dirs that start with a dot by default, which seems very strange, since users could easily specify with a regex to ignore dirs/files that start with a dot!

My question is then, is there a tsconfig.json setting I can use to include the .suman directory with my build?

@ORESoftware ORESoftware changed the title files/dirs that start with a dot . do not get copied or transpiled by default files/dirs that start with a dot (.) do not get copied or transpiled by default Jan 10, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Jan 11, 2017

files and folders starting with a . are ignored by the glob patterns. this to accomodate for hidden folders that tools like git rely on. You need to add the folder starting with a . explcitlly in your include patter:

  "include": [
    "./**/*",
    "./test/.suman/**/*"
  ],

also one note, you need to exclude your outDir, or you will be consuming the output again, given that you have --allowJs set. so your exclude patterns should be:

  "exclude": [
    "node_modules",
    "./dist"
  ]

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Jan 11, 2017
@ORESoftware
Copy link
Author

ahh thanks so much that helps a ton!

@mhegazy mhegazy closed this as completed Apr 21, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

2 participants