Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions 8 lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ function runTypeScriptCompiler(logger, projectDir, options) {

if (!options.release) {
// For debugging in Chrome DevTools
nodeArgs.push(
'--sourceMap', 'false',
'--inlineSourceMap', 'true',
'--inlineSources', 'true'
);
nodeArgs.push('--inlineSourceMap', '--inlineSources');
}

logger.trace(process.execPath, nodeArgs.join(' '));
var tsc = spawn(process.execPath, nodeArgs);

var isResolved = false;
tsc.stdout.on('data', function(data) {
var stringData = data.toString();
Expand Down
36 changes: 30 additions & 6 deletions 36 postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ var path = require('path');

var projectDir = hook.findProjectDir();
if (projectDir) {
createTsconfig();
var tsconfigPath = path.join(projectDir, 'tsconfig.json');
if (fs.existsSync(tsconfigPath)) {
migrateTsconfig(tsconfigPath);
} else {
createTsconfig(tsconfigPath);
}
createReferenceFile();
installTypescript();
}
Expand All @@ -20,8 +25,29 @@ function createReferenceFile() {
}
}

function createTsconfig() {
var tsconfigPath = path.join(projectDir, 'tsconfig.json');
function migrateTsconfig(tsconfigPath) {
var displaybleTsconfigPath = path.relative(projectDir, tsconfigPath);

try {
var existingConfigContents = fs.readFileSync(tsconfigPath);
var existingConfig = JSON.parse(existingConfigContents);
} catch (e) {
console.error("Invalid " + displaybleTsconfigPath + ": " + e);
return;
}

if (existingConfig["compilerOptions"]) {
if ("sourceMap" in existingConfig["compilerOptions"]) {
delete existingConfig["compilerOptions"]["sourceMap"];
console.warn("> Deleted \"compilerOptions.sourceMap\" setting in \"" + displaybleTsconfigPath + "\".");
console.warn("> Inline source maps will be used when building in Debug configuration from now on.");
}
}

fs.writeFileSync(tsconfigPath, JSON.stringify(existingConfig, null, 4));
}

function createTsconfig(tsconfigPath) {
var tsconfig = {};

tsconfig.compilerOptions = {
Expand All @@ -35,9 +61,7 @@ function createTsconfig() {

tsconfig.exclude = ['node_modules', 'platforms', "**/*.aot.ts"];

if (!fs.existsSync(tsconfigPath)) {
fs.appendFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
}
fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 4));
}

function getProjectTypeScriptVersion() {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.