@feathersjs/generators 5.0.0-pre.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/LICENSE +22 -0
- package/README.md +23 -0
- package/lib/app/index.d.ts +29 -0
- package/lib/app/index.js +146 -0
- package/lib/app/index.js.map +1 -0
- package/lib/app/index.ts +228 -0
- package/lib/app/static/.gitignore +121 -0
- package/lib/app/templates/app.test.tpl.d.ts +2 -0
- package/lib/app/templates/app.test.tpl.js +49 -0
- package/lib/app/templates/app.test.tpl.js.map +1 -0
- package/lib/app/templates/app.test.tpl.ts +50 -0
- package/lib/app/templates/app.tpl.d.ts +2 -0
- package/lib/app/templates/app.tpl.js +123 -0
- package/lib/app/templates/app.tpl.js.map +1 -0
- package/lib/app/templates/app.tpl.ts +138 -0
- package/lib/app/templates/channels.tpl.d.ts +2 -0
- package/lib/app/templates/channels.tpl.js +50 -0
- package/lib/app/templates/channels.tpl.js.map +1 -0
- package/lib/app/templates/channels.tpl.ts +56 -0
- package/lib/app/templates/client.test.tpl.d.ts +2 -0
- package/lib/app/templates/client.test.tpl.js +27 -0
- package/lib/app/templates/client.test.tpl.js.map +1 -0
- package/lib/app/templates/client.test.tpl.ts +26 -0
- package/lib/app/templates/client.tpl.d.ts +2 -0
- package/lib/app/templates/client.tpl.js +38 -0
- package/lib/app/templates/client.tpl.js.map +1 -0
- package/lib/app/templates/client.tpl.ts +45 -0
- package/lib/app/templates/configuration.tpl.d.ts +2 -0
- package/lib/app/templates/configuration.tpl.js +71 -0
- package/lib/app/templates/configuration.tpl.js.map +1 -0
- package/lib/app/templates/configuration.tpl.ts +82 -0
- package/lib/app/templates/declarations.tpl.d.ts +2 -0
- package/lib/app/templates/declarations.tpl.js +28 -0
- package/lib/app/templates/declarations.tpl.js.map +1 -0
- package/lib/app/templates/declarations.tpl.ts +37 -0
- package/lib/app/templates/index.html.tpl.d.ts +2 -0
- package/lib/app/templates/index.html.tpl.js +45 -0
- package/lib/app/templates/index.html.tpl.js.map +1 -0
- package/lib/app/templates/index.html.tpl.ts +44 -0
- package/lib/app/templates/index.tpl.d.ts +2 -0
- package/lib/app/templates/index.tpl.js +22 -0
- package/lib/app/templates/index.tpl.js.map +1 -0
- package/lib/app/templates/index.tpl.ts +26 -0
- package/lib/app/templates/logger.tpl.d.ts +3 -0
- package/lib/app/templates/logger.tpl.js +45 -0
- package/lib/app/templates/logger.tpl.js.map +1 -0
- package/lib/app/templates/logger.tpl.ts +56 -0
- package/lib/app/templates/package.json.tpl.d.ts +2 -0
- package/lib/app/templates/package.json.tpl.js +58 -0
- package/lib/app/templates/package.json.tpl.js.map +1 -0
- package/lib/app/templates/package.json.tpl.ts +71 -0
- package/lib/app/templates/prettierrc.tpl.d.ts +2 -0
- package/lib/app/templates/prettierrc.tpl.js +11 -0
- package/lib/app/templates/prettierrc.tpl.js.map +1 -0
- package/lib/app/templates/prettierrc.tpl.ts +14 -0
- package/lib/app/templates/readme.md.tpl.d.ts +2 -0
- package/lib/app/templates/readme.md.tpl.js +54 -0
- package/lib/app/templates/readme.md.tpl.js.map +1 -0
- package/lib/app/templates/readme.md.tpl.ts +57 -0
- package/lib/app/templates/services.tpl.d.ts +2 -0
- package/lib/app/templates/services.tpl.js +15 -0
- package/lib/app/templates/services.tpl.js.map +1 -0
- package/lib/app/templates/services.tpl.ts +20 -0
- package/lib/app/templates/tsconfig.json.tpl.d.ts +2 -0
- package/lib/app/templates/tsconfig.json.tpl.js +22 -0
- package/lib/app/templates/tsconfig.json.tpl.js.map +1 -0
- package/lib/app/templates/tsconfig.json.tpl.ts +28 -0
- package/lib/app/templates/validators.tpl.d.ts +2 -0
- package/lib/app/templates/validators.tpl.js +36 -0
- package/lib/app/templates/validators.tpl.js.map +1 -0
- package/lib/app/templates/validators.tpl.ts +40 -0
- package/lib/authentication/index.d.ts +73 -0
- package/lib/authentication/index.js +107 -0
- package/lib/authentication/index.js.map +1 -0
- package/lib/authentication/index.ts +126 -0
- package/lib/authentication/templates/authentication.tpl.d.ts +2 -0
- package/lib/authentication/templates/authentication.tpl.js +40 -0
- package/lib/authentication/templates/authentication.tpl.js.map +1 -0
- package/lib/authentication/templates/authentication.tpl.ts +51 -0
- package/lib/authentication/templates/client.test.tpl.d.ts +2 -0
- package/lib/authentication/templates/client.test.tpl.js +62 -0
- package/lib/authentication/templates/client.test.tpl.js.map +1 -0
- package/lib/authentication/templates/client.test.tpl.ts +74 -0
- package/lib/authentication/templates/config.tpl.d.ts +2 -0
- package/lib/authentication/templates/config.tpl.js +50 -0
- package/lib/authentication/templates/config.tpl.js.map +1 -0
- package/lib/authentication/templates/config.tpl.ts +57 -0
- package/lib/authentication/templates/declarations.tpl.d.ts +2 -0
- package/lib/authentication/templates/declarations.tpl.js +19 -0
- package/lib/authentication/templates/declarations.tpl.js.map +1 -0
- package/lib/authentication/templates/declarations.tpl.ts +34 -0
- package/lib/authentication/templates/knex.tpl.d.ts +2 -0
- package/lib/authentication/templates/knex.tpl.js +45 -0
- package/lib/authentication/templates/knex.tpl.js.map +1 -0
- package/lib/authentication/templates/knex.tpl.ts +62 -0
- package/lib/authentication/templates/schema.json.tpl.d.ts +2 -0
- package/lib/authentication/templates/schema.json.tpl.js +103 -0
- package/lib/authentication/templates/schema.json.tpl.js.map +1 -0
- package/lib/authentication/templates/schema.json.tpl.ts +124 -0
- package/lib/authentication/templates/schema.typebox.tpl.d.ts +3 -0
- package/lib/authentication/templates/schema.typebox.tpl.js +86 -0
- package/lib/authentication/templates/schema.typebox.tpl.js.map +1 -0
- package/lib/authentication/templates/schema.typebox.tpl.ts +108 -0
- package/lib/commons.d.ts +150 -0
- package/lib/commons.js +198 -0
- package/lib/commons.js.map +1 -0
- package/lib/commons.ts +284 -0
- package/lib/connection/index.d.ts +55 -0
- package/lib/connection/index.js +88 -0
- package/lib/connection/index.js.map +1 -0
- package/lib/connection/index.ts +123 -0
- package/lib/connection/templates/knex.tpl.d.ts +2 -0
- package/lib/connection/templates/knex.tpl.js +48 -0
- package/lib/connection/templates/knex.tpl.js.map +1 -0
- package/lib/connection/templates/knex.tpl.ts +67 -0
- package/lib/connection/templates/mongodb.tpl.d.ts +2 -0
- package/lib/connection/templates/mongodb.tpl.js +34 -0
- package/lib/connection/templates/mongodb.tpl.js.map +1 -0
- package/lib/connection/templates/mongodb.tpl.ts +40 -0
- package/lib/hook/index.d.ts +22 -0
- package/lib/hook/index.js +43 -0
- package/lib/hook/index.js.map +1 -0
- package/lib/hook/index.ts +47 -0
- package/lib/hook/templates/hook.tpl.d.ts +2 -0
- package/lib/hook/templates/hook.tpl.js +22 -0
- package/lib/hook/templates/hook.tpl.js.map +1 -0
- package/lib/hook/templates/hook.tpl.ts +33 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +37 -0
- package/lib/index.js.map +1 -0
- package/lib/index.ts +8 -0
- package/lib/service/index.d.ts +64 -0
- package/lib/service/index.js +116 -0
- package/lib/service/index.js.map +1 -0
- package/lib/service/index.ts +191 -0
- package/lib/service/templates/client.tpl.d.ts +2 -0
- package/lib/service/templates/client.tpl.js +30 -0
- package/lib/service/templates/client.tpl.js.map +1 -0
- package/lib/service/templates/client.tpl.ts +56 -0
- package/lib/service/templates/schema.json.tpl.d.ts +2 -0
- package/lib/service/templates/schema.json.tpl.js +83 -0
- package/lib/service/templates/schema.json.tpl.js.map +1 -0
- package/lib/service/templates/schema.json.tpl.ts +98 -0
- package/lib/service/templates/schema.typebox.tpl.d.ts +2 -0
- package/lib/service/templates/schema.typebox.tpl.js +61 -0
- package/lib/service/templates/schema.typebox.tpl.js.map +1 -0
- package/lib/service/templates/schema.typebox.tpl.ts +76 -0
- package/lib/service/templates/service.tpl.d.ts +3 -0
- package/lib/service/templates/service.tpl.js +112 -0
- package/lib/service/templates/service.tpl.js.map +1 -0
- package/lib/service/templates/service.tpl.ts +152 -0
- package/lib/service/templates/test.tpl.d.ts +2 -0
- package/lib/service/templates/test.tpl.js +25 -0
- package/lib/service/templates/test.tpl.js.map +1 -0
- package/lib/service/templates/test.tpl.ts +33 -0
- package/lib/service/type/custom.tpl.d.ts +3 -0
- package/lib/service/type/custom.tpl.js +98 -0
- package/lib/service/type/custom.tpl.js.map +1 -0
- package/lib/service/type/custom.tpl.ts +109 -0
- package/lib/service/type/knex.tpl.d.ts +3 -0
- package/lib/service/type/knex.tpl.js +71 -0
- package/lib/service/type/knex.tpl.js.map +1 -0
- package/lib/service/type/knex.tpl.ts +92 -0
- package/lib/service/type/mongodb.tpl.d.ts +3 -0
- package/lib/service/type/mongodb.tpl.js +50 -0
- package/lib/service/type/mongodb.tpl.js.map +1 -0
- package/lib/service/type/mongodb.tpl.ts +62 -0
- package/package.json +89 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { generator, toFile, writeJSON } from '@feathershq/pinion'
|
|
2
|
+
import { renderSource } from '../../commons'
|
|
3
|
+
import { AppGeneratorContext } from '../index'
|
|
4
|
+
|
|
5
|
+
const defaultConfig = ({}: AppGeneratorContext) => ({
|
|
6
|
+
host: 'localhost',
|
|
7
|
+
port: 3030,
|
|
8
|
+
public: './public/',
|
|
9
|
+
origins: ['http://localhost:3030'],
|
|
10
|
+
paginate: {
|
|
11
|
+
default: 10,
|
|
12
|
+
max: 50
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const customEnvironment = {
|
|
17
|
+
port: {
|
|
18
|
+
__name: 'PORT',
|
|
19
|
+
__format: 'number'
|
|
20
|
+
},
|
|
21
|
+
host: 'HOSTNAME'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const testConfig = {
|
|
25
|
+
port: 8998
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const configurationJsonTemplate =
|
|
29
|
+
({}: AppGeneratorContext) => /* ts */ `import { defaultAppSettings, getValidator } from '@feathersjs/schema'
|
|
30
|
+
import type { FromSchema } from '@feathersjs/schema'
|
|
31
|
+
|
|
32
|
+
import { dataValidator } from './validators'
|
|
33
|
+
|
|
34
|
+
export const configurationSchema = {
|
|
35
|
+
type: 'object',
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
required: [ 'host', 'port', 'public' ],
|
|
38
|
+
properties: {
|
|
39
|
+
...defaultAppSettings,
|
|
40
|
+
host: { type: 'string' },
|
|
41
|
+
port: { type: 'number' },
|
|
42
|
+
public: { type: 'string' }
|
|
43
|
+
}
|
|
44
|
+
} as const
|
|
45
|
+
|
|
46
|
+
export const configurationValidator = getValidator(configurationSchema, dataValidator)
|
|
47
|
+
|
|
48
|
+
export type ApplicationConfiguration = FromSchema<typeof configurationSchema>
|
|
49
|
+
`
|
|
50
|
+
|
|
51
|
+
const configurationTypeboxTemplate =
|
|
52
|
+
({}: AppGeneratorContext) => /* ts */ `import { Type, getValidator, defaultAppConfiguration } from '@feathersjs/typebox'
|
|
53
|
+
import type { Static } from '@feathersjs/typebox'
|
|
54
|
+
|
|
55
|
+
import { dataValidator } from './validators'
|
|
56
|
+
|
|
57
|
+
export const configurationSchema = Type.Intersect([
|
|
58
|
+
defaultAppConfiguration,
|
|
59
|
+
Type.Object({
|
|
60
|
+
host: Type.String(),
|
|
61
|
+
port: Type.Number(),
|
|
62
|
+
public: Type.String()
|
|
63
|
+
})
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
export type ApplicationConfiguration = Static<typeof configurationSchema>
|
|
67
|
+
|
|
68
|
+
export const configurationValidator = getValidator(configurationSchema, dataValidator)
|
|
69
|
+
`
|
|
70
|
+
|
|
71
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
72
|
+
generator(ctx)
|
|
73
|
+
.then(writeJSON(defaultConfig, toFile('config', 'default.json')))
|
|
74
|
+
.then(writeJSON(testConfig, toFile('config', 'test.json')))
|
|
75
|
+
.then(writeJSON(customEnvironment, toFile('config', 'custom-environment-variables.json')))
|
|
76
|
+
.then(
|
|
77
|
+
renderSource(
|
|
78
|
+
async (ctx) =>
|
|
79
|
+
ctx.schema === 'typebox' ? configurationTypeboxTemplate(ctx) : configurationJsonTemplate(ctx),
|
|
80
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'configuration')
|
|
81
|
+
)
|
|
82
|
+
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = void 0;
|
|
4
|
+
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
+
const template = ({ framework }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/typescript.html
|
|
6
|
+
import { HookContext as FeathersHookContext, NextFunction } from '@feathersjs/feathers'
|
|
7
|
+
import { Application as FeathersApplication } from '@feathersjs/${framework}'
|
|
8
|
+
import { ApplicationConfiguration } from './configuration'
|
|
9
|
+
|
|
10
|
+
export { NextFunction }
|
|
11
|
+
|
|
12
|
+
// The types for app.get(name) and app.set(name)
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
14
|
+
export interface Configuration extends ApplicationConfiguration {}
|
|
15
|
+
|
|
16
|
+
// A mapping of service names to types. Will be extended in service files.
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
18
|
+
export interface ServiceTypes {}
|
|
19
|
+
|
|
20
|
+
// The application instance type that will be used everywhere else
|
|
21
|
+
export type Application = FeathersApplication<ServiceTypes, Configuration>
|
|
22
|
+
|
|
23
|
+
// The context for hook functions - can be typed with a service class
|
|
24
|
+
export type HookContext<S = any> = FeathersHookContext<Application, S>
|
|
25
|
+
`;
|
|
26
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.when)(({ language }) => language === 'ts', (0, pinion_1.renderTemplate)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'declarations.ts'))));
|
|
27
|
+
exports.generate = generate;
|
|
28
|
+
//# sourceMappingURL=declarations.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/declarations.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4E;AAG5E,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACW,EAAE,EAAE,CAAC,QAAQ,CAAC;;kEAE8B,SAAS;;;;;;;;;;;;;;;;;;CAkB1E,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,aAAI,EACF,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,EACnC,IAAA,uBAAc,EACZ,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,CACjE,CACF,CACF,CAAA;AATU,QAAA,QAAQ,YASlB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { generator, toFile, when, renderTemplate } from '@feathershq/pinion'
|
|
2
|
+
import { AppGeneratorContext } from '../index'
|
|
3
|
+
|
|
4
|
+
const template = ({
|
|
5
|
+
framework
|
|
6
|
+
}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/typescript.html
|
|
7
|
+
import { HookContext as FeathersHookContext, NextFunction } from '@feathersjs/feathers'
|
|
8
|
+
import { Application as FeathersApplication } from '@feathersjs/${framework}'
|
|
9
|
+
import { ApplicationConfiguration } from './configuration'
|
|
10
|
+
|
|
11
|
+
export { NextFunction }
|
|
12
|
+
|
|
13
|
+
// The types for app.get(name) and app.set(name)
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
15
|
+
export interface Configuration extends ApplicationConfiguration {}
|
|
16
|
+
|
|
17
|
+
// A mapping of service names to types. Will be extended in service files.
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
19
|
+
export interface ServiceTypes {}
|
|
20
|
+
|
|
21
|
+
// The application instance type that will be used everywhere else
|
|
22
|
+
export type Application = FeathersApplication<ServiceTypes, Configuration>
|
|
23
|
+
|
|
24
|
+
// The context for hook functions - can be typed with a service class
|
|
25
|
+
export type HookContext<S = any> = FeathersHookContext<Application, S>
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
29
|
+
generator(ctx).then(
|
|
30
|
+
when<AppGeneratorContext>(
|
|
31
|
+
({ language }) => language === 'ts',
|
|
32
|
+
renderTemplate(
|
|
33
|
+
template,
|
|
34
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'declarations.ts')
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = void 0;
|
|
4
|
+
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
+
const template = ({ name, description }) => /* html */ `<!DOCTYPE html>
|
|
6
|
+
<html lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>${name}</title>
|
|
9
|
+
<meta name="description" content="${description}">
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
11
|
+
<style>
|
|
12
|
+
* {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
html {
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body {
|
|
23
|
+
min-height: 100%;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
img.logo {
|
|
29
|
+
display: block;
|
|
30
|
+
margin: auto auto;
|
|
31
|
+
width: 30%;
|
|
32
|
+
max-width: 100%;
|
|
33
|
+
max-height: 100%;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
</head>
|
|
37
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jQxMyA3MS4xMTFjNi4yNTgtMS4zMjcgNy43NzUtNzMuOTU2IDcuNzc1LTczLjk1NnM3LjU4NS41NjkgOS4yOTItMS4zMjdjMy44NTYtMi42NTUgMTIuODI2LTMwLjIyNCAxMi45NTgtMzQuMjAyIDAgMC0xMC40MSAxLjk1Mi0xNS40ODcgMy45MjQgMy44MjYtMy44IDE2LjA0OS02LjM1MiAxNi4wNDktNi4zNTIgMy4zMTUtMy45NzkgMTAuMjkxLTMxLjA0NyAxMC45OTQtMzkuMzkxLjE3Ni0yLjA5My41ODMtNC42NTcuMjY4LTguMzk4IDAgMC05Ljk0MSAyLjE3Ny0xMi4wMTQgMS40MjQgMi4xMDQtLjIzNyAxMi4yNjMtNC4xNCAxMi4yNjMtNC4xNCAxLjgwMS0xNi4yMTMgMi4zNTgtNDIuMDkxLTMuNDEzLTQzLjE0MXptLTM2LjM4IDE3MS42OTFjLS43OTUgMTkuNDk2LTEuMjk0IDI1LjAwNC0yLjExNSAyOS42MDEtLjM3OS44NTctLjc1OC45OTctMS4xMzgtLjA5NS0zLjQ3Ny0xNS45OTItMy4yMjQtMTM2LjQzOCAzNi40MDktMTkxLjI0MS0yMy4wNSA0Mi4wOTItMzMuNTM1IDEyMi44NjEtMzMuMTU2IDE2MS43MzV6IiBmaWxsPSIjMzMzIi8+PC9zdmc+" />
|
|
39
|
+
</body>
|
|
40
|
+
</html>
|
|
41
|
+
|
|
42
|
+
`;
|
|
43
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.renderTemplate)(template, (0, pinion_1.toFile)('public', 'index.html')));
|
|
44
|
+
exports.generate = generate;
|
|
45
|
+
//# sourceMappingURL=index.html.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.html.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/index.html.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsE;AAGtE,MAAM,QAAQ,GAAG,CAAC,EAAE,IAAI,EAAE,WAAW,EAAuB,EAAE,EAAE,CAAC,UAAU,CAAC;;;aAG/D,IAAI;wCACuB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiClD,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,uBAAc,EAAC,QAAQ,EAAE,IAAA,eAAM,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;AADlE,QAAA,QAAQ,YAC0D"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { generator, renderTemplate, toFile } from '@feathershq/pinion'
|
|
2
|
+
import { AppGeneratorContext } from '../index'
|
|
3
|
+
|
|
4
|
+
const template = ({ name, description }: AppGeneratorContext) => /* html */ `<!DOCTYPE html>
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<title>${name}</title>
|
|
8
|
+
<meta name="description" content="${description}">
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
|
+
<style>
|
|
11
|
+
* {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html {
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
body {
|
|
22
|
+
min-height: 100%;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
img.logo {
|
|
28
|
+
display: block;
|
|
29
|
+
margin: auto auto;
|
|
30
|
+
width: 30%;
|
|
31
|
+
max-width: 100%;
|
|
32
|
+
max-height: 100%;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<img class="logo" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h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jkgOS4yOTItMS4zMjdjMy44NTYtMi42NTUgMTIuODI2LTMwLjIyNCAxMi45NTgtMzQuMjAyIDAgMC0xMC40MSAxLjk1Mi0xNS40ODcgMy45MjQgMy44MjYtMy44IDE2LjA0OS02LjM1MiAxNi4wNDktNi4zNTIgMy4zMTUtMy45NzkgMTAuMjkxLTMxLjA0NyAxMC45OTQtMzkuMzkxLjE3Ni0yLjA5My41ODMtNC42NTcuMjY4LTguMzk4IDAgMC05Ljk0MSAyLjE3Ny0xMi4wMTQgMS40MjQgMi4xMDQtLjIzNyAxMi4yNjMtNC4xNCAxMi4yNjMtNC4xNCAxLjgwMS0xNi4yMTMgMi4zNTgtNDIuMDkxLTMuNDEzLTQzLjE0MXptLTM2LjM4IDE3MS42OTFjLS43OTUgMTkuNDk2LTEuMjk0IDI1LjAwNC0yLjExNSAyOS42MDEtLjM3OS44NTctLjc1OC45OTctMS4xMzgtLjA5NS0zLjQ3Ny0xNS45OTItMy4yMjQtMTM2LjQzOCAzNi40MDktMTkxLjI0MS0yMy4wNSA0Mi4wOTItMzMuNTM1IDEyMi44NjEtMzMuMTU2IDE2MS43MzV6IiBmaWxsPSIjMzMzIi8+PC9zdmc+" />
|
|
38
|
+
</body>
|
|
39
|
+
</html>
|
|
40
|
+
|
|
41
|
+
`
|
|
42
|
+
|
|
43
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
44
|
+
generator(ctx).then(renderTemplate(template, toFile('public', 'index.html')))
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = void 0;
|
|
4
|
+
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
+
const commons_1 = require("../../commons");
|
|
6
|
+
const template = ({}) => /* ts */ `import { app } from './app'
|
|
7
|
+
import { logger } from './logger'
|
|
8
|
+
|
|
9
|
+
const port = app.get('port')
|
|
10
|
+
const host = app.get('host')
|
|
11
|
+
|
|
12
|
+
process.on('unhandledRejection', (reason, p) =>
|
|
13
|
+
logger.error('Unhandled Rejection at: Promise ', p, reason)
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
app.listen(port).then(() => {
|
|
17
|
+
logger.info(\`Feathers app listening on http://\${host}:\${port}\`)
|
|
18
|
+
})
|
|
19
|
+
`;
|
|
20
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'index')));
|
|
21
|
+
exports.generate = generate;
|
|
22
|
+
//# sourceMappingURL=index.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/index.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;CAatD,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,CACvD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { generator, toFile } from '@feathershq/pinion'
|
|
2
|
+
import { renderSource } from '../../commons'
|
|
3
|
+
import { AppGeneratorContext } from '../index'
|
|
4
|
+
|
|
5
|
+
const template = ({}: AppGeneratorContext) => /* ts */ `import { app } from './app'
|
|
6
|
+
import { logger } from './logger'
|
|
7
|
+
|
|
8
|
+
const port = app.get('port')
|
|
9
|
+
const host = app.get('host')
|
|
10
|
+
|
|
11
|
+
process.on('unhandledRejection', (reason, p) =>
|
|
12
|
+
logger.error('Unhandled Rejection at: Promise ', p, reason)
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
app.listen(port).then(() => {
|
|
16
|
+
logger.info(\`Feathers app listening on http://\${host}:\${port}\`)
|
|
17
|
+
})
|
|
18
|
+
`
|
|
19
|
+
|
|
20
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
21
|
+
generator(ctx).then(
|
|
22
|
+
renderSource(
|
|
23
|
+
template,
|
|
24
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'index')
|
|
25
|
+
)
|
|
26
|
+
)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AppGeneratorContext } from '../index';
|
|
2
|
+
export declare const logErrorTemplate = "// For more information about this file see https://dove.feathersjs.com/guides/cli/log-error.html\nimport type { HookContext, NextFunction } from '../declarations'\nimport { logger } from '../logger'\n\nexport const logError = async (context: HookContext, next: NextFunction) => {\n try {\n await next()\n } catch (error: any) {\n logger.error(error.stack)\n \n // Log validation errors\n if (error.data) {\n logger.error('Data: %O', error.data)\n }\n\n throw error\n }\n}\n";
|
|
3
|
+
export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = exports.logErrorTemplate = void 0;
|
|
4
|
+
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
+
const commons_1 = require("../../commons");
|
|
6
|
+
const template = ({}) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/logging.html
|
|
7
|
+
import { createLogger, format, transports } from 'winston'
|
|
8
|
+
|
|
9
|
+
// Configure the Winston logger. For the complete documentation see https://github.com/winstonjs/winston
|
|
10
|
+
export const logger = createLogger({
|
|
11
|
+
// To see more detailed errors, change this to 'debug'
|
|
12
|
+
level: 'info',
|
|
13
|
+
format: format.combine(
|
|
14
|
+
format.splat(),
|
|
15
|
+
format.simple()
|
|
16
|
+
),
|
|
17
|
+
transports: [
|
|
18
|
+
new transports.Console()
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
`;
|
|
22
|
+
exports.logErrorTemplate = `// For more information about this file see https://dove.feathersjs.com/guides/cli/log-error.html
|
|
23
|
+
import type { HookContext, NextFunction } from '../declarations'
|
|
24
|
+
import { logger } from '../logger'
|
|
25
|
+
|
|
26
|
+
export const logError = async (context: HookContext, next: NextFunction) => {
|
|
27
|
+
try {
|
|
28
|
+
await next()
|
|
29
|
+
} catch (error: any) {
|
|
30
|
+
logger.error(error.stack)
|
|
31
|
+
|
|
32
|
+
// Log validation errors
|
|
33
|
+
if (error.data) {
|
|
34
|
+
logger.error('Data: %O', error.data)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
throw error
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx)
|
|
42
|
+
.then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'logger')))
|
|
43
|
+
.then((0, commons_1.renderSource)(exports.logErrorTemplate, (0, pinion_1.toFile)(({ lib }) => lib, 'hooks', 'log-error')));
|
|
44
|
+
exports.generate = generate;
|
|
45
|
+
//# sourceMappingURL=logger.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/logger.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GACZ,CAAC,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;CAevC,CAAA;AAEY,QAAA,gBAAgB,GAAY;;;;;;;;;;;;;;;;;;CAkBxC,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CACH,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CACxD,CACF;KACA,IAAI,CACH,IAAA,sBAAY,EACV,wBAAgB,EAChB,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC,CACpE,CACF,CAAA;AAbQ,QAAA,QAAQ,YAahB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { generator, toFile } from '@feathershq/pinion'
|
|
2
|
+
import { renderSource } from '../../commons'
|
|
3
|
+
import { AppGeneratorContext } from '../index'
|
|
4
|
+
|
|
5
|
+
const template =
|
|
6
|
+
({}: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/logging.html
|
|
7
|
+
import { createLogger, format, transports } from 'winston'
|
|
8
|
+
|
|
9
|
+
// Configure the Winston logger. For the complete documentation see https://github.com/winstonjs/winston
|
|
10
|
+
export const logger = createLogger({
|
|
11
|
+
// To see more detailed errors, change this to 'debug'
|
|
12
|
+
level: 'info',
|
|
13
|
+
format: format.combine(
|
|
14
|
+
format.splat(),
|
|
15
|
+
format.simple()
|
|
16
|
+
),
|
|
17
|
+
transports: [
|
|
18
|
+
new transports.Console()
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
export const logErrorTemplate = /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/log-error.html
|
|
24
|
+
import type { HookContext, NextFunction } from '../declarations'
|
|
25
|
+
import { logger } from '../logger'
|
|
26
|
+
|
|
27
|
+
export const logError = async (context: HookContext, next: NextFunction) => {
|
|
28
|
+
try {
|
|
29
|
+
await next()
|
|
30
|
+
} catch (error: any) {
|
|
31
|
+
logger.error(error.stack)
|
|
32
|
+
|
|
33
|
+
// Log validation errors
|
|
34
|
+
if (error.data) {
|
|
35
|
+
logger.error('Data: %O', error.data)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
throw error
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`
|
|
42
|
+
|
|
43
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
44
|
+
generator(ctx)
|
|
45
|
+
.then(
|
|
46
|
+
renderSource(
|
|
47
|
+
template,
|
|
48
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'logger')
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
.then(
|
|
52
|
+
renderSource(
|
|
53
|
+
logErrorTemplate,
|
|
54
|
+
toFile<AppGeneratorContext>(({ lib }) => lib, 'hooks', 'log-error')
|
|
55
|
+
)
|
|
56
|
+
)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = void 0;
|
|
4
|
+
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
+
const jsPackageJson = (lib) => ({
|
|
6
|
+
type: 'module',
|
|
7
|
+
scripts: {
|
|
8
|
+
start: `node ${lib}`,
|
|
9
|
+
dev: `nodemon ${lib}/`,
|
|
10
|
+
prettier: 'npx prettier "**/*.js" --write',
|
|
11
|
+
mocha: 'cross-env NODE_ENV=test mocha test/ --recursive --exit',
|
|
12
|
+
test: 'npm run mocha',
|
|
13
|
+
'bundle:client': 'npm pack --pack-destination ./public'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const tsPackageJson = (lib) => ({
|
|
17
|
+
scripts: {
|
|
18
|
+
dev: `nodemon -x ts-node ${lib}/index.ts`,
|
|
19
|
+
compile: 'shx rm -rf lib/ && tsc',
|
|
20
|
+
start: 'node lib/',
|
|
21
|
+
prettier: 'npx prettier "**/*.ts" --write',
|
|
22
|
+
mocha: 'cross-env NODE_ENV=test mocha test/ --require ts-node/register --recursive --extension .ts --exit',
|
|
23
|
+
test: 'npm run mocha',
|
|
24
|
+
'bundle:client': 'npm run compile && npm pack --pack-destination ./public'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const packageJson = ({ name, description, language, packager, database, framework, transports, lib, test, schema }) => ({
|
|
28
|
+
name,
|
|
29
|
+
description,
|
|
30
|
+
version: '0.0.0',
|
|
31
|
+
homepage: '',
|
|
32
|
+
private: true,
|
|
33
|
+
keywords: ['feathers'],
|
|
34
|
+
author: {},
|
|
35
|
+
contributors: [],
|
|
36
|
+
bugs: {},
|
|
37
|
+
engines: {
|
|
38
|
+
node: `>= ${process.version.substring(1)}`
|
|
39
|
+
},
|
|
40
|
+
feathers: {
|
|
41
|
+
language,
|
|
42
|
+
packager,
|
|
43
|
+
database,
|
|
44
|
+
framework,
|
|
45
|
+
transports,
|
|
46
|
+
schema
|
|
47
|
+
},
|
|
48
|
+
directories: {
|
|
49
|
+
lib,
|
|
50
|
+
test
|
|
51
|
+
},
|
|
52
|
+
files: ['lib/client.js', 'lib/**/*.d.ts'],
|
|
53
|
+
main: language === 'ts' ? 'lib/client' : `${lib}/client`,
|
|
54
|
+
...(language === 'ts' ? tsPackageJson(lib) : jsPackageJson(lib))
|
|
55
|
+
});
|
|
56
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.writeJSON)(packageJson, (0, pinion_1.toFile)('package.json')));
|
|
57
|
+
exports.generate = generate;
|
|
58
|
+
//# sourceMappingURL=package.json.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.json.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/package.json.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AAGjE,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC;IACtC,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE;QACP,KAAK,EAAE,QAAQ,GAAG,EAAE;QACpB,GAAG,EAAE,WAAW,GAAG,GAAG;QACtB,QAAQ,EAAE,gCAAgC;QAC1C,KAAK,EAAE,wDAAwD;QAC/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C,GAAG,CAAC,CAAC;CACjE,CAAC,CAAA;AAEK,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,kBAAS,EAAC,WAAW,EAAE,IAAA,eAAM,EAAC,cAAc,CAAC,CAAC,CAAC,CAAA;AADxD,QAAA,QAAQ,YACgD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { generator, toFile, writeJSON } from '@feathershq/pinion'
|
|
2
|
+
import { AppGeneratorContext } from '../index'
|
|
3
|
+
|
|
4
|
+
const jsPackageJson = (lib: string) => ({
|
|
5
|
+
type: 'module',
|
|
6
|
+
scripts: {
|
|
7
|
+
start: `node ${lib}`,
|
|
8
|
+
dev: `nodemon ${lib}/`,
|
|
9
|
+
prettier: 'npx prettier "**/*.js" --write',
|
|
10
|
+
mocha: 'cross-env NODE_ENV=test mocha test/ --recursive --exit',
|
|
11
|
+
test: 'npm run mocha',
|
|
12
|
+
'bundle:client': 'npm pack --pack-destination ./public'
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const tsPackageJson = (lib: string) => ({
|
|
17
|
+
scripts: {
|
|
18
|
+
dev: `nodemon -x ts-node ${lib}/index.ts`,
|
|
19
|
+
compile: 'shx rm -rf lib/ && tsc',
|
|
20
|
+
start: 'node lib/',
|
|
21
|
+
prettier: 'npx prettier "**/*.ts" --write',
|
|
22
|
+
mocha:
|
|
23
|
+
'cross-env NODE_ENV=test mocha test/ --require ts-node/register --recursive --extension .ts --exit',
|
|
24
|
+
test: 'npm run mocha',
|
|
25
|
+
'bundle:client': 'npm run compile && npm pack --pack-destination ./public'
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const packageJson = ({
|
|
30
|
+
name,
|
|
31
|
+
description,
|
|
32
|
+
language,
|
|
33
|
+
packager,
|
|
34
|
+
database,
|
|
35
|
+
framework,
|
|
36
|
+
transports,
|
|
37
|
+
lib,
|
|
38
|
+
test,
|
|
39
|
+
schema
|
|
40
|
+
}: AppGeneratorContext) => ({
|
|
41
|
+
name,
|
|
42
|
+
description,
|
|
43
|
+
version: '0.0.0',
|
|
44
|
+
homepage: '',
|
|
45
|
+
private: true,
|
|
46
|
+
keywords: ['feathers'],
|
|
47
|
+
author: {},
|
|
48
|
+
contributors: [] as string[],
|
|
49
|
+
bugs: {},
|
|
50
|
+
engines: {
|
|
51
|
+
node: `>= ${process.version.substring(1)}`
|
|
52
|
+
},
|
|
53
|
+
feathers: {
|
|
54
|
+
language,
|
|
55
|
+
packager,
|
|
56
|
+
database,
|
|
57
|
+
framework,
|
|
58
|
+
transports,
|
|
59
|
+
schema
|
|
60
|
+
},
|
|
61
|
+
directories: {
|
|
62
|
+
lib,
|
|
63
|
+
test
|
|
64
|
+
},
|
|
65
|
+
files: ['lib/client.js', 'lib/**/*.d.ts'],
|
|
66
|
+
main: language === 'ts' ? 'lib/client' : `${lib}/client`,
|
|
67
|
+
...(language === 'ts' ? tsPackageJson(lib) : jsPackageJson(lib))
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
71
|
+
generator(ctx).then(writeJSON(packageJson, toFile('package.json')))
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = void 0;
|
|
4
|
+
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
+
const commons_1 = require("../../commons");
|
|
6
|
+
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.writeJSON)((ctx) => ({
|
|
7
|
+
...commons_1.PRETTIERRC,
|
|
8
|
+
parser: ctx.language === 'ts' ? 'typescript' : 'babel'
|
|
9
|
+
}), (0, pinion_1.toFile)('.prettierrc')));
|
|
10
|
+
exports.generate = generate;
|
|
11
|
+
//# sourceMappingURL=prettierrc.tpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prettierrc.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/prettierrc.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AAEjE,2CAA0C;AAEnC,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,kBAAS,EACP,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACR,GAAG,oBAAU;IACb,MAAM,EAAE,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO;CACvD,CAAC,EACF,IAAA,eAAM,EAAC,aAAa,CAAC,CACtB,CACF,CAAA;AATU,QAAA,QAAQ,YASlB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { generator, toFile, writeJSON } from '@feathershq/pinion'
|
|
2
|
+
import { AppGeneratorContext } from '../index'
|
|
3
|
+
import { PRETTIERRC } from '../../commons'
|
|
4
|
+
|
|
5
|
+
export const generate = (ctx: AppGeneratorContext) =>
|
|
6
|
+
generator(ctx).then(
|
|
7
|
+
writeJSON<AppGeneratorContext>(
|
|
8
|
+
(ctx) => ({
|
|
9
|
+
...PRETTIERRC,
|
|
10
|
+
parser: ctx.language === 'ts' ? 'typescript' : 'babel'
|
|
11
|
+
}),
|
|
12
|
+
toFile('.prettierrc')
|
|
13
|
+
)
|
|
14
|
+
)
|