docs: add version to the docs data misc generator (#4827)
parent
b42a84340d
commit
a1517f18e5
|
@ -110,7 +110,7 @@ func commitLintRunE(cmd *cobra.Command, args []string) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if pathCommitLintConfig, err = cmd.Flags().GetString(cmdFlagFileConfigCommitLint); err != nil {
|
if pathCommitLintConfig, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagWeb, cmdFlagFileConfigCommitLint); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,26 @@ func docsDataMiscRunE(cmd *cobra.Command, args []string) (err error) {
|
||||||
data.CSP.TemplateDefault = strings.ReplaceAll(data.CSP.TemplateDefault, "%s", codeCSPNonce)
|
data.CSP.TemplateDefault = strings.ReplaceAll(data.CSP.TemplateDefault, "%s", codeCSPNonce)
|
||||||
data.CSP.TemplateDevelopment = strings.ReplaceAll(data.CSP.TemplateDevelopment, "%s", codeCSPNonce)
|
data.CSP.TemplateDevelopment = strings.ReplaceAll(data.CSP.TemplateDevelopment, "%s", codeCSPNonce)
|
||||||
|
|
||||||
|
var (
|
||||||
|
pathPackageJSON string
|
||||||
|
dataPackageJSON []byte
|
||||||
|
packageJSON PackageJSON
|
||||||
|
)
|
||||||
|
|
||||||
|
if pathPackageJSON, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagWeb, cmdFlagFileWebPackage); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if dataPackageJSON, err = os.ReadFile(pathPackageJSON); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = json.Unmarshal(dataPackageJSON, &packageJSON); err != nil {
|
||||||
|
return fmt.Errorf("failed to unmarshall package.json: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Latest = packageJSON.Version
|
||||||
|
|
||||||
var (
|
var (
|
||||||
outputPath string
|
outputPath string
|
||||||
dataJSON []byte
|
dataJSON []byte
|
||||||
|
|
|
@ -42,7 +42,7 @@ func localesRunE(cmd *cobra.Command, args []string) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if pathWebI18NIndex, err = cmd.Flags().GetString(cmdFlagFileWebI18N); err != nil {
|
if pathWebI18NIndex, err = getPFlagPath(cmd.Flags(), cmdFlagRoot, cmdFlagWeb, cmdFlagFileWebI18N); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,14 @@ func newRootCmd() *cobra.Command {
|
||||||
|
|
||||||
cmd.PersistentFlags().StringP(cmdFlagCwd, "C", "", "Sets the CWD for git commands")
|
cmd.PersistentFlags().StringP(cmdFlagCwd, "C", "", "Sets the CWD for git commands")
|
||||||
cmd.PersistentFlags().StringP(cmdFlagRoot, "d", dirCurrent, "The repository root")
|
cmd.PersistentFlags().StringP(cmdFlagRoot, "d", dirCurrent, "The repository root")
|
||||||
|
cmd.PersistentFlags().String(cmdFlagWeb, dirWeb, "The repository web directory in relation to the root directory")
|
||||||
cmd.PersistentFlags().StringSliceP(cmdFlagExclude, "X", nil, "Sets the names of excluded generators")
|
cmd.PersistentFlags().StringSliceP(cmdFlagExclude, "X", nil, "Sets the names of excluded generators")
|
||||||
cmd.PersistentFlags().String(cmdFlagFeatureRequest, fileGitHubIssueTemplateFR, "Sets the path of the feature request issue template file")
|
cmd.PersistentFlags().String(cmdFlagFeatureRequest, fileGitHubIssueTemplateFR, "Sets the path of the feature request issue template file")
|
||||||
cmd.PersistentFlags().String(cmdFlagBugReport, fileGitHubIssueTemplateBR, "Sets the path of the bug report issue template file")
|
cmd.PersistentFlags().String(cmdFlagBugReport, fileGitHubIssueTemplateBR, "Sets the path of the bug report issue template file")
|
||||||
cmd.PersistentFlags().Int(cmdFlagVersions, 5, "the maximum number of minor versions to list in output templates")
|
cmd.PersistentFlags().Int(cmdFlagVersions, 5, "the maximum number of minor versions to list in output templates")
|
||||||
cmd.PersistentFlags().String(cmdFlagDirLocales, dirLocales, "The locales directory in relation to the root")
|
cmd.PersistentFlags().String(cmdFlagDirLocales, dirLocales, "The locales directory in relation to the root")
|
||||||
cmd.PersistentFlags().String(cmdFlagFileWebI18N, fileWebI18NIndex, "The i18n typescript configuration file in relation to the root")
|
cmd.PersistentFlags().String(cmdFlagFileWebI18N, fileWebI18NIndex, "The i18n typescript configuration file in relation to the web directory")
|
||||||
|
cmd.PersistentFlags().String(cmdFlagFileWebPackage, fileWebPackage, "The node package configuration file in relation to the web directory")
|
||||||
cmd.PersistentFlags().String(cmdFlagDocsDataLanguages, fileDocsDataLanguages, "The languages docs data file in relation to the docs data folder")
|
cmd.PersistentFlags().String(cmdFlagDocsDataLanguages, fileDocsDataLanguages, "The languages docs data file in relation to the docs data folder")
|
||||||
cmd.PersistentFlags().String(cmdFlagDocsDataMisc, fileDocsDataMisc, "The misc docs data file in relation to the docs data folder")
|
cmd.PersistentFlags().String(cmdFlagDocsDataMisc, fileDocsDataMisc, "The misc docs data file in relation to the docs data folder")
|
||||||
cmd.PersistentFlags().String(cmdFlagDocsCLIReference, dirDocsCLIReference, "The directory to store the markdown in")
|
cmd.PersistentFlags().String(cmdFlagDocsCLIReference, dirDocsCLIReference, "The directory to store the markdown in")
|
||||||
|
|
|
@ -3,12 +3,14 @@ package main
|
||||||
const (
|
const (
|
||||||
dirCurrent = "./"
|
dirCurrent = "./"
|
||||||
dirLocales = "internal/server/locales"
|
dirLocales = "internal/server/locales"
|
||||||
|
dirWeb = "web"
|
||||||
|
|
||||||
subPathCmd = "cmd"
|
subPathCmd = "cmd"
|
||||||
subPathInternal = "internal"
|
subPathInternal = "internal"
|
||||||
|
|
||||||
fileCICommitLintConfig = "web/.commitlintrc.js"
|
fileCICommitLintConfig = ".commitlintrc.js"
|
||||||
fileWebI18NIndex = "web/src/i18n/index.ts"
|
fileWebI18NIndex = "src/i18n/index.ts"
|
||||||
|
fileWebPackage = "package.json"
|
||||||
|
|
||||||
fileDocsCommitMessageGuidelines = "docs/content/en/contributing/guidelines/commit-message.md"
|
fileDocsCommitMessageGuidelines = "docs/content/en/contributing/guidelines/commit-message.md"
|
||||||
|
|
||||||
|
@ -68,25 +70,28 @@ const (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
cmdFlagRoot = "dir.root"
|
cmdFlagRoot = "dir.root"
|
||||||
cmdFlagExclude = "exclude"
|
cmdFlagWeb = "dir.web"
|
||||||
cmdFlagVersions = "versions"
|
cmdFlagFileWebI18N = "file.web.i18n"
|
||||||
|
cmdFlagFileWebPackage = "file.web.package"
|
||||||
|
cmdFlagDocs = "dir.docs"
|
||||||
cmdFlagDirLocales = "dir.locales"
|
cmdFlagDirLocales = "dir.locales"
|
||||||
cmdFlagDocsCLIReference = "dir.docs.cli-reference"
|
cmdFlagDocsCLIReference = "dir.docs.cli-reference"
|
||||||
cmdFlagDocsContent = "dir.docs.content"
|
cmdFlagDocsContent = "dir.docs.content"
|
||||||
cmdFlagDocsData = "dir.docs.data"
|
cmdFlagDocsData = "dir.docs.data"
|
||||||
cmdFlagDocs = "dir.docs"
|
|
||||||
cmdFlagDocsDataLanguages = "file.docs.data.languages"
|
|
||||||
cmdFlagDocsDataMisc = "file.docs.data.misc"
|
cmdFlagDocsDataMisc = "file.docs.data.misc"
|
||||||
cmdFlagDocsDataKeys = "file.docs.data.keys"
|
cmdFlagDocsDataKeys = "file.docs.data.keys"
|
||||||
cmdFlagCwd = "cwd"
|
cmdFlagDocsDataLanguages = "file.docs.data.languages"
|
||||||
cmdFlagFileConfigKeys = "file.configuration-keys"
|
cmdFlagFileConfigKeys = "file.configuration-keys"
|
||||||
cmdFlagFileScriptsGen = "file.scripts.gen"
|
cmdFlagFileScriptsGen = "file.scripts.gen"
|
||||||
cmdFlagFileServerGenerated = "file.server.generated"
|
cmdFlagFileServerGenerated = "file.server.generated"
|
||||||
cmdFlagFileConfigCommitLint = "file.commit-lint-config"
|
cmdFlagFileConfigCommitLint = "file.commit-lint-config"
|
||||||
cmdFlagFileDocsCommitMsgGuidelines = "file.docs-commit-msg-guidelines"
|
cmdFlagFileDocsCommitMsgGuidelines = "file.docs-commit-msg-guidelines"
|
||||||
cmdFlagFileWebI18N = "file.web-i18n"
|
|
||||||
cmdFlagFeatureRequest = "file.feature-request"
|
cmdFlagFeatureRequest = "file.feature-request"
|
||||||
cmdFlagBugReport = "file.bug-report"
|
cmdFlagBugReport = "file.bug-report"
|
||||||
|
|
||||||
|
cmdFlagExclude = "exclude"
|
||||||
|
cmdFlagVersions = "versions"
|
||||||
|
cmdFlagCwd = "cwd"
|
||||||
cmdFlagPackageConfigKeys = "package.configuration.keys"
|
cmdFlagPackageConfigKeys = "package.configuration.keys"
|
||||||
cmdFlagPackageScriptsGen = "package.scripts.gen"
|
cmdFlagPackageScriptsGen = "package.scripts.gen"
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,6 +33,7 @@ type GitHubTagsJSON struct {
|
||||||
// DocsDataMisc represents the docs misc data schema.
|
// DocsDataMisc represents the docs misc data schema.
|
||||||
type DocsDataMisc struct {
|
type DocsDataMisc struct {
|
||||||
CSP TemplateCSP `json:"csp"`
|
CSP TemplateCSP `json:"csp"`
|
||||||
|
Latest string `json:"latest"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TemplateCSP represents the CSP template vars.
|
// TemplateCSP represents the CSP template vars.
|
||||||
|
@ -139,7 +140,13 @@ func (t labelType) String() string {
|
||||||
return fmt.Sprintf("%s/%s", labelAreaPrefixType, labelTypeDescriptions[t])
|
return fmt.Sprintf("%s/%s", labelAreaPrefixType, labelTypeDescriptions[t])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CSPValue represents individual CSP values.
|
||||||
type CSPValue struct {
|
type CSPValue struct {
|
||||||
Name string
|
Name string
|
||||||
Value string
|
Value string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PackageJSON represents a NPM package.json file.
|
||||||
|
type PackageJSON struct {
|
||||||
|
Version string `json:"version"`
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"csp":{"default":"default-src 'self'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-${NONCE}'; frame-ancestors 'none'; base-uri 'self'","development":"default-src 'self' 'unsafe-eval'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-${NONCE}'; frame-ancestors 'none'; base-uri 'self'","nonce":"${NONCE}"}}
|
{"csp":{"default":"default-src 'self'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-${NONCE}'; frame-ancestors 'none'; base-uri 'self'","development":"default-src 'self' 'unsafe-eval'; frame-src 'none'; object-src 'none'; style-src 'self' 'nonce-${NONCE}'; frame-ancestors 'none'; base-uri 'self'","nonce":"${NONCE}"},"latest":"4.37.5"}
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="col-lg-9 col-xl-8 text-center">
|
<div class="col-lg-9 col-xl-8 text-center">
|
||||||
<p class="lead">{{ .Params.lead | safeHTML }}</p>
|
<p class="lead">{{ .Params.lead | safeHTML }}</p>
|
||||||
<a class="btn btn-primary btn-lg px-4 mb-2" href="/integration/prologue/get-started/" role="button">Get Started</a>
|
<a class="btn btn-primary btn-lg px-4 mb-2" href="/integration/prologue/get-started/" role="button">Get Started</a>
|
||||||
<p class="meta">Open-source Apache 2.0 Licensed. <a href="https://github.com/authelia/authelia">GitHub v{{ $data := getJSON "https://raw.githubusercontent.com/authelia/authelia/master/web/package.json" }}{{ $data.version }}</a></p>
|
<p class="meta">Open-source Apache 2.0 Licensed. <a href="https://github.com/authelia/authelia">GitHub v{{ $.Site.Data.misc.latest }}</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Reference in New Issue