-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevcheck.mjs
More file actions
64 lines (59 loc) · 2.52 KB
/
Copy pathdevcheck.mjs
File metadata and controls
64 lines (59 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
*
* @Project: @cldmv/droidsock
* @Filename: /devcheck.mjs
* @Date: 2025-11-08T22:18:57-08:00 (1762669137)
* @Author: Nate Corcoran <CLDMV>
* @Email: <Shinrai@users.noreply.github.com>
* -----
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
* @Last modified time: 2026-10-02T15:29:45-07:00 (1790980185)
* -----
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
*
*/
import { existsSync } from "node:fs";
import { fileURLToPath } from "node:url";
import path from "node:path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const srcPath = path.join(__dirname, "src");
// const distPath = path.join(__dirname, "dist");
// Detect if we're running in a CI environment
const isCI = !!(
process.env.CI || // Generic CI flag
process.env.GITHUB_ACTIONS || // GitHub Actions
process.env.TRAVIS || // Travis CI
process.env.CIRCLECI || // CircleCI
process.env.GITLAB_CI || // GitLab CI
process.env.BUILDKITE || // Buildkite
process.env.JENKINS_URL || // Jenkins
process.env.TF_BUILD // Azure DevOps
);
if (existsSync(srcPath) && !isCI) {
// if (existsSync(srcPath) && !existsSync(distPath)) {
// NODE_ENV plays no part in Node's conditional-exports resolution - only the
// "--conditions=droidsock-dev" condition (via NODE_OPTIONS) actually routes
// exports["./main"] to src/ instead of dist/. NODE_ENV=development alone
// would previously pass this check while still resolving to dist/.
const hasNodeOptions = process.env.NODE_OPTIONS?.includes("--conditions=droidsock-dev");
if (!hasNodeOptions) {
console.error("❌ Development environment not properly configured!");
console.error("📁 Source folder detected but NODE_OPTIONS is not set for development.");
console.error("");
console.error("🔧 To fix this, run one of these commands:");
console.error(" Windows (cmd):");
console.error(" set NODE_OPTIONS=--conditions=droidsock-dev");
console.error("");
console.error(" Windows (PowerShell):");
console.error(" $env:NODE_OPTIONS='--conditions=droidsock-dev'");
console.error("");
console.error(" Unix/Linux/macOS:");
console.error(" export NODE_OPTIONS=--conditions=droidsock-dev");
console.error("");
console.error("💡 This ensures this module loads from src/ instead of dist/ for development.");
console.error(" (NODE_ENV is not checked here - it has no effect on this resolution.)");
console.error("🚀 CI environments automatically skip this check.");
process.exit(1);
}
}