@rvoh/dream 0.32.4 → 0.33.0
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/dist/cjs/src/Dream.js +1 -1
- package/dist/cjs/src/bin/helpers/sync.js +2 -2
- package/dist/cjs/src/dream-application/helpers/DreamImporter.js +0 -5
- package/dist/cjs/src/dream-application/helpers/lookupClassByGlobalName.js +0 -2
- package/dist/cjs/src/dream-application/index.js +4 -10
- package/dist/cjs/src/helpers/DreamGlam/howyadoins/whaaaaaaaaaaok.js +2 -2
- package/dist/cjs/src/helpers/cli/SchemaBuilder.js +2 -2
- package/dist/cjs/src/helpers/cli/autoGeneratedFileDisclaimer.js +33 -0
- package/dist/cjs/src/helpers/loadRepl.js +3 -5
- package/dist/cjs/src/helpers/path/dreamPath.js +0 -2
- package/dist/esm/src/Dream.js +1 -1
- package/dist/esm/src/bin/helpers/sync.js +1 -1
- package/dist/esm/src/dream-application/helpers/DreamImporter.js +0 -5
- package/dist/esm/src/dream-application/helpers/lookupClassByGlobalName.js +0 -2
- package/dist/esm/src/dream-application/index.js +4 -10
- package/dist/esm/src/helpers/DreamGlam/howyadoins/whaaaaaaaaaaok.js +2 -2
- package/dist/esm/src/helpers/cli/SchemaBuilder.js +1 -1
- package/dist/esm/src/helpers/cli/autoGeneratedFileDisclaimer.js +30 -0
- package/dist/esm/src/helpers/loadRepl.js +3 -5
- package/dist/esm/src/helpers/path/dreamPath.js +0 -2
- package/dist/types/src/Dream.d.ts +1 -1
- package/dist/types/src/dream-application/helpers/DreamImporter.d.ts +0 -1
- package/dist/types/src/dream-application/index.d.ts +5 -5
- package/dist/types/src/helpers/loadRepl.d.ts +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Benchmark.html +2 -2
- package/docs/classes/CalendarDate.html +2 -2
- package/docs/classes/CreateOrFindByFailedToCreateAndFind.html +3 -3
- package/docs/classes/Decorators.html +19 -19
- package/docs/classes/Dream.html +126 -126
- package/docs/classes/DreamApplication.html +4 -5
- package/docs/classes/DreamBin.html +2 -2
- package/docs/classes/DreamCLI.html +4 -4
- package/docs/classes/DreamDbConnection.html +2 -2
- package/docs/classes/DreamGlam.html +2 -2
- package/docs/classes/DreamImporter.html +2 -3
- package/docs/classes/DreamMigrationHelpers.html +7 -7
- package/docs/classes/DreamSerializer.html +2 -2
- package/docs/classes/DreamTransaction.html +2 -2
- package/docs/classes/Encrypt.html +2 -2
- package/docs/classes/Env.html +2 -2
- package/docs/classes/GlobalNameNotSet.html +3 -3
- package/docs/classes/NonLoadedAssociation.html +3 -3
- package/docs/classes/Query.html +50 -50
- package/docs/classes/Range.html +2 -2
- package/docs/classes/RecordNotFound.html +3 -3
- package/docs/classes/ValidationError.html +3 -3
- package/docs/functions/Attribute.html +1 -1
- package/docs/functions/RendersMany.html +1 -1
- package/docs/functions/RendersOne.html +1 -1
- package/docs/functions/ReplicaSafe.html +1 -1
- package/docs/functions/STI.html +1 -1
- package/docs/functions/SoftDelete.html +1 -1
- package/docs/functions/camelize.html +1 -1
- package/docs/functions/capitalize.html +1 -1
- package/docs/functions/closeAllDbConnections.html +1 -1
- package/docs/functions/compact.html +1 -1
- package/docs/functions/db.html +1 -1
- package/docs/functions/debug.html +1 -1
- package/docs/functions/dreamDbConnections.html +1 -1
- package/docs/functions/dreamPath.html +1 -1
- package/docs/functions/generateDream.html +1 -1
- package/docs/functions/globalClassNameFromFullyQualifiedModelName.html +1 -1
- package/docs/functions/hyphenize.html +1 -1
- package/docs/functions/inferSerializerFromDreamClassOrViewModelClass.html +1 -1
- package/docs/functions/inferSerializerFromDreamOrViewModel.html +1 -1
- package/docs/functions/isEmpty.html +1 -1
- package/docs/functions/loadRepl.html +1 -1
- package/docs/functions/lookupClassByGlobalName.html +1 -1
- package/docs/functions/pascalize.html +1 -1
- package/docs/functions/pgErrorType.html +1 -1
- package/docs/functions/range-1.html +1 -1
- package/docs/functions/relativeDreamPath.html +1 -1
- package/docs/functions/round.html +1 -1
- package/docs/functions/serializerNameFromFullyQualifiedModelName.html +1 -1
- package/docs/functions/sharedPathPrefix.html +1 -1
- package/docs/functions/snakeify.html +1 -1
- package/docs/functions/sort.html +1 -1
- package/docs/functions/sortBy.html +1 -1
- package/docs/functions/standardizeFullyQualifiedModelName.html +1 -1
- package/docs/functions/uncapitalize.html +1 -1
- package/docs/functions/uniq.html +1 -1
- package/docs/functions/validateColumn.html +1 -1
- package/docs/functions/validateTable.html +1 -1
- package/docs/interfaces/AttributeStatement.html +2 -2
- package/docs/interfaces/DecoratorContext.html +2 -2
- package/docs/interfaces/DreamApplicationInitOptions.html +2 -2
- package/docs/interfaces/DreamApplicationOpts.html +2 -2
- package/docs/interfaces/DreamSerializerAssociationStatement.html +2 -2
- package/docs/interfaces/EncryptOptions.html +2 -2
- package/docs/interfaces/OpenapiSchemaProperties.html +1 -1
- package/docs/interfaces/OpenapiSchemaPropertiesShorthand.html +1 -1
- package/docs/interfaces/OpenapiTypeFieldObject.html +1 -1
- package/docs/types/Camelized.html +1 -1
- package/docs/types/CommonOpenapiSchemaObjectFields.html +1 -1
- package/docs/types/DateTime.html +1 -1
- package/docs/types/DreamAssociationMetadata.html +1 -1
- package/docs/types/DreamAttributes.html +1 -1
- package/docs/types/DreamClassColumn.html +1 -1
- package/docs/types/DreamColumn.html +1 -1
- package/docs/types/DreamColumnNames.html +1 -1
- package/docs/types/DreamLogLevel.html +1 -1
- package/docs/types/DreamLogger.html +1 -1
- package/docs/types/DreamOrViewModelSerializerKey.html +1 -1
- package/docs/types/DreamParamSafeAttributes.html +1 -1
- package/docs/types/DreamParamSafeColumnNames.html +1 -1
- package/docs/types/DreamSerializerKey.html +1 -1
- package/docs/types/DreamSerializers.html +1 -1
- package/docs/types/DreamTableSchema.html +1 -1
- package/docs/types/DreamVirtualColumns.html +1 -1
- package/docs/types/EncryptAlgorithm.html +1 -1
- package/docs/types/Hyphenized.html +1 -1
- package/docs/types/IdType.html +1 -1
- package/docs/types/OpenapiAllTypes.html +1 -1
- package/docs/types/OpenapiFormats.html +1 -1
- package/docs/types/OpenapiNumberFormats.html +1 -1
- package/docs/types/OpenapiPrimitiveTypes.html +1 -1
- package/docs/types/OpenapiSchemaArray.html +1 -1
- package/docs/types/OpenapiSchemaArrayShorthand.html +1 -1
- package/docs/types/OpenapiSchemaBase.html +1 -1
- package/docs/types/OpenapiSchemaBody.html +1 -1
- package/docs/types/OpenapiSchemaBodyShorthand.html +1 -1
- package/docs/types/OpenapiSchemaCommonFields.html +1 -1
- package/docs/types/OpenapiSchemaExpressionAllOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionOneOf.html +1 -1
- package/docs/types/OpenapiSchemaExpressionRef.html +1 -1
- package/docs/types/OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
- package/docs/types/OpenapiSchemaInteger.html +1 -1
- package/docs/types/OpenapiSchemaNull.html +1 -1
- package/docs/types/OpenapiSchemaNumber.html +1 -1
- package/docs/types/OpenapiSchemaObject.html +1 -1
- package/docs/types/OpenapiSchemaObjectAllOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectAllOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectAnyOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectBase.html +1 -1
- package/docs/types/OpenapiSchemaObjectBaseShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectOneOf.html +1 -1
- package/docs/types/OpenapiSchemaObjectOneOfShorthand.html +1 -1
- package/docs/types/OpenapiSchemaObjectShorthand.html +1 -1
- package/docs/types/OpenapiSchemaPartialSegment.html +1 -1
- package/docs/types/OpenapiSchemaPrimitiveGeneric.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionAllOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionOneOf.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
- package/docs/types/OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
- package/docs/types/OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
- package/docs/types/OpenapiSchemaString.html +1 -1
- package/docs/types/OpenapiShorthandAllTypes.html +1 -1
- package/docs/types/OpenapiShorthandPrimitiveTypes.html +1 -1
- package/docs/types/OpenapiTypeField.html +1 -1
- package/docs/types/Pascalized.html +1 -1
- package/docs/types/PrimaryKeyType.html +1 -1
- package/docs/types/RoundingPrecision.html +1 -1
- package/docs/types/SerializableClassOrSerializerCallback.html +1 -1
- package/docs/types/SerializableDreamClassOrViewModelClass.html +1 -1
- package/docs/types/SerializableDreamOrViewModel.html +1 -1
- package/docs/types/SerializableTypes.html +1 -1
- package/docs/types/Snakeified.html +1 -1
- package/docs/types/Timestamp.html +1 -1
- package/docs/types/UpdateableAssociationProperties.html +1 -1
- package/docs/types/UpdateableProperties.html +1 -1
- package/docs/types/ValidationType.html +1 -1
- package/docs/types/ViewModelSerializerKey.html +1 -1
- package/docs/types/WhereStatementForDream.html +1 -1
- package/docs/types/WhereStatementForDreamClass.html +1 -1
- package/docs/variables/DateTime-1.html +1 -1
- package/docs/variables/DreamConst.html +1 -1
- package/docs/variables/TRIGRAM_OPERATORS.html +1 -1
- package/docs/variables/openapiPrimitiveTypes-1.html +1 -1
- package/docs/variables/openapiShorthandPrimitiveTypes-1.html +1 -1
- package/docs/variables/ops.html +1 -1
- package/docs/variables/primaryKeyTypes.html +1 -1
- package/package.json +2 -5
- package/boilerplate/app/models/ApplicationModel.ts +0 -14
- package/boilerplate/app/serializers/.gitkeep +0 -0
- package/boilerplate/bin/esm.js +0 -19
- package/boilerplate/cli/helpers/initializeDreamApplication.ts +0 -6
- package/boilerplate/cli/index.ts +0 -22
- package/boilerplate/conf/inflections.ts +0 -5
- package/boilerplate/conf/loadEnv.ts +0 -4
- package/boilerplate/conf/repl.ts +0 -11
- package/boilerplate/eslint.config.js +0 -21
- package/boilerplate/package.json +0 -39
- package/boilerplate/tsconfig.build.json +0 -41
- package/boilerplate/tsconfig.json +0 -12
- package/boilerplate/types/db.ts +0 -5
- package/boilerplate/types/dream.ts +0 -3
- package/dist/cjs/boilerplate/package.json +0 -39
- package/dist/cjs/src/dream-application/helpers/globalServiceKeyFromPath.js +0 -11
- package/dist/cjs/src/dream-application/helpers/importers/importServices.js +0 -43
- package/dist/cjs/src/global-cli/dream.js +0 -46
- package/dist/cjs/src/global-cli/file-builders/DreamtsBuilder.js +0 -69
- package/dist/cjs/src/global-cli/file-builders/EnvBuilder.js +0 -27
- package/dist/cjs/src/global-cli/file-builders/EslintConfBuilder.js +0 -29
- package/dist/cjs/src/global-cli/file-builders/PackagejsonBuilder.js +0 -9
- package/dist/cjs/src/global-cli/helpers/argAndValue.js +0 -15
- package/dist/cjs/src/global-cli/helpers/autogeneratedFileMessage.js +0 -71
- package/dist/cjs/src/global-cli/helpers/buildNewDreamApp.js +0 -63
- package/dist/cjs/src/global-cli/helpers/copyRecursive.js +0 -20
- package/dist/cjs/src/global-cli/helpers/filterObjectByKey.js +0 -23
- package/dist/cjs/src/global-cli/helpers/generateEncryptionKey.js +0 -26
- package/dist/cjs/src/global-cli/helpers/globalCliSnakeify.js +0 -1
- package/dist/cjs/src/global-cli/helpers/initDreamAppIntoExistingProject.js +0 -85
- package/dist/cjs/src/global-cli/helpers/log.js +0 -28
- package/dist/cjs/src/global-cli/helpers/logo.js +0 -81
- package/dist/cjs/src/global-cli/helpers/primaryKeyTypes.js +0 -13
- package/dist/cjs/src/global-cli/helpers/prompt.js +0 -33
- package/dist/cjs/src/global-cli/helpers/select.js +0 -113
- package/dist/cjs/src/global-cli/helpers/sleep.js +0 -10
- package/dist/cjs/src/global-cli/helpers/sspawn.js +0 -21
- package/dist/cjs/src/global-cli/helpers/welcomeMessage.js +0 -41
- package/dist/cjs/src/global-cli/init.js +0 -56
- package/dist/cjs/src/global-cli/new.js +0 -10
- package/dist/esm/boilerplate/package.json +0 -39
- package/dist/esm/src/dream-application/helpers/globalServiceKeyFromPath.js +0 -8
- package/dist/esm/src/dream-application/helpers/importers/importServices.js +0 -37
- package/dist/esm/src/global-cli/dream.js +0 -44
- package/dist/esm/src/global-cli/file-builders/DreamtsBuilder.js +0 -66
- package/dist/esm/src/global-cli/file-builders/EnvBuilder.js +0 -24
- package/dist/esm/src/global-cli/file-builders/EslintConfBuilder.js +0 -26
- package/dist/esm/src/global-cli/file-builders/PackagejsonBuilder.js +0 -6
- package/dist/esm/src/global-cli/helpers/argAndValue.js +0 -12
- package/dist/esm/src/global-cli/helpers/autogeneratedFileMessage.js +0 -68
- package/dist/esm/src/global-cli/helpers/buildNewDreamApp.js +0 -60
- package/dist/esm/src/global-cli/helpers/copyRecursive.js +0 -17
- package/dist/esm/src/global-cli/helpers/filterObjectByKey.js +0 -20
- package/dist/esm/src/global-cli/helpers/generateEncryptionKey.js +0 -23
- package/dist/esm/src/global-cli/helpers/globalCliSnakeify.js +0 -1
- package/dist/esm/src/global-cli/helpers/initDreamAppIntoExistingProject.js +0 -82
- package/dist/esm/src/global-cli/helpers/log.js +0 -24
- package/dist/esm/src/global-cli/helpers/logo.js +0 -77
- package/dist/esm/src/global-cli/helpers/primaryKeyTypes.js +0 -10
- package/dist/esm/src/global-cli/helpers/prompt.js +0 -30
- package/dist/esm/src/global-cli/helpers/select.js +0 -110
- package/dist/esm/src/global-cli/helpers/sleep.js +0 -7
- package/dist/esm/src/global-cli/helpers/sspawn.js +0 -17
- package/dist/esm/src/global-cli/helpers/welcomeMessage.js +0 -38
- package/dist/esm/src/global-cli/init.js +0 -53
- package/dist/esm/src/global-cli/new.js +0 -7
- package/dist/types/src/dream-application/helpers/globalServiceKeyFromPath.d.ts +0 -1
- package/dist/types/src/dream-application/helpers/importers/importServices.d.ts +0 -4
- package/dist/types/src/global-cli/dream.d.ts +0 -2
- package/dist/types/src/global-cli/file-builders/DreamtsBuilder.d.ts +0 -4
- package/dist/types/src/global-cli/file-builders/EnvBuilder.d.ts +0 -6
- package/dist/types/src/global-cli/file-builders/EslintConfBuilder.d.ts +0 -3
- package/dist/types/src/global-cli/file-builders/PackagejsonBuilder.d.ts +0 -3
- package/dist/types/src/global-cli/helpers/argAndValue.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/buildNewDreamApp.d.ts +0 -2
- package/dist/types/src/global-cli/helpers/copyRecursive.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/filterObjectByKey.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/generateEncryptionKey.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/globalCliSnakeify.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/initDreamAppIntoExistingProject.d.ts +0 -2
- package/dist/types/src/global-cli/helpers/log.d.ts +0 -10
- package/dist/types/src/global-cli/helpers/logo.d.ts +0 -2
- package/dist/types/src/global-cli/helpers/primaryKeyTypes.d.ts +0 -22
- package/dist/types/src/global-cli/helpers/prompt.d.ts +0 -8
- package/dist/types/src/global-cli/helpers/select.d.ts +0 -17
- package/dist/types/src/global-cli/helpers/sleep.d.ts +0 -1
- package/dist/types/src/global-cli/helpers/sspawn.d.ts +0 -2
- package/dist/types/src/global-cli/helpers/welcomeMessage.d.ts +0 -1
- package/dist/types/src/global-cli/init.d.ts +0 -2
- package/dist/types/src/global-cli/new.d.ts +0 -2
- /package/dist/types/src/{global-cli/helpers/autogeneratedFileMessage.d.ts → helpers/cli/autoGeneratedFileDisclaimer.d.ts} +0 -0
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export default class DreamtsBuilder {
|
|
2
|
-
static build(options) {
|
|
3
|
-
const { configPath, dbPath, typesPath, factoriesPath, modelsPath, serializersPath, servicesPath, modelSpecsPath, primaryKeyType, } = options;
|
|
4
|
-
return `\
|
|
5
|
-
import * as path from 'path'
|
|
6
|
-
import { DreamApplication } from '@rvoh/dream'
|
|
7
|
-
import inflections from './inflections.js'
|
|
8
|
-
|
|
9
|
-
export default async function (app: DreamApplication) {
|
|
10
|
-
await app.load('models', path.join(__dirname, '..', 'models'))
|
|
11
|
-
await app.load('serializers', path.join(__dirname, '..', 'serializers'))
|
|
12
|
-
await app.load('services', path.join(__dirname, '..', 'services'))
|
|
13
|
-
|
|
14
|
-
app.set('projectRoot', path.join(__dirname, '..', '..', '..'))
|
|
15
|
-
app.set('primaryKeyType', '${primaryKeyType}')
|
|
16
|
-
app.set('inflections', inflections)
|
|
17
|
-
|
|
18
|
-
// app.set(
|
|
19
|
-
// 'logger',
|
|
20
|
-
// winston.createLogger({
|
|
21
|
-
// level: 'info',
|
|
22
|
-
// format: winston.format.json(),
|
|
23
|
-
// defaultMeta: { service: 'user-service' },
|
|
24
|
-
// transports: [
|
|
25
|
-
// new winston.transports.File({ filename: 'error.log', level: 'error' }),
|
|
26
|
-
// new winston.transports.File({ filename: 'combined.log' }),
|
|
27
|
-
// ],
|
|
28
|
-
// })
|
|
29
|
-
// )
|
|
30
|
-
|
|
31
|
-
// provides a list of path overrides for your app. This is optional, and will default
|
|
32
|
-
// to the paths expected for a typical psychic application.
|
|
33
|
-
app.set('paths', {
|
|
34
|
-
conf: '${configPath}',
|
|
35
|
-
db: '${dbPath}',
|
|
36
|
-
types: '${typesPath}',
|
|
37
|
-
factories: '${factoriesPath}',
|
|
38
|
-
models: '${modelsPath}',
|
|
39
|
-
serializers: '${serializersPath}',
|
|
40
|
-
services: '${servicesPath}',
|
|
41
|
-
modelSpecs: '${modelSpecsPath}',
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
// provides db credentials and configuration for your app.
|
|
45
|
-
app.set('db', {
|
|
46
|
-
primary: {
|
|
47
|
-
user: process.env.DB_USER!,
|
|
48
|
-
password: process.env.DB_PASSWORD!,
|
|
49
|
-
host: process.env.DB_HOST!,
|
|
50
|
-
name: process.env.DB_NAME!,
|
|
51
|
-
port: parseInt(process.env.DB_PORT!),
|
|
52
|
-
useSsl: process.env.DB_USE_SSL === '1',
|
|
53
|
-
},
|
|
54
|
-
replica: {
|
|
55
|
-
user: process.env.DB_USER!,
|
|
56
|
-
password: process.env.DB_PASSWORD!,
|
|
57
|
-
host: process.env.REPLICA_DB_HOST!,
|
|
58
|
-
name: process.env.REPLICA_DB_NAME!,
|
|
59
|
-
port: parseInt(process.env.DB_PORT!),
|
|
60
|
-
useSsl: process.env.DB_USE_SSL === '1',
|
|
61
|
-
},
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import generateEncryptionKey from '../helpers/generateEncryptionKey.js';
|
|
2
|
-
export default class EnvBuilder {
|
|
3
|
-
static build({ env, appName }) {
|
|
4
|
-
return `\
|
|
5
|
-
DB_USER=
|
|
6
|
-
DB_NAME=${snakeify(appName)}_${env}
|
|
7
|
-
DB_PORT=5432
|
|
8
|
-
DB_HOST=localhost
|
|
9
|
-
APP_ENCRYPTION_KEY='${generateEncryptionKey()}'
|
|
10
|
-
TZ=UTC
|
|
11
|
-
`;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
// TODO: import from shared space. The version within dream contains the most robust variant of snakeify,
|
|
15
|
-
// though we don't really use it for anything other than string transformations, so this version has been simplified.
|
|
16
|
-
function snakeify(str) {
|
|
17
|
-
return str
|
|
18
|
-
.replace(/[ _-]+/g, '_')
|
|
19
|
-
.replace(/(?:^|\.?)([A-Z])/g, (_, y) => '_' + y.toLowerCase())
|
|
20
|
-
.replace(/^_/, '')
|
|
21
|
-
.replace(/\//g, '_')
|
|
22
|
-
.replace(/-/g, '_')
|
|
23
|
-
.toLowerCase();
|
|
24
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export default class ESLintConfBuilder {
|
|
2
|
-
static buildForViteReact() {
|
|
3
|
-
return `\
|
|
4
|
-
export default {
|
|
5
|
-
root: true,
|
|
6
|
-
env: { browser: true, es2020: true },
|
|
7
|
-
extends: [
|
|
8
|
-
'eslint:recommended',
|
|
9
|
-
'plugin:@typescript-eslint/recommended',
|
|
10
|
-
'plugin:react-hooks/recommended',
|
|
11
|
-
],
|
|
12
|
-
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
|
13
|
-
parser: '@typescript-eslint/parser',
|
|
14
|
-
plugins: ['react-refresh'],
|
|
15
|
-
rules: {
|
|
16
|
-
'react-refresh/only-export-components': [
|
|
17
|
-
'warn',
|
|
18
|
-
{ allowConstantExport: true },
|
|
19
|
-
],
|
|
20
|
-
'@typescript-eslint/no-explicit-any': [
|
|
21
|
-
'off',
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
}`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default function argAndValue(arg, args) {
|
|
2
|
-
const argIndex = args.findIndex(a => a === arg);
|
|
3
|
-
const foundArg = argIndex === -1 ? null : args[argIndex];
|
|
4
|
-
const foundValue = argIndex === -1 ? null : valueOrNull(argIndex, args);
|
|
5
|
-
return [foundArg ?? null, foundValue];
|
|
6
|
-
}
|
|
7
|
-
function valueOrNull(argIndex, args) {
|
|
8
|
-
const value = args[argIndex + 1];
|
|
9
|
-
if (value === undefined || /--/.test(value))
|
|
10
|
-
return null;
|
|
11
|
-
return value;
|
|
12
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { basicLogo } from './logo.js';
|
|
2
|
-
export default function autogeneratedFileDisclaimer(startComment = '\n/*', endComment = '\n*/') {
|
|
3
|
-
return `\
|
|
4
|
-
${startComment}
|
|
5
|
-
--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
|
|
6
|
-
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
7
|
-
--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
|
|
8
|
-
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
9
|
-
BEGIN AUTOGENERATED MESSAGE
|
|
10
|
-
--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
|
|
11
|
-
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
12
|
-
--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
|
|
13
|
-
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
${basicLogo()}
|
|
17
|
-
|
|
18
|
-
This file was automatically generated by my cat, Aster.
|
|
19
|
-
He does not want you mucking about with his files,
|
|
20
|
-
and we are pretty lax on trimming his nails.
|
|
21
|
-
|
|
22
|
-
I mean, we have him pretty well fenced in but he is an
|
|
23
|
-
escape artist and he still manages to get fleas!
|
|
24
|
-
|
|
25
|
-
My point is, don't go mucking about with his files!
|
|
26
|
-
|
|
27
|
-
He actually has a hopefully well-tempered message for
|
|
28
|
-
us humans, he says:
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
Dear pathetic humans,
|
|
32
|
-
|
|
33
|
-
Here is a haiku to keep you in line
|
|
34
|
-
|
|
35
|
-
don't dare go mucking
|
|
36
|
-
with my files, I lyke them fine
|
|
37
|
-
prettierignore
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
Sorry, that's the best we are ganna get from him
|
|
41
|
-
when you ask him to add a disclaimer to all
|
|
42
|
-
autogenerated files on a SUNDAY, when the sun
|
|
43
|
-
is hitting the perfect spot in the living room
|
|
44
|
-
for a mid-morning nap! He can get saucy, and he
|
|
45
|
-
is looking over my shoulder and would like me to
|
|
46
|
-
remind all humans that
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
a.) I have sharp claws.
|
|
50
|
-
b.) All laptops are ok sleeping places for your
|
|
51
|
-
cat overlords. when we decide to sleep on
|
|
52
|
-
them, it is because they are our beds, and
|
|
53
|
-
we just loan them out to you so you can go
|
|
54
|
-
out and get us the right food.
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
|
|
58
|
-
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
59
|
-
--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
|
|
60
|
-
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
61
|
-
END AUTOGENERATED MESSAGE
|
|
62
|
-
--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
|
|
63
|
-
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
64
|
-
--#--#--#--#--#--#--#--#--#--#--#--#--#--#--#
|
|
65
|
-
#--#--#--#--#--#--#--#--#--#--#--#--#--#--#--
|
|
66
|
-
${endComment}
|
|
67
|
-
`;
|
|
68
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as c from 'colorette';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import DreamtsBuilder from '../file-builders/DreamtsBuilder.js';
|
|
4
|
-
import EnvBuilder from '../file-builders/EnvBuilder.js';
|
|
5
|
-
import PackagejsonBuilder from '../file-builders/PackagejsonBuilder.js';
|
|
6
|
-
import copyRecursive from './copyRecursive.js';
|
|
7
|
-
import log from './log.js';
|
|
8
|
-
import { cliPrimaryKeyTypes } from './primaryKeyTypes.js';
|
|
9
|
-
import Select from './select.js';
|
|
10
|
-
import sleep from './sleep.js';
|
|
11
|
-
import sspawn from './sspawn.js';
|
|
12
|
-
import welcomeMessage from './welcomeMessage.js';
|
|
13
|
-
function testEnv() {
|
|
14
|
-
return process.env.NODE_ENV === 'test';
|
|
15
|
-
}
|
|
16
|
-
export default async function buildNewDreamApp(appName, projectPath, options) {
|
|
17
|
-
if (!options.primaryKeyType) {
|
|
18
|
-
const answer = await new Select('what primary key type would you like to use?', cliPrimaryKeyTypes).run();
|
|
19
|
-
options.primaryKeyType = answer;
|
|
20
|
-
}
|
|
21
|
-
copyRecursive(__dirname + '/../../../boilerplate', `${projectPath}/src`);
|
|
22
|
-
if (!testEnv()) {
|
|
23
|
-
log.restoreCache();
|
|
24
|
-
log.write(c.green(`Step 1. write boilerplate to ${appName}: Done!`), { cache: true });
|
|
25
|
-
log.write(c.green(`Step 2. building default config files...`));
|
|
26
|
-
}
|
|
27
|
-
fs.writeFileSync(`${projectPath}/.env`, EnvBuilder.build({ appName, env: 'development' }));
|
|
28
|
-
fs.writeFileSync(`${projectPath}/.env.test`, EnvBuilder.build({ appName, env: 'test' }));
|
|
29
|
-
fs.writeFileSync(projectPath + '/package.json', await PackagejsonBuilder.buildAPI());
|
|
30
|
-
fs.writeFileSync(`${projectPath}/src/conf/dream.ts`, DreamtsBuilder.build(options));
|
|
31
|
-
if (!testEnv()) {
|
|
32
|
-
log.restoreCache();
|
|
33
|
-
log.write(c.green(`Step 2. build default config files: Done!`), { cache: true });
|
|
34
|
-
log.write(c.green(`Step 3. Installing dream dependencies...`));
|
|
35
|
-
// only run yarn install if not in test env to save time
|
|
36
|
-
await sspawn(`cd ${projectPath} && touch yarn.lock && yarn install`);
|
|
37
|
-
}
|
|
38
|
-
// sleeping here because yarn has a delayed print that we need to clean up
|
|
39
|
-
if (!testEnv())
|
|
40
|
-
await sleep(1000);
|
|
41
|
-
if (!testEnv()) {
|
|
42
|
-
log.restoreCache();
|
|
43
|
-
log.write(c.green(`Step 3. Install dream dependencies: Done!`), { cache: true });
|
|
44
|
-
log.write(c.green(`Step 4. Initializing git repository...`));
|
|
45
|
-
// only do this if not test, since using git in CI will fail
|
|
46
|
-
await sspawn(`cd ./${appName} && git init`);
|
|
47
|
-
}
|
|
48
|
-
if (!testEnv()) {
|
|
49
|
-
log.restoreCache();
|
|
50
|
-
log.write(c.green(`Step 4. Initialize git repository: Done!`), { cache: true });
|
|
51
|
-
log.write(c.green(`Step 5. Building project...`));
|
|
52
|
-
}
|
|
53
|
-
// don't sync yet, since we need to run migrations first
|
|
54
|
-
// await sspawn(`yarn --cwd=${projectPath} dream sync:existing`)
|
|
55
|
-
if (!testEnv()) {
|
|
56
|
-
log.restoreCache();
|
|
57
|
-
log.write(c.green(`Step 5. Build project: Done!`), { cache: true });
|
|
58
|
-
console.log(welcomeMessage(appName));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
export default function copyRecursive(src, dest) {
|
|
4
|
-
const exists = fs.existsSync(src);
|
|
5
|
-
const stats = exists && fs.statSync(src);
|
|
6
|
-
const isDirectory = exists && stats.isDirectory();
|
|
7
|
-
if (isDirectory) {
|
|
8
|
-
if (!['.', './.'].includes(dest) && !fs.existsSync(dest))
|
|
9
|
-
fs.mkdirSync(dest);
|
|
10
|
-
fs.readdirSync(src).forEach(function (childItemName) {
|
|
11
|
-
copyRecursive(path.join(src, childItemName), path.join(dest, childItemName));
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
fs.copyFileSync(src, dest);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export default function filterObjectByKey(obj, arr) {
|
|
2
|
-
const workingObj = {};
|
|
3
|
-
const booleanObj = {};
|
|
4
|
-
arr.forEach(key => (booleanObj[key] = true));
|
|
5
|
-
arr.forEach(key => {
|
|
6
|
-
if (booleanObj[key])
|
|
7
|
-
workingObj[protectAgainstPollutingAssignment(key)] = obj[key];
|
|
8
|
-
});
|
|
9
|
-
return workingObj;
|
|
10
|
-
}
|
|
11
|
-
const reservedKeys = new Map([
|
|
12
|
-
['__proto__', true],
|
|
13
|
-
['constructor', true],
|
|
14
|
-
['prototype', true],
|
|
15
|
-
]);
|
|
16
|
-
function protectAgainstPollutingAssignment(key) {
|
|
17
|
-
if (reservedKeys.get(key))
|
|
18
|
-
throw new Error(`Passed "${key}" as the key to modify an object`);
|
|
19
|
-
return key;
|
|
20
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export default function generateEncryptionKey() {
|
|
2
|
-
return (Math.random().toString(36).substr(2, 10) +
|
|
3
|
-
'-' +
|
|
4
|
-
Math.random().toString(36).substr(2, 10) +
|
|
5
|
-
'-' +
|
|
6
|
-
Math.random().toString(36).substr(2, 10) +
|
|
7
|
-
'-' +
|
|
8
|
-
Math.random().toString(36).substr(2, 10) +
|
|
9
|
-
'-' +
|
|
10
|
-
Math.random().toString(36).substr(2, 10) +
|
|
11
|
-
'-' +
|
|
12
|
-
Math.random().toString(36).substr(2, 10) +
|
|
13
|
-
'-' +
|
|
14
|
-
Math.random().toString(36).substr(2, 10) +
|
|
15
|
-
'-' +
|
|
16
|
-
Math.random().toString(36).substr(2, 10) +
|
|
17
|
-
'-' +
|
|
18
|
-
Math.random().toString(36).substr(2, 10) +
|
|
19
|
-
'-' +
|
|
20
|
-
Math.random().toString(36).substr(2, 10) +
|
|
21
|
-
'-' +
|
|
22
|
-
Math.random().toString(36).substr(2, 10));
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import * as c from 'colorette';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import DreamtsBuilder from '../file-builders/DreamtsBuilder.js';
|
|
5
|
-
import EnvBuilder from '../file-builders/EnvBuilder.js';
|
|
6
|
-
import PackagejsonBuilder from '../file-builders/PackagejsonBuilder.js';
|
|
7
|
-
import copyRecursive from './copyRecursive.js';
|
|
8
|
-
import filterObjectByKey from './filterObjectByKey.js';
|
|
9
|
-
import log from './log.js';
|
|
10
|
-
import sleep from './sleep.js';
|
|
11
|
-
import sspawn from './sspawn.js';
|
|
12
|
-
import welcomeMessage from './welcomeMessage.js';
|
|
13
|
-
export default async function initDreamAppIntoExistingProject(appName, options) {
|
|
14
|
-
createDirIfNotExists(options.projectPath);
|
|
15
|
-
createDirIfNotExists(path.join(options.projectPath, options.configPath));
|
|
16
|
-
createDirIfNotExists(path.join(options.projectPath, options.modelsPath));
|
|
17
|
-
createDirIfNotExists(path.join(options.projectPath, options.serializersPath));
|
|
18
|
-
createDirIfNotExists(path.join(options.projectPath, options.servicesPath));
|
|
19
|
-
createDirIfNotExists(path.join(options.dbPath, options.dbPath));
|
|
20
|
-
copyRecursive(__dirname + '/../../../boilerplate/conf', path.join(process.cwd(), options.projectPath, options.configPath));
|
|
21
|
-
copyRecursive(__dirname + '/../../../boilerplate/app/models', path.join(process.cwd(), options.projectPath, options.modelsPath));
|
|
22
|
-
copyRecursive(__dirname + '/../../../boilerplate/app/serializers', path.join(options.projectPath, options.serializersPath));
|
|
23
|
-
copyRecursive(__dirname + '/../../../boilerplate/types', path.join(process.cwd(), options.projectPath, options.dbPath));
|
|
24
|
-
if (!testEnv()) {
|
|
25
|
-
log.restoreCache();
|
|
26
|
-
log.write(c.green(`Step 1. write boilerplate to ${appName}: Done!`), { cache: true });
|
|
27
|
-
log.write(c.green(`Step 2. building default config files...`));
|
|
28
|
-
}
|
|
29
|
-
fs.writeFileSync(`${options.projectPath}/.env`, EnvBuilder.build({ appName, env: 'development' }));
|
|
30
|
-
fs.writeFileSync(`${options.projectPath}/.env.test`, EnvBuilder.build({ appName, env: 'test' }));
|
|
31
|
-
fs.writeFileSync(path.join(process.cwd(), options.projectPath, options.configPath, 'dream.ts'), DreamtsBuilder.build(options));
|
|
32
|
-
const packageJsonPath = path.join(process.cwd(), options.projectPath, 'package.json');
|
|
33
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
34
|
-
const packagejson = await import('../../../boilerplate/package.json');
|
|
35
|
-
const userPackagejson = await import(packageJsonPath);
|
|
36
|
-
mergePackageJsonField('scripts', packagejson, userPackagejson);
|
|
37
|
-
mergePackageJsonField('dependencies', packagejson, userPackagejson);
|
|
38
|
-
mergePackageJsonField('devDependencies', packagejson, userPackagejson);
|
|
39
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(userPackagejson, null, 2));
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
fs.writeFileSync(packageJsonPath, await PackagejsonBuilder.buildAPI());
|
|
43
|
-
}
|
|
44
|
-
if (!testEnv()) {
|
|
45
|
-
log.restoreCache();
|
|
46
|
-
log.write(c.green(`Step 2. build default config files: Done!`), { cache: true });
|
|
47
|
-
log.write(c.green(`Step 3. Installing dream dependencies...`));
|
|
48
|
-
// only run yarn install if not in test env to save time
|
|
49
|
-
await sspawn(`cd ${options.projectPath} && touch yarn.lock && yarn install`);
|
|
50
|
-
}
|
|
51
|
-
// sleeping here because yarn has a delayed print that we need to clean up
|
|
52
|
-
if (!testEnv())
|
|
53
|
-
await sleep(1000);
|
|
54
|
-
if (!testEnv()) {
|
|
55
|
-
log.restoreCache();
|
|
56
|
-
log.write(c.green(`Step 3. Install dream dependencies: Done!`), { cache: true });
|
|
57
|
-
log.write(c.green(`Step 4. Building project...`));
|
|
58
|
-
}
|
|
59
|
-
// don't sync yet, since we need to run migrations first
|
|
60
|
-
// await sspawn(`yarn --cwd=${projectPath} dream sync:existing`)
|
|
61
|
-
if (!testEnv()) {
|
|
62
|
-
log.restoreCache();
|
|
63
|
-
log.write(c.green(`Step 5. Build project: Done!`), { cache: true });
|
|
64
|
-
console.log(welcomeMessage(options.projectPath));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function createDirIfNotExists(dir) {
|
|
68
|
-
if (!fs.existsSync(path.join(process.cwd(), dir))) {
|
|
69
|
-
fs.mkdirSync(path.join(process.cwd(), dir), { recursive: true });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function mergePackageJsonField(field, boilerplatePackagejson, userPackagejson) {
|
|
73
|
-
userPackagejson[field] ||= {};
|
|
74
|
-
userPackagejson[field] = {
|
|
75
|
-
...userPackagejson[field],
|
|
76
|
-
...boilerplatePackagejson[field],
|
|
77
|
-
};
|
|
78
|
-
userPackagejson[field] = filterObjectByKey(userPackagejson[field], Object.keys(userPackagejson[field]).sort());
|
|
79
|
-
}
|
|
80
|
-
function testEnv() {
|
|
81
|
-
return process.env.NODE_ENV === 'test';
|
|
82
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export class Logger {
|
|
2
|
-
cache = [];
|
|
3
|
-
write(text, { cache = false } = {}) {
|
|
4
|
-
console.log(text);
|
|
5
|
-
if (cache)
|
|
6
|
-
this.cache.push(text);
|
|
7
|
-
}
|
|
8
|
-
restoreCache(preRestoreContent) {
|
|
9
|
-
this.clear();
|
|
10
|
-
if (preRestoreContent)
|
|
11
|
-
this.write(preRestoreContent);
|
|
12
|
-
this.cache.forEach(str => {
|
|
13
|
-
this.write(str);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
clear() {
|
|
17
|
-
console.clear();
|
|
18
|
-
// @ts-expect-error this works fine with no args
|
|
19
|
-
process.stdout.clearLine();
|
|
20
|
-
process.stdout.cursorTo(0);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const log = new Logger();
|
|
24
|
-
export default log;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import * as colors from 'colorette';
|
|
2
|
-
export default function logo() {
|
|
3
|
-
return (colors.bgMagentaBright(colors.black(`
|
|
4
|
-
,▄█▄
|
|
5
|
-
]█▄▄ ╓█████▌
|
|
6
|
-
▐██████▄ ▄█████▓╣█
|
|
7
|
-
║████████▄, , ,,▄,▄▄▄▓██████╬╬╣╣▌
|
|
8
|
-
╚███╣██████████▓▓▓▓██████████╩╠╬▓
|
|
9
|
-
╙█╬╬╬▓███████████████████████▒▓▌ `)) +
|
|
10
|
-
colors.bgMagentaBright(colors.black(`
|
|
11
|
-
╙▓█▓██████████████████████████
|
|
12
|
-
╚██████▀███████████`) +
|
|
13
|
-
colors.greenBright(`╩█▓▌`) +
|
|
14
|
-
colors.black(`▐▓████▄
|
|
15
|
-
'║█████`) +
|
|
16
|
-
colors.greenBright(`\`╣█Γ║`) +
|
|
17
|
-
colors.black(`████████▄▄φ▓█████▌
|
|
18
|
-
║█████████████████████▓█████▌
|
|
19
|
-
█████████████▓▓████████████ `)) +
|
|
20
|
-
colors.bgMagentaBright(colors.black(`
|
|
21
|
-
║█████████████████████████
|
|
22
|
-
]█████████████████████████
|
|
23
|
-
,▓██████████████████████████
|
|
24
|
-
▓█████████████████████████████µ `)) +
|
|
25
|
-
colors.bgMagentaBright(colors.black(`
|
|
26
|
-
▐███████████████████████████████▄▄
|
|
27
|
-
║█████████████████████████████████╬╬╣▓
|
|
28
|
-
,╔╦║███████████████████████████████████▓╬╬╣
|
|
29
|
-
,≥≥⌠░░░╠▓████████████████████████████████████▓▓
|
|
30
|
-
,;=-',▄█████████████████████████████████████████▓ `)) +
|
|
31
|
-
colors.bgGreen(colors.magenta(`
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
██████╗ ███████╗██╗ ██╗ ██████╗██╗ ██╗██╗ ██████╗
|
|
36
|
-
██╔══██╗██╔════╝╚██╗ ██╔╝██╔════╝██║ ██║██║██╔════╝
|
|
37
|
-
██████╔╝███████╗ ╚████╔╝ ██║ ███████║██║██║
|
|
38
|
-
██╔═══╝ ╚════██║ ╚██╔╝ ██║ ██╔══██║██║██║
|
|
39
|
-
██║ ███████║ ██║ ╚██████╗██║ ██║██║╚██████╗
|
|
40
|
-
╚═╝ ╚══════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═════╝
|
|
41
|
-
|
|
42
|
-
`)));
|
|
43
|
-
}
|
|
44
|
-
export function basicLogo() {
|
|
45
|
-
return (`
|
|
46
|
-
,▄█▄
|
|
47
|
-
]█▄▄ ╓█████▌
|
|
48
|
-
▐██████▄ ▄█████▓╣█
|
|
49
|
-
║████████▄, , ,,▄,▄▄▄▓██████╬╬╣╣▌
|
|
50
|
-
╚███╣██████████▓▓▓▓██████████╩╠╬▓
|
|
51
|
-
╙█╬╬╬▓███████████████████████▒▓▌
|
|
52
|
-
╙▓█▓██████████████████████████
|
|
53
|
-
╚██████▀███████████╩█▓▌▐▓████▄
|
|
54
|
-
'║█████\`╣█Γ║████████▄▄φ▓█████▌
|
|
55
|
-
║█████████████████████▓█████▌
|
|
56
|
-
█████████████▓▓████████████
|
|
57
|
-
║█████████████████████████
|
|
58
|
-
]█████████████████████████
|
|
59
|
-
,▓██████████████████████████
|
|
60
|
-
▓█████████████████████████████µ
|
|
61
|
-
▐███████████████████████████████▄▄
|
|
62
|
-
║█████████████████████████████████╬╬╣▓
|
|
63
|
-
,╔╦║███████████████████████████████████▓╬╬╣
|
|
64
|
-
,≥≥⌠░░░╠▓████████████████████████████████████▓▓
|
|
65
|
-
,;=-',▄█████████████████████████████████████████▓
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
██████╗ ███████╗██╗ ██╗ ██████╗██╗ ██╗██╗ ██████╗
|
|
70
|
-
██╔══██╗██╔════╝╚██╗ ██╔╝██╔════╝██║ ██║██║██╔════╝
|
|
71
|
-
██████╔╝███████╗ ╚████╔╝ ██║ ███████║██║██║
|
|
72
|
-
██╔═══╝ ╚════██║ ╚██╔╝ ██║ ██╔══██║██║██║
|
|
73
|
-
██║ ███████║ ██║ ╚██████╗██║ ██║██║╚██████╗
|
|
74
|
-
╚═╝ ╚══════╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═════╝
|
|
75
|
-
|
|
76
|
-
`);
|
|
77
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const cliPrimaryKeyTypes = ['bigserial', 'serial', 'uuid'];
|
|
2
|
-
export const cliDefaultProjectPath = '.';
|
|
3
|
-
export const cliDefaultConfigPath = 'src/conf.js';
|
|
4
|
-
export const cliDefaultDbPath = 'src/db.js';
|
|
5
|
-
export const cliDefaultTypesPath = 'src/types.js';
|
|
6
|
-
export const cliDefaultModelsPath = 'src/app/models.js';
|
|
7
|
-
export const cliDefaultSerializersPath = 'src/app/serializers.js';
|
|
8
|
-
export const cliDefaultServicesPath = 'src/app/services.js';
|
|
9
|
-
export const cliDefaultModelSpecsPath = 'spec/uspec/models.js';
|
|
10
|
-
export const cliDefaultFactoriesPath = 'spec/factories.js';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as readline from 'readline';
|
|
2
|
-
const input = process.stdin;
|
|
3
|
-
export default class Prompt {
|
|
4
|
-
question;
|
|
5
|
-
cb = null;
|
|
6
|
-
constructor(question) {
|
|
7
|
-
this.question = question;
|
|
8
|
-
}
|
|
9
|
-
async run() {
|
|
10
|
-
this.init();
|
|
11
|
-
return new Promise(accept => {
|
|
12
|
-
this.cb = accept;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
init() {
|
|
16
|
-
const rl = readline.createInterface({
|
|
17
|
-
input: process.stdin,
|
|
18
|
-
output: process.stdout,
|
|
19
|
-
});
|
|
20
|
-
rl.question(this.question + '\n', res => {
|
|
21
|
-
this.cb?.(res);
|
|
22
|
-
rl.close();
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
close = () => {
|
|
26
|
-
input.setRawMode(false);
|
|
27
|
-
input.pause();
|
|
28
|
-
process.exit(0);
|
|
29
|
-
};
|
|
30
|
-
}
|