diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 0000000..e5396b5 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,29 @@ +name: Manual Trigger Workflow with loglevel & tags +#get log & tags information +on: + workflow_dispatch: + branches: + - wip/dispatch + - dev + inputs: + logLevel: + description: 'Log level' + required: true + default: 'information' + type: choice + options: + - information + - debug + - warning + - critical + tags: + description: 'Purpose of Run This Workflow?' + required: true + type: string + +jobs: + print-tag: + runs-on: ubuntu-latest + steps: + - name: Print the purpose of run + run: echo ${{ inputs.tags }} purpose \ No newline at end of file diff --git a/README.md b/README.md index d3c7998..784bb2d 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,9 @@ The following dependencies are used for this project. Feel free to use other dep - Checkout the excel file format on the `/app/data/day1.xlsx` sample file for more information 5. (Optional) Download URL for a remote excel file. - See the `EXCEL_FILE_URL` variable on the [Installation](#installation) section. +6. (Optional) Docker + - Use Docker for localhost development + - See the [Docker Dependencies](#docker-dependencies) section for more information. @@ -72,7 +75,7 @@ The following dependencies are used for this project. Feel free to use other dep ## FAQs
- + What is the purpose or goal of ph-municipalities? @@ -89,7 +92,7 @@ Its early stages were written as procedural functions within a _private backend
- + Can ph-municipalities parse and extract PAGASA 10-day weather forecast data? @@ -104,7 +107,7 @@ ph-municipalities only have class methods for parsing, extracting, listing and q
- + Are there alternative libraries to ph-municipalities for listing Philippine provinces and municipalities? @@ -129,15 +132,15 @@ Note, however, that these items use old and new data sources. These may not be f
- + Is it possible to make ph-municipalities parse and extract PAGASA 10-day weather forecast data?
-While ph-municipalites do not support parsing and extracting PAGASA 10-day weather forecast data, _you can extend the `ExcelFile` or `ExcelAdapter` classes with custom logic and codes to enable parsing and extracting PAGASA 10-day weather forecast data_. +While ph-municipalites do not support parsing and extracting PAGASA 10-day weather forecast data, _you can extend the `ExcelFile` or `ExcelFactory` classes with custom logic and codes to enable parsing and extracting PAGASA 10-day weather forecast data_. -Since the `ExcelFile` or `ExcelAdapter` are [classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) (functions in disguise, not true OOP, but inheritance still works), you can extend them with class inheritance, overriding or creating new class methods to accommodate processing the PAGASA 10-day weather forecast data. Refer to the [ph-municipalities class documentation](https://ciatph.github.io/ph-municipalities) to know more about the available classes, member variables, and methods. +Since the `ExcelFile` or `ExcelFactory` are JavaScript [Classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) (Functions in disguise, not true OOP, but inheritance still works), you can extend them with class inheritance, overriding or creating new class methods to accommodate processing the PAGASA 10-day weather forecast data. Refer to the [ph-municipalities class documentation](https://ciatph.github.io/ph-municipalities) to know more about the available classes, member variables, and methods. An example of extending the classes to parse PAGASA 10-day weather forecast data may go along the lines of: @@ -174,8 +177,8 @@ weatherForecast = parser.getWeatherData()
- - + + How does ph-municipalities determine which provinces belong to a region? @@ -196,18 +199,18 @@ This file contains region/province names mapping encoded manually with reference
- - - Are the provinces and municipality list generated by ph-municipalities updated? + + + Are the provinces and municipality lists generated by ph-municipalities updated?
-NO. By default, ph-municipalities use an outdated PAGASA 10-day Excel file by default for its local data source, downloaded on August 8, 2022. However, it also provides several ways for using updated PAGASA 10-day Excel files as data sources by: +NO. By default, ph-municipalities use an outdated PAGASA 10-day Excel file for its local data source, downloaded on August 8, 2022. However, it also provides several ways for using updated PAGASA 10-day Excel files as data sources: - Prompting to download an updated PAGASA 10-day Excel file using the [Interactive CLI Scripts](#interactive-cli-scripts) -- Providing [class methods](https://ciatph.github.io/ph-municipalities/ExcelFile.html#download) to programmatically download and use a remote PAGASA 10-day Excel file +- Providing [class methods](https://ciatph.github.io/ph-municipalities/ExcelFile.html#download) for programmatically downloading and using a remote PAGASA 10-day Excel file - Allowing to override the default region - province list settings during class initialization (See [Class Usage - Using a Custom Configuration File](#using-a-custom-configuration-file)) > **NOTE:**
@@ -452,7 +455,7 @@ npm run list:region Builds the class documentation into the **/docs** directory. -> [!NOTE] +> **NOTE:**
> This script requires manual installation of the `jsdoc@4.0.3`, `minami@1.2.3`, and `taffydb@2.7.3` packages as **devDependencies** inside the **/app** directory. > These libraries, only used for building the class documentation, were excluded from the final package.json to have fewer external dependencies. > ```bash @@ -464,7 +467,7 @@ Builds the class documentation into the **/docs** directory. Runs the Bash script that installs the JSDoc and theme dependencies for building the class documentation only within the **development Docker environment**. -> [!NOTE] +> **NOTE:**
> This script requires running from a Bash terminal - it won't work from a Windows command line terminal. It is reserved for building the documentation with Docker. This script is used for building the class documentation from a local Docker environment along with the `npm run docs:build` NPM script. @@ -478,7 +481,7 @@ docker exec -u root -it ph-municipalities npm run docs:build Runs the Bash script that builds the class documentation using JSDoc only within the **development Docker environment**. -> [!NOTE] +> **NOTE:**
> This script requires running from a Bash terminal - it won't work from a Windows command line terminal. It is reserved for building the documentation with Docker. This script is used for building the class documentation from a local Docker environment along with the `npm run docs:install` NPM script. diff --git a/app/.npmignore b/app/.npmignore index 00ab32d..101b7f9 100644 --- a/app/.npmignore +++ b/app/.npmignore @@ -8,9 +8,10 @@ dist/ *.zip *.tgz *.txt -*.tgz *.png *.sh +*.md +*.tmp .env.example .eslintrc.js @@ -18,8 +19,6 @@ dist/ .gitignore .npmignore .eslintignore -README.md -README.tmp # Ignore all JSON files except: !package.json @@ -34,7 +33,12 @@ src/examples/ docs/ diagrams/ -# Docker +# Exclude the __tests__ directory except for some files +__tests__/**/* +!__tests__/provinces/**/*.js +!__tests__/classInitialization/checkClass.js + +# Docker and other files Dockerfile .dockerignore jest.config.js diff --git a/app/__tests__/municipalities/municipalitiesPerProvinceCount.js b/app/__tests__/municipalities/municipalitiesPerProvinceCount.js index 385d645..d09282c 100644 --- a/app/__tests__/municipalities/municipalitiesPerProvinceCount.js +++ b/app/__tests__/municipalities/municipalitiesPerProvinceCount.js @@ -90,14 +90,14 @@ describe('Municipalities per province count match', () => { const missingInConfig = allProvinces.filter(item => !allProvincesConfig.includes(item)) if (missingInParsed.length > 0) { - let msg = `[WARNING]: ${missingInParsed.length} province(s) in the 10-Day Excel file are missing\n` - msg += `in the (PAGASA seasonal) config: ${arrayToString(missingInParsed)}` + let msg = `[WARNING]: ${missingInParsed.length} province(s) missing in the 10-Day Excel file\n` + msg += `but present in the (PAGASA seasonal) config: ${arrayToString(missingInParsed)}` logger.log(msg, { color: ColorLog.COLORS.TEXT.YELLOW }) } if (missingInConfig.length > 0) { - let msg = `[WARNING]: ${missingInConfig.length} province(s) in the (PAGASA seasonal) config are missing\n` - msg += `in the 10-Day Excel file: ${arrayToString(missingInConfig)}` + let msg = `[WARNING]: ${missingInConfig.length} province(s) in the (PAGASA seasonal) config is/are missing\n` + msg += `but available in the 10-Day Excel file: ${arrayToString(missingInConfig)}` logger.log(msg, { color: ColorLog.COLORS.TEXT.YELLOW }) } } diff --git a/app/__tests__/provinces/updateInstances.js b/app/__tests__/provinces/updateInstances.js index 316a1a5..49c3a0a 100644 --- a/app/__tests__/provinces/updateInstances.js +++ b/app/__tests__/provinces/updateInstances.js @@ -32,7 +32,7 @@ const updateInstances = ({ if (fromConfig.length > 0) { uniqueProvinces = new Set(allProvinces.filter(item => !fromConfig.includes(item))) - let msg = `[WARNING]: ${fromConfig.length} province(s) in the (PAGASA seasonal) config are missing\n` + let msg = `[WARNING]: ${fromConfig.length} province(s) from the (PAGASA seasonal) config are missing \n` msg += `in the 10-Day Excel file: ${arrayToString(fromConfig)}` logger.log(msg) @@ -41,8 +41,8 @@ const updateInstances = ({ // Provinces present in the 10-Day Excel file but missing in the config (PAGASA seasonal) file if (fromExcel.length > 0) { uniqueExcelProvinces = new Set(allExcelProvinces.filter(item => !fromExcel.includes(item))) - let msg = `[WARNING]: ${fromExcel.length} province(s) in the 10-Day Excel file are missing\n` - msg += `in the (PAGASA seasonal) config: ${arrayToString(fromExcel)}` + let msg = `[WARNING]: ${fromExcel.length} province(s) present in the 10-Day Excel file\n` + msg += `but missing in the (PAGASA seasonal) config: ${arrayToString(fromExcel)}` logger.log(msg) } diff --git a/app/index.js b/app/index.js index a53c319..84ad839 100644 --- a/app/index.js +++ b/app/index.js @@ -1,8 +1,10 @@ const ExcelFile = require('./src/classes/excel') const ExcelFactory = require('./src/classes/excelfactory') const Schema = require('./src/classes/schema') +const ColorLog = require('./src/classes/colorlog') module.exports = { + ColorLog, ExcelFile, ExcelFactory, Schema diff --git a/app/package-lock.json b/app/package-lock.json index f330304..48aa42a 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "ph-municipalities", - "version": "1.4.0", + "version": "1.4.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ph-municipalities", - "version": "1.4.0", + "version": "1.4.1", "license": "ISC", "dependencies": { "dotenv": "^16.0.1", diff --git a/app/package.json b/app/package.json index 60141dd..6b9aafc 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "ph-municipalities", - "version": "1.4.0", + "version": "1.4.1", "description": "List and write the `municipalities` of Philippines provinces or regions into JSON files", "main": "index.js", "engines": {