Skip to content

Commit

Permalink
Merge pull request #167 from smolinari/dev
Browse files Browse the repository at this point in the history
Add some tweaks for ESM and Readme improvement
  • Loading branch information
smolinari authored May 8, 2024
2 parents f570930 + 141e421 commit 0a811db
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,21 @@ Quasar CLI will retrieve the extension from NPM
([@quasar/quasar-app-extension-apollo](https://www.npmjs.com/package/@quasar/quasar-app-extension-apollo))

The extension will add a configuration file into `src/apollo` and a boot file.
You'll need to manually register the latter into `quasar.conf.js > boot`.

## Config File Entry

**IMPORTANT** You'll need to manually register the boot file in `quasar.conf.js > boot`.

Like so:
```js
export default configure((/* ctx */) => {
return {
boot: [
'apollo'
],
// ....
}
```
### Prompts
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ module.exports = function (api) {
api.extendQuasarConf((conf, api) => {
// Allow overriding the graphql uri using an env variable
// https://quasar.dev/quasar-cli/handling-process-env#Adding-to-process.env
conf.build.env.GRAPHQL_URI = process.env.GRAPHQL_URI
conf.build.env.GRAPHQL_URI = process.env.GRAPHQL_URI || ''
if (api.prompts.subscriptions === true) {
conf.build.env.GRAPHQL_URI_WS = process.env.GRAPHQL_URI_WS
conf.build.env.GRAPHQL_URI_WS = process.env.GRAPHQL_URI_WS || ''
}

// `graphql` package does not work with Vite, so apply a workaround
Expand Down
8 changes: 8 additions & 0 deletions src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,12 @@ module.exports = async function(api) {
api.extendJsonFile('.vscode/extensions.json', {
recommendations: ['apollographql.vscode-apollo'],
})
api.onExitLog('##########################################################################')
api.onExitLog('# ==Thank you for installing the Quasar Apollo App Extension== #')
api.onExitLog('# #')
api.onExitLog('# ⚠️ Please make sure to add the boot entry in your quasar.config.js file.#')
api.onExitLog('# ⚠️ See the Apollo App Extension README for more information. #')
api.onExitLog('# https://github.com/quasarframework/app-extension-apollo #')
api.onExitLog('##########################################################################')

}
File renamed without changes.
4 changes: 3 additions & 1 deletion src/templates/no-typescript/src/apollo/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { createHttpLink, InMemoryCache } from '@apollo/client/core'<% if (hasSubscriptions) { %>
import { createHttpLink } from '@apollo/client/link/http/index.js'
import { InMemoryCache } from '@apollo/client/cache/index.js'
<% if (hasSubscriptions) { %>
import { split } from '@apollo/client/link/core'
import { Kind, OperationTypeNode } from 'graphql';
import { getMainDefinition } from '@apollo/client/utilities'<% if (subscriptionsTransport === 'ws') { %>
Expand Down
3 changes: 2 additions & 1 deletion src/templates/typescript/src/apollo/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ApolloClientOptions } from '@apollo/client/core'
import { createHttpLink, InMemoryCache } from '@apollo/client/core'
import { createHttpLink } from '@apollo/client/link/http/index.js'
import { InMemoryCache } from '@apollo/client/cache/index.js'
import type { BootFileParams } from '@quasar/app-<%= hasVite ? 'vite' : 'webpack' %>'<% if (hasSubscriptions) { %>
import { split } from '@apollo/client/link/core'
import { Kind, OperationTypeNode } from 'graphql';
Expand Down

0 comments on commit 0a811db

Please sign in to comment.