build: allow node package depends on workspace packages (#11892)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { writeFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { appendFileSync, writeFileSync } from 'node:fs';
|
||||
import { join, parse } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { Logger } from '@nestjs/common';
|
||||
@@ -45,15 +45,21 @@ export class CreateCommand extends CommandRunner {
|
||||
|
||||
const timestamp = Date.now();
|
||||
const content = this.createScript(upperFirst(camelCase(name)) + timestamp);
|
||||
const fileName = `${timestamp}-${kebabCase(name)}.ts`;
|
||||
const filePath = join(
|
||||
const migrationDir = join(
|
||||
fileURLToPath(import.meta.url),
|
||||
'../../migrations',
|
||||
fileName
|
||||
'../../migrations'
|
||||
);
|
||||
const fileName = `${timestamp}-${kebabCase(name)}.ts`;
|
||||
const filePath = join(migrationDir, fileName);
|
||||
|
||||
this.logger.log(`Creating ${fileName}...`);
|
||||
writeFileSync(filePath, content);
|
||||
const indexFile = join(migrationDir, 'index.ts');
|
||||
appendFileSync(
|
||||
indexFile,
|
||||
`export * from './${parse(fileName).name}';`,
|
||||
'utf-8'
|
||||
);
|
||||
this.logger.log(`Migration file created at ${filePath}`);
|
||||
this.logger.log('Done');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user