Skip to content

Commit

Permalink
fix: vue 2.7 typescript fork-ts issue (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachJW34 committed Jul 2, 2022
1 parent 4052e8c commit 0162a96
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 86 deletions.
2 changes: 1 addition & 1 deletion apps/docusaurus-e2e/tests/docusaurus.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ensureNxProject, uniq } from '@nrwl/nx-plugin/testing';
import { runNxCommandAsyncStripped } from '@nx-plus/test-utils';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

describe('docusaurus e2e', () => {
it('should create and build docusaurus', async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/nuxt-e2e/tests/nuxt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
uniq,
updateFile,
} from '@nrwl/nx-plugin/testing';
import { runNxCommandAsyncStripped } from '@nx-plus/test-utils';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

describe('nuxt e2e', () => {
beforeAll(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/vite-e2e/tests/vite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
updateFile,
} from '@nrwl/nx-plugin/testing';
import { join } from 'path';
import { runNxCommandAsyncStripped } from '@nx-plus/test-utils';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

describe('vite e2e', () => {
it('should create vite app', async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/vue-e2e/tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { tags } from '@angular-devkit/core';
import { checkFilesExist, tmpProjPath } from '@nrwl/nx-plugin/testing';
import * as cp from 'child_process';
import { runNxCommandAsyncStripped } from '@nx-plus/test-utils';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

export async function testGeneratedApp(
appName: string,
Expand Down
2 changes: 1 addition & 1 deletion apps/vue-e2e/tests/vue-2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
updateFile,
} from '@nrwl/nx-plugin/testing';
import { runNxProdCommandAsync, testGeneratedApp } from './utils';
import { runNxCommandAsyncStripped } from '@nx-plus/test-utils';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

describe('vue 2 e2e', () => {
describe('app', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/vue-e2e/tests/vue-3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
updateFile,
} from '@nrwl/nx-plugin/testing';
import { runNxProdCommandAsync, testGeneratedApp } from './utils';
import { runNxCommandAsyncStripped } from '@nx-plus/test-utils';
import { runNxCommandAsyncStripped } from '@nx-plus/shared/testing';

describe('vue 3 e2e', () => {
describe('app', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["../../.eslintrc.json"],
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
Expand Down
7 changes: 7 additions & 0 deletions libs/shared/testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# shared-testing

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build shared-testing` to build the library.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@nx-plus/test-utils",
"name": "@nx-plus/shared/testing",
"version": "0.0.1",
"type": "commonjs"
}
15 changes: 15 additions & 0 deletions libs/shared/testing/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/shared/testing/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/shared/testing/**/*.ts"]
}
}
},
"tags": []
}
1 change: 1 addition & 0 deletions libs/shared/testing/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/shared-testing';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
Expand All @@ -14,9 +14,6 @@
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "../../../dist/out-tsc",
"declaration": true,
"types": []
},
Expand Down
11 changes: 0 additions & 11 deletions libs/test-utils/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions libs/test-utils/jest.config.ts

This file was deleted.

33 changes: 0 additions & 33 deletions libs/test-utils/project.json

This file was deleted.

1 change: 0 additions & 1 deletion libs/test-utils/src/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions libs/test-utils/tsconfig.spec.json

This file was deleted.

4 changes: 2 additions & 2 deletions libs/vue/src/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function modifyTsConfigPaths(
): void {
const tsConfigPath = path.join(context.root, options.tsConfig);
const vue = loadModule('vue', context.root);
const isVue3 = semver.major(vue.version) === 3;
const isVue3orVue2_7 = semver.satisfies(vue.version, '>=2.7.0');

config.module
.rule('ts')
Expand All @@ -53,7 +53,7 @@ export function modifyTsConfigPaths(
return loaderOptions;
});
config.plugin('fork-ts-checker').tap((args: ANY) => {
if (isVue3) {
if (isVue3orVue2_7) {
args[0].typescript.configFile = tsConfigPath;
} else {
args[0].tsconfig = tsConfigPath;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"paths": {
"@nx-plus/docusaurus": ["libs/docusaurus/src/index.ts"],
"@nx-plus/nuxt": ["libs/nuxt/src/index.ts"],
"@nx-plus/test-utils": ["libs/test-utils/src/index.ts"],
"@nx-plus/shared/testing": ["libs/shared/testing/src/index.ts"],
"@nx-plus/vite": ["libs/vite/src/index.ts"],
"@nx-plus/vue": ["libs/vue/src/index.ts"]
}
Expand Down
2 changes: 1 addition & 1 deletion workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"docusaurus-e2e": "apps/docusaurus-e2e",
"nuxt": "libs/nuxt",
"nuxt-e2e": "apps/nuxt-e2e",
"test-utils": "libs/test-utils",
"shared-testing": "libs/shared/testing",
"vite": "libs/vite",
"vite-e2e": "apps/vite-e2e",
"vue": "libs/vue",
Expand Down

0 comments on commit 0162a96

Please sign in to comment.