@driveflux/vercel 3.0.0 → 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.
@@ -1,33 +1,36 @@
1
1
  import crypto from 'node:crypto';
2
- var slugify = function(str) {
3
- var slug = str.toLowerCase() // Convert to lowercase
4
- .replace(/\//, '-') // replace one forward slash with hyphen
5
- .replace(/[^a-z0-9-]/g, '') // Replace any non-alphanumeric characters with hyphens
6
- .replace(/-+/g, '-') // Replace any consecutive hyphens with a single hyphen
7
- .replace(/^-|-$/g, '') // Remove any leading or trailing hyphens
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 var truncate = function(prefix, branch, projectName, org) {
12
- var branchSlug = slugify(branch);
13
- var deploymentName = "".concat(projectName, "-").concat(prefix, "-").concat(branchSlug, "-").concat(org);
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 "https://".concat(deploymentName, ".vercel.app");
15
+ return `https://${deploymentName}.vercel.app`;
16
16
  }
17
- var hash = crypto.createHash('sha256').update("git-".concat(branch).concat(projectName)).digest('hex').slice(0, 6);
18
- var suffix = "".concat(hash.slice(0, 6), "-").concat(org);
19
- var truncatedName = deploymentName.slice(0, 61 - suffix.length);
20
- return "https://".concat(truncatedName, "-").concat(suffix, ".vercel.app");
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 var buildVercelUrl = function(projectName, branchName) {
23
- var scopeSlug = 'driveflux';
24
- var prefix = 'git';
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 var isPreviewButNotStaging = function() {
28
- var KNOWN_BRANCHES = [
29
- 'develop',
30
- 'master'
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
@@ -1,2 +1,3 @@
1
1
  // TODO ask aladin what is required for this
2
2
  export default {};
3
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driveflux/vercel",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -16,14 +16,14 @@
16
16
  "dist"
17
17
  ],
18
18
  "devDependencies": {
19
- "@driveflux/fab": "4.0.0",
20
- "@driveflux/tsconfig": "3.0.0",
21
- "@swc/cli": "^0.7.8",
22
- "@swc/core": "^1.13.5",
23
- "@types/lodash": "^4.17.20",
24
- "@types/node": "^24.9.1",
19
+ "@driveflux/fab": "4.0.2",
20
+ "@driveflux/tsconfig": "3.0.2",
21
+ "@swc/cli": "^0.8.1",
22
+ "@swc/core": "^1.15.33",
23
+ "@types/lodash": "^4.17.24",
24
+ "@types/node": "^25.9.1",
25
25
  "del-cli": "^7.0.0",
26
- "typescript": "^5.9.3"
26
+ "typescript": "^6.0.3"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "fab",