Skip to content

Commit f6bc6e7

Browse files
author
David Paz
committed
Rename to enableTypeScriptLoader
1 parent facc132 commit f6bc6e7

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ module.exports = {
344344
/**
345345
* Call this if you plan on loading TypeScript files.
346346
*
347-
* Encore.configureTypeScript(function(tsConfig) {
347+
* Encore.enableTypeScriptLoader(function(tsConfig) {
348348
* // change the tsConfig
349349
* });
350350
*
@@ -354,8 +354,8 @@ module.exports = {
354354
* @param {function} callback
355355
* @return {exports}
356356
*/
357-
configureTypeScript(callback) {
358-
webpackConfig.configureTypeScript(callback);
357+
enableTypeScriptLoader(callback) {
358+
webpackConfig.enableTypeScriptLoader(callback);
359359

360360
return this;
361361
},

lib/WebpackConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,11 @@ class WebpackConfig {
224224
this.useReact = true;
225225
}
226226

227-
configureTypeScript(callback) {
227+
enableTypeScriptLoader(callback) {
228228
this.useTypeScriptLoader = true;
229229

230230
if (typeof callback !== 'function') {
231-
throw new Error('Argument 1 to configureTypeScript() must be a callback function.');
231+
throw new Error('Argument 1 to enableTypeScriptLoader() must be a callback function.');
232232
}
233233

234234
this.tsConfigurationCallback = callback;

lib/loader-features.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const loaderFeatures = {
3737
description: 'process React JS files'
3838
},
3939
typescript: {
40-
method: 'configureTypeScript()',
40+
method: 'enableTypeScriptLoader()',
4141
packages: ['typescript', 'ts-loader'],
4242
description: 'process TypeScript files'
4343
}

test/WebpackConfig.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,19 +278,23 @@ describe('WebpackConfig object', () => {
278278
});
279279
});
280280

281-
describe('configureTypeScript', () => {
281+
describe('enableTypeScriptLoader', () => {
282282
it('Calling method sets it', () => {
283283
const config = createConfig();
284284
const testCallback = () => {};
285-
config.configureTypeScript(testCallback);
285+
config.enableTypeScriptLoader(testCallback);
286286
expect(config.tsConfigurationCallback).to.equal(testCallback);
287287
});
288288

289289
it('Calling with non-callback throws an error', () => {
290290
const config = createConfig();
291291

292292
expect(() => {
293-
config.configureTypeScript('FOO');
293+
config.enableTypeScriptLoader('FOO');
294+
}).to.throw('must be a callback function');
295+
296+
expect(() => {
297+
config.enableTypeScriptLoader();
294298
}).to.throw('must be a callback function');
295299
});
296300
});

test/functional.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ module.exports = {
588588
config.setPublicPath('/build');
589589
config.addEntry('main', ['./js/render.ts', './js/index.ts']);
590590
const testCallback = () => {};
591-
config.configureTypeScript(testCallback);
591+
config.enableTypeScriptLoader(testCallback);
592592

593593
testSetup.runWebpack(config, (webpackAssert) => {
594594
// check that ts-loader transformed the ts file

test/loaders/typescript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function createConfig() {
2525
describe('loaders/typescript', () => {
2626
it('getLoaders() basic usage', () => {
2727
const config = createConfig();
28-
config.configureTypeScript(function(config) {
28+
config.enableTypeScriptLoader(function(config) {
2929
config.foo = 'bar';
3030
});
3131

@@ -37,7 +37,7 @@ describe('loaders/typescript', () => {
3737

3838
it('getLoaders() check defaults configuration values', () => {
3939
const config = createConfig();
40-
config.configureTypeScript(function(config) {
40+
config.enableTypeScriptLoader(function(config) {
4141
config.foo = 'bar';
4242
});
4343

0 commit comments

Comments
 (0)