From 5e1d0b0a6cdee415ad3f10be3998d65d53b1cbc5 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Fri, 13 Jul 2018 10:01:13 -0700 Subject: [PATCH] Looks like VS Code tried to be helpful and automatically use my path alias to /src for all files in /src. Unfortunately, this breaks the compiled js because the paths don't get resolved in the js. Working as intended: https://github.com/Microsoft/TypeScript/issues/10866 Just going to get rid of that alias entirely - It isn't going to make things easier in the long term like I hoped it would. I originally only intended it to be used in the tests, but if VS code is going to be aggressive about it, then its better to just forgo it entirely. --- src/coalesce-vue/package.json | 1 - src/coalesce-vue/src/api-client.ts | 6 +++--- src/coalesce-vue/src/index.ts | 8 ++++---- src/coalesce-vue/src/model.ts | 4 ++-- src/coalesce-vue/src/viewmodel.ts | 8 ++++---- src/coalesce-vue/test/model.display.spec.ts | 4 ++-- src/coalesce-vue/test/model.shared.ts | 2 +- src/coalesce-vue/test/model.spec.ts | 2 +- src/coalesce-vue/test/model.toDto.spec.ts | 6 +++--- src/coalesce-vue/test/model.toModel.spec.ts | 6 +++--- src/coalesce-vue/test/targets.apiclients.ts | 2 +- src/coalesce-vue/test/targets.metadata.ts | 2 +- src/coalesce-vue/test/targets.models.ts | 2 +- src/coalesce-vue/test/targets.viewmodels.ts | 2 +- src/coalesce-vue/test/viewmodel.spec.ts | 4 ++-- src/coalesce-vue/tsconfig.json | 7 +------ 16 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/coalesce-vue/package.json b/src/coalesce-vue/package.json index 5577c3234..16915c6f4 100644 --- a/src/coalesce-vue/package.json +++ b/src/coalesce-vue/package.json @@ -49,7 +49,6 @@ ], "moduleNameMapper": { "^vue$": "vue/dist/vue.common.js", - "^@/(.*)$": "/src/$1", "//": "Map the esm version of libs to the non-esm for the tests - jest doesn't do well with es modules & typescript. By some sheer chance of luck, the import statements can be written the same between the es and non-es versions of the files.", "^date-fns/esm$": "date-fns", "lodash-es": "lodash" diff --git a/src/coalesce-vue/src/api-client.ts b/src/coalesce-vue/src/api-client.ts index c173ce8de..d10e2c36a 100644 --- a/src/coalesce-vue/src/api-client.ts +++ b/src/coalesce-vue/src/api-client.ts @@ -18,9 +18,9 @@ declare module "axios" { } } -import { ModelType, ClassType, Method, Service, ApiRoutedType, DataSourceType, Value, ModelValue, CollectionValue, VoidValue } from '@/metadata' -import { Model, convertToModel, mapToDto, mapValueToDto, DataSource, convertValueToModel } from '@/model' -import { OwnProps, Indexable } from '@/util' +import { ModelType, ClassType, Method, Service, ApiRoutedType, DataSourceType, Value, ModelValue, CollectionValue, VoidValue } from './metadata' +import { Model, convertToModel, mapToDto, mapValueToDto, DataSource, convertValueToModel } from './model' +import { OwnProps, Indexable } from './util' import axios, { AxiosPromise, AxiosResponse, AxiosError, AxiosRequestConfig, Canceler, CancelTokenSource, CancelToken, AxiosInstance, Cancel} from 'axios' import * as qs from 'qs' diff --git a/src/coalesce-vue/src/index.ts b/src/coalesce-vue/src/index.ts index 734e7672f..85a275219 100644 --- a/src/coalesce-vue/src/index.ts +++ b/src/coalesce-vue/src/index.ts @@ -1,6 +1,6 @@ -export * from '@/metadata' -export * from '@/model' -export * from '@/api-client' -export * from '@/viewmodel' \ No newline at end of file +export * from './metadata' +export * from './model' +export * from './api-client' +export * from './viewmodel' \ No newline at end of file diff --git a/src/coalesce-vue/src/model.ts b/src/coalesce-vue/src/model.ts index 5dff6918d..28c010153 100644 --- a/src/coalesce-vue/src/model.ts +++ b/src/coalesce-vue/src/model.ts @@ -2,8 +2,8 @@ // Tedious imports for maximum tree shaking import { toDate, isValid, format } from 'date-fns/esm' -import { ClassType, Property, PropNames, resolvePropMeta, Value, EnumValue, PrimitiveValue, DateValue, CollectionValue, DataSourceType, ModelValue, ObjectValue } from "@/metadata" -import { Indexable } from '@/util' +import { ClassType, Property, PropNames, resolvePropMeta, Value, EnumValue, PrimitiveValue, DateValue, CollectionValue, DataSourceType, ModelValue, ObjectValue } from "./metadata" +import { Indexable } from './util' /** * Represents a model with metadata information. diff --git a/src/coalesce-vue/src/viewmodel.ts b/src/coalesce-vue/src/viewmodel.ts index e3a640e8c..0ecd3e322 100644 --- a/src/coalesce-vue/src/viewmodel.ts +++ b/src/coalesce-vue/src/viewmodel.ts @@ -1,10 +1,10 @@ import Vue from 'vue'; -import { ModelType, CollectionProperty, PropertyOrName, resolvePropMeta, PropNames } from '@/metadata'; -import { ModelApiClient, ListParameters } from '@/api-client'; -import { Model, modelDisplay, propDisplay, mapToDto, convertToModel, updateFromModel } from '@/model'; -import { Indexable } from '@/util'; +import { ModelType, CollectionProperty, PropertyOrName, resolvePropMeta, PropNames } from './metadata'; +import { ModelApiClient, ListParameters } from './api-client'; +import { Model, modelDisplay, propDisplay, mapToDto, convertToModel, updateFromModel } from './model'; +import { Indexable } from './util'; import { debounce } from 'lodash-es' import { Cancelable } from 'lodash' diff --git a/src/coalesce-vue/test/model.display.spec.ts b/src/coalesce-vue/test/model.display.spec.ts index b45564f10..cd7c9ce0c 100644 --- a/src/coalesce-vue/test/model.display.spec.ts +++ b/src/coalesce-vue/test/model.display.spec.ts @@ -1,6 +1,6 @@ -import * as model from "@/model"; +import * as model from "../src/model"; import * as $metadata from "./targets.metadata"; -import { ObjectValue, Value } from "@/metadata"; +import { ObjectValue, Value } from "../src/metadata"; import { shortStringify } from "./test-utils"; const studentProps = $metadata.Student.props; diff --git a/src/coalesce-vue/test/model.shared.ts b/src/coalesce-vue/test/model.shared.ts index 0ce3746a2..a7ef1fc98 100644 --- a/src/coalesce-vue/test/model.shared.ts +++ b/src/coalesce-vue/test/model.shared.ts @@ -1,6 +1,6 @@ import * as $metadata from "./targets.metadata"; -import { ObjectValue, Value, ModelValue } from "@/metadata"; +import { ObjectValue, Value, ModelValue } from "../src/metadata"; const studentProps = $metadata.Student.props; diff --git a/src/coalesce-vue/test/model.spec.ts b/src/coalesce-vue/test/model.spec.ts index bd43acf95..1e379dba4 100644 --- a/src/coalesce-vue/test/model.spec.ts +++ b/src/coalesce-vue/test/model.spec.ts @@ -1,6 +1,6 @@ -import * as model from "@/model"; +import * as model from "../src/model"; import * as $metadata from "./targets.metadata"; import { Indexable } from "lib/util"; diff --git a/src/coalesce-vue/test/model.toDto.spec.ts b/src/coalesce-vue/test/model.toDto.spec.ts index c8e948c90..c47fd0e19 100644 --- a/src/coalesce-vue/test/model.toDto.spec.ts +++ b/src/coalesce-vue/test/model.toDto.spec.ts @@ -1,8 +1,8 @@ -import * as model from "@/model"; +import * as model from "../src/model"; import * as $metadata from "./targets.metadata"; -import { ModelValue, ObjectValue, Value, ObjectType, CollectionValue } from "@/metadata"; +import { ModelValue, ObjectValue, Value, ObjectType, CollectionValue } from "../src/metadata"; import { shortStringify } from "./test-utils"; -import { Indexable } from "@/util"; +import { Indexable } from "../src/util"; import { twoWayConversions, studentValue, MappingData } from "./model.shared"; const studentProps = $metadata.Student.props; diff --git a/src/coalesce-vue/test/model.toModel.spec.ts b/src/coalesce-vue/test/model.toModel.spec.ts index f4fe72402..3983d3874 100644 --- a/src/coalesce-vue/test/model.toModel.spec.ts +++ b/src/coalesce-vue/test/model.toModel.spec.ts @@ -1,9 +1,9 @@ -import * as model from "@/model"; +import * as model from "../src/model"; import * as $metadata from "./targets.metadata"; -import { ModelValue, ObjectValue, Value, ObjectType, CollectionValue } from "@/metadata"; +import { ModelValue, ObjectValue, Value, ObjectType, CollectionValue } from "../src/metadata"; import { shortStringify } from "./test-utils"; -import { Indexable } from "@/util"; +import { Indexable } from "../src/util"; import { twoWayConversions, studentValue, MappingData, displaysStudentValue } from "./model.shared"; const studentProps = $metadata.Student.props; diff --git a/src/coalesce-vue/test/targets.apiclients.ts b/src/coalesce-vue/test/targets.apiclients.ts index 7db50a73f..e417aaf6d 100644 --- a/src/coalesce-vue/test/targets.apiclients.ts +++ b/src/coalesce-vue/test/targets.apiclients.ts @@ -1,4 +1,4 @@ -import { ModelApiClient } from "@/api-client"; +import { ModelApiClient } from "../src/api-client"; import * as $models from "./targets.models" import * as $metadata from "./targets.metadata" diff --git a/src/coalesce-vue/test/targets.metadata.ts b/src/coalesce-vue/test/targets.metadata.ts index 11e47b80e..e4efec665 100644 --- a/src/coalesce-vue/test/targets.metadata.ts +++ b/src/coalesce-vue/test/targets.metadata.ts @@ -1,4 +1,4 @@ -import { ObjectType, BasicCollectionProperty, getEnumMeta, ObjectProperty, ModelType, ModelCollectionNavigationProperty, ClassType } from "@/metadata"; +import { ObjectType, BasicCollectionProperty, getEnumMeta, ObjectProperty, ModelType, ModelCollectionNavigationProperty, ClassType } from "../src/metadata"; const metaBase = (name: string = "model") => { return { diff --git a/src/coalesce-vue/test/targets.models.ts b/src/coalesce-vue/test/targets.models.ts index eafdc915d..f572708f4 100644 --- a/src/coalesce-vue/test/targets.models.ts +++ b/src/coalesce-vue/test/targets.models.ts @@ -1,5 +1,5 @@ import * as metadata from './targets.metadata' -import { Model, DataSource, convertToModel, mapToModel } from '@/model' +import { Model, DataSource, convertToModel, mapToModel } from '../src/model' export enum Grade { Freshman = 9, diff --git a/src/coalesce-vue/test/targets.viewmodels.ts b/src/coalesce-vue/test/targets.viewmodels.ts index c699ba20c..b3f56402e 100644 --- a/src/coalesce-vue/test/targets.viewmodels.ts +++ b/src/coalesce-vue/test/targets.viewmodels.ts @@ -1,7 +1,7 @@ import * as metadata from "./targets.metadata" import * as models from "./targets.models" import * as apiClients from "./targets.apiclients" -import { ViewModel, ListViewModel, defineProps } from '@/viewmodel' +import { ViewModel, ListViewModel, defineProps } from '../src/viewmodel' export interface StudentViewModel extends models.Student {} export class StudentViewModel extends ViewModel { diff --git a/src/coalesce-vue/test/viewmodel.spec.ts b/src/coalesce-vue/test/viewmodel.spec.ts index 7d1f709e6..cba85a5db 100644 --- a/src/coalesce-vue/test/viewmodel.spec.ts +++ b/src/coalesce-vue/test/viewmodel.spec.ts @@ -1,8 +1,8 @@ import Vue from 'vue'; -import { AxiosClient, AxiosItemResult } from '@/api-client' -import { mapToDto, mapToModel } from '@/model'; +import { AxiosClient, AxiosItemResult } from '../src/api-client' +import { mapToDto, mapToModel } from '../src/model'; import { StudentViewModel } from './targets.viewmodels'; import { Student } from './targets.models'; diff --git a/src/coalesce-vue/tsconfig.json b/src/coalesce-vue/tsconfig.json index b5794b905..c41c26648 100644 --- a/src/coalesce-vue/tsconfig.json +++ b/src/coalesce-vue/tsconfig.json @@ -10,12 +10,7 @@ "strict": true, "declaration": true, "lib": ["es2015", "es2017", "dom"], - "baseUrl": ".", - "paths": { - "@/*": [ - "src/*" - ] - }, + "baseUrl": "." }, "exclude": [