Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: SPO set up instruction #1289

Merged
merged 13 commits into from
Jun 16, 2020
24 changes: 24 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

# change these settings to your own preference
indent_style = space
indent_size = 2

# we recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[{package,bower}.json]
indent_style = space
indent_size = 2
32 changes: 32 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Logs
logs
*.log
npm-debug.log*

# Dependency directories
node_modules

# Build generated files
dist
lib
solution
temp
*.sppkg

# Coverage directory used by tools like istanbul
coverage

# OSX
.DS_Store

# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj

# Resx Generated Code
*.resx.ts

# Styles Generated Code
*.scss.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"msjsdiag.debugger-for-chrome"
]
}
43 changes: 43 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
/**
* Install Chrome Debugger Extension for Visual Studio Code to debug your components with the
* Chrome browser: https://aka.ms/spfx-debugger-extensions
*/
"version": "0.2.0",
"configurations": [{
"name": "Local workbench",
"type": "chrome",
"request": "launch",
"url": "https://localhost:4321/temp/workbench.html",
"webRoot": "${workspaceRoot}",
"sourceMaps": true,
"sourceMapPathOverrides": {
"webpack:///.././src/*": "${webRoot}/src/*",
"webpack:///../../../src/*": "${webRoot}/src/*",
"webpack:///../../../../src/*": "${webRoot}/src/*",
"webpack:///../../../../../src/*": "${webRoot}/src/*"
},
"runtimeArgs": [
"--remote-debugging-port=9222"
]
},
{
"name": "Hosted workbench",
"type": "chrome",
"request": "launch",
"url": "https://enter-your-SharePoint-site/_layouts/workbench.aspx",
"webRoot": "${workspaceRoot}",
"sourceMaps": true,
"sourceMapPathOverrides": {
"webpack:///.././src/*": "${webRoot}/src/*",
"webpack:///../../../src/*": "${webRoot}/src/*",
"webpack:///../../../../src/*": "${webRoot}/src/*",
"webpack:///../../../../../src/*": "${webRoot}/src/*"
},
xiao-lix marked this conversation as resolved.
Show resolved Hide resolved
"runtimeArgs": [
"--remote-debugging-port=9222",
"-incognito"
]
}
]
}
13 changes: 13 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Place your settings in this file to overwrite default and user settings.
{
// Configure glob patterns for excluding files and folders in the file explorer.
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/bower_components": true,
"**/coverage": true,
"**/lib-amd": true,
"src/**/*.scss.ts": true
},
"typescript.tsdk": ".\\node_modules\\typescript\\lib"
}
13 changes: 13 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/.yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"@microsoft/generator-sharepoint": {
"isCreatingSolution": true,
"environment": "spo",
"version": "1.10.0",
"libraryName": "appinsights-extension-solution-sample",
"libraryId": "2e36a9ed-006f-496a-9cba-ff420cdce3c6",
"packageManager": "npm",
"isDomainIsolated": false,
"componentType": "extension",
"extensionType": "ApplicationCustomizer"
}
}
30 changes: 30 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## appinsights-extension-solution-sample

This is a sample SharePoint Framework Extension solution that will set up Application Insights on a [SharePoint Online modern site](https://support.microsoft.com/en-ie/office/sharepoint-classic-and-modern-experiences-5725c103-505d-4a6e-9350-300d3ec7d73f?ui=en-us&rs=en-ie&ad=ie).

### Building the code

```bash
git clone the repo
```
Inside AppInsightsExtensionSolutionSample root folder
```bash
npm i
npm i -g gulp
gulp
```
For solution deployment, check out the [Set up deployment](https://github.com/microsoft/ApplicationInsights-JS/tree/master/SPO/README.md#set-up-deployment) configuration section.
xiao-lix marked this conversation as resolved.
Show resolved Hide resolved

This package produces the following:

* lib/* - intermediate-stage commonjs build artifacts
* dist/* - the bundled script, along with other resources
* deploy/* - all resources which should be uploaded to a CDN.

### Build options

gulp clean - TODO
gulp test - TODO
gulp serve - TODO
gulp bundle - TODO
gulp package-solution - TODO
18 changes: 18 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"app-insights-application-customizer": {
"components": [
{
"entrypoint": "./lib/extensions/appInsights/AppInsightsApplicationCustomizer.js",
"manifest": "./src/extensions/appInsights/AppInsightsApplicationCustomizer.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"AppInsightsApplicationCustomizerStrings": "lib/extensions/appInsights/loc/{locale}.js"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
"deployCdnPath": "temp/deploy"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./temp/deploy/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "appinsights-extension-solution-sample",
"accessKey": "<!-- ACCESS KEY -->"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "appinsights-extension-solution-sample-client-side-solution",
"id": "2e36a9ed-006f-496a-9cba-ff420cdce3c6",
"version": "1.0.0.1",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"features": [
{
"title": "Application Extension - Deployment of custom action.",
"description": "Deploys a custom action with ClientSideComponentId association",
"id": "02536507-bbf5-436c-b746-3ecf2d81f02e",
"version": "1.0.0.1",
"assets": {
"elementManifests": [
"elements.xml",
"ClientSideInstance.xml"
]
}
}
]
},
"paths": {
"zippedPackage": "solution/appinsights-extension-solution-sample.sppkg"
}
}
29 changes: 29 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/config/serve.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321,
"https": true,
"serveConfigurations": {
"default": {
"pageUrl": "https://contoso.sharepoint.com/sites/mySite/SitePages/myPage.aspx",
"customActions": {
"53048b36-d45c-4706-b6ae-00afa52b2b3d": {
"location": "ClientSideExtension.ApplicationCustomizer",
"properties": {
"testMessage": "Test message"
}
}
}
},
"appInsights": {
"pageUrl": "https://contoso.sharepoint.com/sites/mySite/SitePages/myPage.aspx",
"customActions": {
"53048b36-d45c-4706-b6ae-00afa52b2b3d": {
"location": "ClientSideExtension.ApplicationCustomizer",
"properties": {
"testMessage": "Test message"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}
7 changes: 7 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

const build = require('@microsoft/sp-build-web');

build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);

build.initialize(require('gulp'));
34 changes: 34 additions & 0 deletions SPO/AppInsightsExtensionSolutionSample/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "appinsights-extension-solution-sample",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@microsoft/applicationinsights-web": "^2.5.5",
"@microsoft/decorators": "1.10.0",
"@microsoft/sp-application-base": "1.10.0",
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-dialog": "1.10.0",
"@types/es6-promise": "0.0.33",
"@types/webpack-env": "1.13.1"
},
"devDependencies": {
"@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"gulp": "~3.9.1",
"@types/chai": "3.4.34",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ClientSideComponentInstance
Title="AppInsights"
Location="ClientSideExtension.ApplicationCustomizer"
ComponentId="53048b36-d45c-4706-b6ae-00afa52b2b3d"
Properties="{&quot;instrumentationKey&quot;:&quot;YOUR_INSTRUMENTATION_KEY_GOES_HERE&quot;}">
</ClientSideComponentInstance>
</Elements>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Title="AppInsights"
Location="ClientSideExtension.ApplicationCustomizer"
ClientSideComponentId="53048b36-d45c-4706-b6ae-00afa52b2b3d"
ClientSideComponentProperties="{&quot;instrumentationKey&quot;:&quot;YOUR_INSTRUMENTATION_KEY_GOES_HERE&quot;}">
</CustomAction>
</Elements>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-extension-manifest.schema.json",

"id": "53048b36-d45c-4706-b6ae-00afa52b2b3d",
"alias": "AppInsightsApplicationCustomizer",
"componentType": "Extension",
"extensionType": "ApplicationCustomizer",

// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,

// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false
}
Loading