@driveflux/vercel 3.0.1 → 3.0.2
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/dist/deployment/build-vercel-url.js +27 -24
- package/dist/index.js +1 -0
- package/package.json +4 -4
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
import crypto from 'node:crypto';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const slugify = (str) => {
|
|
3
|
+
const slug = str
|
|
4
|
+
.toLowerCase() // Convert to lowercase
|
|
5
|
+
.replace(/\//, '-') // replace one forward slash with hyphen
|
|
6
|
+
.replace(/[^a-z0-9-]/g, '') // Replace any non-alphanumeric characters with hyphens
|
|
7
|
+
.replace(/-+/g, '-') // Replace any consecutive hyphens with a single hyphen
|
|
8
|
+
.replace(/^-|-$/g, ''); // Remove any leading or trailing hyphens
|
|
9
9
|
return slug;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const truncate = (prefix, branch, projectName, org) => {
|
|
12
|
+
const branchSlug = slugify(branch);
|
|
13
|
+
const deploymentName = `${projectName}-${prefix}-${branchSlug}-${org}`;
|
|
14
14
|
if (deploymentName.length < 64) {
|
|
15
|
-
return
|
|
15
|
+
return `https://${deploymentName}.vercel.app`;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const hash = crypto
|
|
18
|
+
.createHash('sha256')
|
|
19
|
+
.update(`git-${branch}${projectName}`)
|
|
20
|
+
.digest('hex')
|
|
21
|
+
.slice(0, 6);
|
|
22
|
+
const suffix = `${hash.slice(0, 6)}-${org}`;
|
|
23
|
+
const truncatedName = deploymentName.slice(0, 61 - suffix.length);
|
|
24
|
+
return `https://${truncatedName}-${suffix}.vercel.app`;
|
|
21
25
|
};
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
export const buildVercelUrl = (projectName, branchName) => {
|
|
27
|
+
const scopeSlug = 'driveflux';
|
|
28
|
+
const prefix = 'git';
|
|
25
29
|
return truncate(prefix, branchName, projectName, scopeSlug);
|
|
26
30
|
};
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
];
|
|
32
|
-
return !!process.env.VERCEL_GIT_COMMIT_REF && !KNOWN_BRANCHES.includes(process.env.VERCEL_GIT_COMMIT_REF);
|
|
31
|
+
export const isPreviewButNotStaging = () => {
|
|
32
|
+
const KNOWN_BRANCHES = ['develop', 'master'];
|
|
33
|
+
return (!!process.env.VERCEL_GIT_COMMIT_REF &&
|
|
34
|
+
!KNOWN_BRANCHES.includes(process.env.VERCEL_GIT_COMMIT_REF));
|
|
33
35
|
};
|
|
36
|
+
//# sourceMappingURL=build-vercel-url.js.map
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driveflux/vercel",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@driveflux/fab": "4.0.
|
|
20
|
-
"@driveflux/tsconfig": "3.0.
|
|
19
|
+
"@driveflux/fab": "4.0.2",
|
|
20
|
+
"@driveflux/tsconfig": "3.0.2",
|
|
21
21
|
"@swc/cli": "^0.8.1",
|
|
22
22
|
"@swc/core": "^1.15.33",
|
|
23
23
|
"@types/lodash": "^4.17.24",
|
|
24
|
-
"@types/node": "^25.
|
|
24
|
+
"@types/node": "^25.9.1",
|
|
25
25
|
"del-cli": "^7.0.0",
|
|
26
26
|
"typescript": "^6.0.3"
|
|
27
27
|
},
|