Skip to content

Commit

Permalink
chore: apply nx 14 migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Hotell committed May 18, 2023
1 parent cc80f8e commit 2676412
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 60 deletions.
2 changes: 1 addition & 1 deletion jest.config.js → jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { getJestProjects } = require('@nrwl/jest');

module.exports = {
export default {
projects: [...getJestProjects()],
};
30 changes: 11 additions & 19 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "fluentui",
"implicitDependencies": {
"package.json": {
Expand Down Expand Up @@ -28,24 +29,15 @@
"analyzeSourceFiles": true
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
],
"package": [
{
"target": "package",
"projects": "dependencies"
}
],
"prepare": [
{
"target": "prepare",
"projects": "dependencies"
}
]
"targetDefaults": {
"build": {
"dependsOn": ["^build"]
},
"package": {
"dependsOn": ["^package"]
},
"prepare": {
"dependsOn": ["^prepare"]
}
}
}
4 changes: 2 additions & 2 deletions tools/generators/add-codeowners.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Tree, addProjectConfiguration, stripIndents } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import { addCodeowner } from './add-codeowners';
import { setupCodeowners } from '../utils-testing';
import { workspacePaths } from '../utils';
Expand All @@ -8,7 +8,7 @@ describe(`#addCodeowner`, () => {
let tree: Tree;

beforeEach(() => {
tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();

addProjectConfiguration(tree, '@proj/react-one', {
root: '/packages/react-one',
Expand Down
4 changes: 2 additions & 2 deletions tools/generators/dependency-mismatch/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import { Tree, addProjectConfiguration, serializeJson, readWorkspaceConfiguration, readJson } from '@nrwl/devkit';

import generator from './index';
Expand All @@ -9,7 +9,7 @@ describe('dependency-mismatch generator', () => {
let workspaceNpmScope: string;

beforeEach(() => {
appTree = createTreeWithEmptyWorkspace();
appTree = createTreeWithEmptyV1Workspace();
workspaceNpmScope = readWorkspaceConfiguration(appTree).npmScope as string;
});

Expand Down
12 changes: 6 additions & 6 deletions tools/generators/epic-generator/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addProjectConfiguration, ProjectType, stripIndents, writeJson } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import { execSync, spawnSync, SpawnSyncReturns } from 'child_process';
import { workspacePaths } from '../../utils';
import epicGenerator from './index';
Expand All @@ -16,7 +16,7 @@ type Package = {
};

function setupTest(packages: Package[]) {
const tree = createTreeWithEmptyWorkspace();
const tree = createTreeWithEmptyV1Workspace();

// Initialize NX package structure
packages.forEach(pckg => {
Expand Down Expand Up @@ -80,15 +80,15 @@ function setupTest(packages: Package[]) {
describe('epic-generator', () => {
describe('validation', () => {
it('requires a non-empty title', () => {
const tree = createTreeWithEmptyWorkspace();
const tree = createTreeWithEmptyV1Workspace();

expect(() =>
epicGenerator(tree, { title: ' ', repository: 'microsoft/fluentui' }),
).toThrowErrorMatchingInlineSnapshot(`"Must provide a title for the issue"`);
});

it('requires a well formatted repository', () => {
const tree = createTreeWithEmptyWorkspace();
const tree = createTreeWithEmptyV1Workspace();

expect(() => epicGenerator(tree, { title: 'test title', repository: 'invalid_repo' }))
.toThrowErrorMatchingInlineSnapshot(`
Expand All @@ -103,7 +103,7 @@ describe('epic-generator', () => {
spawnSyncMock.mockReturnValueOnce({
error: new Error('command not found.'),
});
const tree = createTreeWithEmptyWorkspace();
const tree = createTreeWithEmptyV1Workspace();

expect(() => epicGenerator(tree, { title: 'test title', repository: 'microsoft/fluentui' }))
.toThrowErrorMatchingInlineSnapshot(`
Expand All @@ -117,7 +117,7 @@ describe('epic-generator', () => {
output: [['You are not logged into any GitHub hosts. Run gh auth login to authenticate.']],
});

const tree = createTreeWithEmptyWorkspace();
const tree = createTreeWithEmptyV1Workspace();

expect(() =>
epicGenerator(tree, { title: 'test title', repository: 'microsoft/fluentui' }),
Expand Down
4 changes: 2 additions & 2 deletions tools/generators/migrate-converged-pkg/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Enquirer from 'enquirer';
import * as fs from 'fs';
import * as path from 'path';
import * as chalk from 'chalk';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import {
Tree,
readProjectConfiguration,
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('migrate-converged-pkg generator', () => {
jest.spyOn(console, 'info').mockImplementation(noop);
jest.spyOn(console, 'warn').mockImplementation(noop);

tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();
tree = setupCodeowners(tree, { content: `` });
tree.write(
'jest.config.js',
Expand Down
4 changes: 2 additions & 2 deletions tools/generators/migrate-fixed-versions/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import {
Tree,
readProjectConfiguration,
Expand All @@ -24,7 +24,7 @@ describe('migrate-fixed-versions generator', () => {
jest.spyOn(console, 'info').mockImplementation(noop);
jest.spyOn(console, 'warn').mockImplementation(noop);

tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();
tree = setupDummyPackage(tree, options);
});

Expand Down
4 changes: 2 additions & 2 deletions tools/generators/migrate-v8-pkg/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import {
Tree,
readProjectConfiguration,
Expand Down Expand Up @@ -34,7 +34,7 @@ describe('migrate-v8-pkg generator', () => {
jest.spyOn(console, 'info').mockImplementation(noop);
jest.spyOn(console, 'warn').mockImplementation(noop);

tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();
tree = setupDummyPackage(tree, options);
tree = setupDummyPackage(tree, {
name: '@proj/react',
Expand Down
4 changes: 2 additions & 2 deletions tools/generators/move-packages/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import {
Tree,
readProjectConfiguration,
Expand Down Expand Up @@ -36,7 +36,7 @@ describe('move-packages generator', () => {
jest.restoreAllMocks();
jest.spyOn(console, 'log').mockImplementation(noop);

tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();

setupCodeowners(tree, { content: `packages/test @dummyOwner` });

Expand Down
4 changes: 2 additions & 2 deletions tools/generators/print-stats.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addProjectConfiguration, getProjects, logger, Tree } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import * as chalk from 'chalk';
import { disableChalk, formatMockedCalls } from '../utils-testing';

Expand All @@ -19,7 +19,7 @@ describe(`print stats`, () => {
jest.spyOn(console, 'info').mockImplementation(noop);
jest.spyOn(console, 'warn').mockImplementation(noop);

tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();

addProjectConfiguration(tree, '@proj/pkg-a', {
root: 'packages/pkg-a',
Expand Down
4 changes: 2 additions & 2 deletions tools/generators/rc-caret/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import {
Tree,
readProjectConfiguration,
Expand All @@ -23,7 +23,7 @@ describe('rc-caret generator', () => {
jest.spyOn(console, 'info').mockImplementation(noop);
jest.spyOn(console, 'warn').mockImplementation(noop);

tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();
npmScope = readWorkspaceConfiguration(tree).npmScope ?? '@proj';
});

Expand Down
4 changes: 2 additions & 2 deletions tools/generators/tsconfig-base-all/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import { Tree, writeJson, readJson, updateJson } from '@nrwl/devkit';

import generator from './index';
Expand All @@ -9,7 +9,7 @@ describe('tsconfig-base-all generator', () => {
const options: TsconfigBaseAllGeneratorSchema = {};

beforeEach(() => {
tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();
writeJson(tree, '/tsconfig.base.v0.json', {
compilerOptions: {
paths: {
Expand Down
4 changes: 2 additions & 2 deletions tools/generators/version-bump/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import {
Tree,
readProjectConfiguration,
Expand Down Expand Up @@ -28,7 +28,7 @@ describe('version-string-replace generator', () => {
jest.spyOn(console, 'info').mockImplementation(noop);
jest.spyOn(console, 'warn').mockImplementation(noop);

tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();
});

it('should bump alpha package to beta', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import { Tree, readProjectConfiguration } from '@nrwl/devkit';

import generator from './index';
Expand All @@ -9,7 +9,7 @@ describe('<%= name %> generator', () => {
const options: <%= className %>GeneratorSchema = { name: 'test' };

beforeEach(() => {
appTree = createTreeWithEmptyWorkspace();
appTree = createTreeWithEmptyV1Workspace();
});

it('should run successfully', async () => {
Expand Down
8 changes: 4 additions & 4 deletions tools/generators/workspace-generator/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import { Tree, readJson } from '@nrwl/devkit';

import generator from './index';
Expand All @@ -9,7 +9,7 @@ describe('workspace-generator generator', () => {
const options: WorkspaceGeneratorGeneratorSchema = { name: 'custom' };

beforeEach(() => {
tree = createTreeWithEmptyWorkspace();
tree = createTreeWithEmptyV1Workspace();
});

it('should generate boilerplate', async () => {
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('workspace-generator generator', () => {
const content = tree.read('/tools/generators/custom/index.spec.ts')?.toString();

expect(content).toMatchInlineSnapshot(`
"import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
"import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
import { Tree, readProjectConfiguration } from '@nrwl/devkit';
import generator from './index';
Expand All @@ -129,7 +129,7 @@ describe('workspace-generator generator', () => {
const options: CustomGeneratorSchema = { name: 'test' };
beforeEach(() => {
appTree = createTreeWithEmptyWorkspace();
appTree = createTreeWithEmptyV1Workspace();
});
it('should run successfully', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tools/jest.config.js → tools/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
export default {
displayName: 'tools',
preset: '../jest.preset.js',
globals: {
Expand Down
2 changes: 1 addition & 1 deletion tools/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"outDir": "../dist/out-tsc",
"types": ["node"]
},
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
"exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}
3 changes: 2 additions & 1 deletion tools/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"**/*.test.js",
"**/*.spec.jsx",
"**/*.test.jsx",
"**/*.d.ts"
"**/*.d.ts",
"jest.config.ts"
]
}
2 changes: 1 addition & 1 deletion tools/tsconfig.tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"importHelpers": false,
"downlevelIteration": true
},
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
"exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}
9 changes: 5 additions & 4 deletions workspace.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "./node_modules/nx/schemas/workspace-schema.json",
"version": 2,
"projects": {
"@fluentui/a11y-testing": {
Expand Down Expand Up @@ -188,25 +189,25 @@
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/tools"],
"options": {
"jestConfig": "tools/jest.config.js",
"jestConfig": "tools/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"executor": "@nrwl/workspace:run-commands",
"executor": "nx:run-commands",
"options": {
"command": "eslint **/*.ts",
"cwd": "tools"
}
},
"type-check": {
"executor": "@nrwl/workspace:run-commands",
"executor": "nx:run-commands",
"options": {
"command": "tsc -b tools/tsconfig.json"
}
},
"check-graph": {
"executor": "@nrwl/workspace:run-commands",
"executor": "nx:run-commands",
"options": {
"command": "node ./tools/check-dep-graph.js"
}
Expand Down

0 comments on commit 2676412

Please sign in to comment.