Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(docs): CLI and application structure guide #2818

Merged
merged 28 commits into from
Dec 8, 2022
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
855d89e
docs for initial cli guide
marshallswain Nov 5, 2022
19d3fd3
Update sidebar
marshallswain Nov 5, 2022
e213b62
Merge branch 'dove' of github.com:feathersjs/feathers into dove-docs-cli
daffl Nov 9, 2022
2ddb968
Further work on CLI guides
daffl Nov 11, 2022
128d68f
More CLI guides
daffl Nov 11, 2022
d3adafe
Small tweaks in generate app
daffl Nov 11, 2022
0c2aaa5
Start directory and file based generator documentation
daffl Nov 18, 2022
eeca6e2
Add and fix missing template file
daffl Nov 18, 2022
f7e2575
More in-depth generator docs
daffl Nov 18, 2022
c528f02
independent select components, reorganize cli guide
marshallswain Nov 18, 2022
b13776e
docs(config): fix branch name for “edit this page” link
marshallswain Nov 11, 2022
17663f9
docs(typebox): fix code examples for union
marshallswain Nov 11, 2022
1fd80cd
docs(typebox): add descriptions for all types (#2873)
marshallswain Nov 11, 2022
4eca9e4
docs(mongodb): update examples to latest CLI code
marshallswain Nov 14, 2022
b341703
docs(typebox): document string formats and custom options
marshallswain Nov 14, 2022
e434570
docs(typo): fix variable name in query resolver
marshallswain Nov 15, 2022
d6ce24b
fix(cli): mongodb connection string for node 17+ (#2875)
marshallswain Nov 18, 2022
8c9c488
docs(awesome): Use query-string url for search filters (#2843)
fratzinger Nov 18, 2022
aa69e0f
fix sorting on the ecosystem packages
marshallswain Nov 18, 2022
ae76c03
Fix custom service template
daffl Nov 19, 2022
451de99
Fix dead links
daffl Nov 19, 2022
793cd16
Merge with latest dove
daffl Dec 1, 2022
4a126ba
Make external password resolver a local template
daffl Dec 1, 2022
522432c
Make CLI paths backwards compatible
daffl Dec 1, 2022
a5acfcd
Merge with latest dove
daffl Dec 7, 2022
1219714
Add some client docs
daffl Dec 7, 2022
dc36e9c
Fix build
daffl Dec 8, 2022
af6d419
Add missing pages and flag as work in progress
daffl Dec 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/.vitepress/components.d.ts
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ declare module '@vue/runtime-core' {
BlockQuote: typeof import('./components/BlockQuote.vue')['default']
Contributors: typeof import('./components/Contributors.vue')['default']
DatabaseBlock: typeof import('./components/DatabaseBlock.vue')['default']
DatabaseSelect: typeof import('./components/DatabaseSelect.vue')['default']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElInput: typeof import('element-plus/es')['ElInput']
ElOption: typeof import('element-plus/es')['ElOption']
@@ -19,6 +20,7 @@ declare module '@vue/runtime-core' {
ElSelect: typeof import('element-plus/es')['ElSelect']
FeaturesList: typeof import('./components/FeaturesList.vue')['default']
LanguageBlock: typeof import('./components/LanguageBlock.vue')['default']
LanguageSelect: typeof import('./components/LanguageSelect.vue')['default']
ListItem: typeof import('./components/ListItem.vue')['default']
Logo: typeof import('./components/Logo.vue')['default']
Select: typeof import('./components/Select.vue')['default']
26 changes: 26 additions & 0 deletions docs/.vitepress/components/DatabaseSelect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script setup lang="ts">
import { useGlobalDb } from '../theme/store'
import Select from './Select.vue'

const activeGlobalDb = useGlobalDb()

const handleGlobalDbUpdate = (val: string) => {
if (activeGlobalDb.value !== val) {
activeGlobalDb.value = val
document.body.setAttribute('data-db', val)
}
}
</script>

<template>
<Select
id="GlobalDbSelect"
:value="activeGlobalDb"
label="Database"
:options="[
{ value: 'sql', text: 'SQL' },
{ value: 'mongodb', text: 'MongoDB' }
]"
@update-value="handleGlobalDbUpdate"
/>
</template>
24 changes: 24 additions & 0 deletions docs/.vitepress/components/LanguageSelect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { useGlobalLanguage } from '../theme/store'
import Select from './Select.vue'

const activeGlobalLanguage = useGlobalLanguage()

const handleGlobalLanguageUpdate = (val: string) => {
activeGlobalLanguage.value = val
document.body.setAttribute('data-language', val)
}
</script>

<template>
<Select
id="GlobalLanguageSelect"
:value="activeGlobalLanguage"
label="Code Language"
:options="[
{ value: 'ts', text: 'TypeScript' },
{ value: 'js', text: 'JavaScript' }
]"
@update-value="handleGlobalLanguageUpdate"
/>
</template>
156 changes: 152 additions & 4 deletions docs/.vitepress/config.sidebar.ts
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ export default {
{
text: 'Frontend',
collapsible: true,
collapsed: false,
items: [
{
text: 'JavaScript',
@@ -77,16 +78,163 @@ export default {
]
},
{
text: 'Migrating',
// collapsible: true,
text: 'CLI',
collapsible: true,
collapsed: true,
items: [
{
text: 'Migration guide',
link: '/guides/migrating.md'
text: 'Using the CLI',
link: '/guides/cli/index.md'
},
{
text: 'Generate App',
link: '/guides/cli/generate-app.md'
}
]
},
{
text: 'App Structure',
collapsible: true,
collapsed: false,
items: [
{
text: '📂 config',
items: [
{
text: '📄 default.json',
link: '/guides/cli/default.json.md'
},
{
text: '📄 custom-environment-variables.json',
link: '/guides/cli/custom-environment-variables.md'
}
]
},
{
text: '📂 src',
items: [
{
text: '📂 hooks',
items: [
{
text: '📄 &lt;hook&gt;',
link: '/guides/cli/hook.md'
},
{
text: '📄 log-error',
link: '/guides/cli/log-error.md'
}
]
},
{
text: '📂 services',
items: [
{
text: '📂 &lt;service&gt;',
items: [
{
text: '📄 &lt;service&gt;',
link: '/guides/cli/service.md'
},
{
text: '📄 &lt;service&gt;.class',
link: '/guides/cli/service.class.md'
},
{
text: '📄 &lt;service&gt;.schemas',
link: '/guides/cli/service.schemas.md'
}
]
},
{
text: '📄 index'
}
]
},
{
text: '📄 app',
link: '/guides/cli/app.md'
},
{
text: '📄 authentication',
link: '/guides/cli/authentication.md'
},
{
text: '📄 channels',
link: '/guides/cli/channels.md'
},
{
text: '📄 client',
link: '/guides/cli/client.md'
},
{
text: '📄 configuration',
link: '/guides/cli/configuration.md'
},
{
text: '📄 declarations',
link: '/guides/cli/declarations.md'
},
{
text: '📄 logger',
link: '/guides/cli/logger.md'
},
{
text: '📄 validators',
link: '/guides/cli/validators.md'
},
{
text: '📄 &lt;database&gt;',
link: '/guides/cli/databases.md'
}
]
},
{
text: '📂 test',
items: [
{
text: '📄 client.test',
link: '/guides/cli/client.test.md'
},
{
text: '📄 app.test',
link: '/guides/cli/app.test.md'
},
{
text: '📄 &lt;service&gt;.test',
link: '/guides/cli/service.test.md'
}
]
},
{
text: '📄 .prettierrc',
link: '/guides/cli/prettierrc.md'
},
{
text: '📄 knexfile',
link: '/guides/cli/knexfile.md'
},
{
text: '📄 package.json',
link: '/guides/cli/package.md'
},
{
text: '📄 tsconfig.json',
link: '/guides/cli/tsconfig.md'
}
]
},
{
text: 'Migrating',
// collapsible: true,
items: [
{
text: "What's new?",
link: '/guides/whats-new.md'
},
{
text: 'Migration guide',
link: '/guides/migrating.md'
}
]
}
40 changes: 4 additions & 36 deletions docs/.vitepress/theme/FeathersLayout.vue
Original file line number Diff line number Diff line change
@@ -1,49 +1,17 @@
<script setup lang="ts">
import DefaultTheme from 'vitepress/theme'
import Footer from '../../components/Footer.vue'
import { useGlobalLanguage, useGlobalDb } from './store'
import Select from '../components/Select.vue'
import LanguageSelect from '../components/LanguageSelect.vue'
import DatabaseSelect from '../components/DatabaseSelect.vue'

const { Layout } = DefaultTheme

const activeGlobalLanguage = useGlobalLanguage()
const activeGlobalDb = useGlobalDb()

const handleGlobalLanguageUpdate = (val: string) => {
activeGlobalLanguage.value = val
document.body.setAttribute('data-language', val)
}
const handleGlobalDbUpdate = (val: string) => {
if (activeGlobalDb.value !== val) {
activeGlobalDb.value = val
document.body.setAttribute('data-db', val)
}
}
</script>

<template>
<Layout>
<template #sidebar-nav-before>
<Select
id="GlobalLanguageSelect"
:value="activeGlobalLanguage"
label="Code Language"
:options="[
{ value: 'ts', text: 'TypeScript' },
{ value: 'js', text: 'JavaScript' }
]"
@update-value="handleGlobalLanguageUpdate"
/>
<Select
id="GlobalDbSelect"
:value="activeGlobalDb"
label="Database"
:options="[
{ value: 'sql', text: 'SQL' },
{ value: 'mongodb', text: 'MongoDB' }
]"
@update-value="handleGlobalDbUpdate"
/>
<LanguageSelect />
<DatabaseSelect />
</template>
</Layout>
<Footer />
3 changes: 0 additions & 3 deletions docs/.vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/api/schema/validators.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ Ajv and most other validation libraries are only used for ensuring data is valid

## Usage

The following is the standard `validators.ts` file that sets up a validator for data and querys (for which string types will be coerced automatically). It also sets up a collection of additional formats using [ajv-formats](https://ajv.js.org/packages/ajv-formats.html). The validators in this file can be customized according to the [Ajv documentation](https://ajv.js.org/) and [its plugins](https://ajv.js.org/packages/). You can find the available Ajv options in the [Ajs class API docs](https://ajv.js.org/options.html).
The following is the standard `validators.ts` file that sets up a validator for data and querys (for which string types will be coerced automatically). It also sets up a collection of additional formats using [ajv-formats](https://ajv.js.org/packages/ajv-formats.html). The validators in this file can be customized according to the [Ajv documentation](https://ajv.js.org/) and [its plugins](https://ajv.js.org/packages/). You can find the available Ajv options in the [Ajv class API docs](https://ajv.js.org/options.html).

```ts
import { Ajv, addFormats } from '@feathersjs/schema'
7 changes: 5 additions & 2 deletions docs/ecosystem/Packages.vue
Original file line number Diff line number Diff line change
@@ -139,9 +139,12 @@ const packagesToShow = computed(() => {
return a.hasNPM ? -1 : 1
}

if (a[key] > b[key]) {
const valA = a[key] || 0
const valB = b[key] || 0

if (valA > valB) {
return -1
} else if (a[key] < b[key]) {
} else if (valA < valB) {
return 1
} else {
return 0
11 changes: 7 additions & 4 deletions docs/guides/basics/schemas.md
Original file line number Diff line number Diff line change
@@ -30,6 +30,9 @@ While schemas and resolvers can be used outside of a Feather application, you wi
- **Query** schemas and resolvers validate and convert the query string and can also be used for additional limitations like only allowing a user to see and modify their own data
- **External** resolvers that return a safe version of the data (e.g. hiding a users password) that can be sent to external clients

<hr />
<DatabaseSelect />

## Adding a user avatar

Let's extend our existing users schema to add an `avatar` property so that our users can have a profile image.
@@ -55,7 +58,7 @@ import type { Static } from '@feathersjs/typebox'
import { passwordHash } from '@feathersjs/authentication-local'

import type { HookContext } from '../../declarations'
import { dataValidator, queryValidator } from '../../schemas/validators'
import { dataValidator, queryValidator } from '../../validators'

// Main data model schema
export const userSchema = Type.Object(
@@ -133,7 +136,7 @@ import type { Static } from '@feathersjs/typebox'
import { passwordHash } from '@feathersjs/authentication-local'

import type { HookContext } from '../../declarations'
import { dataValidator, queryValidator } from '../../schemas/validators'
import { dataValidator, queryValidator } from '../../validators'

// Main data model schema
export const userSchema = Type.Object(
@@ -220,7 +223,7 @@ import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/t
import type { Static } from '@feathersjs/typebox'

import type { HookContext } from '../../declarations'
import { dataValidator, queryValidator } from '../../schemas/validators'
import { dataValidator, queryValidator } from '../../validators'
import { userSchema } from '../users/users.schema'

// Main data model schema
@@ -295,7 +298,7 @@ import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/t
import type { Static } from '@feathersjs/typebox'

import type { HookContext } from '../../declarations'
import { dataValidator, queryValidator } from '../../schemas/validators'
import { dataValidator, queryValidator } from '../../validators'
import { userSchema } from '../users/users.schema'

// Main data model schema
Loading