Skip to content

Commit 1407af7

Browse files
Remove .ts from tns-core-modules package when moving it to platforms dir
The new tns-core-modules package has .d.ts files. We should skip them when moving tns-core-modules to platforms dir. The current logic is - copy everything from node_modules to tns_modules dir. After that move everything from tns_modules/tns-core-modules dir to tns_modules and delete tns-core-modules. Add logic to delete .ts file BEFORE moving the files from tns_modules/tns-core-modules dir to tns_modules.
1 parent 6c5682b commit 1407af7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/tools/broccoli/node-modules-dest-copy.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import * as semver from "semver";
77
import * as shelljs from "shelljs";
88
import {wrapBroccoliPlugin} from './broccoli-plugin-wrapper-factory';
99
import * as constants from "../../constants";
10+
import * as minimatch from "minimatch";
11+
import Future = require("fibers/future");
1012

1113
/**
1214
* Intercepts each directory as it is copied to the destination tempdir,
@@ -79,6 +81,12 @@ export class DestCopy implements IBroccoliPlugin {
7981

8082
if (dependency.name === constants.TNS_CORE_MODULES_NAME) {
8183
let tnsCoreModulesResourcePath = path.join(this.outputRoot, constants.TNS_CORE_MODULES_NAME);
84+
85+
// Remove .ts files
86+
let allFiles = this.$fs.enumerateFilesInDirectorySync(tnsCoreModulesResourcePath);
87+
let deleteFilesFutures = allFiles.filter(file => minimatch(file, "**/*.ts", {nocase: true})).map(file => this.$fs.deleteFile(file));
88+
Future.wait(deleteFilesFutures);
89+
8290
shelljs.cp("-Rf", path.join(tnsCoreModulesResourcePath, "*"), this.outputRoot);
8391
this.$fs.deleteDirectory(tnsCoreModulesResourcePath).wait();
8492
}

0 commit comments

Comments
 (0)