Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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": "none",
"comment": "chore: Migrate to new package structure.",
"packageName": "@fluentui/global-context",
"email": "tristan.watanabe@gmail.com",
"dependentChangeType": "none"
}
5 changes: 3 additions & 2 deletions packages/react-components/global-context/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
bundle-size/
config/
coverage/
e2e/
docs/
etc/
node_modules/
src/
stories/
dist/types/
temp/
__fixtures__
Expand All @@ -16,7 +17,7 @@ __tests__
*.api.json
*.log
*.spec.*
*.stories.*
*.cy.*
*.test.*
*.yml

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext, createContextSelector } from '@fluentui/global-context';
import { SYMBOL_NAMESPACE } from '../src/global-context';
import { SYMBOL_NAMESPACE as CONTEXT_SELECTOR_SYMBOL_NAMESPACE } from '../src/global-context-selector';
import { SYMBOL_NAMESPACE } from './global-context';
import { SYMBOL_NAMESPACE as CONTEXT_SELECTOR_SYMBOL_NAMESPACE } from './global-context-selector';

function cleanWindowSymbols(namespace: string) {
getGlobalContextSymbols(namespace).forEach(sym => {
Expand Down Expand Up @@ -28,13 +28,13 @@ describe('createContext', () => {
beforeEach(() => cleanWindowSymbols(SYMBOL_NAMESPACE));

it('should create context on window', () => {
const MyContext = createContext({}, 'MyContext', 'package', '9.0.0');
const MyContext = createContext(undefined, 'MyContext', 'package', '9.0.0');
expect(getWindowProperty(getGlobalContextSymbols(SYMBOL_NAMESPACE)[0])).equals(MyContext);
});

it('should create single context', () => {
const MyContext = createContext({}, 'MyContext', 'package', '9.0.0');
const MyContext2 = createContext({}, 'MyContext', 'package', '9.0.0');
const MyContext = createContext(undefined, 'MyContext', 'package', '9.0.0');

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes linting error: error Invalid default value for context declaration, default value should be undefined @fluentui/no-context-default-value

const MyContext2 = createContext(undefined, 'MyContext', 'package', '9.0.0');

expect(getGlobalContextSymbols(SYMBOL_NAMESPACE).length).equals(1);
expect(getWindowProperty(getGlobalContextSymbols(SYMBOL_NAMESPACE)[0])).equals(MyContext);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../tsconfig.json",
"extends": "./tsconfig.json",
"compilerOptions": {
"isolatedModules": false,
"types": ["node", "cypress", "cypress-storybook/cypress", "cypress-real-events"],
"lib": ["ES2019", "dom"]
},
"include": ["**/*.ts", "**/*.tsx"]
"include": ["**/*.cy.ts", "**/*.cy.tsx"]
}
2 changes: 1 addition & 1 deletion packages/react-components/global-context/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"path": "./tsconfig.spec.json"
},
{
"path": "./e2e/tsconfig.json"
"path": "./tsconfig.cy.json"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"inlineSources": true,
"types": ["static-assets", "environment", "node"]
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx"],
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.cy.ts", "**/*.cy.tsx"],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
10 changes: 9 additions & 1 deletion packages/react-components/global-context/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
"outDir": "dist",
"types": ["jest", "node"]
},
"include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
"include": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.d.ts",
"./src/testing/**/*.ts",
"./src/testing/**/*.tsx"
]
}