Skip to content

Commit

Permalink
rename module
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Klesse committed May 15, 2023
1 parent 71c3dab commit ff2ee54
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 40 deletions.
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,57 @@
Get your module up and running quickly.
Find and replace all on all files (CMD+SHIFT+F):
- Name: My Module
- Package name: @lenne.tech/lenne-nuxt-gql
- Name: nuxt-zeus
- Package name: nuxt-zeus
- Description: My new Nuxt module
-->

# @lenne.tech/lenne-nuxt-gql
# nuxt-zeus

[![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.

- [ Release Notes](/CHANGELOG.md)
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/@lenne.tech/lenne-nuxt-gql?file=playground%2Fapp.vue) -->
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/nuxt-zeus?file=playground%2Fapp.vue) -->
<!-- - [📖 &nbsp;Documentation](https://example.com) -->

Nuxt 3 module for https://github.com/graphql-editor/graphql-zeus 🚀

## Features

<!-- Highlight some of the features your module provide here -->
- &nbsp;Foo
- 🚠 &nbsp;Bar
- 🌲 &nbsp;Baz
- 🚀 &nbsp;Use zeus in nuxt app
- 🚀 &nbsp;Some helper functions for better usage
- 🚀 &nbsp;Completely typed

## Quick Setup

1. Add `@lenne.tech/lenne-nuxt-gql` dependency to your project
1. Add `nuxt-zeus` dependency to your project

```bash
# Using pnpm
pnpm add -D @lenne.tech/lenne-nuxt-gql
pnpm add -D nuxt-zeus

# Using yarn
yarn add --dev @lenne.tech/lenne-nuxt-gql
yarn add --dev nuxt-zeus

# Using npm
npm install --save-dev @lenne.tech/lenne-nuxt-gql
npm install --save-dev nuxt-zeus
```

2. Add `@lenne.tech/lenne-nuxt-gql` to the `modules` section of `nuxt.config.ts`
2. Add `nuxt-zeus` to the `modules` section of `nuxt.config.ts`

```js
export default defineNuxtConfig({
modules: [
'@lenne.tech/lenne-nuxt-gql'
'nuxt-zeus'
]
})
```

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

## Development

Expand Down Expand Up @@ -81,14 +81,14 @@ npm run release
```

<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/@lenne.tech/lenne-nuxt-gql/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/@lenne.tech/lenne-nuxt-gql
[npm-version-src]: https://img.shields.io/npm/v/nuxt-zeus/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-version-href]: https://npmjs.com/package/nuxt-zeus

[npm-downloads-src]: https://img.shields.io/npm/dm/@lenne.tech/lenne-nuxt-gql.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/@lenne.tech/lenne-nuxt-gql
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-zeus.svg?style=flat&colorA=18181B&colorB=28CF8D
[npm-downloads-href]: https://npmjs.com/package/nuxt-zeus

[license-src]: https://img.shields.io/npm/l/@lenne.tech/lenne-nuxt-gql.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/@lenne.tech/lenne-nuxt-gql
[license-src]: https://img.shields.io/npm/l/nuxt-zeus.svg?style=flat&colorA=18181B&colorB=28CF8D
[license-href]: https://npmjs.com/package/nuxt-zeus

[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
[nuxt-href]: https://nuxt.com
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lenne.tech/lenne-nuxt-gql",
"version": "1.0.3",
"name": "nuxt-zeus",
"version": "1.0.4",
"description": "Nuxt graphql module of @lenne.tech",
"repository": "https://github.com/lenneTech/lenne-nuxt-gql",
"license": "MIT",
Expand Down
24 changes: 12 additions & 12 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { defineNuxtModule, createResolver, addImportsDir, addTemplate, useLogger } from '@nuxt/kit'
import { TreeToTS } from 'graphql-zeus-core';
import { addImportsDir, addTemplate, createResolver, defineNuxtModule, useLogger } from '@nuxt/kit';
import { defu } from 'defu';
import { Parser } from 'graphql-js-tree';
import { readFileSync } from 'node:fs'
import { defu } from 'defu'
import { TreeToTS } from 'graphql-zeus-core';
import { readFileSync } from 'node:fs';
// TODO: replace when es-module error is fixed
import { Utils } from './zeus_utils'
const logger = useLogger("[@lenne.tech/zeus] ");
import { Utils } from './zeus_utils';
const logger = useLogger("[nuxt-zeus] ");

export interface ModuleOptions {
/**
Expand All @@ -26,7 +26,7 @@ export interface ModuleOptions {

export default defineNuxtModule<ModuleOptions>({
meta: {
name: '@lenne.tech/lenne-nuxt-gql',
name: 'nuxt-zeus',
configKey: 'zeus'
},
// Default configuration options of the Nuxt module
Expand All @@ -38,7 +38,7 @@ export default defineNuxtModule<ModuleOptions>({
const { resolve } = createResolver(import.meta.url)

if (!options.host) {
throw new Error('[@lenne.tech/zeus]: Host must be provided, in module config!')
throw new Error('[nuxt-zeus]: Host must be provided, in module config!')
}

nuxt.options.runtimeConfig.public.zeus = defu(nuxt.options.runtimeConfig.public.zeus, {
Expand All @@ -55,14 +55,14 @@ export default defineNuxtModule<ModuleOptions>({

if (options.pathToSchema) {
if (options.pathToSchema && options.pathToSchema.startsWith('http')) {
logger.success("[@lenne.tech/zeus] custom remote schema path will be used");
logger.success("[nuxt-zeus] custom remote schema path will be used");
schemaFileContents = await Utils.getFromUrl(options.pathToSchema)
} else {
logger.success("[@lenne.tech/zeus] local schema will be used");
logger.success("[nuxt-zeus] local schema will be used");
schemaFileContents = readFileSync(resolve(options.pathToSchema), 'utf8')
}
} else {
logger.success("[@lenne.tech/zeus] host will be used as schema path");
logger.success("[nuxt-zeus] host will be used as schema path");
schemaFileContents = await Utils.getFromUrl(options.host)
}

Expand All @@ -74,7 +74,7 @@ export default defineNuxtModule<ModuleOptions>({
),
});

logger.success("[@lenne.tech/zeus] Generated zeus/index.ts");
logger.success("[nuxt-zeus] Generated zeus/index.ts");
nuxt.options.alias['#zeus'] = resolve(nuxt.options.buildDir, 'zeus')
nuxt.options.alias['#zeus/*'] = resolve(nuxt.options.buildDir, 'zeus', '*')

Expand Down

0 comments on commit ff2ee54

Please sign in to comment.