mirror of
https://github.com/spacebarchat/server.git
synced 2026-04-13 03:05:40 +00:00
Push local state...
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
#!/bin/sh
|
||||
read -p "Enter migration filename: " FILENAME
|
||||
|
||||
if [ ! -z "$1" ]
|
||||
then
|
||||
FILENAME="$1"
|
||||
echo "Using filename: $FILENAME"
|
||||
else
|
||||
read -p "Enter migration filename: " FILENAME
|
||||
fi
|
||||
|
||||
[ -f ".env" ] && (
|
||||
mv .env .env.tmp
|
||||
source .env.tmp
|
||||
@@ -8,8 +16,8 @@ read -p "Enter migration filename: " FILENAME
|
||||
make_migration() {
|
||||
echo "Creating migrations for $2"
|
||||
mkdir "../util/src/migrations/$2"
|
||||
npm run build clean logerrors pretty-errors
|
||||
THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
|
||||
# npm run build clean logerrors pretty-errors
|
||||
# THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
|
||||
THREADS=1 DATABASE="$1" DB_MIGRATE=a npx typeorm-ts-node-commonjs migration:generate "../util/src/migrations/$2/$FILENAME" -d ../util/src/util/Database.ts -p
|
||||
npm run build clean logerrors pretty-errors
|
||||
THREADS=1 DATABASE="$1" DB_MIGRATE=a npm run start:bundle
|
||||
|
||||
34
bundle/scripts/gen_index.js
Normal file
34
bundle/scripts/gen_index.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { execIn, getLines, parts } = require('./utils');
|
||||
|
||||
if (!process.argv[2] || !fs.existsSync(process.argv[2])) {
|
||||
console.log("Please pass a directory that exists!");
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`// ${process.argv[2]}/index.ts`)
|
||||
const recurse = process.argv.includes("--recursive")
|
||||
|
||||
const files = fs.readdirSync(process.argv[2]).filter(x => x.endsWith('.ts') && x != 'index.ts');
|
||||
|
||||
let output = '';
|
||||
|
||||
files.forEach(x => output += `export * from "./${x.replaceAll('.ts','')}";\n`)
|
||||
|
||||
const dirs = fs.readdirSync(process.argv[2]).filter(x => {
|
||||
try {
|
||||
fs.readdirSync(path.join(process.argv[2], x));
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
dirs.forEach(x => {
|
||||
output += `export * from "./${x}/index";\n`
|
||||
})
|
||||
console.log(output);
|
||||
fs.writeFileSync(path.join(process.argv[2], "index.ts"), output)
|
||||
|
||||
dirs.forEach(x => {
|
||||
if(recurse) console.log(execIn([process.argv[0], process.argv[1], `"${path.join(process.argv[2], x)}"`, "--recursive"].join(' '), process.cwd()))
|
||||
})
|
||||
9
bundle/scripts/update_schemas.js
Normal file
9
bundle/scripts/update_schemas.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { env } = require("process");
|
||||
const { execSync } = require("child_process");
|
||||
const { argv, stdout, exit } = require("process");
|
||||
|
||||
const { execIn, getLines, parts } = require("./utils");
|
||||
|
||||
execIn("node scripts/generate_schema.js", path.join("..", "..", "api"));
|
||||
@@ -28,13 +28,14 @@ function copyRecursiveSync(src, dest) {
|
||||
}
|
||||
}
|
||||
|
||||
function execIn(cmd, workdir) {
|
||||
function execIn(cmd, workdir, opts) {
|
||||
try {
|
||||
return execSync(cmd, {
|
||||
cwd: workdir,
|
||||
shell: true,
|
||||
env: process.env,
|
||||
encoding: "utf-8",
|
||||
...opts
|
||||
});
|
||||
} catch (error) {
|
||||
return error.stdout;
|
||||
|
||||
Reference in New Issue
Block a user