#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 source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const fs = require('fs');
const $ = gulpLoadPlugins()
@ -128,8 +129,20 @@ gulp.task('images', () => {
})
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($.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({
showFiles: true,
}))

69
package-lock.json generated
View file

@ -2099,6 +2099,12 @@
"integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==",
"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": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
@ -3886,6 +3892,12 @@
"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": {
"version": "1.3.545",
"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"
}
},
"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": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-3.0.0.tgz",
@ -5495,6 +5495,17 @@
"integrity": "sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==",
"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": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-4.1.0.tgz",
@ -6582,6 +6593,17 @@
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
"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": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz",
@ -6849,12 +6871,6 @@
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
"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": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
@ -9022,6 +9038,17 @@
"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": {
"version": "2.88.2",
"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": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",

View file

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

View file

@ -1,33 +1,19 @@
{
"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",
"homepage_url": "https://github.com/Serraniel/EnhancedAniwatch",
"content_scripts": [{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"utils/colors.js",
"utils/helpers.js",
"utils/aniwatchCore.js"
],
"run_at": "document_start"
},
{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"enhancements/quickSearch.js",
"enhancements/animeRequests.js",
"enhancements/lists.js"
],
"run_at": "document_end"
}
]
}
{
"name": "$name",
"short_name": "$shortName",
"version": "$version",
"version_name": "$semanticVersion",
"description": "$description",
"manifest_version": 2,
"author": "$author",
"homepage_url": "$homepageURL",
"content_scripts": [{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"javascript/app.min.js"
],
"run_at": "document_start"
}]
}

View file

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

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",
"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.",
"name": "$name",
"short_name": "$shortName",
"version": "$version",
"version_name": "$semanticVersion",
"description": "$description",
"manifest_version": 2,
"author": "Serraniel",
"developer": "Serraniel and contributors",
"homepage_url": "https://github.com/Serraniel/EnhancedAniwatch",
"author": "$author",
"developer": "$developer",
"homepage_url": "$homepageURL",
"content_scripts": [{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"utils/colors.js",
"utils/helpers.js",
"utils/aniwatchCore.js"
],
"run_at": "document_start"
},
{
"matches": [
"*://aniwatch.me/*"
],
"js": [
"enhancements/quickSearch.js",
"enhancements/animeRequests.js",
"enhancements/lists.js"
],
"run_at": "document_end"
}
]
"matches": [
"*://aniwatch.me/*"
],
"js": [
"javascript/app.min.js"
],
"run_at": "document_start"
}]
}