#35 Changed manifests to template system

Including a template file and replacing of variables in buildscripts
This commit is contained in:
Serraniel 2020-08-26 20:52:15 +02:00
parent df33bdfa84
commit 2a6af16ea5
Signed by: Serraniel
GPG key ID: 3690B4E7364525D3
7 changed files with 137 additions and 112 deletions

View file

@ -7,6 +7,7 @@ const browserify = require('browserify');
const babelify = require('babelify'); const babelify = require('babelify');
const source = require('vinyl-source-stream'); const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer'); const buffer = require('vinyl-buffer');
const fs = require('fs');
const $ = gulpLoadPlugins() const $ = gulpLoadPlugins()
@ -128,8 +129,20 @@ gulp.task('images', () => {
}) })
gulp.task('manifests', () => { gulp.task('manifests', () => {
return gulp.src(`${src.manifests}/**/*.json`) const templateFile = `${src.manifests}/manifest.template.json`;
let template = JSON.parse(fs.readFileSync(templateFile))
return gulp.src(`${src.manifests}/**/!(*.template).json`)
.pipe($.plumber()) .pipe($.plumber())
.pipe($.replace('$name', template.name))
.pipe($.replace('$shortName', template.short_name))
.pipe($.replace('$version', template.version))
.pipe($.replace('$semanticVersion', template.version_name))
.pipe($.replace('$description', template.description))
.pipe($.replace('$author', template.author))
.pipe($.replace('$developer', template.developer))
.pipe($.replace('$homepageURL', template.homepage_url))
.pipe($.size({ .pipe($.size({
showFiles: true, showFiles: true,
})) }))

69
package-lock.json generated
View file

@ -2099,6 +2099,12 @@
"integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==",
"dev": true "dev": true
}, },
"binaryextensions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-2.3.0.tgz",
"integrity": "sha512-nAihlQsYGyc5Bwq6+EsubvANYGExeJKHDO3RjnvwU042fawQTQfM3Kxn7IHUXQOz4bzfwsGYYHGSvXyW4zOGLg==",
"dev": true
},
"bindings": { "bindings": {
"version": "1.5.0", "version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
@ -3886,6 +3892,12 @@
"safer-buffer": "^2.1.0" "safer-buffer": "^2.1.0"
} }
}, },
"editions": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz",
"integrity": "sha512-gzao+mxnYDzIysXKMQi/+M1mjy/rjestjg6OPoYTtI+3Izp23oiGZitsl9lPDPiTGXbcSIk1iJWhliSaglxnUg==",
"dev": true
},
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.545", "version": "1.3.545",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.545.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.545.tgz",
@ -5200,18 +5212,6 @@
"vinyl-sourcemaps-apply": "^0.2.0" "vinyl-sourcemaps-apply": "^0.2.0"
} }
}, },
"gulp-better-rollup": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/gulp-better-rollup/-/gulp-better-rollup-4.0.1.tgz",
"integrity": "sha512-oUGrMd+p9umBPoIPYVDxFT4EwCzywh3o8q++eswJyAxrRgYCEM6OOGGxJLG+AmzzjEoiq0cc/ndgF5SH2qW3Fg==",
"dev": true,
"requires": {
"lodash.camelcase": "^4.3.0",
"plugin-error": "^1.0.1",
"vinyl": "^2.1.0",
"vinyl-sourcemaps-apply": "^0.2.1"
}
},
"gulp-if": { "gulp-if": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz", "resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz",
@ -5495,6 +5495,17 @@
"integrity": "sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==", "integrity": "sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==",
"dev": true "dev": true
}, },
"gulp-replace": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.0.0.tgz",
"integrity": "sha512-lgdmrFSI1SdhNMXZQbrC75MOl1UjYWlOWNbNRnz+F/KHmgxt3l6XstBoAYIdadwETFyG/6i+vWUSCawdC3pqOw==",
"dev": true,
"requires": {
"istextorbinary": "2.2.1",
"readable-stream": "^2.0.1",
"replacestream": "^4.0.0"
}
},
"gulp-sass": { "gulp-sass": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-4.1.0.tgz", "resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-4.1.0.tgz",
@ -6582,6 +6593,17 @@
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
"dev": true "dev": true
}, },
"istextorbinary": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-2.2.1.tgz",
"integrity": "sha512-TS+hoFl8Z5FAFMK38nhBkdLt44CclNRgDHWeMgsV8ko3nDlr/9UI2Sf839sW7enijf8oKsZYXRvM8g0it9Zmcw==",
"dev": true,
"requires": {
"binaryextensions": "2",
"editions": "^1.3.3",
"textextensions": "2"
}
},
"isurl": { "isurl": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz",
@ -6849,12 +6871,6 @@
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
"dev": true "dev": true
}, },
"lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=",
"dev": true
},
"lodash.memoize": { "lodash.memoize": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
@ -9022,6 +9038,17 @@
"remove-trailing-separator": "^1.1.0" "remove-trailing-separator": "^1.1.0"
} }
}, },
"replacestream": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz",
"integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==",
"dev": true,
"requires": {
"escape-string-regexp": "^1.0.3",
"object-assign": "^4.0.1",
"readable-stream": "^2.0.2"
}
},
"request": { "request": {
"version": "2.88.2", "version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
@ -10213,6 +10240,12 @@
} }
} }
}, },
"textextensions": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/textextensions/-/textextensions-2.6.0.tgz",
"integrity": "sha512-49WtAWS+tcsy93dRt6P0P3AMD2m5PvXRhuEA0kaXos5ZLlujtYmpmFsB+QvWUSxE1ZsstmYXfQ7L40+EcQgpAQ==",
"dev": true
},
"through": { "through": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",

View file

@ -28,6 +28,7 @@
"gulp-plumber": "^1.2.1", "gulp-plumber": "^1.2.1",
"gulp-postcss": "^8.0.0", "gulp-postcss": "^8.0.0",
"gulp-rename": "^2.0.0", "gulp-rename": "^2.0.0",
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.1.0", "gulp-sass": "^4.1.0",
"gulp-size": "^3.0.0", "gulp-size": "^3.0.0",
"gulp-sourcemaps": "^2.6.5", "gulp-sourcemaps": "^2.6.5",
@ -50,4 +51,4 @@
"url": "https://github.com/Serraniel/EnhancedAniwatch/issues" "url": "https://github.com/Serraniel/EnhancedAniwatch/issues"
}, },
"homepage": "https://github.com/Serraniel/EnhancedAniwatch#readme" "homepage": "https://github.com/Serraniel/EnhancedAniwatch#readme"
} }

View file

@ -1,33 +1,19 @@
{ {
"name": "Enhanced Aniwatch", "name": "$name",
"short_name": "Enhanced Ani", "short_name": "$shortName",
"version": "0.1.0.0", "version": "$version",
"version_name": "0.1 Beta", "version_name": "$semanticVersion",
"description": "Enhanced Aniwatch is a slim extension which provides several UI improvments for https://aniwatch.me.", "description": "$description",
"manifest_version": 2, "manifest_version": 2,
"author": "Serraniel", "author": "$author",
"homepage_url": "https://github.com/Serraniel/EnhancedAniwatch", "homepage_url": "$homepageURL",
"content_scripts": [{ "content_scripts": [{
"matches": [ "matches": [
"*://aniwatch.me/*" "*://aniwatch.me/*"
], ],
"js": [ "js": [
"utils/colors.js", "javascript/app.min.js"
"utils/helpers.js", ],
"utils/aniwatchCore.js" "run_at": "document_start"
], }]
"run_at": "document_start" }
},
{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"enhancements/quickSearch.js",
"enhancements/animeRequests.js",
"enhancements/lists.js"
],
"run_at": "document_end"
}
]
}

View file

@ -1,33 +1,19 @@
{ {
"name": "Enhanced Aniwatch", "name": "$name",
"short_name": "Enhanced Ani", "short_name": "$shortName",
"version": "0.1.0.0", "version": "$version",
"description": "Enhanced Aniwatch is a slim extension which provides several UI improvments for https://aniwatch.me.", "description": "$description",
"manifest_version": 2, "manifest_version": 2,
"author": "Serraniel", "author": "$author",
"developer": "Serraniel and contributors", "developer": "$developer",
"homepage_url": "https://github.com/Serraniel/EnhancedAniwatch", "homepage_url": "$homepageURL",
"content_scripts": [{ "content_scripts": [{
"matches": [ "matches": [
"*://aniwatch.me/*" "*://aniwatch.me/*"
], ],
"js": [ "js": [
"utils/colors.js", "javascript/app.min.js"
"utils/helpers.js", ],
"utils/aniwatchCore.js" "run_at": "document_start"
], }]
"run_at": "document_start"
},
{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"enhancements/quickSearch.js",
"enhancements/animeRequests.js",
"enhancements/lists.js"
],
"run_at": "document_end"
}
]
} }

View file

@ -0,0 +1,20 @@
{
"name": "Enhanced Aniwatch",
"short_name": "Enhanced Ani",
"version": "0.1.0.0",
"version_name": "0.1 Beta",
"description": "Enhanced Aniwatch is a slim extension which provides several UI improvments for https://aniwatch.me.",
"manifest_version": 2,
"author": "Serraniel",
"developer": "Serraniel and contributors",
"homepage_url": "https://github.com/Serraniel/EnhancedAniwatch",
"content_scripts": [{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"javascript/app.min.js"
],
"run_at": "document_start"
}]
}

View file

@ -1,34 +1,20 @@
{ {
"name": "Enhanced Aniwatch", "name": "$name",
"short_name": "Enhanced Ani", "short_name": "$shortName",
"version": "0.1.0.0", "version": "$version",
"version_name": "0.1 Beta", "version_name": "$semanticVersion",
"description": "Enhanced Aniwatch is a slim extension which provides several UI improvments for https://aniwatch.me.", "description": "$description",
"manifest_version": 2, "manifest_version": 2,
"author": "Serraniel", "author": "$author",
"developer": "Serraniel and contributors", "developer": "$developer",
"homepage_url": "https://github.com/Serraniel/EnhancedAniwatch", "homepage_url": "$homepageURL",
"content_scripts": [{ "content_scripts": [{
"matches": [ "matches": [
"*://aniwatch.me/*" "*://aniwatch.me/*"
], ],
"js": [ "js": [
"utils/colors.js", "javascript/app.min.js"
"utils/helpers.js", ],
"utils/aniwatchCore.js" "run_at": "document_start"
], }]
"run_at": "document_start"
},
{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"enhancements/quickSearch.js",
"enhancements/animeRequests.js",
"enhancements/lists.js"
],
"run_at": "document_end"
}
]
} }