Thank you for your interest in contributing! FEAScript is in early development, with continuous additions of new features and improvements. To ensure a smooth and collaborative development process, please review and follow the guidelines below.
- Development Environment & Coding Style
- Variable & File Naming
- File Structure
- Branching & Workflow
- Local Testing
- Running the Node.js Examples
- Verifying Your Changes
- Use Visual Studio Code with the Prettier plugin for automatic code formatting
- Use a 110-character line width to maintain consistent formatting
- Observe the code near your intended changes and aim to preserve that style in your modifications
- Use camelCase formatting for variable names throughout the code
- JavaScript source file names use camelCase (e.g.,
logging.js,meshGeneration.js,newtonRaphson.js)
- Public entry file:
index.js(standard entry point convention) - Core model file:
FEAScript.js(matches the library name)
All files in the FEAScript-core codebase should follow this structure:
- Banner: All files start with the FEAScript banner
- Imports:
- External imports first, alphabetically ordered
- Internal imports next, grouped by module/folder
- Classes/Functions: Implementation with proper JSDoc comments
Example:
/**
* ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
* FEAScript Library
* Lightweight Finite Element Simulation in JavaScript
* Version: {VERSION} | https://feascript.com
* MIT License Β© 2023β20xx FEAScript
* ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
*/
// External imports
import { mathLibrary } from "math-package";
// Internal imports
import { relatedFunction } from "../utilities/helper.js";
/**
* Class to handle specific functionality
*/
export class MyClass {
/**
* Constructor to initialize the class
* @param {object} options - Configuration options
*/
constructor(options) {
// Implementation
}
/**
* Function to perform a specific action
* @param {number} input - Input value
* @returns {number} Processed result
*/
doSomething(input) {
// Implementation
return input * DEFAULT_VALUE;
}
}To contribute a new feature or fix:
- Do not commit directly to
main - Instead, create a shortβlived branch:
feature/<topic>for new functionalityfix/<issue>for bug fixes
External contributors:
- Fork the repo
- Branch from
mainin your fork - Push and open a PR from your forkβs branch into
main
Before submitting a pull request, test your modifications by running the FEAScript library from a local directory. For example, you can load the library in your HTML file as follows:
import { FEAScriptModel, plotSolution, printVersion } from "[USER_DIRECTORY]/FEAScript-core/src/index.js";FEAScript can be run on a local server. You must start the server from the workspace root directory (the folder that contains both FEAScript-core/ and FEAScript-website/), not from inside either subfolder. The HTML files use relative paths such as ../feascript-website.css and ../../FEAScript-core/src/index.js that only resolve correctly from that root.
# Navigate to the workspace root first
cd /path/to/FEAScript-workspace
# Then start the server
python3 -m http.serverThe server will be available at http://127.0.0.1:8000/. Open a tutorial at its full path, e.g.:
http://127.0.0.1:8000/FEAScript-website/tutorials/solidification-front-2d-worker.html
Static file server npm packages like serve and Vite can also be used.
Testing can be also performed at the Node.js environment. In this case you can also run predefined tests to make sure nothing is broken. This performed as follows:
npm testThese tests compare the numerical results against stored reference solutions at selected points.