Rename npm scripts to environment-prefixed names (dev:/prod:/devtoprod:/prodto:dev:/infra:).

Align package.json scripts and their references across scripts/, infra/, and db/ SQL with the dev-first workflow naming scheme.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Danila Khodjaef
2026-07-07 12:37:21 +03:00
co-authored by Cursor
parent a2263ca186
commit 96285737f5
16 changed files with 73 additions and 75 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ if (fromProd) {
} else {
assertDevDatabase(config.database);
if (config.database.endsWith('_prod')) {
console.error('Refusing backup of production database without --prod. Use: npm run db:backup:prod');
console.error('Refusing backup of production database without --prod. Use: npm run prod:db:backup');
process.exit(1);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* Download artist portrait images from Wikipedia (and fallbacks) into data/images/portraits/.
* Run: npm run fetch-artist-images
* Run: npm run dev:fetch-artist-images
* Flags: --force (re-fetch even when portrait_path is set), --limit=N
*/
require('dotenv').config();
+6 -6
View File
@@ -4,11 +4,11 @@
* - Insert artist/movement influence sources from Influencedby, Teachers, Influencedon, Pupils
*
* Usage:
* npm run migrate:artist-palette
* npm run import-painter-palette # metadata + influences
* npm run import-painter-palette -- --dry-run
* npm run import-painter-palette -- --metadata-only
* npm run import-painter-palette -- --influences-only
* npm run dev:migrate:artist-palette
* npm run dev:import-painter-palette # metadata + influences
* npm run dev:import-painter-palette -- --dry-run
* npm run dev:import-painter-palette -- --metadata-only
* npm run dev:import-painter-palette -- --influences-only
*/
require('dotenv').config();
const pool = require('../server/db');
@@ -47,7 +47,7 @@ async function main() {
) AS ok
`);
if (!tableCheck.rows[0]?.ok) {
console.error('Run npm run migrate:artist-palette first.');
console.error('Run npm run dev:migrate:artist-palette first.');
process.exit(1);
}
+2 -2
View File
@@ -1,8 +1,8 @@
/**
* Restore a data-only backup (INSERT dumps from npm run db:backup) into a database.
* Restore a data-only backup (INSERT dumps from npm run dev:db:backup) into a database.
*
* Dev: node scripts/restore-db-data.js --file db/DataBackup/gallery_dev_data_....txt
* Prod: npm run db:restore:prod -- --file db/DataBackup/gallery_dev_data_....txt
* Prod: npm run devtoprod:db:restore -- --file db/DataBackup/gallery_dev_data_....txt
*/
const fs = require('fs');
const path = require('path');
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Curated eras, movements, and artist metadata for npm run seed.
* Curated eras, movements, and artist metadata for npm run dev:seed.
* Flagship paintings are resolved from art-influences-data.js and famous-paintings-data.js.
*/
const FAMOUS = require('./famous-paintings-data');
+5 -5
View File
@@ -1,6 +1,6 @@
/**
* Seed historical eras, art movements, artists, periods, and flagship paintings.
* Run: npm run seed
* Run: npm run dev:seed
* Flags: --force (re-seed), --fetch-images (download portraits and paintings from Wikipedia)
*/
require('dotenv').config();
@@ -180,12 +180,12 @@ async function main() {
console.log(` Portraits downloaded: ${stats.portraitsFetched}`);
console.log(` Painting images: ${stats.imagesFetched}`);
} else {
console.log(' Run with --fetch-images to download artwork files, or npm run fetch-images later.');
console.log(' Run with --fetch-images to download artwork files, or npm run dev:fetch-images later.');
}
console.log('\nNext steps:');
console.log(' npm run fetch-artist-bios');
console.log(' npm run expand-catalog');
console.log(' npm run update-influences');
console.log(' npm run dev:fetch-artist-bios');
console.log(' npm run dev:expand-catalog');
console.log(' npm run dev:update-influences');
}
main()
+4 -4
View File
@@ -2,7 +2,7 @@
* One-time split of legacy Gallery → gallery_prod + gallery_dev on TrueNAS PostgreSQL.
*
* Usage:
* PGPASSWORD=... PGHOST=192.168.10.122 PGUSER=postgres npm run db:split-databases
* PGPASSWORD=... PGHOST=192.168.10.122 PGUSER=postgres npm run infra:db:split-dev-prod
*
* Options:
* --copy pg_dump legacy → gallery_prod instead of rename
@@ -116,12 +116,12 @@ async function main() {
} else {
console.warn(`No legacy database (${LEGACY_DB_NAMES.join(' / ')}) or "${PROD_DB_NAME}" found`);
await createDatabaseIfMissing(admin, PROD_DB_NAME);
console.log('Run npm run migrate against gallery_prod to apply schema');
console.log('Run npm run dev:migrate against gallery_prod to apply schema');
}
if (!skipDev) {
await cloneDevFromProd(admin);
console.log(`Next on dev PC: set .env DB_NAME=${DEV_DB_NAME}, then npm run migrate`);
console.log(`Next on dev PC: set .env DB_NAME=${DEV_DB_NAME}, then npm run dev:migrate`);
}
await admin.end();
@@ -134,7 +134,7 @@ main().catch((error) => {
'Permission denied — the gallery user cannot rename databases.\n'
+ 'Use pgAdmin on the dev PC (recommended):\n'
+ ' Open db/split-dev-prod-pgadmin.sql → connect as postgres → run each STEP (F5)\n'
+ 'Or: PGUSER=postgres PGPASSWORD=... npm run db:split-databases\n'
+ 'Or: PGUSER=postgres PGPASSWORD=... npm run infra:db:split-dev-prod\n'
+ 'Or: psql -h 192.168.10.122 -U postgres -d postgres -f db/split-dev-prod.sql',
);
}
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* Align painting image_path / thumbnail_path with files on disk and import missing rows.
* Run: npm run sync-image-paths
* Run: npm run dev:sync-image-paths
* Flags: --dry-run (report only, no DB writes)
*/
require('dotenv').config();
+1 -1
View File
@@ -135,7 +135,7 @@ async function main() {
) AS ok
`);
if (!tableCheck.rows[0]?.ok) {
console.error('Run npm run migrate:influence-sources before update-influences.');
console.error('Run npm run dev:migrate:influence-sources before update-influences.');
process.exit(1);
}