Skip to content

Commit b5c6960

Browse files
Updated samples to use local package dependencies (#655)
* Updated vue-app to use local packages * Updated samples to use re-exported contructs from mgt instead of mgt-element Co-authored-by: Nikola Metulev <[email protected]>
1 parent cb322b9 commit b5c6960

File tree

15 files changed

+270
-257
lines changed

15 files changed

+270
-257
lines changed

docs/preview/mgt-element.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ Going forward in version 2, Microsoft Graph Toolkit will be broken up into multi
44

55
`@microsft/mgt-element` is the first of these packages. It contains the low level interfaces and base classes that all MGT components and providers are built upon.
66

7-
The most notable change for consuming apps is the relocation of the `Providers` class. Access to the global provider instance is managed through `Providers`, so any module references will need to import from `@microsoft/mgt-element` instead.
8-
97
```ts
108
<script type="module">
11-
import { MsalProvider } from '@microsoft/mgt';
12-
import { IGraph, IProvider, Providers } from '@microsoft/mgt-element'
9+
import { IProvider, Providers } from '@microsoft/mgt-element'
10+
11+
export class MyProvider extends IProvider {
12+
// Create your own provider
13+
}
1314

14-
const provider: IProvider = new MsalProvider({ clientId: '[CLIENT-ID]' });
15+
const provider: IProvider = new MyProvider();
1516
Providers.globalProvider = provider;
1617

1718
const graph: IGraph = provider.graph;

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"packages": ["packages/*", "samples/react-app", "samples/angular-app"],
2+
"packages": ["packages/*", "samples/react-app", "samples/angular-app", "samples/vue-app"],
33
"npmClient": "yarn",
44
"useWorkspaces": true,
55
"version": "independent"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"workspaces": [
55
"packages/*",
66
"samples/react-app",
7-
"samples/angular-app"
7+
"samples/angular-app",
8+
"samples/vue-app"
89
],
910
"scripts": {
1011
"build": "npm run prettier:check && npm run clean && lerna run build --scope @microsoft/*",

samples/angular-app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"@angular/router": "~9.1.6",
2222
"@azure/msal-angular": "^1.0.0",
2323
"@microsoft/mgt": "*",
24-
"@microsoft/mgt-element": "*",
2524
"rxjs": "~6.5.4",
2625
"tslib": "^1.10.0",
2726
"zone.js": "~0.10.2"

samples/angular-app/src/app/app.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
22
import { MsalService } from '@azure/msal-angular';
3-
import { MsalProvider } from '@microsoft/mgt';
4-
import { LoginType, Providers, ProviderState, TemplateHelper } from '@microsoft/mgt-element';
3+
import { MsalProvider, LoginType, Providers, ProviderState, TemplateHelper } from '@microsoft/mgt';
54
import { MSALAngularConfig } from '../environments/environment.msal';
65

76
@Component({

samples/angular-app/src/environments/environment.msal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const isIE = window.navigator.userAgent.indexOf('MSIE ') > -1 || window.navigato
77

88
export const MsalConfig: Configuration = {
99
auth: {
10-
clientId: '[YOUR-CLIENT-ID]',
10+
clientId: 'a974dfa0-9f57-49b9-95db-90f04ce2111a',
1111
authority: 'https://login.microsoftonline.com/common/',
1212
validateAuthority: true,
1313
redirectUri: 'http://localhost:4200/',

samples/examples/person-card-extensions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</mgt-person>
1616

1717
<script type="module">
18-
import { Providers } from '../../packages/mgt-element/dist/index.js';
18+
import { Providers } from '../../packages/mgt/es6/dist/index.js';
1919

2020
let mgtPerson = document.querySelector('mgt-person');
2121
mgtPerson.addEventListener('templateRendered', async e => {

samples/react-app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"private": true,
55
"dependencies": {
66
"@microsoft/mgt": "*",
7-
"@microsoft/mgt-element": "*",
87
"@microsoft/mgt-react": "*",
98
"@webcomponents/webcomponentsjs": "2.2.10",
109
"react": "^16.8.5",

samples/react-app/src/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import '../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js';
1313
import React from 'react';
1414
import ReactDOM from 'react-dom';
1515
import App from './App';
16-
import { Providers } from '@microsoft/mgt-element';
17-
import { MsalProvider } from '@microsoft/mgt';
16+
import { Providers, MsalProvider } from '@microsoft/mgt';
1817
import { MockProvider } from '@microsoft/mgt/dist/es6/mock/MockProvider';
1918

2019
Providers.globalProvider = new MockProvider(true);

samples/teams-tab/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<html>
22
<head>
33
<script src="https://unpkg.com/@microsoft/teams-js/dist/MicrosoftTeams.min.js" crossorigin="anonymous"></script>
4-
<script src="https://unpkg.com/@microsoft/mgt/dist/bundle/mgt-loader.js"></script>
4+
<script src="../../packages/mgt/dist/es6/index.js"></script>
55
</head>
66
<body>
77
<mgt-teams-provider client-id="<CLIENT-ID>" auth-popup-url="auth.html"></mgt-teams-provider>

0 commit comments

Comments
 (0)