Skip to content

Commit bf2a8bd

Browse files
committed
chore: scaffold rest of dev and build environment
1 parent aee83f1 commit bf2a8bd

File tree

10 files changed

+7201
-14
lines changed

10 files changed

+7201
-14
lines changed

.devcontainer/devcontainer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu
3+
{
4+
"name": "Ubuntu",
5+
"image": "mcr.microsoft.com/vscode/devcontainers/base:0-ubuntu-22.04",
6+
7+
"onCreateCommand": "corepack enable && pnpm install --shamefully-hoist && pnpm prepare || true",
8+
9+
"remoteUser": "vscode",
10+
"features": {
11+
// For config options, see https://github.com/devcontainers/features/tree/main/src/node
12+
"ghcr.io/devcontainers/features/node:1": "18"
13+
},
14+
"customizations": {
15+
"vscode": {
16+
"extensions": [
17+
"dbaeumer.vscode-eslint",
18+
"esbenp.prettier-vscode",
19+
"ZixuanChen.vitest-explorer",
20+
"streetsidesoftware.code-spell-checker",
21+
"github.vscode-pull-request-github"
22+
]
23+
}
24+
}
25+
}

.eslintrc

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,52 @@
11
{
22
"extends": [
3-
"@nuxtjs/eslint-config-typescript"
3+
"@nuxtjs/eslint-config-typescript",
4+
// Enable typescript-specific recommended rules
5+
"plugin:@typescript-eslint/recommended",
6+
// Turns off all rules that are unnecessary or might conflict with Prettier (needs to be last)
7+
"prettier"
48
],
9+
"plugins": ["unused-imports"],
510
"rules": {
6-
"@typescript-eslint/no-unused-vars": [
7-
"off"
8-
]
9-
}
11+
// Workaround for bug https://github.com/nuxt/eslint-config/issues/147
12+
"no-useless-constructor": "off",
13+
"@typescript-eslint/no-useless-constructor": "error",
14+
// Don"t report unused imports (this is handled by prettier)
15+
"unused-imports/no-unused-imports": "off",
16+
// Report unused variables (except the ones prefixed with an underscore)
17+
"unused-imports/no-unused-vars": [
18+
"warn",
19+
{
20+
"vars": "all",
21+
"varsIgnorePattern": "^_",
22+
"args": "after-used",
23+
"argsIgnorePattern": "^_"
24+
}
25+
],
26+
// Ensure void operator is not used, except for variable assignment or function return (might be handy for promises)
27+
"no-void": ["error", { "allowAsStatement": true }],
28+
// Demote this to warning as long as we are still using cjs modules
29+
"import/named": "warn",
30+
// Import order is handled by prettier (which is incompatible with this rule: https://github.com/simonhaenisch/prettier-plugin-organize-imports/issues/65)
31+
"import/order": "off"
32+
},
33+
"overrides": [
34+
{
35+
"files": ["*.ts", "*.vue"],
36+
// Parser supporting vue files
37+
"parser": "vue-eslint-parser",
38+
"parserOptions": {
39+
// Use ts parser for ts files and for the script tag in vue files
40+
"parser": "@typescript-eslint/parser",
41+
// Path to tsconfig to enable rules that require type information
42+
"project": "./tsconfig.eslint.json",
43+
// Correctly handle vue files
44+
"extraFileExtensions": [".vue"]
45+
},
46+
"extends": [
47+
// Enable recommended rules for typescript that use typing information (may be CPU intensive)
48+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
49+
]
50+
}
51+
]
1052
}

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
ci:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- run: corepack enable
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 16
20+
cache: 'pnpm'
21+
- run: pnpm install --shamefully-hoist
22+
- run: pnpm prepare
23+
- run: pnpm lint
24+
- run: pnpm build
25+
#- run: pnpm vitest --coverage
26+
#- run: pnpm test:integration
27+
#- uses: codecov/codecov-action@v3

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
name: release
6+
jobs:
7+
release-pr:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
release_created: ${{ steps.release.outputs.release_created }}
11+
steps:
12+
- uses: google-github-actions/release-please-action@v3
13+
id: release
14+
with:
15+
release-type: node
16+
token: ${{ secrets.RELEASE_PR_TOKEN }}
17+
changelog-types: |-
18+
[
19+
{ "type": "feat", "section": "🔖 Features", "hidden": false },
20+
{ "type": "fix", "section": "🐛 Bug Fixes", "hidden": false },
21+
{ "type": "chore", "section": "🧹 Miscellaneous", "hidden": false }
22+
]
23+
24+
# Format changelog, workaround for https://github.com/google-github-actions/release-please-action/issues/542
25+
# Taken from https://github.com/remarkablemark/release-please-extra-files-demo/blob/master/.github/workflows/release-please.yml
26+
- uses: actions/checkout@v3
27+
if: ${{ steps.release.outputs.pr }}
28+
with:
29+
ref: ${{ fromJson(steps.release.outputs.pr).headBranchName }}
30+
31+
- name: Configure Git user
32+
if: ${{ steps.release.outputs.pr }}
33+
run: |
34+
git config --global user.name 'github-actions[bot]'
35+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
36+
git --no-pager show --name-only
37+
38+
- name: Format CHANGELOG.md
39+
if: ${{ steps.release.outputs.pr }}
40+
run: npx prettier --write CHANGELOG.md
41+
42+
- name: Commit and push
43+
if: ${{ steps.release.outputs.pr }}
44+
run: |
45+
git add CHANGELOG.md
46+
git commit -m 'chore: Format CHANGELOG.md with Prettier' --no-verify
47+
git push
48+
49+
publish_npm:
50+
name: Publish to npm
51+
runs-on: ubuntu-latest
52+
needs: [release-pr]
53+
if: needs.release-pr.outputs.release_created
54+
steps:
55+
- uses: actions/checkout@v3
56+
- run: corepack enable
57+
- uses: actions/setup-node@v3
58+
with:
59+
node-version: 16
60+
cache: 'pnpm'
61+
- name: Install dependencies
62+
run: pnpm install --shamefully-hoist
63+
- name: Publish to npm
64+
run: pnpm publish --access public
65+
env:
66+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"singleAttributePerLine": true
5+
}

README.md

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,46 @@
1-
# Nuxt Module
1+
# GraphQL Server Toolkit for Nuxt
22

3-
## Development
3+
[![npm version][npm-version-src]][npm-version-href]
4+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
5+
[![Github Actions][github-actions-src]][github-actions-href]
6+
[![Codecov][codecov-src]][codecov-href]
47

5-
- Run `npm run dev:prepare` to generate type stubs.
6-
- Use `npm run dev` to start [playground](./playground) in development mode.
8+
This package allows you to easily develop a GraphQL server in your [nuxt](v3.nuxtjs.org) application.
9+
10+
## Installation
11+
12+
```sh
13+
# npm
14+
npm install @apollo/server graphql @as-integrations/h3 @tobiasdiez/nuxt-graphql-server
15+
16+
# yarn
17+
yarn add @apollo/server graphql @as-integrations/h3 @tobiasdiez/nuxt-graphql-server
18+
19+
# pnpm
20+
pnpm add @apollo/server graphql @as-integrations/h3 @tobiasdiez/nuxt-graphql-server
21+
```
22+
23+
## 💻 Development
24+
25+
- Clone this repository
26+
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10).
27+
- Install dependencies using `pnpm install --shamefully-hoist`.
28+
- - Run `pnpm run prepare` to generate type stubs.
29+
- Use `pnpm run dev` to start [playground](./playground) in development mode.
30+
31+
## License
32+
33+
Made with 💛
34+
35+
Published under [MIT License](./LICENSE).
36+
37+
<!-- Badges -->
38+
39+
[npm-version-src]: https://img.shields.io/npm/v/@as-integrations/h3?style=flat-square
40+
[npm-version-href]: https://npmjs.com/package/@as-integrations/h3
41+
[npm-downloads-src]: https://img.shields.io/npm/dm/@as-integrations/h3?style=flat-square
42+
[npm-downloads-href]: https://npmjs.com/package/@as-integrations/h3
43+
[github-actions-src]: https://img.shields.io/github/workflow/status/apollo-server-integrations/apollo-server-integration-h3/ci/main?style=flat-square
44+
[github-actions-href]: https://github.com/apollo-server-integrations/apollo-server-integration-h3/actions?query=workflow%3Aci
45+
[codecov-src]: https://img.shields.io/codecov/c/gh/apollo-server-integrations/apollo-server-integration-h3/main?style=flat-square
46+
[codecov-href]: https://codecov.io/gh/apollo-server-integrations/apollo-server-integration-h3

package.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
2-
"name": "my-module",
2+
"name": "nuxt-graphql-server",
33
"version": "1.0.0",
4+
"description": "Easy GraphQL server implementation with Nuxt",
5+
"repository": "https://github.com/tobiasdiez/nuxt-graphql-server",
46
"license": "MIT",
57
"type": "module",
68
"exports": {
@@ -15,10 +17,14 @@
1517
"dist"
1618
],
1719
"scripts": {
18-
"prepack": "nuxt-module-build",
20+
"build": "nuxt-module-build",
1921
"dev": "nuxi dev playground",
2022
"dev:build": "nuxi build playground",
21-
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
23+
"prepare": "nuxt-module-build --stub && nuxi prepare playground",
24+
"lint": "pnpm lint:eslint && pnpm lint:prettier",
25+
"lint:eslint": "eslint --ext .ts,.js,.vue,.graphql --ignore-path .gitignore --report-unused-disable-directives .",
26+
"lint:prettier": "prettier --check --ignore-path .gitignore . '!pnpm-lock.yaml'",
27+
"release": "standard-version && git push --follow-tags && pnpm publish"
2228
},
2329
"dependencies": {
2430
"@nuxt/kit": "^3.0.0-rc.12"
@@ -27,7 +33,15 @@
2733
"@nuxt/module-builder": "^0.2.0",
2834
"@nuxt/schema": "^3.0.0-rc.12",
2935
"@nuxtjs/eslint-config-typescript": "^11.0.0",
36+
"@typescript-eslint/eslint-plugin": "^5.40.1",
37+
"@typescript-eslint/parser": "^5.40.1",
3038
"eslint": "^8.26.0",
31-
"nuxt": "^3.0.0-rc.12"
32-
}
39+
"eslint-config-prettier": "^8.5.0",
40+
"eslint-plugin-unused-imports": "^2.0.0",
41+
"nuxt": "^3.0.0-rc.12",
42+
"prettier": "^2.7.1",
43+
"standard-version": "^9.5.0",
44+
"typescript": "^4.8.4"
45+
},
46+
"packageManager": "pnpm@7.14.0"
3347
}

0 commit comments

Comments
 (0)