diff --git a/branding.json b/branding.json index 659570ef378e..e9028555d02a 100644 --- a/branding.json +++ b/branding.json @@ -7,4 +7,4 @@ "faviconIco": "branding/favicon.ico", "pwaIcon192": "branding/pwa-icon-192.png", "pwaIcon512": "branding/pwa-icon-512.png" -} \ No newline at end of file +} diff --git a/branding/favicon.ico b/branding/favicon.ico index 509384d93087..e721447bd9d1 100644 Binary files a/branding/favicon.ico and b/branding/favicon.ico differ diff --git a/branding/favicon.svg b/branding/favicon.svg new file mode 100644 index 000000000000..45388729b6b4 --- /dev/null +++ b/branding/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/branding/logo.svg b/branding/logo.svg index 12cbb1008dc1..45388729b6b4 100644 --- a/branding/logo.svg +++ b/branding/logo.svg @@ -1,2 +1 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/branding/pwa-icon-192.png b/branding/pwa-icon-192.png index 9a1da9af0992..a6ee503115d8 100644 Binary files a/branding/pwa-icon-192.png and b/branding/pwa-icon-192.png differ diff --git a/branding/pwa-icon-512.png b/branding/pwa-icon-512.png index 8ffb7f2d8355..ff42978ce9a5 100644 Binary files a/branding/pwa-icon-512.png and b/branding/pwa-icon-512.png differ diff --git a/ci/dev/apply-branding.js b/ci/dev/apply-branding.js index e72dacd2912f..3e25fb08e95f 100644 --- a/ci/dev/apply-branding.js +++ b/ci/dev/apply-branding.js @@ -1,66 +1,137 @@ -const fs = require('fs'); -const path = require('path'); +const fs = require("fs") +const path = require("path") -const branding = require('../../branding.json'); -const root = path.resolve(__dirname, '../..'); +const branding = require("../../branding.json") +const root = path.resolve(__dirname, "../..") const replacements = [ { - files: ['ci/build/nfpm.yaml'], + files: ["ci/build/nfpm.yaml"], from: [/vendor: "Coder"/g, /homepage: "https:\/\/github.com\/coder\/code-server"/g, /maintainer: ".*"/g], - to: [`vendor: "${branding.companyName}"`, `homepage: "https://${branding.companyDomain}"`, `maintainer: "community@${branding.companyDomain}"`], + to: [ + `vendor: "${branding.companyName}"`, + `homepage: "https://${branding.companyDomain}"`, + `maintainer: "community@${branding.companyDomain}"`, + ], }, { - files: ['package.json'], - from: [/"homepage": "https:\/\/github.com\/coder\/code-server"/g, /"url": "https:\/\/github.com\/coder\/code-server\/issues"/g, /"repository": "https:\/\/github.com\/coder\/code-server"/g], - to: [`"homepage": "https://${branding.companyDomain}"`, `"url": "https://${branding.companyDomain}/issues"`, `"repository": "https://${branding.companyDomain}"`], + files: ["package.json"], + from: [ + /"homepage": "https:\/\/github.com\/coder\/code-server"/g, + /"url": "https:\/\/github.com\/coder\/code-server\/issues"/g, + /"repository": "https:\/\/github.com\/coder\/code-server"/g, + ], + to: [ + `"homepage": "https://${branding.companyDomain}"`, + `"url": "https://${branding.companyDomain}/issues"`, + `"repository": "https://${branding.companyDomain}"`, + ], }, { - files: ['src/browser/pages/login.html', 'src/browser/pages/error.html'], + files: ["src/browser/pages/login.html", "src/browser/pages/error.html"], from: [/code-server<\/title>/g, /<meta id="coder-options"/g], to: [`<title>${branding.productName}`, ` { + json.shortName = branding.productName + json.longName = branding.productName + json.applicationName = branding.productName.toLowerCase().replace(/[^a-z0-9-]/g, "-") + json.dataFolderName = `${branding.productName}-data` + json.urlProtocol = branding.productName.toLowerCase() + json.reportIssueUrl = `https://${branding.companyDomain}/support` + json.documentationUrl = `https://${branding.companyDomain}` + json.vendor = branding.companyName + }) + } +} function applyReplacements() { - console.log('Applying branding...'); + console.log("Applying branding…") for (const { files, from, to } of replacements) { for (const file of files) { - const filePath = path.join(root, file); - let content = fs.readFileSync(filePath, 'utf8'); - for (let i = 0; i < from.length; i++) { - content = content.replace(from[i], to[i]); + const filePath = path.join(root, file) + let content = fs.readFileSync(filePath, "utf8") + for (let i = 0; i < from.length; i += 1) { + content = content.replace(from[i], to[i]) } - fs.writeFileSync(filePath, content, 'utf8'); + fs.writeFileSync(filePath, content, "utf8") } } for (const asset of assetReplacements) { - const fromPath = path.join(root, asset.from); - const toPath = path.join(root, asset.to); + const fromPath = path.join(root, asset.from) + const toPath = path.join(root, asset.to) if (fs.existsSync(fromPath)) { - fs.copyFileSync(fromPath, toPath); + fs.copyFileSync(fromPath, toPath) } } - console.log('Branding applied successfully.'); + + applyBrandingToReleaseArtifacts() + console.log("Branding applied successfully.") } -applyReplacements(); \ No newline at end of file +applyReplacements()