Files
dealplustech/node_modules/@astrojs/telemetry/dist/project-info.js
Kunthawat 5171a789e9 fix: Final restoration with port 80
 COMPLETED:
1. Dockerfile uses port 80 (astro preview)
2. BaseLayout imports globals.css
3. globals.css with Tailwind v4 @theme syntax
4. index.astro has Header, Footer, FixedContact
5. All image references fixed to existing files
6. Hero uses hdpe_pipe_main.jpg
7. Product cards use hdpe001.jpg
8. pt-20 on main for fixed header

 TESTED LOCALLY:
- Build: 15 pages in 1.27s
- Docker build successful
- Port 80 working
- Images load
- CSS works

Ready for Easypanel deployment.
2026-03-12 08:58:56 +07:00

56 lines
1.3 KiB
JavaScript

import { execSync } from "node:child_process";
import { createHash } from "node:crypto";
import detectPackageManager from "which-pm-runs";
function createAnonymousValue(payload) {
if (payload === "") {
return payload;
}
const hash = createHash("sha256");
hash.update(payload);
return hash.digest("hex");
}
function getProjectIdFromGit() {
try {
const originBuffer = execSync(`git rev-list --max-parents=0 HEAD`, {
timeout: 500,
stdio: ["ignore", "pipe", "ignore"]
});
return String(originBuffer).trim();
} catch (_) {
return null;
}
}
function getProjectId(isCI) {
const projectIdFromGit = getProjectIdFromGit();
if (projectIdFromGit) {
return {
isGit: true,
anonymousProjectId: createAnonymousValue(projectIdFromGit)
};
}
const cwd = process.cwd();
const isCwdGeneric = (cwd.match(/[/|\\]/g) || []).length === 1;
if (isCI || isCwdGeneric) {
return {
isGit: false,
anonymousProjectId: void 0
};
}
return {
isGit: false,
anonymousProjectId: createAnonymousValue(cwd)
};
}
function getProjectInfo(isCI) {
const projectId = getProjectId(isCI);
const packageManager = detectPackageManager();
return {
...projectId,
packageManager: packageManager?.name,
packageManagerVersion: packageManager?.version
};
}
export {
getProjectInfo
};