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
Expand Up @@ -141,6 +141,8 @@
platform: "JavaScript",
},
{ key: "Exceptionless.Node", name: "Node.js", platform: "JavaScript" },
{ key: "Exceptionless.ReactNative", name: "React Native", platform: "JavaScript" },
{ key: "Exceptionless.Expo", name: "Expo", platform: "JavaScript" },
];
}

Expand All @@ -160,6 +162,14 @@
return vm.currentProjectType.key === "Exceptionless.Node";
}

function isReactNative() {
return vm.currentProjectType.key === "Exceptionless.ReactNative";
}

function isExpo() {
return vm.currentProjectType.key === "Exceptionless.Expo";
}

function isBashShell() {
return vm.currentProjectType.key === "Bash Shell";
}
Expand Down Expand Up @@ -207,9 +217,11 @@
vm.isBashShell = isBashShell;
vm.isCommandLine = isCommandLine;
vm.isDotNet = isDotNet;
vm.isExpo = isExpo;
vm.isGeneratingSampleData = false;
vm.isJavaScript = isJavaScript;
vm.isNode = isNode;
vm.isReactNative = isReactNative;
vm.navigateToDashboard = navigateToDashboard;
vm.onCopyError = onCopyError;
vm.project = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<pre class="command-line-code" ng-if="vm.isBashShell()">
curl "{{::vm.serverUrl}}/api/v2/events" \
--request POST \
--header "Authorization: Bearer {{::vm.apiKey}}" \
--header "Authorization: Bearer {{vm.apiKey}}" \
--header "Content-Type: application/json" \
--data-binary '[{"type":"log","message":"Hello World!"}]'</pre>
<pre class="command-line-code" ng-if="!vm.isBashShell()">
Expand All @@ -61,7 +61,7 @@
} | ConvertTo-Json

$header = @{
"Authorization"="Bearer {{::vm.apiKey}}"
"Authorization"="Bearer {{vm.apiKey}}"
"Content-Type"="application/json"
}

Expand All @@ -77,7 +77,7 @@
<pre><a ng-href="http://nuget.org/packages/{{vm.currentProjectType.key}}" target="_blank">Install-Package {{vm.currentProjectType.key}}</a></pre>
</div>
<div ng-if="vm.isJavaScript()">
<div ng-if="!vm.isNode()">
<div ng-if="!vm.isNode() && !vm.isReactNative() && !vm.isExpo()">
<p ng-bind-html="'Notice_Install_Node_Package' | translate"></p>
<pre><a href="https://www.npmjs.com/package/@exceptionless/browser" target="_blank">npm install @exceptionless/browser --save</a></pre>
<p ng-bind-html="'Notice_Install_Manually' | translate"></p>
Expand All @@ -86,22 +86,42 @@
<p ng-bind-html="'Notice_Install_Node_Package' | translate"></p>
<pre><a href="https://www.npmjs.com/package/@exceptionless/node" target="_blank">npm install @exceptionless/node --save</a></pre>
</div>
<div ng-if="vm.isReactNative()">
<p>Install Exceptionless using the <a href="https://www.npmjs.com/package/@exceptionless/react-native" target="_blank">Node Package Manager</a>. Install AsyncStorage with the client. It is a peer dependency used for persistent event queue storage.</p>
<pre>npm install @exceptionless/react-native @react-native-async-storage/async-storage</pre>
</div>
<div ng-if="vm.isExpo()">
<p>Install Exceptionless using the <a href="https://www.npmjs.com/package/@exceptionless/react-native" target="_blank">Node Package Manager</a>. Install AsyncStorage with the client. It is a peer dependency used for persistent event queue storage.</p>
<pre><a href="https://www.npmjs.com/package/@exceptionless/react-native" target="_blank">npx expo install @exceptionless/react-native @react-native-async-storage/async-storage</a></pre>
</div>
</div>
</li>
<li ng-if="vm.isJavaScript()" style="margin-top: 15px">
<div ng-if="!vm.isNode()">
<div ng-if="!vm.isNode() && !vm.isReactNative() && !vm.isExpo()">
<p>
{{::'Configure the ExceptionlessClient with your Exceptionless API key:' |
translate}}
</p>
<pre>import { Exceptionless } from "@exceptionless/browser";<br /><br />await Exceptionless.startup(c => {<br />&nbsp;&nbsp;c.apiKey = "{{::vm.apiKey}}";<br />});</pre>
<pre>import { Exceptionless } from "@exceptionless/browser";<br /><br />await Exceptionless.startup(c => {<br />&nbsp;&nbsp;c.apiKey = "{{vm.apiKey}}";<br />});</pre>
</div>
<div ng-if="vm.isNode()">
<p>
{{::'Configure the ExceptionlessClient with your Exceptionless API key:' |
translate}}
</p>
<pre>import { Exceptionless } from "@exceptionless/node";<br /><br />await Exceptionless.startup(c => {<br />&nbsp;&nbsp;c.apiKey = "{{::vm.apiKey}}";<br />});</pre>
<pre>import { Exceptionless } from "@exceptionless/node";<br /><br />await Exceptionless.startup(c => {<br />&nbsp;&nbsp;c.apiKey = "{{vm.apiKey}}";<br />});</pre>
</div>
<div ng-if="vm.isExpo()">
<p>Add the Exceptionless config plugin to app.json when using development or standalone builds:</p>
<pre>{<br />&nbsp;&nbsp;"expo": {<br />&nbsp;&nbsp;&nbsp;&nbsp;"plugins": ["@exceptionless/react-native/expo-plugin"]<br />&nbsp;&nbsp;}<br />}</pre>
<p>Native iOS crash reporting requires an Expo development build or standalone build. JavaScript error reporting works in Expo Go.</p>
</div>
<div ng-if="vm.isReactNative() || vm.isExpo()">
<p>
{{::'Configure the ExceptionlessClient with your Exceptionless API key:' |
translate}}
</p>
<pre>import { Exceptionless } from "@exceptionless/react-native";<br /><br />await Exceptionless.startup(c => {<br />&nbsp;&nbsp;c.apiKey = "{{vm.apiKey}}";<br />});</pre>
</div>
</li>
<li ng-if="vm.isDotNet()" style="margin-top: 15px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@
platform: string;
}

type CodeBlockLanguage = 'csharp' | 'javascript' | 'json' | 'powershell' | 'shellscript' | 'xml';

interface JavaScriptConfigurationStep {
code: string;
description: string;
language: CodeBlockLanguage;
note?: string;
}

interface JavaScriptClientConfiguration {
extraSteps?: JavaScriptConfigurationStep[];
installCommand: string;
installNote?: string;
packageName: string;
startupCode: string;
}

const projectTypes: ProjectType[] = [
{ id: 'bash', label: 'Bash Shell', platform: 'Command Line' },
{ id: 'powershell', label: 'PowerShell', platform: 'Command Line' },
Expand All @@ -106,6 +123,8 @@

{ id: 'javascript-browser', label: 'Browser applications', package: 'Exceptionless.JavaScript', platform: 'JavaScript' },
{ id: 'javascript-nodejs', label: 'Node.js', package: 'Exceptionless.Node', platform: 'JavaScript' },
{ id: 'javascript-react-native', label: 'React Native', package: '@exceptionless/react-native', platform: 'JavaScript' },
{ id: 'javascript-expo', label: 'Expo', package: '@exceptionless/react-native', platform: 'JavaScript' },

{ id: 'dotnet-legacy-console', label: 'Console and Service applications', package: 'Exceptionless', platform: '.NET Legacy' },
{ config: 'web.config', id: 'dotnet-legacy-mvc', label: 'ASP.NET MVC', package: 'Exceptionless.Mvc', platform: '.NET Legacy' },
Expand Down Expand Up @@ -148,13 +167,16 @@
const isDotNet = $derived(selectedProjectType?.platform === '.NET');
const isDotNetLegacy = $derived(selectedProjectType?.platform === '.NET Legacy');
const isJavaScript = $derived(selectedProjectType?.platform === 'JavaScript');
const isNode = $derived(selectedProjectType?.package === 'Exceptionless.Node');
const isBashShell = $derived(selectedProjectType?.id === 'bash');
const clientDocumentationUrl = $derived.by(() => {
if (isDotNet || isDotNetLegacy) {
return 'https://exceptionless.com/docs/clients/dotnet/';
}

if (selectedProjectType?.id === 'javascript-react-native' || selectedProjectType?.id === 'javascript-expo') {
return 'https://github.com/exceptionless/Exceptionless.JavaScript/tree/main/packages/react-native';
}

if (isJavaScript) {
return 'https://exceptionless.com/docs/clients/javascript/';
}
Expand Down Expand Up @@ -207,6 +229,18 @@ $header = @{

Invoke-RestMethod -Uri "${serverUrl}/api/v2/events" -Method "Post" -Body $body -Headers $header`,

reactNativeExpoPlugin: `{
"expo": {
"plugins": ["@exceptionless/react-native/expo-plugin"]
}
}`,

reactNativeJs: `import { Exceptionless } from "@exceptionless/react-native";

await Exceptionless.startup(c => {
c.apiKey = "${apiKey}";
});`,

webApi: `public static void Register(HttpConfiguration config) {
config.AddExceptionless("${apiKey}");
}`,
Expand Down Expand Up @@ -250,6 +284,47 @@ public partial class App : Application {
}`
});

const javascriptClientConfiguration = $derived.by((): JavaScriptClientConfiguration | null => {
switch (selectedProjectType?.id) {
case 'javascript-browser':
return {
installCommand: 'npm install @exceptionless/browser --save',
packageName: '@exceptionless/browser',
startupCode: codeSamples.browserJs
};
case 'javascript-expo':
return {
extraSteps: [
{
code: codeSamples.reactNativeExpoPlugin,
description: 'Add the Exceptionless config plugin to app.json when using development or standalone builds.',
language: 'json',
note: 'Native iOS crash reporting requires an Expo development build or standalone build. JavaScript error reporting works in Expo Go.'
}
],
installCommand: 'npx expo install @exceptionless/react-native @react-native-async-storage/async-storage',
installNote: 'The AsyncStorage package is a peer dependency used for persistent event queue storage, so install it alongside the client.',
packageName: '@exceptionless/react-native',
startupCode: codeSamples.reactNativeJs
};
case 'javascript-nodejs':
return {
installCommand: 'npm install @exceptionless/node --save',
packageName: '@exceptionless/node',
startupCode: codeSamples.nodeJs
};
case 'javascript-react-native':
return {
installCommand: 'npm install @exceptionless/react-native @react-native-async-storage/async-storage',
installNote: 'The AsyncStorage package is a peer dependency used for persistent event queue storage, so install it alongside the client.',
packageName: '@exceptionless/react-native',
startupCode: codeSamples.reactNativeJs
};
default:
return null;
}
});

useEventListener(document, 'PersistentEventChanged', async (event) => {
const message = (event as CustomEvent<WebSocketMessageValue<'PersistentEventChanged'>>).detail;

Expand Down Expand Up @@ -563,40 +638,40 @@ public partial class App : Application {
{/if}
{/if}

{#if isJavaScript}
{#if isJavaScript && javascriptClientConfiguration}
<li>
<P
>Install the <strong>{selectedProjectType.package}</strong> npm package in your JavaScript project by running this command in the project
directory.</P
>Install the <strong>{javascriptClientConfiguration.packageName}</strong> npm package in your JavaScript project by running this command
in the project directory. {javascriptClientConfiguration.installNote ?? ''}</P
>
<div class="bg-muted relative min-h-13 overflow-hidden rounded-md">
{#if isNode}
<CodeBlock code="npm install @exceptionless/node --save" language="shellscript" />
<div class="absolute top-2 right-2">
<CopyToClipboardButton value="npm install @exceptionless/node --save" />
</div>
{:else}
<CodeBlock code="npm install @exceptionless/browser --save" language="shellscript" />
<CodeBlock code={javascriptClientConfiguration.installCommand} language="shellscript" />
<div class="absolute top-2 right-2">
<CopyToClipboardButton value={javascriptClientConfiguration.installCommand} />
</div>
</div>
</li>
{#each javascriptClientConfiguration.extraSteps ?? [] as step (step.description)}
<li>
<P>{step.description}</P>
<div class="bg-muted relative min-h-13 overflow-hidden rounded-md">
<CodeBlock code={step.code} language={step.language} />
<div class="absolute top-2 right-2">
<CopyToClipboardButton value="npm install @exceptionless/browser --save" />
<CopyToClipboardButton value={step.code} />
</div>
</div>
{#if step.note}
<P>{step.note}</P>
{/if}
</div>
</li>
</li>
{/each}
<li>
<P>Configure the ExceptionlessClient with your Exceptionless API key.</P>
<div class="bg-muted relative min-h-13 overflow-hidden rounded-md">
{#if !isNode}
<CodeBlock code={codeSamples.browserJs} language="javascript" />
<div class="absolute top-2 right-2">
<CopyToClipboardButton value={codeSamples.browserJs} />
</div>
{:else}
<CodeBlock code={codeSamples.nodeJs} language="javascript" />
<div class="absolute top-2 right-2">
<CopyToClipboardButton value={codeSamples.nodeJs} />
</div>
{/if}
<CodeBlock code={javascriptClientConfiguration.startupCode} language="javascript" />
<div class="absolute top-2 right-2">
<CopyToClipboardButton value={javascriptClientConfiguration.startupCode} />
</div>
</div>
</li>
{/if}
Expand Down
Loading