Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f848fd9
feat(workspace-library): initial split-library-in-two implementation
Hotell Mar 8, 2024
816dd49
feat(scrtips-storybook): resolve stories properly if project has been…
Hotell Mar 25, 2024
50eede5
feat(workspace-plugin): add --all flag support to split-library-in-two
Hotell Mar 25, 2024
51cd1e1
feat(workspace-plugin): setup correctly eslint extraneous dependencie…
Hotell Mar 25, 2024
6234a80
feat(workspace-plugin): dont add test-ssr target to /stories project
Hotell Mar 25, 2024
604f15e
fix(workspace-plugin): exit flow when assetProject catches invalid pr…
Hotell Apr 5, 2024
8bf9be5
fix(workspace-plugin): update test-ssr target only if present
Hotell Apr 5, 2024
e7fb451
feat(workspace-plugin): update paths in tsconfigLib,babelrc,api-extra…
Hotell Apr 5, 2024
2fd08ce
chore: add new workspace path resolution for nested react-components/…
Hotell Apr 5, 2024
61389c8
perf: speed up tsc by not running on cypress files during .d.ts gener…
Hotell Apr 5, 2024
2450216
perf(scripts-task): turn off path aliases within generate-api task, m…
Hotell Apr 5, 2024
bd3a93c
chore: re-genearate api.md as result of perf improvements to generate…
Hotell Apr 5, 2024
22e1a7f
feat(eslint-plugin): add triple-slash-reference rule to ban TS '///'…
Hotell Apr 8, 2024
dd88b3e
feat(workspace-plugin): build proper dep graph from jest and cypress …
Hotell Apr 8, 2024
115c688
fix(react-drawer): remove circular dependency from cypress test files
Hotell Apr 8, 2024
e77a5b3
style(react-tag-picker-preview): fix lint violations
Hotell Apr 11, 2024
f39270e
fix(workspace-plugin): properly set mainEntryPointFilePath path withi…
Hotell Apr 11, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "feat(eslint-plugin): add triple-slash-reference rule to ban TS '///' within source code",
"packageName": "@fluentui/eslint-plugin",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "perf: speed up tsc by not running on cypress files during .d.ts generation and type-checking",
"packageName": "@fluentui/react-drawer",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "chore: re-genearate api.md as result of perf improvements to generate-api task",
"packageName": "@fluentui/react-field",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "perf: speed up tsc by not running on cypress files during .d.ts generation and type-checking",
"packageName": "@fluentui/react-infobutton",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "perf: speed up tsc by not running on cypress files during .d.ts generation and type-checking",
"packageName": "@fluentui/react-infolabel",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "perf: speed up tsc by not running on cypress files during .d.ts generation and type-checking",
"packageName": "@fluentui/react-tree",
"email": "[email protected]",
"dependentChangeType": "none"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
"packages/*",
"packages/fluentui/*",
"packages/react-components/*",
"packages/react-components/*/*",
"scripts/*",
"tools/*",
"typings"
Expand Down
4 changes: 3 additions & 1 deletion packages/cra-template/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"files": ["template/**/*.{ts,tsx}"],
"rules": {
// the rule can't understand that the actual list of deps is in template.json
"import/no-extraneous-dependencies": "off"
"import/no-extraneous-dependencies": "off",
// valid in some template files - don't wanna spam consumer with inline eslint-disabled pragmas
"@typescript-eslint/triple-slash-reference": "off"
}
}
]
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-plugin/src/configs/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module.exports = {
*/
...getNamingConventionRule(),
'@fluentui/max-len': 'off',
// @typescript-eslint rules
'@typescript-eslint/triple-slash-reference': ['error', { lib: 'always', path: 'never', types: 'never' }],
},
overrides: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference types="cypress-real-events" />
import * as React from 'react';
import { mount as mountBase } from '@cypress/react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import { mount } from '@cypress/react';
import { FluentProvider } from '@fluentui/react-provider';
import { webLightTheme } from '@fluentui/react-theme';
import { DrawerProps } from '@fluentui/react-components';

import type { DrawerProps } from '../Drawer';

const mountFluent = (element: JSX.Element) => {
mount(<FluentProvider theme={webLightTheme}>{element}</FluentProvider>);
Expand Down
5 changes: 4 additions & 1 deletion packages/react-components/react-drawer/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
},
"exclude": [
"./src/testing/**",
"./src/e2e/**",
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.stories.ts",
"**/*.stories.tsx"
"**/*.stories.tsx",
"**/*.cy.ts",
"**/*.cy.tsx"
],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const Field: ForwardRefComponent<FieldProps>;
export const fieldClassNames: SlotClassNames<FieldSlots>;

// @public (undocumented)
export const FieldContextProvider: React_2.Provider<Readonly<Pick<FieldState, "orientation" | "required" | "size" | "validationState" | "generatedControlId"> & {
export const FieldContextProvider: React_2.Provider<Readonly<Pick<FieldState, "required" | "size" | "orientation" | "validationState" | "generatedControlId"> & {
labelFor?: string | undefined;
labelId?: string | undefined;
validationMessageId?: string | undefined;
Expand Down Expand Up @@ -81,7 +81,7 @@ export const renderField_unstable: (state: FieldState, contextValues: FieldConte
export const useField_unstable: (props: FieldProps, ref: React_2.Ref<HTMLDivElement>) => FieldState;

// @public (undocumented)
export const useFieldContext_unstable: () => Readonly<Pick<FieldState, "orientation" | "required" | "size" | "validationState" | "generatedControlId"> & {
export const useFieldContext_unstable: () => Readonly<Pick<FieldState, "required" | "size" | "orientation" | "validationState" | "generatedControlId"> & {
labelFor?: string | undefined;
labelId?: string | undefined;
validationMessageId?: string | undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable deprecation/deprecation */
/// <reference types="cypress-real-events" />

import * as React from 'react';
import { mount as mountBase } from '@cypress/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"**/*.test.ts",
"**/*.test.tsx",
"**/*.stories.ts",
"**/*.stories.tsx"
"**/*.stories.tsx",
"**/*.cy.ts",
"**/*.cy.tsx"
],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress-real-events" />

import * as React from 'react';
import { mount as mountBase } from '@cypress/react';
import { FluentProvider } from '@fluentui/react-provider';
Expand Down
3 changes: 3 additions & 0 deletions packages/react-components/react-infolabel/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
},
{
"path": "./.storybook/tsconfig.json"
},
{
"path": "./tsconfig.cy.json"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"**/*.test.ts",
"**/*.test.tsx",
"**/*.stories.ts",
"**/*.stories.tsx"
"**/*.stories.tsx",
"**/*.cy.ts",
"**/*.cy.tsx"
],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// <reference types="cypress" />
/// <reference types="cypress-real-events" />

import * as React from 'react';
import { mount as mountBase } from '@cypress/react';
import { FluentProvider } from '@fluentui/react-provider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// <reference types="cypress" />
/// <reference types="cypress-real-events" />

import * as React from 'react';
import { mount as mountBase } from '@cypress/react';
import { FluentProvider } from '@fluentui/react-provider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// <reference types="cypress" />
/// <reference types="cypress-real-events" />

import * as React from 'react';
import { mount as mountBase } from '@cypress/react';
import { FluentProvider } from '@fluentui/react-provider';
Expand Down
3 changes: 3 additions & 0 deletions packages/react-components/react-tree/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
},
{
"path": "./.storybook/tsconfig.json"
},
{
"path": "./tsconfig.cy.json"
}
]
}
4 changes: 3 additions & 1 deletion packages/react-components/react-tree/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"**/*.test.ts",
"**/*.test.tsx",
"**/*.stories.ts",
"**/*.stories.tsx"
"**/*.stories.tsx",
"**/*.cy.ts",
"**/*.cy.tsx"
],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
8 changes: 7 additions & 1 deletion scripts/storybook/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function getPackageStoriesGlob(options) {
const packages = Object.keys(dependencies);

const result = packages
.filter(pkgName => pkgName.startsWith('@fluentui/') && !excludeStoriesInsertionFromPackages.includes(pkgName))
.filter(pkgName => projects.has(pkgName) && !excludeStoriesInsertionFromPackages.includes(pkgName))
.map(pkgName => {
const storiesGlob = '**/@(index.stories.@(ts|tsx)|*.stories.mdx)';
const pkgMetadata = getMetadata(pkgName, projects);
Expand All @@ -238,6 +238,12 @@ function getPackageStoriesGlob(options) {
return `${rootOffset}${pkgMetadata.root}/stories/${storiesGlob}`;
}

// if defined package has stories project use that
const pkgMetadataStories = projects.get(`${pkgName}-stories`);
if (pkgMetadataStories) {
return `${rootOffset}${pkgMetadataStories.root}/src/${storiesGlob}`;
}

return `${rootOffset}${pkgMetadata.root}/src/${storiesGlob}`;
});

Expand Down
5 changes: 3 additions & 2 deletions scripts/tasks/src/generate-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ export function generateApi() {
}

function generateTypeDeclarations() {
const { isUsingPathAliasesForDx, tsConfigFileForCompilation } = getTsPathAliasesConfigUsedOnlyForDx();
const { tsConfigFileForCompilation } = getTsPathAliasesConfigUsedOnlyForDx();
const cmd = [
'tsc',
`-p ./${tsConfigFileForCompilation}`,
'--emitDeclarationOnly',
isUsingPathAliasesForDx ? '--baseUrl .' : null,
// turn off path aliases.
'--baseUrl .',
]
.filter(Boolean)
.join(' ');
Expand Down
2 changes: 1 addition & 1 deletion scripts/tasks/src/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function prepareTsTaskConfig(options: TscTaskOptions) {

const { isUsingPathAliasesForDx, tsConfigFileForCompilation } = getTsPathAliasesConfigUsedOnlyForDx();

if (isUsingPathAliasesForDx) {
if (isUsingPathAliasesForDx()) {
logger.info(`📣 TSC: Project is using TS path aliases for DX. Disabling aliases for build.`);
options.baseUrl = '.';
options.rootDir = './src';
Expand Down
13 changes: 8 additions & 5 deletions scripts/tasks/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,27 @@ export function getTsPathAliasesConfig() {

export function getTsPathAliasesConfigUsedOnlyForDx() {
const tsConfigFilesWithAliases = ['tsconfig.app.json', 'tsconfig.lib.json', 'tsconfig.json'];
const tsConfigBaseFilesForDx = ['tsconfig.base.v8.json', 'tsconfig.base.all.json'];
const cwd = process.cwd();
const tsConfigPath = path.join(cwd, `./tsconfig.json`);

if (!fs.existsSync(tsConfigPath)) {
throw new Error(`${tsConfigPath} doesn't exist`);
}

const tsConfig = JSON.parse(stripJsonComments(fs.readFileSync(tsConfigPath, 'utf-8')));
const isUsingPathAliasesForDx =
tsConfig.extends && tsConfigBaseFilesForDx.some(relativeFilePath => tsConfig.extends.endsWith(relativeFilePath));

const tsConfigFileForCompilation = tsConfigFilesWithAliases.find(fileName => fs.existsSync(path.join(cwd, fileName)));

if (!tsConfigFileForCompilation) {
throw new Error(`no tsconfig from one of [${tsConfigFilesWithAliases}] found!`);
}

const isUsingPathAliasesForDx = () => {
const tsConfigBaseFilesForDx = ['tsconfig.base.v8.json', 'tsconfig.base.all.json'];
const tsConfig = JSON.parse(stripJsonComments(fs.readFileSync(tsConfigPath, 'utf-8')));
return Boolean(
tsConfig.extends && tsConfigBaseFilesForDx.some(relativeFilePath => tsConfig.extends.endsWith(relativeFilePath)),
);
};

return { isUsingPathAliasesForDx, tsConfigFileForCompilation };
}

Expand Down

This file was deleted.

Loading