From 06b087707b8235fb125541e2df8a5f06595ba1e4 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:58:56 +0100 Subject: [PATCH 1/7] Add GitHub Action to publish documentation --- .github/workflows/documentation.yml | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..2948171 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,32 @@ +name: "documentation" + +on: + push: + branches: [main] + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + - run: npm ci + - run: npm run document + - uses: actions/upload-pages-artifact@v3 + with: + path: ./docs + deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v3 \ No newline at end of file From b3832e9bf398fe634f9ed5903599ca0432cea004 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:52:17 +0200 Subject: [PATCH 2/7] Switch alpha to public --- src/generator.ts | 15 ++++++-------- src/index.ts | 2 +- src/loadFromFile.ts | 3 +-- src/question.ts | 4 ++-- src/shared.types.ts | 50 +++++++++++++++++++++++++++++---------------- 5 files changed, 42 insertions(+), 32 deletions(-) diff --git a/src/generator.ts b/src/generator.ts index cfa0312..a509734 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -14,7 +14,7 @@ class Generator { * @param locale - {@link localesType} * @param fprVersion - {@link fprVersionType} * @returns A Generator class with the functions {@link getNextQuestion} and {@link getTechnicalDocumentation} - * @alpha + * @public */ packageVersion = '1.0.0' locale: localesType @@ -48,7 +48,7 @@ class Generator { /** Returns the next question * @returns The question object {@link questionType} for the next question - * @alpha + * @public */ getNextQuestion (): questionType { if (!this.allQuestionsAnswered()) { @@ -62,7 +62,7 @@ class Generator { /** Returns the tecnhical documentation * @returns The technical documentation {@link technicalDocumentationType} object for the EU fertilizing product - * @alpha + * @public */ getTechnicalDocumentation (): technicalDocumentationType { return { @@ -75,7 +75,7 @@ class Generator { /** * Check if all questions have been answered * @returns true if all questions have been answered, else false - * @alpha + * @public */ allQuestionsAnswered (): boolean { let returnValue: boolean @@ -126,7 +126,6 @@ class Generator { * If the general questions for a FPRversion have been answered, this function returns true. * @returns boolean * @internal - * @alpha */ generalQuestionsComplete (): boolean { let returnValue: boolean @@ -191,7 +190,7 @@ class Generator { * * @param answer - The answer to the question of type {@link answerType}. * @returns `true` if the answer was successfully saved, and `false` otherwise. - * @alpha + * @public */ saveAnswer (answer: answerType): boolean { /** @@ -236,7 +235,6 @@ class Generator { /** Returns the things that need to be included in the technical documentation of a product * @returns The list of things that need to be included in the technical documentation of a product * @internal - * @alpha */ getTechnicalDocumentationTaskList (): technicalDocumentationTaskListType { if (!this.allQuestionsAnswered()) { @@ -315,8 +313,7 @@ class Generator { /** Store the generator as JSON file * @param filePath - The file path for where to store the properties of the generator. Should have the extension ".json". * @returns A boolean to indicate if the file has been stored successfully - * @internal - * @alpha + * @public */ saveToFile (filePath: string): boolean { // Check if filePath is actual json and can be stored diff --git a/src/index.ts b/src/index.ts index f73a455..1470b76 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,7 @@ * Source code available at https://github.com/AgroCares/fpr-td-gen * In case you find a bug, please report at https://github.com/AgroCares/fpr-td-gen/issues * - * @alpha + * @public * @packageDocumentation */ diff --git a/src/loadFromFile.ts b/src/loadFromFile.ts index 000e93d..9f914ad 100644 --- a/src/loadFromFile.ts +++ b/src/loadFromFile.ts @@ -6,8 +6,7 @@ import Generator from './generator' /** Load from JSON file to generator * @param filePath - The path to where the JSON file is stored, include the filename. It can be generated using the saveToFile method {@link saveToFile} * @returns A generator class with the specified properties {@link Generator} -* @internal -* @alpha +* @public */ function LoadFromFile (filePath: string): Generator { // Check if filePath is actual json and can be stored diff --git a/src/question.ts b/src/question.ts index 7d9e17e..4d442d4 100644 --- a/src/question.ts +++ b/src/question.ts @@ -7,7 +7,7 @@ export class Question { * @param locale - {@link localesType} * @param id - {@link idType} * @returns A Question class with the function {@link getQuestion} -* @alpha +* @public */ locale: localesType id: idType @@ -54,7 +54,7 @@ export class Question { /** * Returns a question object * @returns A question object {@link questionType} -* @alpha +* @public */ getQuestion (): questionType { return this.question diff --git a/src/shared.types.ts b/src/shared.types.ts index 8b9270e..0df1c11 100644 --- a/src/shared.types.ts +++ b/src/shared.types.ts @@ -2,7 +2,7 @@ * The question to be asked * * @typeParam askType - The question to be asked - * @alpha + * @public */ export type askType = string @@ -11,7 +11,7 @@ export type askType = string * * @typeParam fprVersionType - The version of the FPR to be used * @remarks Currently only `FPR 2019/100` is allowed - * @alpha + * @public */ export type fprVersionType = 'FPR 2019/1009' @@ -20,6 +20,7 @@ export type fprVersionType = 'FPR 2019/1009' * @remarks generalProductQuestions must be asked for all products, * cmcQuestions are iterable questions which may be asked for each component, * blendQuestions are questions specific for fertiling product blends (PFC 7) which do not need to give information on its component materials but on the fertiling products contained within the blend. + * @public */ export interface fprType { fprVersion: fprVersionType @@ -32,7 +33,7 @@ export interface fprType { * The id of the question * * @typeParam idType - The id of the question - * @alpha + * @public */ export type idType = string @@ -40,7 +41,7 @@ export type idType = string * Helper text of a question * * @typeParam helpType - Explains the question in more detail - * @alpha + * @public */ export type helpType = string @@ -49,7 +50,7 @@ export type helpType = string * * @typeParam localesType - The language selected to be used * @remarks Currently only English ('en') and Dutch are available ('nl') - * @alpha + * @public */ export type localesType = 'en' | 'nl' @@ -57,7 +58,7 @@ export type localesType = 'en' | 'nl' * Placeholder for answer * * @typeParam placeholderType - Provides a placeholder for the answer of a question - * @alpha + * @public */ export type placeholderType = string | null @@ -65,7 +66,7 @@ export type placeholderType = string | null * Available options set for a question * * @typeParam optionsSetType - The available options set available to answer a question - * @alpha + * @public */ export interface optionsSetType { value: string @@ -76,7 +77,7 @@ export interface optionsSetType { * Available options for a question * @typeParam optionsType - The available options available to answer a question * - * @alpha + * @public */ export interface optionsType { value: string @@ -87,7 +88,7 @@ export interface optionsType { * The question to be asked * * @typeParam questionType - The question to be asked - * @alpha + * @public */ export interface questionType { id: idType @@ -102,7 +103,7 @@ export interface questionType { * The question set that contains the details of a question * * @typeParam questionSetType - The question set that contains the details of a question - * @internal + * @public */ export interface questionSetType { id: string @@ -118,7 +119,7 @@ export interface questionSetType { * The items that need to be contained in the technical documentation * * @typeParam tasklistSetType - The question set that contains the details of a question - * @internal + * @public */ export interface tasklistSetType { taskId: string @@ -135,7 +136,7 @@ export interface tasklistSetType { * A collection of various entries for questionsSet * * @typeParam questionSetsType - A collection of various entries for questionsSet {@link questionSetType} - * @internal + * @public */ export type questionSetsType = questionSetType[] @@ -151,7 +152,7 @@ export type tasklistSetsType = tasklistSetType[] * The technical documentation of the FPR * * @typeParam technicalDocumentationType - The technical documentation of the FPR - * @alpha + * @public */ export interface technicalDocumentationType { locale: localesType @@ -164,7 +165,7 @@ export interface technicalDocumentationType { * * @typeParam typesType - The type of question * @remarks Currently only `text`, `select`, `checkbox` and `multitext` are allowed - * @alpha + * @public */ export type typesType = 'text' | 'select' | 'checkbox' | 'multitext' | undefined @@ -172,16 +173,18 @@ export type typesType = 'text' | 'select' | 'checkbox' | 'multitext' | undefined * The id of the option from a `select` question * * @typeParam optionsIdType - The id of the option - * @alpha + * @public */ export type optionsIdType = string[] | undefined /** * Array of values allowed for PFCs * + * @public * @see {@link pfcType} */ export const pfcDesignations = [undefined, 'PFC 1.A.I', 'PFC 1.A.II', 'PFC 1.B.I', 'PFC 1.B.II', 'PFC 1.C.I.a.i', 'PFC 1.C.I.a.i.A', 'PFC 1.C.I.a.ii', 'PFC 1.C.I.a.ii.A', 'PFC 1.C.I.b.i', 'PFC 1.C.I.b.ii', 'PFC 1.C.II.a', 'PFC 1.C.II.b', 'PFC 2', 'PFC 3.A', 'PFC 3.B', 'PFC 4', 'PFC 5.A', 'PFC 5.B', 'PFC 5.C', 'PFC 6.A', 'PFC 6.B', 'PFC 7'] as const + /** * The PFC designation * @@ -210,13 +213,14 @@ export const pfcDesignations = [undefined, 'PFC 1.A.I', 'PFC 1.A.II', 'PFC 1.B.I * * `PFC 6.A` * * `PFC 6.B` * * `PFC 7` - * @alpha + * @public */ export type pfcType = typeof pfcDesignations[number] /** * Array of values allowed for CMCs * + * @public * @see {@link cmcType} */ export const cmcDesginations = [undefined, 'CMC 1', 'CMC 2', 'CMC 3', 'CMC 4', 'CMC 5', 'CMC 6', 'CMC 7'] as const @@ -234,7 +238,7 @@ export const cmcDesginations = [undefined, 'CMC 1', 'CMC 2', 'CMC 3', 'CMC 4', ' * * `CMC 5` * * `CMC 6` * * `CMC 7` - * @alpha + * @public */ export type cmcType = typeof cmcDesginations[number] @@ -245,16 +249,26 @@ export type answerSet = Map * * @typeParam answerType - The answer to a question * @remarks Currently only `string` and `string[]` are allowed - * @alpha + * @public */ export type answerType = string | string[] | boolean /** * Type of the technicaldocumenatation task list + * + * @typeParam technicalDocumentationTaskListType - An array for {@link technicalDocumentationTask} + * @see {@link technicalDocumentationTask} + * @public */ export type technicalDocumentationTaskListType = technicalDocumentationTask[] +/** + * Type of technicalDocumentationTask + * + * typeParam technicalDocumentationTask - An object with the properties of a task for the Technical Documentation + * @public + */ export interface technicalDocumentationTask { applicableElement: 'product' | string taskName: string From 6f710bbeaba70433e5f227580cb0345e6d149a7c Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:53:18 +0200 Subject: [PATCH 3/7] Remove link that does not work --- src/loadFromFile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loadFromFile.ts b/src/loadFromFile.ts index 9f914ad..eaec6fe 100644 --- a/src/loadFromFile.ts +++ b/src/loadFromFile.ts @@ -4,7 +4,7 @@ import crypto from 'node:crypto' import Generator from './generator' /** Load from JSON file to generator -* @param filePath - The path to where the JSON file is stored, include the filename. It can be generated using the saveToFile method {@link saveToFile} +* @param filePath - The path to where the JSON file is stored, include the filename. It can be generated using the saveToFile method * @returns A generator class with the specified properties {@link Generator} * @public */ From f4859a715c0abec33ea6601a976de238eb5e20b3 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:58:01 +0200 Subject: [PATCH 4/7] Update changelog and bump version number --- CHANGELOG.MD | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- src/generator.ts | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index c5e27db..1d96ba8 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,11 @@ # Changelog +## v1.1.0 2024-04-22 +### Added +* Adds GitHub Pages with documentation of the package + +### Changed +* Changed all documented `@alpha` release stages changes to `@public` + ## v1.0.0 2024-04-15 First stable release! From now on changes to the `fpr-td-gen` will be documented in this changelog and at [GitHub Releases](https://github.com/AgroCares/fpr-td-gen/releases) diff --git a/package-lock.json b/package-lock.json index cb9b9f4..18f1f9e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@nmi-agro/fpr-td-gen", - "version": "1.0.0", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@nmi-agro/fpr-td-gen", - "version": "1.0.0", + "version": "1.1.0", "license": "EUPL-1.2", "devDependencies": { "@types/jest": "^29.5.10", diff --git a/package.json b/package.json index a582436..02c390b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nmi-agro/fpr-td-gen", "private": false, - "version": "1.0.0", + "version": "1.1.0", "description": "A generator for the Technical Documentation of the EU Fertilizer Product Regulation", "keywords": [ "EU", diff --git a/src/generator.ts b/src/generator.ts index a509734..f6b49a0 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -16,7 +16,7 @@ class Generator { * @returns A Generator class with the functions {@link getNextQuestion} and {@link getTechnicalDocumentation} * @public */ - packageVersion = '1.0.0' + packageVersion = '1.1.0' locale: localesType fprVersion: fprVersionType pfcDesignation: pfcType = undefined From e86f9d24b09112ed6b29ddac5a4a2172d6157308 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Mon, 22 Apr 2024 09:59:59 +0200 Subject: [PATCH 5/7] Add temporary trigger to test documentation --- .github/workflows/documentation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 2948171..9017403 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -3,6 +3,8 @@ name: "documentation" on: push: branches: [main] + pull_request: + branches: [main] permissions: contents: read From 9f6552b19cfabe8eaf4dc94853a3b8b55e6a2b23 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Mon, 22 Apr 2024 10:19:12 +0200 Subject: [PATCH 6/7] Use updated version of deploy-pages --- .github/workflows/documentation.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 9017403..77a0de9 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -6,11 +6,6 @@ on: pull_request: branches: [main] -permissions: - contents: read - pages: write - id-token: write - jobs: build: runs-on: ubuntu-latest @@ -23,12 +18,15 @@ jobs: with: path: ./docs deploy: - runs-on: ubuntu-latest + needs: build + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - needs: build + runs-on: ubuntu-latest steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v3 \ No newline at end of file + uses: actions/deploy-pages@v4 \ No newline at end of file From c746aa9967e21c593d8036ab841c964adcd4fd50 Mon Sep 17 00:00:00 2001 From: Sven Verweij <37927107+SvenVw@users.noreply.github.com> Date: Mon, 22 Apr 2024 10:20:51 +0200 Subject: [PATCH 7/7] Remove temporary trigger --- .github/workflows/documentation.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 77a0de9..a7163b7 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -3,9 +3,7 @@ name: "documentation" on: push: branches: [main] - pull_request: - branches: [main] - + jobs: build: runs-on: ubuntu-latest