plugins prepare enhanced

- split Plugins in Plugins & DocsPlugins
- created docs-prepare & install npm script
- renamed prepare npm script to prepare-release
- updated .npmignore
This commit is contained in:
REJack 2019-09-19 09:02:07 +02:00
parent 3607ed15ed
commit 4454f712ff
No known key found for this signature in database
GPG key ID: 9F3976CC630CC888
7 changed files with 113 additions and 51 deletions

View file

@ -1,2 +1,3 @@
/docs/
/plugins/
!/plugins/flot-old/

46
build/npm/DocsPlugins.js Normal file
View file

@ -0,0 +1,46 @@
const Plugins = [
// AdminLTE Dist
{
from: 'dist/css/',
to : 'docs/assets/css/'
},
{
from: 'dist/js/',
to : 'docs/assets/js/'
},
// jQuery
{
from: 'node_modules/jquery/dist/',
to : 'docs/assets/plugins/jquery/'
},
// Popper
{
from: 'node_modules/popper.js/dist/',
to : 'docs/assets/plugins/popper/'
},
// Bootstrap
{
from: 'node_modules/bootstrap/dist/js/',
to : 'docs/assets/plugins/bootstrap/js/'
},
// Font Awesome
{
from: 'node_modules/@fortawesome/fontawesome-free/css/',
to : 'docs/assets/plugins/fontawesome-free/css/'
},
{
from: 'node_modules/@fortawesome/fontawesome-free/webfonts/',
to : 'docs/assets/plugins/fontawesome-free/webfonts/'
},
// overlayScrollbars
{
from: 'node_modules/overlayscrollbars/js/',
to : 'docs/assets/plugins/overlayScrollbars/js/'
},
{
from: 'node_modules/overlayscrollbars/css/',
to : 'docs/assets/plugins/overlayScrollbars/css/'
}
]
module.exports = Plugins

43
build/npm/DocsPublish.js Normal file
View file

@ -0,0 +1,43 @@
const Plugins = require('./DocsPlugins')
const fse = require('fs-extra')
class Publish {
constructor() {
this.options = {
verbose: false
}
this.getArguments()
}
getArguments() {
if (process.argv.length > 2) {
let arg = process.argv[2]
switch (arg) {
case '-v':
case '--verbose':
this.options.verbose = true
break
default:
throw new Error(`Unknown option ${arg}`)
}
}
}
run() {
// Publish files
Plugins.forEach((module) => {
try {
fse.copySync(module.from, module.to)
if (this.options.verbose) {
console.log(`Copied ${module.from} to ${module.to}`)
}
} catch (err) {
console.error(`Error: ${err}`)
}
})
}
}
(new Publish()).run()

View file

@ -384,49 +384,6 @@ const Plugins = [
from: 'node_modules/bootstrap-switch/dist',
to: 'plugins/bootstrap-switch/'
},
// AdminLTE Dist
{
from: 'dist/css',
to : 'docs/assets/css'
},
{
from: 'dist/js',
to : 'docs/assets/js'
},
// jQuery
{
from: 'node_modules/jquery/dist',
to : 'docs/assets/plugins/jquery'
},
// Popper
{
from: 'node_modules/popper.js/dist',
to : 'docs/assets/plugins/popper'
},
// Bootstrap
{
from: 'node_modules/bootstrap/dist/js',
to : 'docs/assets/plugins/bootstrap/js'
},
// Font Awesome
{
from: 'node_modules/@fortawesome/fontawesome-free/css',
to : 'docs/assets/plugins/fontawesome-free/css'
},
{
from: 'node_modules/@fortawesome/fontawesome-free/webfonts',
to : 'docs/assets/plugins/fontawesome-free/webfonts'
},
// overlayScrollbars
{
from: 'node_modules/overlayscrollbars/js',
to : 'docs/assets/plugins/overlayScrollbars/js'
},
{
from: 'node_modules/overlayscrollbars/css',
to : 'docs/assets/plugins/overlayScrollbars/css'
}
]
module.exports = Plugins

View file

@ -27,13 +27,15 @@ class Publish {
run() {
// Publish files
Plugins.forEach((module) => {
fse.copy(module.from, module.to, error => {
if (error) {
console.error(`Error: ${error}`)
} else if (this.options.verbose) {
try {
fse.copySync(module.from, module.to)
if (this.options.verbose) {
console.log(`Copied ${module.from} to ${module.to}`)
}
})
} catch (err) {
console.error(`Error: ${err}`)
}
})
}
}

11
package-lock.json generated
View file

@ -10663,6 +10663,17 @@
"locate-path": "^2.0.0"
}
},
"fs-extra": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz",
"integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"fsevents": {
"version": "1.2.9",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz",

View file

@ -12,14 +12,16 @@
"css-minify": "cleancss --level 1 --source-map --source-map-inline-sources --output dist/css/adminlte.min.css dist/css/adminlte.css",
"compile": "npm-run-all --parallel js css",
"dev": "npm-run-all --parallel watch sync",
"docs-serve": "cd docs/ && bundle exec jekyll serve",
"docs-compile": "cd docs/ && bundle exec jekyll build -d ../docs_html",
"docs-clean": "cd docs/ && bundle exec jekyll clean -d ../docs_html",
"docs-compile": "cd docs/ && bundle exec jekyll build -d ../docs_html",
"docs-serve": "cd docs/ && bundle exec jekyll serve",
"docs-prepare": "node build/npm/DocsPublish.js -v",
"install": "npm run plugins",
"js": "npm-run-all --sequential js-compile js-minify",
"js-compile": "rollup --config build/config/rollup.config.js --sourcemap",
"js-minify": "terser --compress typeofs=false --mangle --comments \"/^!/\" --source-map \"content=dist/js/adminlte.js.map,includeSources,url=adminlte.min.js.map\" --output dist/js/adminlte.min.js dist/js/adminlte.js",
"production": "npm-run-all --sequential compile plugins",
"prepare": "npm-run-all --sequential compile plugins docs-clean docs-compile",
"prepare-release": "npm-run-all --sequential compile plugins docs-clean docs-compile",
"plugins": "node build/npm/Publish.js -v",
"sync": "browser-sync start --server --files *.html pages/ dist/",
"watch": "npm-run-all --parallel watch-css watch-js",