js-build-tools 4.0.10 → 4.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/partials/tsFor.js
CHANGED
|
@@ -22,6 +22,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
22
22
|
const tsFor = function () {
|
|
23
23
|
let srcPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : gulpConfig.get('typescript.from');
|
|
24
24
|
let distPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : gulpConfig.get('typescript.to');
|
|
25
|
+
if (gulpConfig.get('typescript.enabled') === false) {
|
|
26
|
+
return () => {};
|
|
27
|
+
}
|
|
25
28
|
const declarationProject = _gulpTypescript.default.createProject(gulpConfig.get('typescript.config'));
|
|
26
29
|
const tsProject = _gulpTypescript.default.createProject(gulpConfig.get('typescript.config'));
|
|
27
30
|
const makeDeclarations = () => (0, _gulp.src)(srcPath).pipe(declarationProject()).dts.pipe((0, _gulp.dest)(distPath));
|
|
@@ -111,6 +111,8 @@ describe('distFor', () => {
|
|
|
111
111
|
}, 5000)
|
|
112
112
|
|
|
113
113
|
test('can process typescript before babel', done => {
|
|
114
|
+
// Since adding the additional skip in tsFor if not enabled we need to ensure that we enable typescript for this test.
|
|
115
|
+
gulpConfig.set('typescript.enabled', true)
|
|
114
116
|
const srcPath = gulpConfig.get('srcPath')
|
|
115
117
|
const srcFile = `${srcPath}/distFor.ts`
|
|
116
118
|
fs.writeFileSync(srcFile, rawTsContents)
|
|
@@ -11,6 +11,9 @@ import ts from 'gulp-typescript'
|
|
|
11
11
|
* @see `https://www.typescriptlang.org/docs/handbook/gulp.html` for more info
|
|
12
12
|
*/
|
|
13
13
|
export const tsFor = (srcPath = gulpConfig.get('typescript.from'), distPath = gulpConfig.get('typescript.to')) => {
|
|
14
|
+
if (gulpConfig.get('typescript.enabled') === false) {
|
|
15
|
+
return () => {}
|
|
16
|
+
}
|
|
14
17
|
const declarationProject = ts.createProject(gulpConfig.get('typescript.config'))
|
|
15
18
|
const tsProject = ts.createProject(gulpConfig.get('typescript.config'))
|
|
16
19
|
const makeDeclarations = () => src(srcPath).pipe(declarationProject()).dts.pipe(dest(distPath))
|
|
@@ -24,6 +24,7 @@ afterEach(setUp.afterEach)
|
|
|
24
24
|
|
|
25
25
|
describe('tsFor', () => {
|
|
26
26
|
test('copies the src directory and compiles it into the dist directory', done => {
|
|
27
|
+
gulpConfig.set('typescript.enabled', true)
|
|
27
28
|
const distPath = gulpConfig.get('typescript.to')
|
|
28
29
|
const srcPath = gulpConfig.get('srcPath')
|
|
29
30
|
const srcFile = `${srcPath}/typeScript.ts`
|
|
@@ -37,4 +38,10 @@ describe('tsFor', () => {
|
|
|
37
38
|
done()
|
|
38
39
|
})
|
|
39
40
|
}, 60000)
|
|
41
|
+
|
|
42
|
+
test('skips if typescript.enabled is false', () => {
|
|
43
|
+
gulpConfig.set('typescript.enabled', false)
|
|
44
|
+
const result = tsFor()
|
|
45
|
+
expect(result).toBeInstanceOf(Function)
|
|
46
|
+
})
|
|
40
47
|
})
|