UNPKG

1.05 kBPlain TextView Raw
1
2
3
4/**
5 * the resolved assets path is the path ot the assets folder in the running environment
6 */
7export const resolveAssetsPath = (buildPath: string, serverName: string, assetsPath: string) => {
8 const path = require('path');
9
10 const resolvedPath = path.resolve(buildPath, serverName, assetsPath);
11
12 return !resolvedPath.endsWith("/") ? resolvedPath+"/" : resolvedPath;
13};
14
15
16export const getStaticBucketName = (accountId: string, stackName: string, assetsPath: string | undefined, stage: string) => {
17 return `infrcomp-${accountId}-${stackName}-${assetsPath !== undefined ? assetsPath+"-" : ""}${stage}`;
18}
19
20
21export const getBasename = () => {
22
23 // first check whether we are a client
24 if (typeof window != 'undefined' && window.__BASENAME__) {
25 return window.__BASENAME__;
26
27 // we do not delete the basename here, because we may need it at different places
28 //delete window.__BASENAME__;
29 }
30
31 return process.env.STAGE_PATH && process.env.STAGE_PATH !== "undefined" ?
32 "/"+process.env.STAGE_PATH : "/";
33};
\No newline at end of file