Skip to content

Commit

Permalink
chore: update docs/metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
DaPotatoMan committed Apr 3, 2024
1 parent c3ec9b7 commit d15af93
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 37 deletions.
53 changes: 23 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,76 @@
Get your module up and running quickly.
Find and replace all on all files (CMD+SHIFT+F):
- Name: My Module
- Package name: my-module
- Name: msoffice-addin
- Package name: msoffice-addin
- Description: My new Nuxt module
-->

# My Module
# msoffice-addin

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]

My new Nuxt module for doing amazing things.
MS Office addin for Nuxt and Vite

- [ Release Notes](/CHANGELOG.md)
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/my-module?file=playground%2Fapp.vue) -->
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/msoffice-addin?file=playground%2Fapp.vue) -->
<!-- - [📖 &nbsp;Documentation](https://example.com) -->

## Features

<!-- Highlight some of the features your module provide here -->
- &nbsp;Foo
- 🚠 &nbsp;Bar
- 🌲 &nbsp;Baz
- 🌍 Supports both Nuxt & Vite
- ⚙️ ENV variables support in manifest files
- 🧬 Same manifest routes in dev and build

## Quick Setup

Install the module to your Nuxt application with one command:

```bash
npx nuxi module add my-module
```

That's it! You can now use My Module in your Nuxt app ✨

- [Nuxt](docs/nuxt-setup.md)
- [Vite](docs/vite-setup.md)

## Contribution

<details>
<summary>Local development</summary>

```bash
# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release
```

</details>


<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=020420&colorB=00DC82
[npm-version-href]: https://npmjs.com/package/my-module
[npm-version-src]: https://img.shields.io/npm/v/msoffice-addin/latest.svg?style=flat&colorA=020420&colorB=00DC82
[npm-version-href]: https://npmjs.com/package/msoffice-addin

[npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=020420&colorB=00DC82
[npm-downloads-href]: https://npmjs.com/package/my-module
[npm-downloads-src]: https://img.shields.io/npm/dm/msoffice-addin.svg?style=flat&colorA=020420&colorB=00DC82
[npm-downloads-href]: https://npmjs.com/package/msoffice-addin

[license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=020420&colorB=00DC82
[license-href]: https://npmjs.com/package/my-module
[license-src]: https://img.shields.io/npm/l/msoffice-addin.svg?style=flat&colorA=020420&colorB=00DC82
[license-href]: https://npmjs.com/package/msoffice-addin

[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
[nuxt-href]: https://nuxt.com
62 changes: 62 additions & 0 deletions docs/nuxt-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Nuxt Setup

Install the module to your Nuxt application with one command:

```bash
npx nuxi module add msoffice-addin
```

#### Define manifest file

```xml
<!-- manifest.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TaskPaneApp">
<Id>{VITE_OFFICE_ID}</Id>
<Version>1.0</Version>
<ProviderName>{VITE_OFFICE_PROVIDER_NAME}</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="{VITE_OFFICE_DISPLAY_NAME}" />
<Description DefaultValue="{VITE_OFFICE_DESCRIPTION}"/>
<SupportUrl DefaultValue="{VITE_OFFICE_DOMAIN}/support" />
<AppDomains>
<AppDomain>{VITE_OFFICE_DOMAIN}</AppDomain>
</AppDomains>
<DefaultSettings>
<SourceLocation DefaultValue="https://www.contoso.com/search_app/Default.aspx" />
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
</OfficeApp>
```

#### Define .env file

```env
VITE_OFFICE_ID=c6890c26-5bbb-40ed-a321-37f07909a2f0
VITE_OFFICE_DOMAIN=https://www.contoso.com
VITE_OFFICE_PROVIDER_NAME=Contoso, Ltd
VITE_OFFICE_DISPLAY_NAME=Contoso App
VITE_OFFICE_DESCRIPTION=Office add-in for Contoso App
```

#### Update config

```ts
export default defineNuxtConfig({
modules: ['msoffice-addin'],

msOfficeAddin: {
manifests: [
{
src: 'manifest.xml',
route: '/outlook/manifest.xml',
},
],

/** Office.js will be injected to index.html page */
injectRoutes: ['/'],
},
})
```

That's it! You can now use msoffice-addin in your Nuxt app ✨
64 changes: 64 additions & 0 deletions docs/vite-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Vite Setup

Install the dependency:

```bash
pnpm add -D msoffice-addin
```

#### Define manifest file

```xml
<!-- manifest.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TaskPaneApp">
<Id>{VITE_OFFICE_ID}</Id>
<Version>1.0</Version>
<ProviderName>{VITE_OFFICE_PROVIDER_NAME}</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="{VITE_OFFICE_DISPLAY_NAME}" />
<Description DefaultValue="{VITE_OFFICE_DESCRIPTION}"/>
<SupportUrl DefaultValue="{VITE_OFFICE_DOMAIN}/support" />
<AppDomains>
<AppDomain>{VITE_OFFICE_DOMAIN}</AppDomain>
</AppDomains>
<DefaultSettings>
<SourceLocation DefaultValue="https://www.contoso.com/search_app/Default.aspx" />
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
</OfficeApp>
```

#### Define .env file

```env
VITE_OFFICE_ID=c6890c26-5bbb-40ed-a321-37f07909a2f0
VITE_OFFICE_DOMAIN=https://www.contoso.com
VITE_OFFICE_PROVIDER_NAME=Contoso, Ltd
VITE_OFFICE_DISPLAY_NAME=Contoso App
VITE_OFFICE_DESCRIPTION=Office add-in for Contoso App
```

#### Update config

```ts
import MSOfficeAddin from 'msoffice-addin/vite'

export default defineConfig({
plugins: [
MSOfficeAddin({
manifests: [
{
src: 'manifest.xml',
route: '/outlook/manifest.xml',
},
],

/** Office.js will be injected to index.html page */
injectRoutes: ['/']
}),
],
})
```

That's it! You can now use msoffice-addin in your Nuxt app ✨
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "my-module",
"name": "msoffice-addin",
"type": "module",
"version": "1.0.0",
"description": "Microsoft office addin module for Nuxt",
"version": "0.0.0",
"description": "Microsoft office addin module for Nuxt abd vite",
"author": "Fahadul Islam @dapotatoman",
"license": "MIT",
"repository": "dapotatoman/nuxt-msoffice-addin",
"repository": "dapotatoman/msoffice-addin",
"keywords": [
"env",
"office-addin",
"nuxt",
"vite-plugin"
],
Expand Down
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "my-module-playground",
"name": "msoffice-addin-playground",
"type": "module",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Plugin, UserConfig } from 'vite'
import type { MSOfficeAddinConfig } from './types'
import { transformManifests } from './utils'

export default (params: MSOfficeAddinConfig): Plugin => {
export default function MSOfficeAddin(params: MSOfficeAddinConfig): Plugin {
let mode: string
let viteConfig: UserConfig

Expand Down

0 comments on commit d15af93

Please sign in to comment.