Skip to content

chore: revert the tilde resolution as it was removed by mistake #77

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

Merged
merged 1 commit into from
Feb 7, 2019
Merged
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
14 changes: 14 additions & 0 deletions tsconfig-upgrader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var __migrations = [
inlineSourceMapMigration,
addDomLibs,
addIterableToAngularProjects,
addTnsCoreModulesPathMappings,
];

function migrateProject(tsConfig, tsconfigPath, projectDir) {
Expand Down Expand Up @@ -80,6 +81,19 @@ function addTsLib(existingConfig, libName) {
}
}

function addTnsCoreModulesPathMappings(existingConfig, displayableTsconfigPath, projectDir) {
Copy link

@vchimev vchimev Feb 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could change the function's name as it no longer maps tns-core-modules short imports, but only tilde. ;)

console.log("Adding tns-core-modules path mappings lib to tsconfig.json...");
existingConfig["compilerOptions"] = existingConfig["compilerOptions"] || {};
var compilerOptions = existingConfig["compilerOptions"];
compilerOptions["baseUrl"] = ".";
compilerOptions["paths"] = compilerOptions["paths"] || {};

const appPath = getAppPath(projectDir);
compilerOptions["paths"]["~/*"] = compilerOptions["paths"]["~/*"] || [
`${appPath}/*`
];
}

function getAppPath(projectDir) {
const DEFAULT_PATH = "app";
const nsConfigPath = path.join(projectDir, "nsconfig.json");
Expand Down