@rvoh/dream 0.32.3 → 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/db/runMigration.js +11 -12
- 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/db/runMigration.js +11 -12
- 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,110 +0,0 @@
|
|
|
1
|
-
import * as colors from 'colorette';
|
|
2
|
-
import * as readline from 'readline';
|
|
3
|
-
const input = process.stdin;
|
|
4
|
-
const output = process.stdout;
|
|
5
|
-
let firstCallComplete = false;
|
|
6
|
-
export default class Select {
|
|
7
|
-
question;
|
|
8
|
-
selectIndex = 0;
|
|
9
|
-
options;
|
|
10
|
-
selector = '>';
|
|
11
|
-
isFirstTimeShowMenu = true;
|
|
12
|
-
cb = null;
|
|
13
|
-
constructor(question, options) {
|
|
14
|
-
this.question = question;
|
|
15
|
-
this.options = options;
|
|
16
|
-
}
|
|
17
|
-
async run() {
|
|
18
|
-
this.init();
|
|
19
|
-
return new Promise(accept => {
|
|
20
|
-
this.cb = accept;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
keyPressedHandler(_, key) {
|
|
24
|
-
if (key) {
|
|
25
|
-
const optionLength = this.options.length - 1;
|
|
26
|
-
if (key.name === 'down' && this.selectIndex < optionLength) {
|
|
27
|
-
this.selectIndex += 1;
|
|
28
|
-
this.createOptionMenu();
|
|
29
|
-
}
|
|
30
|
-
else if (key.name === 'up' && this.selectIndex > 0) {
|
|
31
|
-
this.selectIndex -= 1;
|
|
32
|
-
this.createOptionMenu();
|
|
33
|
-
}
|
|
34
|
-
else if (key.name === 'return') {
|
|
35
|
-
this.cb?.(this.options[this.selectIndex]);
|
|
36
|
-
input.removeAllListeners('keypress');
|
|
37
|
-
if (firstCallComplete) {
|
|
38
|
-
output.write('\n');
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
firstCallComplete = true;
|
|
42
|
-
}
|
|
43
|
-
input.setRawMode(false);
|
|
44
|
-
input.pause();
|
|
45
|
-
}
|
|
46
|
-
else if (key.name === 'escape' || (key.name === 'c' && key.ctrl)) {
|
|
47
|
-
this.close();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
ansiEraseLines(count) {
|
|
52
|
-
//adapted from sindresorhus ansi-escape module
|
|
53
|
-
const ESC = '\u001B[';
|
|
54
|
-
const eraseLine = ESC + '2K';
|
|
55
|
-
const cursorUp = (count = 1) => ESC + count + 'A';
|
|
56
|
-
const cursorLeft = ESC + 'G';
|
|
57
|
-
let clear = '';
|
|
58
|
-
for (let i = 0; i < count; i++) {
|
|
59
|
-
clear += eraseLine + (i < count - 1 ? cursorUp() : '');
|
|
60
|
-
}
|
|
61
|
-
if (count) {
|
|
62
|
-
clear += cursorLeft;
|
|
63
|
-
}
|
|
64
|
-
return clear;
|
|
65
|
-
}
|
|
66
|
-
init() {
|
|
67
|
-
console.log(this.question);
|
|
68
|
-
readline.emitKeypressEvents(input);
|
|
69
|
-
this.start();
|
|
70
|
-
}
|
|
71
|
-
start() {
|
|
72
|
-
//setup the input for reading
|
|
73
|
-
input.setRawMode(true);
|
|
74
|
-
input.resume();
|
|
75
|
-
input.on('keypress', (event, key) => this.keyPressedHandler(event, key));
|
|
76
|
-
if (this.selectIndex >= 0) {
|
|
77
|
-
this.createOptionMenu();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
close = () => {
|
|
81
|
-
input.setRawMode(false);
|
|
82
|
-
input.pause();
|
|
83
|
-
process.exit(0);
|
|
84
|
-
};
|
|
85
|
-
getPadding(num = 10) {
|
|
86
|
-
let text = ' ';
|
|
87
|
-
for (let i = 0; i < num; i++) {
|
|
88
|
-
text += ' ';
|
|
89
|
-
}
|
|
90
|
-
return text;
|
|
91
|
-
}
|
|
92
|
-
createOptionMenu() {
|
|
93
|
-
const optionLength = this.options.length;
|
|
94
|
-
if (this.isFirstTimeShowMenu) {
|
|
95
|
-
this.isFirstTimeShowMenu = false;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
output.write(this.ansiEraseLines(optionLength));
|
|
99
|
-
}
|
|
100
|
-
const padding = this.getPadding(0);
|
|
101
|
-
const cursor = colors.magenta(this.selector);
|
|
102
|
-
for (let i = 0; i < optionLength; i++) {
|
|
103
|
-
const selectedOption = i === this.selectIndex
|
|
104
|
-
? `${cursor} ${this.options[i]}`
|
|
105
|
-
: `${cursor.replace(/.*/, ' ')} ${this.options[i]}`;
|
|
106
|
-
const ending = i !== optionLength - 1 ? '\n' : '';
|
|
107
|
-
output.write(padding + selectedOption + ending);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
export default function sspawn(command, opts = {}) {
|
|
3
|
-
return new Promise((accept, reject) => {
|
|
4
|
-
ssspawn(command, opts).on('close', code => {
|
|
5
|
-
if (code !== 0)
|
|
6
|
-
reject(code);
|
|
7
|
-
accept({});
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export function ssspawn(command, opts = {}) {
|
|
12
|
-
return spawn(command, {
|
|
13
|
-
stdio: 'inherit',
|
|
14
|
-
shell: true,
|
|
15
|
-
...opts,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as c from 'colorette';
|
|
2
|
-
export default function welcomeMessage(appName) {
|
|
3
|
-
return `
|
|
4
|
-
${c.green(c.bold(c.italic(`Welcome to Dream! \n cd into ${c.magentaBright(appName)} to get started`)))}
|
|
5
|
-
|
|
6
|
-
${c.magenta(`to create a database,`)}
|
|
7
|
-
${c.magenta(`$ NODE_ENV=development yarn dream db:create`)}
|
|
8
|
-
${c.magenta(`$ NODE_ENV=test yarn dream db:create`)}
|
|
9
|
-
|
|
10
|
-
${c.magentaBright(`to migrate a database,`)}
|
|
11
|
-
${c.magentaBright(`$ NODE_ENV=development yarn dream db:migrate`)}
|
|
12
|
-
${c.magentaBright(`$ NODE_ENV=test yarn dream db:migrate`)}
|
|
13
|
-
|
|
14
|
-
${c.redBright(`to rollback a database,`)}
|
|
15
|
-
${c.redBright(`$ NODE_ENV=development yarn dream db:rollback`)}
|
|
16
|
-
${c.redBright(`$ NODE_ENV=test yarn dream db:rollback --step=1`)}
|
|
17
|
-
|
|
18
|
-
${c.blueBright(`to drop a database,`)}
|
|
19
|
-
${c.blueBright(`$ NODE_ENV=development yarn dream db:drop`)}
|
|
20
|
-
${c.blueBright(`$ NODE_ENV=test yarn dream db:drop`)}
|
|
21
|
-
|
|
22
|
-
# NOTE: doing it this way, you will still need to
|
|
23
|
-
# plug the routes manually in your api/src/app/conf/routes.ts file
|
|
24
|
-
|
|
25
|
-
${c.greenBright(`to create a model`)}
|
|
26
|
-
${c.greenBright(`$ yarn dream g:model user organization:belongs_to likes_chalupas:boolean some_id:uuid`)}
|
|
27
|
-
|
|
28
|
-
${c.yellow(`to create a migration`)}
|
|
29
|
-
${c.yellow(`$ yarn dream g:migration create-users`)}
|
|
30
|
-
|
|
31
|
-
${c.magentaBright(`to run unit tests,`)}
|
|
32
|
-
${c.magentaBright(`$ yarn dream uspec`)}
|
|
33
|
-
|
|
34
|
-
# NOTE: before you get started, be sure to visit your ${c.magenta('.env')} and ${c.magenta('.env.test')}
|
|
35
|
-
# files and make sure they have database credentials set correctly.
|
|
36
|
-
# you can see conf/dream.ts to see how those credentials are used.
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import initDreamAppIntoExistingProject from './helpers/initDreamAppIntoExistingProject.js';
|
|
2
|
-
import { cliDefaultConfigPath, cliDefaultDbPath, cliDefaultFactoriesPath, cliDefaultModelsPath, cliDefaultModelSpecsPath, cliDefaultProjectPath, cliDefaultSerializersPath, cliDefaultServicesPath, cliDefaultTypesPath, cliPrimaryKeyTypes, } from './helpers/primaryKeyTypes.js';
|
|
3
|
-
import Prompt from './helpers/prompt.js';
|
|
4
|
-
import Select from './helpers/select.js';
|
|
5
|
-
export default async function initDreamApp(options) {
|
|
6
|
-
if (!options.primaryKeyType || !cliPrimaryKeyTypes.includes(options.primaryKeyType)) {
|
|
7
|
-
const answer = await new Select('what primary key type would you like to use?', cliPrimaryKeyTypes).run();
|
|
8
|
-
options.primaryKeyType = answer;
|
|
9
|
-
}
|
|
10
|
-
if (!options.projectPath) {
|
|
11
|
-
const answer = await new Prompt(`Relative to the current directory, where would you like us to put your project? (defaults to the current directory)`).run();
|
|
12
|
-
if (process.env.DREAM_CORE_DEVELOPMENT === '1' && !answer) {
|
|
13
|
-
throw new Error(`
|
|
14
|
-
when in dream core development, you must provide an explicit project directory. If you do not specify it,
|
|
15
|
-
you risk accidentally overwriting all the root files in the dream directory.
|
|
16
|
-
`);
|
|
17
|
-
}
|
|
18
|
-
options.projectPath = answer || cliDefaultProjectPath;
|
|
19
|
-
}
|
|
20
|
-
if (!options.configPath) {
|
|
21
|
-
const answer = await new Prompt(`Relative to your project root, where would you like us to put your config files? (defaults to ${cliDefaultConfigPath})`).run();
|
|
22
|
-
options.configPath = answer || cliDefaultConfigPath;
|
|
23
|
-
}
|
|
24
|
-
if (!options.modelsPath) {
|
|
25
|
-
const answer = await new Prompt(`Relative to your project root, where would you like us to put your models? (defaults to ${cliDefaultModelsPath})`).run();
|
|
26
|
-
options.modelsPath = answer || cliDefaultModelsPath;
|
|
27
|
-
}
|
|
28
|
-
if (!options.serializersPath) {
|
|
29
|
-
const answer = await new Prompt(`Relative to your project root, where would you like us to put your serializers? (defaults to ${cliDefaultSerializersPath})`).run();
|
|
30
|
-
options.serializersPath = answer || cliDefaultSerializersPath;
|
|
31
|
-
}
|
|
32
|
-
if (!options.servicesPath) {
|
|
33
|
-
const answer = await new Prompt(`Relative to your project root, where would you like us to put your services? (defaults to ${cliDefaultServicesPath})`).run();
|
|
34
|
-
options.servicesPath = answer || cliDefaultServicesPath;
|
|
35
|
-
}
|
|
36
|
-
if (!options.dbPath) {
|
|
37
|
-
const answer = await new Prompt(`Relative to your project root, where would you like us to put your db files? (defaults to ${cliDefaultDbPath})`).run();
|
|
38
|
-
options.dbPath = answer || cliDefaultDbPath;
|
|
39
|
-
}
|
|
40
|
-
if (!options.typesPath) {
|
|
41
|
-
const answer = await new Prompt(`Relative to your project root, where would you like us to put your dream.ts and db.ts type files? (defaults to ${cliDefaultTypesPath})`).run();
|
|
42
|
-
options.typesPath = answer || cliDefaultTypesPath;
|
|
43
|
-
}
|
|
44
|
-
if (!options.modelSpecsPath) {
|
|
45
|
-
const answer = await new Prompt(`Relative to your project root, where would you like us to put your model tests? (defaults to ${cliDefaultModelSpecsPath})`).run();
|
|
46
|
-
options.modelSpecsPath = answer || cliDefaultModelSpecsPath;
|
|
47
|
-
}
|
|
48
|
-
if (!options.factoriesPath) {
|
|
49
|
-
const answer = await new Prompt(`Relative to your project root, where would you like us to put your factories? (defaults to ${cliDefaultFactoriesPath})`).run();
|
|
50
|
-
options.factoriesPath = answer || cliDefaultFactoriesPath;
|
|
51
|
-
}
|
|
52
|
-
await initDreamAppIntoExistingProject('dream app', options);
|
|
53
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs/promises';
|
|
2
|
-
import buildNewDreamApp from './helpers/buildNewDreamApp.js';
|
|
3
|
-
export default async function newDreamApp(appName, options) {
|
|
4
|
-
const projectPath = `./${appName}`;
|
|
5
|
-
await fs.mkdir(projectPath);
|
|
6
|
-
await buildNewDreamApp(appName, projectPath, options);
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (filepath: string, dirPath: string): string;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export default function importServices(servicesPath: string, serviceImportCb: (path: string) => Promise<any>): Promise<Record<string, any>>;
|
|
2
|
-
export declare function setCachedServices(services: Record<string, any>): void;
|
|
3
|
-
export declare function getServicesOrFail(): Record<string, any>;
|
|
4
|
-
export declare function getServicesOrBlank(): Record<string, any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function argAndValue(arg: string, args: string[]): [string | null, string | null];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function copyRecursive(src: string, dest: string): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function filterObjectByKey<T extends object, U extends string[], R extends Pick<T, U[number] & keyof T>>(obj: T, arr: U): R;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function generateEncryptionKey(): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const cliPrimaryKeyTypes: readonly ["bigserial", "serial", "uuid"];
|
|
2
|
-
export declare const cliDefaultProjectPath = ".";
|
|
3
|
-
export declare const cliDefaultConfigPath = "src/conf.js";
|
|
4
|
-
export declare const cliDefaultDbPath = "src/db.js";
|
|
5
|
-
export declare const cliDefaultTypesPath = "src/types.js";
|
|
6
|
-
export declare const cliDefaultModelsPath = "src/app/models.js";
|
|
7
|
-
export declare const cliDefaultSerializersPath = "src/app/serializers.js";
|
|
8
|
-
export declare const cliDefaultServicesPath = "src/app/services.js";
|
|
9
|
-
export declare const cliDefaultModelSpecsPath = "spec/uspec/models.js";
|
|
10
|
-
export declare const cliDefaultFactoriesPath = "spec/factories.js";
|
|
11
|
-
export interface InitDreamAppCliOptions {
|
|
12
|
-
configPath: string;
|
|
13
|
-
dbPath: string;
|
|
14
|
-
factoriesPath: string;
|
|
15
|
-
modelsPath: string;
|
|
16
|
-
modelSpecsPath: string;
|
|
17
|
-
primaryKeyType: (typeof cliPrimaryKeyTypes)[number];
|
|
18
|
-
projectPath: string;
|
|
19
|
-
serializersPath: string;
|
|
20
|
-
servicesPath: string;
|
|
21
|
-
typesPath: string;
|
|
22
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default class Select<T extends readonly any[]> {
|
|
2
|
-
private question;
|
|
3
|
-
private selectIndex;
|
|
4
|
-
private options;
|
|
5
|
-
private selector;
|
|
6
|
-
private isFirstTimeShowMenu;
|
|
7
|
-
private cb;
|
|
8
|
-
constructor(question: string, options: T);
|
|
9
|
-
run(): Promise<T[number]>;
|
|
10
|
-
private keyPressedHandler;
|
|
11
|
-
private ansiEraseLines;
|
|
12
|
-
private init;
|
|
13
|
-
private start;
|
|
14
|
-
close: () => never;
|
|
15
|
-
private getPadding;
|
|
16
|
-
private createOptionMenu;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function sleep(ms: number): Promise<unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function welcomeMessage(appName: string): string;
|