Skip to content

Commit

Permalink
chore(global-context): migrate to new package structure (#25341)
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanWatanabe authored Oct 24, 2022
1 parent f9436f5 commit 0714171
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 12 deletions.
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');
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"
}
]
}
2 changes: 1 addition & 1 deletion packages/react-components/global-context/tsconfig.lib.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"
]
}

0 comments on commit 0714171

Please sign in to comment.