@realtek/core-theme 0.0.67 → 0.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realtek/core-theme",
3
- "version": "0.0.67",
3
+ "version": "0.0.69",
4
4
  "type": "module",
5
5
  "description": "RealTek CORE-THEME — shared React component & admin-screen library (AddFormV1, EditFormV1, ListView, DetailViewV1, ...).",
6
6
  "license": "UNLICENSED",
@@ -3,11 +3,17 @@
3
3
  import process from 'node:process';
4
4
  import { existsSync, readFileSync, writeFileSync } from 'node:fs';
5
5
  import { resolve as resolvePath } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
6
7
  import { createInterface } from 'node:readline/promises';
7
8
  import { stdin as input, stdout as output } from 'node:process';
8
9
  import { MongoClient, ObjectId } from 'mongodb';
9
10
 
10
11
  const INIT_MARKER_FILENAME = '.core-theme-mongodb-init.json';
12
+
13
+ function isRunningFromOwnRepo() {
14
+ const scriptPath = fileURLToPath(import.meta.url);
15
+ return !scriptPath.split(/[\\/]/).includes('node_modules');
16
+ }
11
17
  const DEFAULT_MONGO_URI = '';
12
18
  const DEFAULT_ADMIN_EMAIL = 'admin@example.com';
13
19
  const DEFAULT_ADMIN_PASSWORD_HASH = '$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy';
@@ -788,6 +794,11 @@ async function main() {
788
794
  return;
789
795
  }
790
796
 
797
+ if (options.postinstall && isRunningFromOwnRepo()) {
798
+ log('SKIPPED : running inside the core-theme package repo itself (not installed as a dependency)');
799
+ return;
800
+ }
801
+
791
802
  if (!options.force && hasCompletedInit()) {
792
803
  log(`SKIPPED : already initialized (see ${INIT_MARKER_FILENAME})`);
793
804
  log('RE-RUN : npx core-theme-init-mongodb --force');