electricessence / TypeScript.NET

A JavaScript-Friendly .NET Based TypeScript Library (Moved)
https://github.com/electricessence/TypeScript.NET-Core
Other
251 stars 36 forks source link

Bug affecting project output #38

Closed galvesribeiro closed 8 years ago

galvesribeiro commented 8 years ago

Steps to reproduce.

Create a folder structure like this(the + signal is just to illustrate the folder level:

+ testbug
++ build
++ src
+++ Person.ts
++ tsconfig.json

Have the following config on tsconfig.json:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
        "sourceRoot": "./src",
        "moduleResolution": "node",
        "outDir": "./build"
    },
    "exclude": [
        "node_modules",
        "build"
    ]
}

And the following src/Person.ts:

console.log('something');

Save everything and build the project (VSCode or tsc command line). Note that output files are dropped correctly to build/ folder.

Now, npm install typescript-dotnet --save and npm update --save.

Change the content of src/Person.ts to:

import List from "typescript-dotnet/dist/commonjs/System/Collections/List"

export class Person
{
    Name:string;
    Age:number;
}

Delete the content of the build/ folder. Save all and now build the project again.

Notice that the output files are dropped into build/src/ instead of the src/ root folder.

The expected behavior is that the files got dropped on build/ while they are sent to the build/src. To confirm that the problem is with this module, comment the firs line (import List from....), clear the build directory and build again. You will see that the files are now again dropped correctly.

What can we do to workaround it?

Thanks for the great work on the project.

Best regards, Gutemberg

electricessence commented 8 years ago

@galvesribeiro Will look into asap!

electricessence commented 8 years ago

capture

This works perfectly for me without issue. Can you be sure we are doing the same thing? :/

electricessence commented 8 years ago

capture Was even able to extend Person as Employee and it keeps the folder structure as expected. Did you try npm uninstall typescript-dotnet --save and then npm install typescript-dotnet --save just to be sure?

npm uninstall typescript-dotnet --save
npm install typescript-dotnet --save
electricessence commented 8 years ago

Does your project contain a package.json? That's part of how node/npm finds sub modules.

galvesribeiro commented 8 years ago

@electricessence you are the man! Perfect! Calling uninstall and them install again got the issue away! :)

May I ask if you fixed something between our last talk on gitter and now?

Thanks!

electricessence commented 8 years ago

@galvesribeiro YES!!! Awesome. Yeah. I've had to do that a few times. npm update --save isn't as reliable as we'd like.

galvesribeiro commented 8 years ago

Thanks! :dancer:

electricessence commented 8 years ago

@galvesribeiro

May I ask if you fixed something between our last talk on gitter and now?

I fixed stuff in the last 24 hours yeah.