-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9eedb03
commit 6f90b74
Showing
8 changed files
with
82 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: 'Alpha Build' | |
|
||
on: | ||
push: | ||
branches: [alpha] | ||
branches: [v460/speed-up-migrate] | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,45 @@ | ||
import getOrmConfig from './db/orm-config'; | ||
import path from 'path'; | ||
import fs from 'fs'; | ||
import yargs from 'yargs/yargs'; | ||
import { hideBin } from 'yargs/helpers'; | ||
|
||
const argv = yargs(hideBin(process.argv)).argv; | ||
|
||
async function buildOrmConfig() { | ||
const config = getOrmConfig(); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
(config as any).entities = [ | ||
`${path.resolve(__dirname, 'db', 'entities')}/*.ts`, | ||
]; | ||
if (argv.ts) { | ||
console.log('Creating TypeScript ormconfig.json before migrations'); | ||
await buildOrmConfigTs(); | ||
} else { | ||
console.log('Creating JavaScript ormconfig.json before migrations'); | ||
await buildOrmConfigJs(); | ||
} | ||
} | ||
|
||
async function buildOrmConfigJs() { | ||
const config = getConfig('js'); | ||
const jsonPath = path.resolve(__dirname, '..', '..', 'ormconfig.json'); | ||
fs.writeFileSync(jsonPath, JSON.stringify(config, null, 2)); | ||
} | ||
|
||
async function buildOrmConfigTs() { | ||
const config = getConfig('ts'); | ||
const jsonPath = path.resolve(__dirname, '..', 'ormconfig.json'); | ||
fs.writeFileSync(jsonPath, JSON.stringify(config, null, 2)); | ||
} | ||
|
||
function getConfig(extension: 'js' | 'ts') { | ||
const config = getOrmConfig(); | ||
const rootPath = path.resolve(__dirname); | ||
const entities = path.resolve(rootPath, 'db', 'entities'); | ||
const migrations = path.resolve(rootPath, 'db', 'migrations'); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
(config as any).entities = [`${entities}/*.${extension}`]; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
(config as any).migrations = [`${migrations}/*.${extension}`]; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
(config as any).cli.migrationsDir = migrations; | ||
return config; | ||
} | ||
|
||
export default buildOrmConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15559,6 +15559,19 @@ yargs@^16.0.0, yargs@^16.0.3, yargs@^16.2.0: | |
y18n "^5.0.5" | ||
yargs-parser "^20.2.2" | ||
|
||
yargs@^17.0.1: | ||
version "17.0.1" | ||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.0.1.tgz#6a1ced4ed5ee0b388010ba9fd67af83b9362e0bb" | ||
integrity sha512-xBBulfCc8Y6gLFcrPvtqKz9hz8SO0l1Ni8GgDekvBX2ro0HRQImDGnikfc33cgzcYUSncapnNcZDjVFIH3f6KQ== | ||
dependencies: | ||
cliui "^7.0.2" | ||
escalade "^3.1.1" | ||
get-caller-file "^2.0.5" | ||
require-directory "^2.1.1" | ||
string-width "^4.2.0" | ||
y18n "^5.0.5" | ||
yargs-parser "^20.2.2" | ||
|
||
[email protected]: | ||
version "0.1.2" | ||
resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419" | ||
|