Skip to content

Commit

Permalink
Merge pull request #1193 from OskarDamkjaer/canary
Browse files Browse the repository at this point in the history
Generate canary manifest
  • Loading branch information
OskarDamkjaer authored Sep 8, 2020
2 parents 96d96e0 + faef52c commit 4ec9e6a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 102 deletions.
9 changes: 9 additions & 0 deletions build_scripts/generate-manifest-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ function loadDataFromFile(file) {
}
}

function writeDataToFile(file, data) {
try {
fs.writeFileSync(file, JSON.stringify(data, null, 2))
} catch (e) {
throw new Error('Could not write to file: ' + file + '. Error: ' + e)
}
}

function buildTargetObject(data, dataProp) {
const out = {}
const keys = data[dataProp] || []
Expand All @@ -42,6 +50,7 @@ function mergeObjects(source, target) {

module.exports = {
loadDataFromFile,
writeDataToFile,
buildTargetObject,
mergeObjects
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"lint": "eslint --fix --ext .js --ext .jsx --ext .ts --ext .tsx ./",
"precommit": "lint-staged",
"prepare-jar": "node ./scripts/prepare-mvn-package.js",
"prepare-canary": "node ./scripts/prepare-canary.js",
"generate-canary-manifest": "node ./scripts/convert-to-canary-manifest.js",
"start": "cross-env NODE_ENV=development webpack-dev-server --colors --config ./build_scripts/webpack.config.js",
"starts": "cross-env NODE_ENV=development webpack-dev-server --https --colors --config ./build_scripts/webpack.config.js",
"start-prod": "cross-env NODE_ENV=production webpack-dev-server --colors --config ./build_scripts/webpack.config.js",
Expand Down
28 changes: 28 additions & 0 deletions scripts/convert-to-canary-manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const {
loadDataFromFile,
writeDataToFile
} = require('../build_scripts/generate-manifest-helpers')

const manifestPath = process.argv[2]
if (!manifestPath) {
console.error('Please provide path to the manifest to be replaced')
process.exit(1)
}

const manifest = loadDataFromFile(manifestPath)

const canaryManifest = {
...manifest,
...{
name: 'Neo4j Browser Canary',
short_name: 'Neo4j Browser Canary',
icons: [
{
src: './assets/images/device-icons/neo4j-desktop-canary.svg',
type: 'svg'
}
]
}
}

writeDataToFile(manifestPath, canaryManifest)
91 changes: 0 additions & 91 deletions scripts/prepare-canary.js

This file was deleted.

Binary file removed src/browser/images/device-icons/64x64-canary.png
Binary file not shown.
10 changes: 0 additions & 10 deletions src/browser/images/device-icons/canary_manifest.json

This file was deleted.

0 comments on commit 4ec9e6a

Please sign in to comment.