Skip to content

Commit

Permalink
Update/22 11 03 (#263)
Browse files Browse the repository at this point in the history
* ✏️ UPDATE: spacing

* 🐛 FIX: when no module, no error

* 🎨 FIX: website?

* 🐛 FIX: pnpm lock
  • Loading branch information
jycouet committed Nov 3, 2022
1 parent 57eda1a commit 2e8385d
Show file tree
Hide file tree
Showing 9 changed files with 800 additions and 590 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-eagles-shake.md
@@ -0,0 +1,5 @@
---
'@kitql/all-in': patch
---

remove error when no module
5 changes: 5 additions & 0 deletions .changeset/rotten-dancers-hammer.md
@@ -0,0 +1,5 @@
---
'vite-plugin-watch-and-run': patch
---

format message update with correct space
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -7,8 +7,7 @@
"type": "module",
"scripts": {
"prepare": "husky install",
"all:gen": "pnpm --filter @kitql/all-in gen",
"all:dev": "pnpm --filter @kitql/all-in dev",
"dev:all": "pnpm --filter @kitql/all-in dev",
"dev:w": "cd website && npm run dev",
"test": "vitest --coverage",
"lint": "eslint --ignore-path .prettierignore .",
Expand Down
28 changes: 14 additions & 14 deletions packages/all-in/package.json
Expand Up @@ -20,9 +20,9 @@
},
"devDependencies": {
"@sveltejs/adapter-auto": "1.0.0-next.86",
"@sveltejs/kit": "1.0.0-next.531",
"@sveltejs/kit": "1.0.0-next.532",
"@sveltejs/package": "1.0.0-next.5",
"@types/glob": "^8.0.0",
"@types/glob": "8.0.0",
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"eslint": "8.23.1",
Expand All @@ -39,24 +39,24 @@
"vite": "3.2.2"
},
"dependencies": {
"@envelop/core": "3.0.3",
"@envelop/graphql-modules": "4.0.3",
"@graphql-codegen/cli": "2.13.8",
"@graphql-codegen/graphql-modules-preset": "2.5.4",
"@graphql-codegen/introspection": "2.2.1",
"@graphql-codegen/typed-document-node": "2.3.5",
"@graphql-codegen/typescript": "2.8.0",
"@graphql-codegen/typescript-resolvers": "2.7.5",
"@graphql-eslint/eslint-plugin": "3.12.0",
"@graphql-typed-document-node/core": "3.1.1",
"@envelop/core": "^3.0.3",
"@envelop/graphql-modules": "^4.0.3",
"@graphql-codegen/cli": "^2.13.11",
"@graphql-codegen/graphql-modules-preset": "^2.5.5",
"@graphql-codegen/introspection": "^2.2.1",
"@graphql-codegen/typed-document-node": "^2.3.6",
"@graphql-codegen/typescript": "^2.8.1",
"@graphql-codegen/typescript-resolvers": "^2.7.6",
"@graphql-eslint/eslint-plugin": "^3.13.0",
"@graphql-typed-document-node/core": "^3.1.1",
"@kitql/helper": "0.6.0-next.3",
"@types/node": "^18.11.8",
"@types/node": "^18.11.9",
"glob": "^8.0.3",
"graphql": "^15.8.0",
"graphql-config": "^4.3.6",
"graphql-modules": "^2.1.0",
"graphql-scalars": "^1.20.0",
"graphql-yoga": "3.0.0-next.8",
"graphql-yoga": "3.0.0-next.10",
"safe-stable-stringify": "^2.4.1",
"ts-node": "^10.9.1",
"vite-plugin-watch-and-run": "1.1.0-next.4"
Expand Down
4 changes: 1 addition & 3 deletions packages/all-in/src/lib/vite/generate.ts
Expand Up @@ -14,9 +14,7 @@ import { getPrismaEnum } from './prismaHelper.js'
import { readLines } from './readWrite.js'
import { updateModuleTypes } from './updateModuleTypes.js'

export function generate(config?: KitQLVite) {
const log = new Log('KitQL')

export function generate(log: Log, config?: KitQLVite) {
const providersFolder = 'providers' as const

const { outputFolder, moduleOutputFolder, importBaseTypesFrom, modules, localDev } = {
Expand Down
17 changes: 14 additions & 3 deletions packages/all-in/src/lib/vite/plugin.ts
@@ -1,10 +1,13 @@
import { createContext, generate as codeGen_generate } from '@graphql-codegen/cli'
import { Log } from '@kitql/helper'
import { resolve } from 'path'
import type { Plugin } from 'vite'
import watch_and_run from 'vite-plugin-watch-and-run'

import type { KitQLVite } from './KitQLVite.js'
import { generate } from './generate.js'
import { generate as kitql_generate } from './generate.js'

const log = new Log('KitQL')

export function kitql(config?: KitQLVite): Plugin[] {
return [
Expand All @@ -15,11 +18,13 @@ export function kitql(config?: KitQLVite): Plugin[] {
await gooo(config)
},
},

watch_and_run([
{
name: 'kitql',
watch: resolve('src/**/*.(graphql)'),
run: () => gooo(config),
quiet: true,
},
]),
]
Expand All @@ -42,8 +47,14 @@ async function gooo(config?: KitQLVite) {
await codeGen_generate(context)

// KitQL (needs to be second as we write in the codegen module files)
generate(config)
kitql_generate(log, config)
} catch (e) {
console.error(e)
if (e.name === 'AggregateError') {
// No '*.graphql' found. Maybe schema is coming from mesh only?
// Still, let's run KitQL generate to clean up old files
kitql_generate(log, config)
} else {
console.error(e)
}
}
}
4 changes: 2 additions & 2 deletions packages/vite-plugin-watch-and-run/src/index.ts
Expand Up @@ -150,12 +150,12 @@ async function watcher(absolutePath: string | null, watchKind: WatchKind, watchA
if (!info.quiet) {
let message = `${logGreen('✔')} Watch ${logCyan(watchKind)}`
if (info.watch && absolutePath) {
message += logGreen(' ' + absolutePath)
message += logGreen(' ' + absolutePath.replaceAll(process.cwd(), ''))
}
if (typeof info.run === 'string') {
message + ` and run ${logGreen(info.run)} `
}
message += logCyan(info.delay + 'ms')
message += ` ${logCyan(info.delay + 'ms')}`

log.info(message)
}
Expand Down

1 comment on commit 2e8385d

@vercel
Copy link

@vercel vercel bot commented on 2e8385d Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kitql – ./

kitql.vercel.app
kitql-jycouet.vercel.app
kitql-git-main-jycouet.vercel.app
kitql.dev
www.kitql.dev

Please sign in to comment.