velocious 1.0.88 → 1.0.90
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/package.json +1 -1
- package/src/cli/base-command.js +25 -2
- package/src/cli/commands/destroy/migration.js +1 -29
- package/src/cli/commands/generate/migration.js +1 -27
- package/src/cli/commands/generate/model.js +1 -27
- package/src/cli/commands/init.js +1 -49
- package/src/cli/index.js +1 -1
- package/src/environment-handlers/base.js +14 -0
- package/src/environment-handlers/browser.js +16 -0
- package/src/environment-handlers/node/cli/commands/destroy/migration.js +35 -0
- package/src/environment-handlers/node/cli/commands/generate/migration.js +33 -0
- package/src/environment-handlers/node/cli/commands/generate/model.js +33 -0
- package/src/environment-handlers/node/cli/commands/init.js +59 -0
- package/src/environment-handlers/node.js +20 -0
- package/src/cli/commands/destroy/migration.native.js +0 -7
- package/src/cli/commands/generate/migration.native.js +0 -7
- package/src/cli/commands/generate/model.native.js +0 -7
package/package.json
CHANGED
package/src/cli/base-command.js
CHANGED
|
@@ -1,16 +1,39 @@
|
|
|
1
1
|
import restArgsError from "../utils/rest-args-error.js"
|
|
2
2
|
|
|
3
3
|
export default class VelociousCliBaseCommand {
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} args
|
|
6
|
+
* @param {object} args.args
|
|
7
|
+
*/
|
|
8
|
+
constructor({args = {}, ...restArgs}) {
|
|
5
9
|
restArgsError(restArgs)
|
|
6
10
|
|
|
7
11
|
this.args = args
|
|
8
12
|
this._configuration = args.configuration
|
|
9
|
-
this._environmentHandler =
|
|
13
|
+
this._environmentHandler = args.configuration.getEnvironmentHandler()
|
|
10
14
|
this.processArgs = args.processArgs
|
|
11
15
|
}
|
|
12
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
13
20
|
directory() { return this.getConfiguration().getDirectory() }
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @interface
|
|
24
|
+
*/
|
|
25
|
+
execute() {
|
|
26
|
+
throw new Error("execute not implemented")
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @returns {import("../configuration.js").default}
|
|
31
|
+
*/
|
|
14
32
|
getConfiguration() { return this._configuration }
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @template T extends import("../environment-handlers/base.js").default
|
|
36
|
+
* @returns {T}
|
|
37
|
+
*/
|
|
15
38
|
getEnvironmentHandler() { return this._environmentHandler }
|
|
16
39
|
}
|
|
@@ -1,35 +1,7 @@
|
|
|
1
1
|
import BaseCommand from "../../base-command.js"
|
|
2
|
-
import fs from "fs/promises"
|
|
3
2
|
|
|
4
3
|
export default class DbDestroyMigration extends BaseCommand {
|
|
5
4
|
async execute() {
|
|
6
|
-
|
|
7
|
-
const migrationDir = `${this.getConfiguration().getDirectory()}/src/database/migrations`
|
|
8
|
-
const migrationFiles = await fs.readdir(migrationDir)
|
|
9
|
-
const destroyed = []
|
|
10
|
-
|
|
11
|
-
for (const migrationFile of migrationFiles) {
|
|
12
|
-
const match = migrationFile.match(/^(\d{14})-(.+)\.js$/)
|
|
13
|
-
|
|
14
|
-
if (!match) {
|
|
15
|
-
continue
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const fileName = match[2]
|
|
19
|
-
|
|
20
|
-
if (fileName != migrationName) continue
|
|
21
|
-
|
|
22
|
-
const fullFilePath = `${migrationDir}/${migrationFile}`
|
|
23
|
-
destroyed.push(fileName)
|
|
24
|
-
|
|
25
|
-
if (!this.args.testing) {
|
|
26
|
-
console.log(`Destroy src/database/migrations/${migrationFile}`)
|
|
27
|
-
await fs.unlink(fullFilePath)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (this.args.testing) {
|
|
32
|
-
return {destroyed}
|
|
33
|
-
}
|
|
5
|
+
return await this.getConfiguration().getEnvironmentHandler().cliCommandsMigrationDestroy(this)
|
|
34
6
|
}
|
|
35
7
|
}
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
import BaseCommand from "../../base-command.js"
|
|
2
|
-
import fileExists from "../../../utils/file-exists.js"
|
|
3
|
-
import fs from "fs/promises"
|
|
4
|
-
import * as inflection from "inflection"
|
|
5
|
-
import strftime from "strftime"
|
|
6
2
|
|
|
7
3
|
export default class DbGenerateMigration extends BaseCommand {
|
|
8
4
|
async execute() {
|
|
9
|
-
|
|
10
|
-
const migrationNameCamelized = inflection.camelize(migrationName.replaceAll("-", "_"))
|
|
11
|
-
const date = new Date()
|
|
12
|
-
const migrationNumber = strftime("%Y%m%d%H%M%S")
|
|
13
|
-
const migrationFileName = `${migrationNumber}-${migrationName}.js`
|
|
14
|
-
const velociousPath = await this.getEnvironmentHandler().getVelociousPath()
|
|
15
|
-
const templateFilePath = `${velociousPath}/src/templates/generate-migration.js`
|
|
16
|
-
const migrationContentBuffer = await fs.readFile(templateFilePath)
|
|
17
|
-
const migrationContent = migrationContentBuffer.toString().replaceAll("__MIGRATION_NAME__", migrationNameCamelized)
|
|
18
|
-
const migrationDir = `${process.cwd()}/src/database/migrations`
|
|
19
|
-
const migrationPath = `${migrationDir}/${migrationFileName}`
|
|
20
|
-
|
|
21
|
-
if (this.args.testing) {
|
|
22
|
-
return {date, migrationContent, migrationName, migrationNameCamelized, migrationNumber, migrationPath}
|
|
23
|
-
} else {
|
|
24
|
-
if (!await fileExists(migrationDir)) {
|
|
25
|
-
await fs.mkdir(migrationDir, {recursive: true})
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
await fs.writeFile(migrationPath, migrationContent)
|
|
29
|
-
|
|
30
|
-
console.log(`create src/database/migrations/${migrationFileName}`)
|
|
31
|
-
}
|
|
5
|
+
return await this.getConfiguration().getEnvironmentHandler().cliCommandsMigrationGenerate(this)
|
|
32
6
|
}
|
|
33
7
|
}
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
import BaseCommand from "../../base-command.js"
|
|
2
|
-
import fileExists from "../../../utils/file-exists.js"
|
|
3
|
-
import fs from "fs/promises"
|
|
4
|
-
import * as inflection from "inflection"
|
|
5
2
|
|
|
6
3
|
export default class DbGenerateModel extends BaseCommand {
|
|
7
4
|
async execute() {
|
|
8
|
-
|
|
9
|
-
const modelNameCamelized = inflection.camelize(modelName.replaceAll("-", "_"))
|
|
10
|
-
const date = new Date()
|
|
11
|
-
const modelFileName = `${inflection.dasherize(inflection.underscore(modelName))}.js`
|
|
12
|
-
const velociousPath = await this.getEnvironmentHandler().getVelociousPath()
|
|
13
|
-
const templateFilePath = `${velociousPath}/src/templates/generate-model.js`
|
|
14
|
-
const modelContentBuffer = await fs.readFile(templateFilePath)
|
|
15
|
-
const modelContent = modelContentBuffer.toString().replaceAll("__MODEL_NAME__", modelNameCamelized)
|
|
16
|
-
const modelsDir = `${process.cwd()}/src/models`
|
|
17
|
-
const modelPath = `${modelsDir}/${modelFileName}`
|
|
18
|
-
|
|
19
|
-
if (await fileExists(modelPath)) throw new Error(`Model file already exists: ${modelPath}`)
|
|
20
|
-
|
|
21
|
-
if (this.args.testing) {
|
|
22
|
-
return {date, modelContent, modelName, modelNameCamelized, modelPath}
|
|
23
|
-
} else {
|
|
24
|
-
if (!await fileExists(modelsDir)) {
|
|
25
|
-
await fs.mkdir(modelsDir, {recursive: true})
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
await fs.writeFile(modelPath, modelContent)
|
|
29
|
-
|
|
30
|
-
console.log(`create src/models/${modelFileName}`)
|
|
31
|
-
}
|
|
5
|
+
return await this.getConfiguration().getEnvironmentHandler().cliCommandsModelGenerate(this)
|
|
32
6
|
}
|
|
33
7
|
}
|
package/src/cli/commands/init.js
CHANGED
|
@@ -1,56 +1,8 @@
|
|
|
1
1
|
import BaseCommand from "../base-command.js"
|
|
2
|
-
import fileExists from "../../utils/file-exists.js"
|
|
3
|
-
import fs from "fs/promises"
|
|
4
2
|
|
|
5
3
|
export default class VelociousCliCommandsInit extends BaseCommand {
|
|
6
4
|
async execute() {
|
|
7
|
-
|
|
8
|
-
const projectPath = this.getConfiguration()?.getDirectory() || process.cwd()
|
|
9
|
-
const projectConfigPath = `${projectPath}/src/config`
|
|
10
|
-
const fileMappings = [
|
|
11
|
-
{
|
|
12
|
-
source: `${velociousPath}/src/templates/configuration.js`,
|
|
13
|
-
target: `${projectConfigPath}/configuration.js`
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
source: `${velociousPath}/src/templates/routes.js`,
|
|
17
|
-
target: `${projectConfigPath}/routes.js`
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
const paths = [
|
|
21
|
-
projectConfigPath,
|
|
22
|
-
`${projectPath}/src/database/migrations`,
|
|
23
|
-
`${projectPath}/src/models`,
|
|
24
|
-
`${projectPath}/src/routes`
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
if (this.args.testing) {
|
|
28
|
-
return {
|
|
29
|
-
fileMappings
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (const path of paths) {
|
|
34
|
-
if (await fileExists(path)) {
|
|
35
|
-
console.log(`Config dir already exists: ${path}`)
|
|
36
|
-
} else {
|
|
37
|
-
console.log(`Config dir doesn't exists: ${path}`)
|
|
38
|
-
await fs.mkdir(path, {recursive: true})
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
for (const fileMapping of fileMappings) {
|
|
43
|
-
if (!await fileExists(fileMapping.source)) {
|
|
44
|
-
throw new Error(`Template doesn't exist: ${fileMapping.source}`)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (await fileExists(fileMapping.target)) {
|
|
48
|
-
console.log(`File already exists: ${fileMapping.target}`)
|
|
49
|
-
} else {
|
|
50
|
-
console.log(`File doesnt exist: ${fileMapping.target}`)
|
|
51
|
-
await fs.copyFile(fileMapping.source, fileMapping.target)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
5
|
+
return await this.getConfiguration().getEnvironmentHandler().cliCommandsInit(this)
|
|
54
6
|
}
|
|
55
7
|
}
|
|
56
8
|
|
package/src/cli/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export default class VelociousCli {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const CommandClass = await this.environmentHandler.requireCommand({commandParts: parsedCommandParts})
|
|
26
|
-
const commandInstance = new CommandClass({args: this.args
|
|
26
|
+
const commandInstance = new CommandClass({args: this.args})
|
|
27
27
|
|
|
28
28
|
if (commandInstance.initialize) {
|
|
29
29
|
await commandInstance.initialize()
|
|
@@ -9,6 +9,20 @@ export default class VelociousEnvironmentHandlerBase {
|
|
|
9
9
|
*/
|
|
10
10
|
async findMigrations() { throw new Error("findMigrations not implemneted") }
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @template T extends import("../cli/base-command.js").default
|
|
14
|
+
* @param {T} command
|
|
15
|
+
* @param {typeof T} CommandClass
|
|
16
|
+
* @returns {any}
|
|
17
|
+
*/
|
|
18
|
+
async forwardCommand(command, CommandClass) {
|
|
19
|
+
const newCommand = new CommandClass({
|
|
20
|
+
args: command.args
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
return await newCommand.execute()
|
|
24
|
+
}
|
|
25
|
+
|
|
12
26
|
/**
|
|
13
27
|
* @interface
|
|
14
28
|
*/
|
|
@@ -15,6 +15,22 @@ export default class VelociousEnvironmentsHandlerBrowser extends Base {
|
|
|
15
15
|
this.migrationsRequireContextCallback = migrationsRequireContextCallback
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
async cliCommandsInit(_command) { // eslint-disable-line no-unused-vars
|
|
19
|
+
throw new Error("Unsupported on browser")
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async cliCommandsMigrationGenerate(_command) { // eslint-disable-line no-unused-vars
|
|
23
|
+
throw new Error("Unsupported on browser")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async cliCommandsMigrationDestroy(_command) { // eslint-disable-line no-unused-vars
|
|
27
|
+
throw new Error("Unsupported on browser")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async cliCommandsModelGenerate(_command) { // eslint-disable-line no-unused-vars
|
|
31
|
+
throw new Error("Unsupported on browser")
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
/**
|
|
19
35
|
* @returns {object}
|
|
20
36
|
*/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import BaseCommand from "../../../../../cli/base-command.js"
|
|
2
|
+
import fs from "fs/promises"
|
|
3
|
+
|
|
4
|
+
export default class DbDestroyMigration extends BaseCommand {
|
|
5
|
+
async execute() {
|
|
6
|
+
const migrationName = this.processArgs[1]
|
|
7
|
+
const migrationDir = `${this.getConfiguration().getDirectory()}/src/database/migrations`
|
|
8
|
+
const migrationFiles = await fs.readdir(migrationDir)
|
|
9
|
+
const destroyed = []
|
|
10
|
+
|
|
11
|
+
for (const migrationFile of migrationFiles) {
|
|
12
|
+
const match = migrationFile.match(/^(\d{14})-(.+)\.js$/)
|
|
13
|
+
|
|
14
|
+
if (!match) {
|
|
15
|
+
continue
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const fileName = match[2]
|
|
19
|
+
|
|
20
|
+
if (fileName != migrationName) continue
|
|
21
|
+
|
|
22
|
+
const fullFilePath = `${migrationDir}/${migrationFile}`
|
|
23
|
+
destroyed.push(fileName)
|
|
24
|
+
|
|
25
|
+
if (!this.args.testing) {
|
|
26
|
+
console.log(`Destroy src/database/migrations/${migrationFile}`)
|
|
27
|
+
await fs.unlink(fullFilePath)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (this.args.testing) {
|
|
32
|
+
return {destroyed}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseCommand from "../../../../../cli/base-command.js"
|
|
2
|
+
import fileExists from "../../../../../utils/file-exists.js"
|
|
3
|
+
import fs from "fs/promises"
|
|
4
|
+
import * as inflection from "inflection"
|
|
5
|
+
import strftime from "strftime"
|
|
6
|
+
|
|
7
|
+
export default class DbGenerateMigration extends BaseCommand {
|
|
8
|
+
async execute() {
|
|
9
|
+
const migrationName = this.processArgs[1]
|
|
10
|
+
const migrationNameCamelized = inflection.camelize(migrationName.replaceAll("-", "_"))
|
|
11
|
+
const date = new Date()
|
|
12
|
+
const migrationNumber = strftime("%Y%m%d%H%M%S")
|
|
13
|
+
const migrationFileName = `${migrationNumber}-${migrationName}.js`
|
|
14
|
+
const velociousPath = await this.getEnvironmentHandler().getVelociousPath()
|
|
15
|
+
const templateFilePath = `${velociousPath}/src/templates/generate-migration.js`
|
|
16
|
+
const migrationContentBuffer = await fs.readFile(templateFilePath)
|
|
17
|
+
const migrationContent = migrationContentBuffer.toString().replaceAll("__MIGRATION_NAME__", migrationNameCamelized)
|
|
18
|
+
const migrationDir = `${process.cwd()}/src/database/migrations`
|
|
19
|
+
const migrationPath = `${migrationDir}/${migrationFileName}`
|
|
20
|
+
|
|
21
|
+
if (this.args.testing) {
|
|
22
|
+
return {date, migrationContent, migrationName, migrationNameCamelized, migrationNumber, migrationPath}
|
|
23
|
+
} else {
|
|
24
|
+
if (!await fileExists(migrationDir)) {
|
|
25
|
+
await fs.mkdir(migrationDir, {recursive: true})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
await fs.writeFile(migrationPath, migrationContent)
|
|
29
|
+
|
|
30
|
+
console.log(`create src/database/migrations/${migrationFileName}`)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseCommand from "../../../../../cli/base-command.js"
|
|
2
|
+
import fileExists from "../../../../../utils/file-exists.js"
|
|
3
|
+
import fs from "fs/promises"
|
|
4
|
+
import * as inflection from "inflection"
|
|
5
|
+
|
|
6
|
+
export default class DbGenerateModel extends BaseCommand {
|
|
7
|
+
async execute() {
|
|
8
|
+
const modelName = this.processArgs[1]
|
|
9
|
+
const modelNameCamelized = inflection.camelize(modelName.replaceAll("-", "_"))
|
|
10
|
+
const date = new Date()
|
|
11
|
+
const modelFileName = `${inflection.dasherize(inflection.underscore(modelName))}.js`
|
|
12
|
+
const velociousPath = await this.getEnvironmentHandler().getVelociousPath()
|
|
13
|
+
const templateFilePath = `${velociousPath}/src/templates/generate-model.js`
|
|
14
|
+
const modelContentBuffer = await fs.readFile(templateFilePath)
|
|
15
|
+
const modelContent = modelContentBuffer.toString().replaceAll("__MODEL_NAME__", modelNameCamelized)
|
|
16
|
+
const modelsDir = `${process.cwd()}/src/models`
|
|
17
|
+
const modelPath = `${modelsDir}/${modelFileName}`
|
|
18
|
+
|
|
19
|
+
if (await fileExists(modelPath)) throw new Error(`Model file already exists: ${modelPath}`)
|
|
20
|
+
|
|
21
|
+
if (this.args.testing) {
|
|
22
|
+
return {date, modelContent, modelName, modelNameCamelized, modelPath}
|
|
23
|
+
} else {
|
|
24
|
+
if (!await fileExists(modelsDir)) {
|
|
25
|
+
await fs.mkdir(modelsDir, {recursive: true})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
await fs.writeFile(modelPath, modelContent)
|
|
29
|
+
|
|
30
|
+
console.log(`create src/models/${modelFileName}`)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import BaseCommand from "../../../../cli/base-command.js"
|
|
2
|
+
import fileExists from "../../../../utils/file-exists.js"
|
|
3
|
+
import fs from "fs/promises"
|
|
4
|
+
|
|
5
|
+
export default class VelociousCliCommandsInit extends BaseCommand {
|
|
6
|
+
async execute() {
|
|
7
|
+
const velociousPath = await this.getEnvironmentHandler().getVelociousPath()
|
|
8
|
+
const projectPath = this.getConfiguration()?.getDirectory() || process.cwd()
|
|
9
|
+
const projectConfigPath = `${projectPath}/src/config`
|
|
10
|
+
const fileMappings = [
|
|
11
|
+
{
|
|
12
|
+
source: `${velociousPath}/src/templates/configuration.js`,
|
|
13
|
+
target: `${projectConfigPath}/configuration.js`
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
source: `${velociousPath}/src/templates/routes.js`,
|
|
17
|
+
target: `${projectConfigPath}/routes.js`
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
const paths = [
|
|
21
|
+
projectConfigPath,
|
|
22
|
+
`${projectPath}/src/database/migrations`,
|
|
23
|
+
`${projectPath}/src/models`,
|
|
24
|
+
`${projectPath}/src/routes`
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
if (this.args.testing) {
|
|
28
|
+
return {
|
|
29
|
+
fileMappings
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
for (const path of paths) {
|
|
34
|
+
if (await fileExists(path)) {
|
|
35
|
+
console.log(`Config dir already exists: ${path}`)
|
|
36
|
+
} else {
|
|
37
|
+
console.log(`Config dir doesn't exists: ${path}`)
|
|
38
|
+
await fs.mkdir(path, {recursive: true})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
for (const fileMapping of fileMappings) {
|
|
43
|
+
if (!await fileExists(fileMapping.source)) {
|
|
44
|
+
throw new Error(`Template doesn't exist: ${fileMapping.source}`)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (await fileExists(fileMapping.target)) {
|
|
48
|
+
console.log(`File already exists: ${fileMapping.target}`)
|
|
49
|
+
} else {
|
|
50
|
+
console.log(`File doesnt exist: ${fileMapping.target}`)
|
|
51
|
+
await fs.copyFile(fileMapping.source, fileMapping.target)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const dontLoadConfiguration = true
|
|
58
|
+
|
|
59
|
+
export {dontLoadConfiguration}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import Base from "./base.js"
|
|
2
|
+
import CliCommandsDestroyMigration from "./node/cli/commands/destroy/migration.js"
|
|
3
|
+
import CliCommandsInit from "./node/cli/commands/init.js"
|
|
4
|
+
import CliCommandsGenerateMigration from "./node/cli/commands/generate/migration.js"
|
|
5
|
+
import CliCommandsGenerateModel from "./node/cli/commands/generate/model.js"
|
|
2
6
|
import {dirname} from "path"
|
|
3
7
|
import {fileURLToPath} from "url"
|
|
4
8
|
import fs from "fs/promises"
|
|
@@ -42,6 +46,22 @@ export default class VelociousEnvironmentHandlerNode extends Base{
|
|
|
42
46
|
return commands
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
async cliCommandsInit(command) {
|
|
50
|
+
return await this.forwardCommand(command, CliCommandsInit)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async cliCommandsMigrationGenerate(command) {
|
|
54
|
+
return await this.forwardCommand(command, CliCommandsGenerateMigration)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async cliCommandsMigrationDestroy(command) {
|
|
58
|
+
return await this.forwardCommand(command, CliCommandsDestroyMigration)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async cliCommandsModelGenerate(command) {
|
|
62
|
+
return await this.forwardCommand(command, CliCommandsGenerateModel)
|
|
63
|
+
}
|
|
64
|
+
|
|
45
65
|
/**
|
|
46
66
|
* @param {Array<string>} commandParts
|
|
47
67
|
* @template T extends import ("./base-command.js").default
|