Skip to content

Commit

Permalink
Merge pull request #363 from ilovepixelart/362-error-err_package_path…
Browse files Browse the repository at this point in the history
…_not_exported-with-programmatic-use

Dep, and registry fix
  • Loading branch information
ilovepixelart authored Dec 7, 2024
2 parents 386eb93 + 64387d6 commit bd8b916
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
29 changes: 15 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@
"@swc-node/register": "1.10.9",
"chalk": "4.1.2",
"commander": "12.1.0",
"dotenv": "16.4.5",
"dotenv": "16.4.7",
"inquirer": "8.2.6",
"mongoose": "8.8.3"
"mongoose": "8.8.4"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
Expand Down
8 changes: 4 additions & 4 deletions src/commander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import type IOptions from './interfaces/IOptions'

import { DEFAULT_MIGRATE_AUTOSYNC, DEFAULT_MIGRATE_CONFIG_PATH, DEFAULT_MIGRATE_MIGRATIONS_PATH, DEFAULT_MIGRATE_MONGO_COLLECTION } from './defaults'

import { register } from '@swc-node/register/register'
register()
import '@swc-node/register'

/**
* Get the options from the config file
Expand Down Expand Up @@ -103,7 +102,7 @@ export const getMigrator = async (options: IOptions): Promise<Migrator> => {
* @class Migrate
*/
export class Migrate {
private program: Command
private readonly program: Command
private migrator!: Migrator

constructor() {
Expand Down Expand Up @@ -137,7 +136,8 @@ export class Migrate {
.description('create a new migration file')
.action(async (migrationName: string) => {
await this.migrator.create(migrationName)
console.log(`Migration created. Run ${chalk.cyan(`migrate up ${migrationName}`)} to apply the migration`)
const migrateUp = chalk.cyan(`migrate up ${migrationName}`)
console.log(`Migration created. Run ${migrateUp} to apply the migration`)
})

this.program
Expand Down
19 changes: 10 additions & 9 deletions src/migrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import { DEFAULT_MIGRATE_AUTOSYNC, DEFAULT_MIGRATE_CLI, DEFAULT_MIGRATE_MIGRATIO

import defaultTemplate from './template'

import { register } from '@swc-node/register/register'
register()
import '@swc-node/register'

export * as IOptions from './interfaces/IOptions'

Expand All @@ -29,12 +28,12 @@ class Migrator {
readonly migrationModel: Model<IMigration>
readonly connection: Connection

private uri?: string
private template: string
private migrationsPath: string
private collection: string
private autosync: boolean
private cli: boolean
private readonly uri?: string
private readonly template: string
private readonly migrationsPath: string
private readonly collection: string
private readonly autosync: boolean
private readonly cli: boolean

private constructor(options: IMigratorOptions) {
// https://mongoosejs.com/docs/guide.
Expand Down Expand Up @@ -279,7 +278,9 @@ class Migrator {
* @private
*/
private logMigrationStatus(direction: 'down' | 'up', filename: string): void {
this.log(`${chalk[direction === 'up' ? 'green' : 'red'](`${direction}:`)} ${filename} `)
const color = direction === 'up' ? 'green' : 'red'
const directionWithColor = chalk[color](`${direction}:`)
this.log(`${directionWithColor} ${filename} `)
}

/**
Expand Down

0 comments on commit bd8b916

Please sign in to comment.