diff --git a/Docs/BuiltinLayers.md b/Docs/BuiltinLayers.md index 9bebbd7a5..2b581b69d 100644 --- a/Docs/BuiltinLayers.md +++ b/Docs/BuiltinLayers.md @@ -784,4 +784,4 @@ The following layers are included in MapComplete: - [watermill](./Layers/watermill.md) -This document is autogenerated from [AllKnownLayers.ts](https://github.com/pietervdvn/MapComplete/blob/develop/AllKnownLayers.ts) \ No newline at end of file +This document is autogenerated from [Customizations/AllKnownLayouts.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Customizations/AllKnownLayouts.ts) \ No newline at end of file diff --git a/Docs/BuiltinQuestions.md b/Docs/BuiltinQuestions.md index b4a345685..6f705ff28 100644 --- a/Docs/BuiltinQuestions.md +++ b/Docs/BuiltinQuestions.md @@ -378,4 +378,4 @@ Read-only tagrendering Read-only tagrendering -This document is autogenerated from [SharedTagRendings.ts](https://github.com/pietervdvn/MapComplete/blob/develop/SharedTagRendings.ts), [assets/tagRenderings/questions.json](https://github.com/pietervdvn/MapComplete/blob/develop/assets/tagRenderings/questions.json) \ No newline at end of file +This document is autogenerated from [Customizations/SharedTagRenderings.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Customizations/SharedTagRenderings.ts), [assets/tagRenderings/questions.json](https://github.com/pietervdvn/MapComplete/blob/develop/assets/tagRenderings/questions.json) \ No newline at end of file diff --git a/Docs/CalculatedTags.md b/Docs/CalculatedTags.md index b52cb4cc3..7bafe7562 100644 --- a/Docs/CalculatedTags.md +++ b/Docs/CalculatedTags.md @@ -292,4 +292,4 @@ For example: `_part_of_walking_routes=feat.memberships().map(r => r.relation.tag 0. key -This document is autogenerated from [SimpleMetaTagger](https://github.com/pietervdvn/MapComplete/blob/develop/SimpleMetaTagger), [ExtraFunction](https://github.com/pietervdvn/MapComplete/blob/develop/ExtraFunction) \ No newline at end of file +This document is autogenerated from [Logic/SimpleMetaTagger.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Logic/SimpleMetaTagger.ts), [Logic/ExtraFunctions.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Logic/ExtraFunctions.ts) \ No newline at end of file diff --git a/Docs/SpecialInputElements.md b/Docs/SpecialInputElements.md index 708adb9c3..d6cde05f9 100644 --- a/Docs/SpecialInputElements.md +++ b/Docs/SpecialInputElements.md @@ -231,4 +231,4 @@ postfix | Piece of text that will always be added to the end of the generated op Shows a color picker -This document is autogenerated from [ValidatedTextField.ts](https://github.com/pietervdvn/MapComplete/blob/develop/ValidatedTextField.ts) \ No newline at end of file +This document is autogenerated from [UI/Input/ValidatedTextField.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/Input/ValidatedTextField.ts) \ No newline at end of file diff --git a/Docs/SpecialRenderings.md b/Docs/SpecialRenderings.md index 19bc49eca..d95222141 100644 --- a/Docs/SpecialRenderings.md +++ b/Docs/SpecialRenderings.md @@ -624,4 +624,4 @@ icon | ./assets/svg/robot.svg | The icon to show on the button `{auto_apply(,,,,./assets/svg/robot.svg)}` -This document is autogenerated from [UI/SpecialVisualisations.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/SpecialVisualisations.ts) \ No newline at end of file +This document is autogenerated from [UI/SpecialVisualizations.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/SpecialVisualizations.ts) \ No newline at end of file diff --git a/Docs/URL_Parameters.md b/Docs/URL_Parameters.md index 1a0d2f187..c1eb48376 100644 --- a/Docs/URL_Parameters.md +++ b/Docs/URL_Parameters.md @@ -219,4 +219,4 @@ Finally, the URL-hash is the part after the `#`. It is `node/1234` in this case. Wether or not the layer with id is shown The default value is _true_ -This document is autogenerated from [QueryParameters](https://github.com/pietervdvn/MapComplete/blob/develop/QueryParameters) \ No newline at end of file +This document is autogenerated from [Logic/Web/QueryParameters.ts](https://github.com/pietervdvn/MapComplete/blob/develop/Logic/Web/QueryParameters.ts), [UI/QueryParameterDocumentation.ts](https://github.com/pietervdvn/MapComplete/blob/develop/UI/QueryParameterDocumentation.ts) \ No newline at end of file diff --git a/scripts/generateDocs.ts b/scripts/generateDocs.ts index 1afdd234c..4d43d5c02 100644 --- a/scripts/generateDocs.ts +++ b/scripts/generateDocs.ts @@ -1,7 +1,7 @@ import Combine from "../UI/Base/Combine"; import BaseUIElement from "../UI/BaseUIElement"; import Translations from "../UI/i18n/Translations"; -import {writeFileSync} from "fs"; +import {existsSync, writeFileSync} from "fs"; import {AllKnownLayouts} from "../Customizations/AllKnownLayouts"; import TableOfContents from "../UI/Base/TableOfContents"; import SimpleMetaTaggers, {SimpleMetaTagger} from "../Logic/SimpleMetaTagger"; @@ -20,6 +20,16 @@ import SharedTagRenderings from "../Customizations/SharedTagRenderings"; function WriteFile(filename, html: BaseUIElement, autogenSource: string[]): void { + + for (const source of autogenSource) { + if(source.indexOf("*") > 0){ + continue + } + if(!existsSync(source)){ + throw "While creating a documentation file and checking that the generation sources are properly linked: source file "+source+" was not found. Typo?" + } + } + if (html instanceof Combine) { const toc = new TableOfContents(html); const els = html.getElements(); @@ -46,13 +56,13 @@ AllKnownLayouts.GenOverviewsForSingleLayer((layer, element) => { WriteFile("./Docs/Layers/" + layer.id + ".md", element, [`assets/layers/${layer.id}/${layer.id}.json`]) }) -WriteFile("./Docs/SpecialRenderings.md", SpecialVisualizations.HelpMessage(), ["UI/SpecialVisualisations.ts"]) +WriteFile("./Docs/SpecialRenderings.md", SpecialVisualizations.HelpMessage(), ["UI/SpecialVisualizations.ts"]) WriteFile("./Docs/CalculatedTags.md", new Combine([new Title("Metatags", 1), SimpleMetaTaggers.HelpText(), ExtraFunctions.HelpText()]).SetClass("flex-col"), - ["SimpleMetaTagger", "ExtraFunction"]) -WriteFile("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText(), ["ValidatedTextField.ts"]); -WriteFile("./Docs/BuiltinLayers.md", AllKnownLayouts.GenLayerOverviewText(), ["AllKnownLayers.ts"]) -WriteFile("./Docs/BuiltinQuestions.md", SharedTagRenderings.HelpText(), ["SharedTagRendings.ts","assets/tagRenderings/questions.json"]) + ["Logic/SimpleMetaTagger.ts", "Logic/ExtraFunctions.ts"]) +WriteFile("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText(), ["UI/Input/ValidatedTextField.ts"]); +WriteFile("./Docs/BuiltinLayers.md", AllKnownLayouts.GenLayerOverviewText(), ["Customizations/AllKnownLayouts.ts"]) +WriteFile("./Docs/BuiltinQuestions.md", SharedTagRenderings.HelpText(), ["Customizations/SharedTagRenderings.ts","assets/tagRenderings/questions.json"]) { // Generate the builtinIndex which shows interlayer dependencies @@ -137,7 +147,7 @@ new FeatureSwitchState(dummyLayout) QueryParameters.GetQueryParameter("layer-<layer-id>", "true", "Wether or not the layer with id is shown") -WriteFile("./Docs/URL_Parameters.md", QueryParameterDocumentation.GenerateQueryParameterDocs(), ["QueryParameters"]) +WriteFile("./Docs/URL_Parameters.md", QueryParameterDocumentation.GenerateQueryParameterDocs(), ["Logic/Web/QueryParameters.ts", "UI/QueryParameterDocumentation.ts"]) console.log("Generated docs")