-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/nextjs-cli-default
- Loading branch information
Showing
47 changed files
with
218 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
import { MigrationsJsonEntry } from 'nx/src/config/misc-interfaces'; | ||
|
||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
|
||
describe('Angular migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: MigrationsJsonEntry) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
assertValidMigrationPaths(json, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
|
||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
|
||
describe('Cypress migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators || {}).forEach((m: any) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
assertValidMigrationPaths(json, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
|
||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
|
||
describe('Detox migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: any) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
assertValidMigrationPaths(json, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* eslint-disable @typescript-eslint/no-restricted-imports */ | ||
export * from 'nx/internal-testing-utils/assert-valid-migrations'; | ||
export * from 'nx/internal-testing-utils/run-migration-against-this-workspace'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import json = require('./migrations.json'); | ||
|
||
import { assertValidMigrationPaths } from './internal-testing-utils'; | ||
|
||
describe('Devkit migrations', () => { | ||
assertValidMigrationPaths(json, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
"**/*.spec.jsx", | ||
"**/*.test.jsx", | ||
"**/*.d.ts", | ||
"internal-testing-utils.ts", | ||
"jest.config.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,7 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
|
||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
|
||
describe('esbuild migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: any) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
assertValidMigrationPaths(json, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import json = require('./migrations.json'); | ||
|
||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
|
||
describe('eslint-plugin migrations', () => { | ||
assertValidMigrationPaths(json, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import json = require('./migrations.json'); | ||
|
||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
import { MigrationsJson } from '@nx/devkit'; | ||
|
||
describe('expo migrations', () => { | ||
assertValidMigrationPaths(json as MigrationsJson, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
|
||
describe('Express migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: any) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
import { MigrationsJson } from '@nx/devkit'; | ||
|
||
describe('express migrations', () => { | ||
assertValidMigrationPaths(json as MigrationsJson, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
import { MigrationsJsonEntry } from 'nx/src/config/misc-interfaces'; | ||
|
||
describe('Jest migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: MigrationsJsonEntry) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
import { MigrationsJson } from '@nx/devkit'; | ||
|
||
describe('jest migrations', () => { | ||
assertValidMigrationPaths(json as MigrationsJson, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
|
||
describe('JS migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: any) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
import { MigrationsJson } from '@nx/devkit'; | ||
|
||
describe('js migrations', () => { | ||
assertValidMigrationPaths(json as MigrationsJson, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
import { MigrationsJsonEntry } from 'nx/src/config/misc-interfaces'; | ||
|
||
describe('Linter migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: MigrationsJsonEntry) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
import { MigrationsJson } from '@nx/devkit'; | ||
|
||
describe('linter migrations', () => { | ||
assertValidMigrationPaths(json as MigrationsJson, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
import { MigrationsJsonEntry } from 'nx/src/config/misc-interfaces'; | ||
|
||
describe('Nest migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: MigrationsJsonEntry) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
import { MigrationsJson } from '@nx/devkit'; | ||
|
||
describe('nest migrations', () => { | ||
assertValidMigrationPaths(json as MigrationsJson, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
import { MigrationsJsonEntry } from 'nx/src/config/misc-interfaces'; | ||
|
||
describe('Next migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: MigrationsJsonEntry) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
import { MigrationsJson } from '@nx/devkit'; | ||
|
||
describe('next migrations', () => { | ||
assertValidMigrationPaths(json as MigrationsJson, __dirname); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
import path = require('path'); | ||
import json = require('./migrations.json'); | ||
import { MigrationsJsonEntry } from 'nx/src/config/misc-interfaces'; | ||
|
||
describe('Node migrations', () => { | ||
it('should have valid paths', () => { | ||
Object.values(json.generators).forEach((m: MigrationsJsonEntry) => { | ||
expect(() => | ||
require.resolve( | ||
path.join(__dirname, `${m.factory ?? m.implementation}.ts`) | ||
) | ||
).not.toThrow(); | ||
}); | ||
}); | ||
import { assertValidMigrationPaths } from '@nx/devkit/internal-testing-utils'; | ||
import { MigrationsJson } from '@nx/devkit'; | ||
|
||
describe('node migrations', () => { | ||
assertValidMigrationPaths(json as MigrationsJson, __dirname); | ||
}); |
33 changes: 33 additions & 0 deletions
33
packages/nx/internal-testing-utils/assert-valid-migrations.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
MigrationsJson, | ||
MigrationsJsonEntry, | ||
} from '../src/config/misc-interfaces'; | ||
import * as path from 'path'; | ||
|
||
export function assertValidMigrationPaths(json: MigrationsJson, root: string) { | ||
Object.entries(json.generators).forEach(([generator, m]) => { | ||
it(`should have valid path generator: ${generator}`, () => { | ||
validateMigration(m, root); | ||
}); | ||
}); | ||
|
||
Object.entries(json.schematics ?? {}).forEach(([schematic, m]) => { | ||
it(`should have valid path schematic: ${schematic}`, () => { | ||
validateMigration(m, root); | ||
}); | ||
}); | ||
} | ||
|
||
function validateMigration(m: MigrationsJsonEntry, root: string) { | ||
const impl = m.factory ?? m.implementation; | ||
const [implPath, implMember] = impl.includes('#') | ||
? impl.split('#') | ||
: [impl, null]; | ||
let implModule; | ||
expect(() => { | ||
implModule = require(path.join(root, `${implPath}.ts`)); | ||
}).not.toThrow(); | ||
if (implMember) { | ||
expect(implModule).toHaveProperty(implMember); | ||
} | ||
} |
Oops, something went wrong.