mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 22:57:12 +01:00
New build process.
This commit is contained in:
parent
c3da37c0b0
commit
551959562e
4 changed files with 99 additions and 28 deletions
|
|
@ -1,22 +0,0 @@
|
|||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { getDatabase, getNpmCommand, runCommand } = require('./common');
|
||||
|
||||
(async () => {
|
||||
const db = getDatabase();
|
||||
|
||||
if (!db) {
|
||||
throw new Error('Database not specified');
|
||||
}
|
||||
|
||||
const src = path.resolve(__dirname, `../prisma/schema.${db}.prisma`);
|
||||
const dest = path.resolve(__dirname, '../prisma/schema.prisma');
|
||||
|
||||
fs.copyFileSync(src, dest);
|
||||
|
||||
await runCommand(getNpmCommand(), ['run', 'prisma-generate']).catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
})();
|
||||
14
scripts/copy-db-schema.js
Normal file
14
scripts/copy-db-schema.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const db = process.env.DATABASE_URL.split(':')[0];
|
||||
|
||||
if (!db) {
|
||||
throw new Error('Database not specified');
|
||||
}
|
||||
|
||||
const src = path.resolve(__dirname, `../prisma/schema.${db}.prisma`);
|
||||
const dest = path.resolve(__dirname, '../prisma/schema.prisma');
|
||||
|
||||
fs.copyFileSync(src, dest);
|
||||
Loading…
Add table
Add a link
Reference in a new issue