Repository navigation
chore(monorepo): refactor entire project to monorepo and setup initial JS package #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
68 commits
Select commit
Hold shift + click to select a range
c4b3ea8
refactor(fs): initial monorepo layout
Ryan-Millard b88514f
chore(legal): update licenses - see conversation in #230
Ryan-Millard baa321f
chore(core-lib): cleanup fs
Ryan-Millard d84a37d
refactor(builds): core as shared lib other link to it
Ryan-Millard 0589276
feat(js-package): create basic start of JS-wasm package
Ryan-Millard be5854f
broken
Ryan-Millard e7e38ed
finally a working project!!
Ryan-Millard cd222d4
fix(js-package): use correct package type - module
Ryan-Millard 2079dc1
feat(react-example): add /about to sitemap
Ryan-Millard 43e47b4
Merge branch 'main' of https://github.com/Ryan-Millard/Img2Num into r…
Ryan-Millard 867b982
refactor(CMake): make internal headers private & separate builds prop…
Ryan-Millard 0bd766a
chore(monorepo): migrate to pnpm workspace
Ryan-Millard 51561c5
chore(js-scripts): reconfig legacy CLI scripts
Ryan-Millard 7039641
feat(.npmrc): add initial .npmrc file
Ryan-Millard 7b781dc
refactor(docker): update to use pnpm & new dev env
Ryan-Millard 0f1cf4b
ci(ci and deploy): update to reflect new repo structure
Ryan-Millard 6c88166
fix(root-package.json): add format scripts and update validate-scripts
Ryan-Millard 68fa94f
style(format): format all files
Ryan-Millard 2435c67
ci(build-docs, build-react-app): fix: add pnpm install before build
Ryan-Millard d1bd5c5
ci(ci.yml): fix typo - lint -> eslint
Ryan-Millard b1723fa
style(eslint): remove unused var in format-cpp.js
Ryan-Millard b07bf4f
fix(deps): add uninstalled peer deps
Ryan-Millard 1b9dd65
fix(docs-build): pnpm + webpack in docusaurus error
Ryan-Millard cde7327
ci(format-check): fix prettier formatting error
Ryan-Millard 95ea01f
chore(dev-scripts): fix script validation
Ryan-Millard 629a080
ci(ci.yml permissions): restrict to read permissions
Ryan-Millard 0c8c700
chore(license): update entire repo licensing - see #230
Ryan-Millard 3eb0296
chore(cpp-console): remove debug printing
Ryan-Millard 464a597
fix(wasmClient): reject pending callbacks on termination
Ryan-Millard 9099d04
feat(wasmClient): worker load/init failures no longer silently lost
Ryan-Millard cdb6727
refactor(js-binding): cmake exit runtime and initial memory
Ryan-Millard 17e181e
chore(image_utils): move includes to cpp & add guard
Ryan-Millard 05d7036
fix(kmeans): prevent float-to-uint8_t overflow in RGB centroid
Ryan-Millard 3108def
fix(wasmWorker): move validation inside try block and post errors to …
Ryan-Millard 2c31622
fix(wasmWorker): wrap string errors in Error objects before rejecting
Ryan-Millard c09dc12
chore(deps-react): move tanstack/react-query from dev deps to deps
Ryan-Millard a4229a1
ci(permissions): update build & deploy permissions
Ryan-Millard 08f9662
style(eslint): mark unused vars with `_` prefix
Ryan-Millard e8270e8
style(format): fix code styles & update .prettierignore
Ryan-Millard f153e01
Merge branch 'main' into refactor/monorepo
Ryan-Millard 136ce2a
chore(approve-builds): approve pnpm builds for some packages
Ryan-Millard 5244d6a
chore(js-pkg): move imageToUint8ClampedArray into JS package
Ryan-Millard a27d27e
docs(js): add jsdocs & typedoc docusaurus plugin
Ryan-Millard 5366325
docs(cleanup): remove old resources
Ryan-Millard 62950de
style(format): format all files
Ryan-Millard 135917e
docs(restructure): change to match monorepo & be kind to newcomers
Ryan-Millard 8699330
docs(README.md, CONTRIBUTING.md): update links & simplify content
Ryan-Millard d5dddea
docs(cleanup & guide): clean up docs structure & add internal install…
Ryan-Millard a6e1ce2
style(format): format docs files
Ryan-Millard 8d795fc
docs(structure): improve structure & update some content
Ryan-Millard e85d8d4
style(format-script): add distinct colors & success message, also for…
Ryan-Millard dda3045
fix(format-check): fix bad path for check arg in format:check script
Ryan-Millard 6ab4c59
ci(deploy.yml): fix: Unpinned tag for a non-immutable Action in workflow
Ryan-Millard 2278913
fix(format-script): Uncontrolled command line
Ryan-Millard 8d46169
docs(wasmWorker): false positive: Missing origin verification in han…
Ryan-Millard 9b6da8c
refactor(format-script): remove argument forwarding entirely
Ryan-Millard 3e979f8
docs(img2num.h): add Doxygen comments
Ryan-Millard 9e61615
docs(doxygen): introduce shared Doxygen config and generation script …
Ryan-Millard 5fd4640
docs(doxygen-docusaurus): embed Doxygen C++ API reference with fullsc…
Ryan-Millard b3c0377
refactor(validate-scripts): make it reusable, add ignore list _meta o…
Ryan-Millard 49d5bc8
style(format): format all files
Ryan-Millard c4a9676
docs(refactor-notice): add simple announcement about incomplete docs
Ryan-Millard 6696370
docs(js-disclaimer): package not on NPM - docs are placeholder
Ryan-Millard 7f3e78e
Merge branch 'main' into refactor/monorepo
Ryan-Millard 3b2ce58
docs(version): update to have old and next
Ryan-Millard 3e63cbd
chore(licenses): add/update LICENSE files
Ryan-Millard 42e6fac
chore(README): update links
Ryan-Millard b33c312
docs(docs-sidebar): fix order
Ryan-Millard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # ================================================================= | ||
| # Img2Num Top-Level | ||
| # ================================================================= | ||
| cmake_minimum_required(VERSION 3.16) | ||
| project(Img2Num LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Default build type | ||
| if(NOT CMAKE_BUILD_TYPE) | ||
| set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) | ||
| endif() | ||
|
|
||
| # Core library | ||
| add_subdirectory(core) | ||
|
|
||
| # JS bindings | ||
| add_subdirectory(bindings/js) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # ================================================================= | ||
| # JS/WASM binding using core object library | ||
| # ================================================================= | ||
| cmake_minimum_required(VERSION 3.16) | ||
| project(JSBindings LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Must be built with Emscripten | ||
| if(NOT EMSCRIPTEN) | ||
| message(FATAL_ERROR "Emscripten is required to build JS bindings.") | ||
| endif() | ||
|
|
||
| # Collect binding sources | ||
| file(GLOB_RECURSE BINDING_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") | ||
| file(GLOB_RECURSE BINDING_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") | ||
|
|
||
| # Build WASM module | ||
| add_executable(img2num_wasm ${BINDING_SRC}) | ||
|
|
||
| # Link core library object files | ||
| target_link_libraries(img2num_wasm PRIVATE core) | ||
|
|
||
| # Include directories | ||
| target_include_directories(img2num_wasm PRIVATE | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
| ) | ||
|
|
||
| # Emscripten options | ||
| set(COMMON_FLAGS | ||
| "SHELL:-s MODULARIZE=1" | ||
| "SHELL:-s EXPORT_ES6=1" | ||
| "SHELL:-s EXIT_RUNTIME=1" | ||
| "SHELL:-s ENVIRONMENT=web,worker" | ||
| "SHELL:-s EXPORTED_FUNCTIONS=['_malloc','_free']" | ||
| "SHELL:-s EXPORTED_RUNTIME_METHODS=['ccall','cwrap','getValue','setValue','HEAPU8','HEAP32']" | ||
| "SHELL:-s INITIAL_MEMORY=1024MB" | ||
| "SHELL:-s MAXIMUM_MEMORY=2048MB" | ||
| "SHELL:-s ALLOW_MEMORY_GROWTH=1" | ||
| "SHELL:-s EXPORT_NAME=createImg2NumModule" | ||
| "SHELL:-s USE_PTHREADS=1" | ||
| "SHELL:-s PTHREAD_POOL_SIZE=8" | ||
| ) | ||
|
|
||
| target_compile_options(img2num_wasm PRIVATE -pthread -msimd128) | ||
| target_link_options(img2num_wasm PRIVATE ${COMMON_FLAGS} -pthread -msimd128) | ||
|
|
||
| # Build type flags | ||
| if(CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
| target_compile_options(img2num_wasm PRIVATE -O2 -g4) | ||
| target_link_options(img2num_wasm PRIVATE "SHELL:-s ASSERTIONS=2" -g4) | ||
| else() | ||
| target_compile_options(img2num_wasm PRIVATE -O3) | ||
| target_link_options(img2num_wasm PRIVATE "SHELL:-s SINGLE_FILE=0") | ||
| endif() | ||
|
|
||
| # Output location | ||
| set_target_properties(img2num_wasm PROPERTIES | ||
| RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/packages/js/build-wasm" | ||
| OUTPUT_NAME "index" | ||
| SUFFIX ".js" | ||
| ) | ||
|
|
||
| message(STATUS "WASM module configured: img2num_wasm") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #include <emscripten/bind.h> | ||
| #include "image_utils.h" | ||
| #include "exported.h" | ||
|
|
||
| EXPORTED void gaussianBlurFft(uint8_t *image, size_t width, size_t height, double sigma) { | ||
| gaussian_blur_fft(image, width, height, sigma); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # ================================================================= | ||
| # Python bindings via pybind11 | ||
| # ================================================================= | ||
| find_package(Python COMPONENTS Interpreter Development REQUIRED) | ||
| find_package(pybind11 REQUIRED) | ||
|
|
||
| pybind11_add_module(img2num_python | ||
| src/python_wrapper.cpp | ||
| ) | ||
|
|
||
| # Link Python module to shared core library | ||
| target_link_libraries(img2num_python PRIVATE img2num_core) | ||
| target_include_directories(img2num_python PRIVATE ${CMAKE_SOURCE_DIR}/core/include) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #include <pybind11/pybind11.h> | ||
| #include "img2num.h" | ||
|
|
||
| namespace py = pybind11; | ||
|
|
||
| PYBIND11_MODULE(img2num, m) { | ||
| m.doc() = "Img2Num library"; | ||
|
|
||
| //m.def("some_function", &some_function, "A function from Img2Num"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # WASM build directory | ||
| build/ | ||
| cmake-build/ | ||
|
|
||
| # C++ object and binary files | ||
| *.o | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # ================================================================= | ||
| # Img2Num Core (Object Library) | ||
| # ================================================================= | ||
| cmake_minimum_required(VERSION 3.16) | ||
| project(CoreLibrary LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Collect sources | ||
| file(GLOB_RECURSE CORE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") | ||
| file(GLOB_RECURSE CORE_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") | ||
|
|
||
| # Build as object library | ||
| add_library(core OBJECT ${CORE_SRC} ${CORE_HEADERS}) | ||
|
|
||
| target_include_directories(core PUBLIC | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
| ) | ||
|
|
||
| # If building with Emscripten and pthreads | ||
| if(EMSCRIPTEN) | ||
| target_compile_options(core PRIVATE -pthread -msimd128) | ||
| target_link_options(core PRIVATE -pthread -msimd128) | ||
| endif() | ||
|
|
||
| message(STATUS "Core library configured with ${CORE_SRC}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 Ryan Millard | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #ifndef EXPORTED_H | ||
| #define EXPORTED_H | ||
|
|
||
| // Macro to export functions for WASM or other C compilers | ||
|
|
||
| #ifdef __EMSCRIPTEN__ | ||
| // Emscripten (Web Assembly) compilation (avoid name | ||
| // mangling & instruct emscripten to keep it) | ||
| #include <emscripten/emscripten.h> | ||
| #define EXPORTED extern "C" EMSCRIPTEN_KEEPALIVE | ||
|
|
||
| #else | ||
|
|
||
| #ifdef __cplusplus | ||
| // Standard C++ compilation (avoid name mangling) | ||
| #define EXPORTED extern "C" | ||
| #else | ||
| // Standard C compilation (nothing) | ||
| #define EXPORTED | ||
| #endif | ||
|
|
||
| #endif | ||
|
|
||
| #endif // EXPORTED_H |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| node_modules | ||
| dist | ||
| dist-ssr | ||
| *.local | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| .DS_Store | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
|
|
||
| # OS Files | ||
| *:Zone.Identifier | ||
|
|
||
| src/data/contributor-credits.json | ||
|
|
||
| .env |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.