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 broken backward compatibility with output file path #18

Merged
merged 1 commit into from
Mar 22, 2014
Merged

Conversation

kotas
Copy link
Owner

@kotas kotas commented Mar 22, 2014

For issue #17

By changing the strategy how to capture output files from tsc in
7156ee4, path of output files changed
accidentally in some cases. This commit fixes it.

When input paths have any common path, tsc skips that common path
and uses only different part of the path for output files.

For example, if we have "foo/bar/a.ts" and "foo/bar/baz/b.ts", tsc skips
"foo/bar/" automatically and outputs "a.ts" and "baz/b.ts". gulp-tsc
followed that rule implicitly by changing the strategy.

However, this is not ideal for gulp tasks since with gulp.src("foo/*/.ts")
the plugin should use "bar/a.ts" and "bar/baz/b.ts" for output paths.

To fix this, we add common part of input paths to output paths.

By changing the strategy how to capture output files from tsc in
7156ee4, path of output files changed
accidentally in some cases. This commit fixes it.

When input paths have any common path, tsc skips that common path
and uses only different part of the path for output files.

For example, if we have "foo/bar/a.ts" and "foo/bar/baz/b.ts", tsc skips
"foo/bar/" automatically and outputs "a.ts" and "baz/b.ts". gulp-tsc
followed that rule implicitly by changing the strategy.

However, this is not ideal for gulp tasks since with gulp.src("foo/**/*.ts")
the plugin should use "bar/a.ts" and "bar/baz/b.ts" for output paths.

To fix this, we add common part of input paths to output paths.
kotas added a commit that referenced this pull request Mar 22, 2014
Fix broken backward compatibility with output file path
@kotas kotas merged commit 6e27b21 into master Mar 22, 2014
@kotas kotas deleted the issues/17 branch March 22, 2014 08:41
@bestander
Copy link

Hi, thanks for the best gulp tsc task.
I think this pull request broke my build and I reverted to version 0.5.0.

This is my setup:

gulp.task('compile-typescript', function() {
    return gulp.src(['app/**/*.ts'])
        .pipe(cache('typescript'))
        .pipe(typescript(typescriptOptions))
        .pipe(gulp.dest(webOutputPath + '/app'));
});
gulp.task('dev', function(callback) {
    runSequence('clean-web-output',
        ['compile-typescript', 'compile-sass' ],//, 'run-tests'],
        function() {
            gulp.watch(['app/**/*.ts'], ['compile-typescript']);
        });
});

If I change one TS file I expect 1 or more JS files to be compiled into my .tmp folder.

For example if I change:

/app/online-reader/popup-reader-directive.ts

Then compiler produces this list:

<tmp>/online-reader/popup-reader-directive.js
<tmp>/online-reader/reader-preferences-service.js
<tmp>/analytics/http-latency-sampler.js

The change in this ticket changes it to:

<tmp>/online-reader/online-reader/popup-reader-directive.js
<tmp>/online-reader/online-reader/reader-preferences-service.js
<tmp>/online-reader/analytics/http-latency-sampler.js

Which os wrong.

I am happy to debug or provide more test data.

@kotas
Copy link
Owner Author

kotas commented Mar 26, 2014

@bestander Thank you for your report! I've made the issue above for the problem. It'll be considered to be a bug.

@kotas
Copy link
Owner Author

kotas commented Mar 26, 2014

@bestander I've published v0.6.0. Please check if it fixes your problem. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants