mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added help message to build pipeline
This commit is contained in:
parent
68896b1a78
commit
0a6e70262b
@ -20,6 +20,7 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import chalk from "chalk"
|
||||||
import gulp from "gulp"
|
import gulp from "gulp"
|
||||||
import notifier from "node-notifier"
|
import notifier from "node-notifier"
|
||||||
import plumber from "gulp-plumber"
|
import plumber from "gulp-plumber"
|
||||||
@ -30,6 +31,7 @@ import yargs from "yargs"
|
|||||||
* Configuration and arguments
|
* Configuration and arguments
|
||||||
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* General configuration */
|
||||||
const config = {
|
const config = {
|
||||||
assets: {
|
assets: {
|
||||||
src: "src/assets", /* Source directory for assets */
|
src: "src/assets", /* Source directory for assets */
|
||||||
@ -45,14 +47,104 @@ const config = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Commandline arguments */
|
||||||
let args = yargs
|
let args = yargs
|
||||||
.default("clean", false) /* Clean before build */
|
.locale("en")
|
||||||
.default("karma", true) /* Karma watchdog */
|
.usage(`\n${chalk.yellow("Usage:")} yarn run <command> -- [options]`)
|
||||||
.default("lint", true) /* Lint sources */
|
.wrap(84)
|
||||||
.default("mkdocs", true) /* MkDocs watchdog */
|
.updateStrings({
|
||||||
.default("optimize", false) /* Optimize sources */
|
"Commands:": chalk.yellow("Commands:"),
|
||||||
.default("revision", false) /* Revision assets */
|
"Examples:": chalk.yellow("Examples:")
|
||||||
.default("sourcemaps", false) /* Create sourcemaps */
|
})
|
||||||
|
|
||||||
|
/* Commands */
|
||||||
|
.command("build", chalk.grey("build assets and views"))
|
||||||
|
.command("clean", chalk.grey("clean build artifacts"))
|
||||||
|
.command("flow", chalk.grey("type check with flow"))
|
||||||
|
.command("help", chalk.grey("display this message"))
|
||||||
|
.command("lint", chalk.grey("lint sources"))
|
||||||
|
.command("start", chalk.grey("start development server"))
|
||||||
|
.command("test:visual:run", chalk.grey("run visual tests"))
|
||||||
|
.command("test:visual:session", chalk.grey("start test server"))
|
||||||
|
.command("test:visual:update", chalk.grey("update reference images"))
|
||||||
|
|
||||||
|
/* Options */
|
||||||
|
.group([
|
||||||
|
"help", "clean"
|
||||||
|
], chalk.yellow("Options:"))
|
||||||
|
.help("help", chalk.grey("display this message"))
|
||||||
|
.option("clean", {
|
||||||
|
describe: chalk.grey("clean artifacts before command"),
|
||||||
|
default: false,
|
||||||
|
global: true
|
||||||
|
})
|
||||||
|
|
||||||
|
/* Build options */
|
||||||
|
.group([
|
||||||
|
"lint", "optimize", "revision", "sourcemaps", "mkdocs"
|
||||||
|
], chalk.yellow("Build Options:"))
|
||||||
|
.option("lint", {
|
||||||
|
describe: chalk.grey("lint sources before build"),
|
||||||
|
default: true,
|
||||||
|
global: true
|
||||||
|
})
|
||||||
|
.option("optimize", {
|
||||||
|
describe: chalk.grey("optimize and minify assets"),
|
||||||
|
default: true,
|
||||||
|
global: true
|
||||||
|
})
|
||||||
|
.option("revision", {
|
||||||
|
describe: chalk.grey("revision assets for cache busting"),
|
||||||
|
default: false,
|
||||||
|
global: true
|
||||||
|
})
|
||||||
|
.option("sourcemaps", {
|
||||||
|
describe: chalk.grey("generate sourcemaps for assets"),
|
||||||
|
default: false,
|
||||||
|
global: true
|
||||||
|
})
|
||||||
|
.option("mkdocs", {
|
||||||
|
describe: chalk.grey("build documentation or start watchdog"),
|
||||||
|
default: true,
|
||||||
|
global: true
|
||||||
|
})
|
||||||
|
|
||||||
|
/* Test options */
|
||||||
|
.group([
|
||||||
|
"grep", "browser"
|
||||||
|
], chalk.yellow("Test Options:"))
|
||||||
|
.option("grep", {
|
||||||
|
describe: chalk.grey("only execute tests matching a regex"),
|
||||||
|
global: true
|
||||||
|
})
|
||||||
|
.option("browser", {
|
||||||
|
describe: chalk.grey("only execute tests for the given browser"),
|
||||||
|
global: true
|
||||||
|
})
|
||||||
|
|
||||||
|
/* Example commands */
|
||||||
|
.example("yarn run build")
|
||||||
|
.example("yarn run build -- --no-optimize")
|
||||||
|
.example("yarn run clean")
|
||||||
|
.example("yarn run flow")
|
||||||
|
.example("yarn run lint")
|
||||||
|
.example("yarn run start")
|
||||||
|
.example("yarn run test:visual:run")
|
||||||
|
.example("yarn run test:visual:run -- --no-clean")
|
||||||
|
.example("yarn run test:visual:run -- --grep nav")
|
||||||
|
.example("yarn run test:visual:run -- --browser ie11")
|
||||||
|
.example("yarn run test:visual:session")
|
||||||
|
.example("yarn run test:visual:update")
|
||||||
|
|
||||||
|
/* Document Environment variables */
|
||||||
|
.epilogue(
|
||||||
|
`${chalk.yellow("Environment:")}\n` +
|
||||||
|
` SAUCE=${chalk.grey("<true|false)>")}\n` +
|
||||||
|
` SAUCE_USERNAME=${chalk.grey("<username>")}\n` +
|
||||||
|
` SAUCE_ACCESS_KEY=${chalk.grey("<key>")}`
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Apply to process.argv */
|
||||||
.argv
|
.argv
|
||||||
|
|
||||||
/* Only use the last seen value if boolean, so overrides are possible */
|
/* Only use the last seen value if boolean, so overrides are possible */
|
||||||
@ -395,6 +487,11 @@ gulp.task("watch", [
|
|||||||
], ["views:build"])
|
], ["views:build"])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print help message
|
||||||
|
*/
|
||||||
|
gulp.task("help")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build assets by default
|
* Build assets by default
|
||||||
*/
|
*/
|
||||||
|
@ -118,7 +118,7 @@ export default (gulp, config, args) => {
|
|||||||
/* Run tests */
|
/* Run tests */
|
||||||
return gemini.test(`${config.tests.visual}/suites`, {
|
return gemini.test(`${config.tests.visual}/suites`, {
|
||||||
reporters: ["flat", "html"],
|
reporters: ["flat", "html"],
|
||||||
browsers: args.browsers ? [].concat(args.browsers) : null
|
browsers: args.browser ? [].concat(args.browser) : null
|
||||||
})
|
})
|
||||||
|
|
||||||
/* Return runner for graceful stop */
|
/* Return runner for graceful stop */
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
"build": "scripts/build",
|
"build": "scripts/build",
|
||||||
"clean": "scripts/clean",
|
"clean": "scripts/clean",
|
||||||
"flow": "scripts/flow",
|
"flow": "scripts/flow",
|
||||||
|
"help": "scripts/help",
|
||||||
"lint": "scripts/lint",
|
"lint": "scripts/lint",
|
||||||
"start": "scripts/start",
|
"start": "scripts/start",
|
||||||
"test:visual:run": "scripts/test/visual/run",
|
"test:visual:run": "scripts/test/visual/run",
|
||||||
|
31
scripts/help
Executable file
31
scripts/help
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
|
||||||
|
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to
|
||||||
|
# deal in the Software without restriction, including without limitation the
|
||||||
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
# sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
# IN THE SOFTWARE.
|
||||||
|
|
||||||
|
# Check if "yarn install" was executed
|
||||||
|
if [[ ! -d $(yarn bin) ]]; then
|
||||||
|
echo "\"node_modules\" not found:"
|
||||||
|
echo "yarn install"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run command
|
||||||
|
$(yarn bin)/gulp help "@"
|
Loading…
Reference in New Issue
Block a user