fix: Replace slugify in deploy-preview-netlify with simple regex solution (#1543)

Co-authored-by: saibotk <git@saibotk.de>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1543
Reviewed-by: konrad <k@knt.li>
Co-authored-by: saibotk <kolaente-dev@saibotk.de>
Co-committed-by: saibotk <kolaente-dev@saibotk.de>
This commit is contained in:
saibotk 2022-02-14 18:09:20 +00:00 committed by konrad
parent 17dc276971
commit 28af46bcd3
4 changed files with 9 additions and 11 deletions

View file

@ -83,7 +83,6 @@
"rollup": "2.67.2", "rollup": "2.67.2",
"rollup-plugin-visualizer": "5.5.4", "rollup-plugin-visualizer": "5.5.4",
"sass": "1.49.7", "sass": "1.49.7",
"slugify": "1.6.5",
"typescript": "4.5.5", "typescript": "4.5.5",
"vite": "2.7.13", "vite": "2.7.13",
"vite-plugin-pwa": "0.11.13", "vite-plugin-pwa": "0.11.13",

View file

@ -1,20 +1,24 @@
const slugify = require('slugify')
const {exec} = require('child_process') const {exec} = require('child_process')
const axios = require('axios') const axios = require('axios')
const BOT_USER_ID = 513 const BOT_USER_ID = 513
const giteaToken = process.env.GITEA_TOKEN const giteaToken = process.env.GITEA_TOKEN
const siteId = process.env.NETLIFY_SITE_ID const siteId = process.env.NETLIFY_SITE_ID
const branchSlug = slugify(process.env.DRONE_SOURCE_BRANCH) const branchSlug = String(process.env.DRONE_SOURCE_BRANCH)
.trim()
.normalize('NFKD')
.toLowerCase()
.replace(/[.\s/]/g, '-')
.replace(/[^A-Za-z\d-]/g, '')
const prNumber = process.env.DRONE_PULL_REQUEST const prNumber = process.env.DRONE_PULL_REQUEST
const prIssueCommentsUrl = `https://kolaente.dev/api/v1/repos/vikunja/frontend/issues/${prNumber}/comments` const prIssueCommentsUrl = `https://kolaente.dev/api/v1/repos/vikunja/frontend/issues/${prNumber}/comments`
const alias = `${prNumber}-${branchSlug}` const alias = `${prNumber}-${branchSlug}`.substring(0,37)
const fullPreviewUrl = `https://${alias}--vikunja-frontend-preview.netlify.app` const fullPreviewUrl = `https://${alias}--vikunja-frontend-preview.netlify.app`
const promiseExec = cmd => { const promiseExec = cmd => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
exec(cmd, (error, stdout, stderr) => { exec(cmd, (error, stdout) => {
if (error) { if (error) {
reject(error) reject(error)
return return

View file

@ -1 +1 @@
55ce0faaa2c1919341617ccfaeccbb6029ac12107964ff488985cff13dd952f1a991df3ab0d4b0705deb761e508e6434 ./scripts/deploy-preview-netlify.js bb46342a0a08105b340ba7976cff9d80ef89901120ec0639669caa70bb7d2dbc43e78b1f635a7654ab2456e8358c98a4 ./scripts/deploy-preview-netlify.js

View file

@ -11663,11 +11663,6 @@ slice-ansi@^5.0.0:
ansi-styles "^6.0.0" ansi-styles "^6.0.0"
is-fullwidth-code-point "^4.0.0" is-fullwidth-code-point "^4.0.0"
slugify@1.6.5:
version "1.6.5"
resolved "https://registry.yarnpkg.com/slugify/-/slugify-1.6.5.tgz#c8f5c072bf2135b80703589b39a3d41451fbe8c8"
integrity sha512-8mo9bslnBO3tr5PEVFzMPIWwWnipGS0xVbYf65zxDqfNwmzYn1LpiKNrR6DlClusuvo+hDHd1zKpmfAe83NQSQ==
snake-case@3.0.4: snake-case@3.0.4:
version "3.0.4" version "3.0.4"
resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c" resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c"