Skip to content

Commit

Permalink
Merge branch 'MAINTENANCE'
Browse files Browse the repository at this point in the history
- fix JSDoc annotations
- add custom css for JSDoc to match the colors to the XKPasswd app
- fix typos in comments
- remove duplicate tests
- update ESLint configuration
- update Jest configuration
- initial setup for Puppeteer

# Conflicts:
#	src/web/configcontroller.mjs
#	src/web/configview.mjs
  • Loading branch information
hepabolu committed Oct 22, 2024
2 parents a754fb7 + 709b869 commit d09b567
Show file tree
Hide file tree
Showing 30 changed files with 4,303 additions and 1,278 deletions.
11 changes: 0 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,3 @@ insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{mjs,js}]
indent_style = space
indent_size = 2

# Matches the exact files package.json
[{package.json}]
indent_style = space
indent_size = 2
14 changes: 0 additions & 14 deletions .eslintrc.json

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

![To anyone who understands information theory and security and is in an infuriating argument with someone who does not (possibly involving mixed case), I sincerely apologize.](https://imgs.xkcd.com/comics/password_strength.png)

Bart is leading this port of the Perl module to JavaScript with the [NosillaCast community](https://podfeet.com/slack) as part of the on-going Programming By Stealth blog/podcast series](https://pbs.bartificer.net) he produces with [Allison Sheridan](https://www.podfeet.com/blog/about/).
Bart is leading this port of the Perl module to JavaScript with the [NosillaCast community](https://podfeet.com/slack) as part of the ongoing [Programming By Stealth blog/podcast series](https://pbs.bartificer.net) he produces with [Allison Sheridan](https://www.podfeet.com/blog/about/).

## Current version of the app

Expand Down Expand Up @@ -38,7 +38,7 @@ The plan is to develop this port in the following broad stages:

## Repository Structure

Fundamentally, the repository is a NodeJS project, so it contains the standard NodeJS files. In addition to these standard files, the project's assets are stored in the following structure:
Fundamentally, the repository is a Node.js project, so it contains the standard Node.js files. In addition to these standard files, the project's assets are stored in the following structure:

* `/buildScripts/` — the folder containing the scripts used to build the bundled versions of the module and the module's documentation site, including its UML diagrams.
* `/dist/` — the target folder into which the build scripts will publish the bundled versions of the module, ready for distribution. **Do not edit the contents of this folder directly!**
Expand All @@ -58,7 +58,7 @@ This project is managed through GitHub. To contribute by starting or commenting

If you download the raw code you'll need the following to build the project, i.e. transform the raw code into a usable JavaScript module with documentation, you'll need:

1. The most recent LTS (Long Term Support) version of the NodeJS runtime available at [nodejs.org](https://nodejs.org/)
1. The most recent LTS (Long Term Support) version of the Node.js runtime available at [nodejs.org](https://nodejs.org/)
2. A POSIX-compliant shell and terminal app capable of running Bash scripts — standard on Linux & Mac, and available for Windows through the Windows Subsystem for Linux (WSL).
* Microsoft's documentation for installing WSL — [learn.microsoft.com/…](https://learn.microsoft.com/en-us/windows/wsl/install)
* The official Bash documentation — [www.gnu.org/…](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html)
Expand Down Expand Up @@ -117,7 +117,7 @@ When writing documentation, try to keep your additions in the same voice as the

When contributing to Mermaid Diagrams, add all class members inside the class definition block; don't use the alternative syntax that allows single members to be added in separate statements.

When writing code, be sure to have ESLint enabled in your editor so you can see when you break the project's style guide. When choosing variable names, try to be consistent with the other nearby variables.
When writing code, be sure to have ESLint enabled in your editor, so you can see when you break the project's style guide. When choosing variable names, try to be consistent with the other nearby variables.

When writing code, make sure it's in line with the project's ESLint configuration, and try to choose variable names that are in line with others in the surrounding code.

Expand Down
6 changes: 3 additions & 3 deletions docs-other/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

If you want to participate in the development of this webapp here are some instructions to help you set up.

* clone the repository on [Github](https://github.com/bartificer/xkpasswd-js)
* clone the repository on [GitHub](https://github.com/bartificer/xkpasswd-js)
* set up your environment
```shell
npm ci # install the modules
npm run build # run the build for the first time. It should finish successfully.
npm test # run the tests for the first time. They should all pass.
npm run cov # run the tests again but this time with test coverage. Coverage should be above 80%
```
* during development you can use the `watch` scripts to have an automatic webpack build and an automatic webserver reload
* during development, you can use the `watch` scripts to have an automatic webpack build and an automatic webserver reload

## Hot build and reload

The easiest way to achieve this is opening a Terminal window in the root directory of this project.

In the Terminal enter `npm run start` to start a local webserver.
This script will watch for any change in any file, and automatically start a
a webpack build and restarts the server when there is a new build.
webpack build and restarts the server when there is a new build.

In your webbrowser enter `http://localhost:8080` to find the webapp.

Expand Down
76 changes: 76 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import globals from 'globals';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import js from '@eslint/js';
import {FlatCompat} from '@eslint/eslintrc';
import jsdoc from 'eslint-plugin-jsdoc';
import google from 'eslint-config-google';
import jest from 'eslint-plugin-jest';

// const __filename = fileURLToPath(import.meta.url);
// const __dirname = path.dirname(__filename);
// const compat = new FlatCompat({
// baseDirectory: __dirname,
// recommendedConfig: js.configs.recommended,
// allConfig: js.configs.all,
// });

export default [
// app related javascript files
{
name: 'app files',
files: ["src/**/*.mjs"],
ignores: ['src/**/*.test.mjs'],
plugins: {
jsdoc,
},
...js.configs.recommended,
...google,
...jsdoc.configs['flat/recommended'],
settings: {
jsdoc: {
mode: 'jsdoc'
}
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
indent: ['error', 2],
'jsdoc/require-description': 'error',
'jsdoc/check-values': 'error',
'jsdoc/informative-docs': 1,
},
},
{
name: 'test files',
files: ["src/**/*.test.mjs"],
plugins: {
jest
},
languageOptions: {
globals: {
...globals.jest,
},
ecmaVersion: 'latest',
sourceType: 'module',
},

// {
// plugins: {
// jest,
// },
//
//
// languageOptions: {
// globals: {
// ...globals.browser,
// ...globals.jest,
// },
//
// ecmaVersion: 'latest',
// sourceType: 'module',
// },
//
}];
32 changes: 32 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"projects": [
{
"displayName": "unit",
"testEnvironment": "jest-environment-node",
"transform": {},
"testPathIgnorePatterns": [
"/node_modules/",
"/archive/"
],
"testMatch": [
"<rootDir>/src/lib/**/?*.test.mjs"
]
},
{
"displayName": "puppeteer",
"preset": "jest-puppeteer",
"transform": {},
"testPathIgnorePatterns": [
"/node_modules/",
"/archive/",
"src/lib/"
],
"testMatch": [
"**/?*.test.mjs"
],
"globalSetup": "jest-environment-puppeteer/setup",
"globalTeardown": "jest-environment-puppeteer/teardown",
"testEnvironment": "jest-environment-puppeteer"
}
]
}
2 changes: 2 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import $ from 'jquery';
global.$ = global.jQuery = $;
41 changes: 40 additions & 1 deletion jsdoc.conf.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
{
"docdash": {
"collapse": true,
"menu": {
"Bartificer Creations": {
"href": "https://bartificer.net/",
"target": "_blank"
},
"Podfeet Podcasts": {
"href": "https://podfeet.com/",
"target": "_blank"
},
"XKPasswd": {
"href": "https://beta.xkpasswd.net",
"target": "_blank"
}
},
"search": true,
"sectionOrder": [
"Modules",
"Classes",
"Tutorials"
],
"static": true,
"sort": true,
"typedefs": true,
"scripts": [
"jsdoc-xkp.css"
]
},
"templates": {
"default": {
"staticFiles": {
"include": [
"src/docs/jsdoc-xkp.css"
]
}
}
},
"opts": {
"encoding": "utf8",
"pedantic": true,
Expand All @@ -7,7 +45,8 @@
"source": {
"include": [
"./src/",
"./src/lib/"
"./src/lib/",
"./src/web/"
],
"includePattern": ".+\\.(mjs|js|jsdoc)$"
},
Expand Down
Loading

0 comments on commit d09b567

Please sign in to comment.