Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
908c8cf
ESM lib
timea-solid Aug 28, 2025
92ca4c6
updated configs && linting fixes
timea-solid Sep 3, 2025
e5f3f7d
replaced webpack with rollup
timea-solid Sep 3, 2025
f9d5d21
replaced webpack with rollup
timea-solid Sep 3, 2025
cc7e1b6
added jest coverage
timea-solid Sep 3, 2025
f51524a
drop node18
timea-solid Sep 3, 2025
b095cf0
updated ci versions
timea-solid Sep 3, 2025
47c4eab
moved form lib to dist and imporved npm publishing content
timea-solid Sep 3, 2025
616b9f9
updated readme
timea-solid Sep 3, 2025
183049d
cleaned up rollup config
timea-solid Sep 3, 2025
74baf17
small improvements
timea-solid Sep 3, 2025
22c8d8a
imporved jest and lint
timea-solid Sep 4, 2025
8e431bd
Update test/helpers/dataSetup.ts
timea-solid Sep 4, 2025
78ce629
revert copilot code change
timea-solid Sep 4, 2025
75b5e6d
added safe for tree-shaking
timea-solid Sep 4, 2025
c3986c3
deleted unused release file
timea-solid Sep 4, 2025
3e818fd
found a missing dep for jest
timea-solid Sep 4, 2025
caa433a
small improvements
timea-solid Sep 9, 2025
66a8779
updated teh release.yml
timea-solid Sep 9, 2025
4ce7677
merged main & updated readme with release info
timea-solid Sep 9, 2025
e3fbc78
decided to have only one release way
timea-solid Sep 10, 2025
42252ae
bundle test, polyfills, minified versions
timea-solid Sep 10, 2025
a4b452e
merge branch updateAuthn
timea-solid Sep 10, 2025
6d50cf3
bundle test and globals
timea-solid Sep 10, 2025
29d7a0d
clean SolidAuthnLogic
timea-solid Sep 10, 2025
08b6da4
switched out rollup for webpack
timea-solid Sep 10, 2025
1c3e6ea
decided to bundle everything, including rdflib
timea-solid Sep 10, 2025
c188582
improved docs and test example, added externalbundles
timea-solid Sep 10, 2025
509ddc5
renamed solid-logic umd to be without umd
timea-solid Sep 12, 2025
e368b0b
linting tests
timea-solid Sep 17, 2025
1c75a86
cleanup dep
timea-solid Sep 17, 2025
8f392e6
cleaned tsconfig
timea-solid Sep 17, 2025
7898142
minor improvements
timea-solid Sep 18, 2025
a31646a
merge mained and updated type check
timea-solid Sep 29, 2025
cdc50bb
merge
timea-solid Sep 29, 2025
98332e2
merge
timea-solid Sep 29, 2025
cfdb831
package-lock
timea-solid Sep 29, 2025
786a33e
need to export ChatLogic for profile-pane
timea-solid Oct 2, 2025
ecb4985
export proper types
timea-solid Oct 6, 2025
1d92309
back to commonsJS not to have breaking changes
timea-solid Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .babelrc

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
strategy:
matrix:
node-version:
- 18.x
- 20.x
- 22.x

Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
node_modules
lib
dist
coverage

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.idea
.vscode

src/versionInfo.ts
src/versionInfo.ts
1 change: 0 additions & 1 deletion .npmignore

This file was deleted.

110 changes: 108 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,113 @@
# solid-logic
Core business logic of SolidOS

# Adendum
<img src="https://raw.githubusercontent.com/solid/community-server/main/templates/images/solid.svg" alt="[Solid logo]" height="150" align="right"/>

[![MIT license](https://img.shields.io/github/license/solidos/solidos)](https://github.com/solidos/solidos/blob/main/LICENSE.md)


Core business logic of SolidOS which can be used for any webapp as well.


# Usage

## Install via npm

```sh
npm install solid-logic
```

### Import in your project (ESM/TypeScript)

```js
import { someFunction } from 'solid-logic';
```

## Use directly in a browser

There are a few differences to mention:
* the UMD bundles come in 2 flavours, with rdflib bundled together and without;
* the ESM bundles do not contain rdflib, so it must be imported separately.

## Files
- For browser UMD, bundled with rdflib: `dist/solid-logic.js` (global `window.SolidLogic`)
- For browser UMD, without rdflib: `dist/solid-logic.external.js` (global `window.SolidLogic`)
- For browser ESM, without rdflib: `dist/solid-logic.esm.external.js` (import as module)
- UMD have also chunked files.
- both version also containe minified versions.


### UMD bundle (global variable)

```html
<!-- Load dependencies first -->
<script src="https://unpkg.com/rdflib/dist/rdflib.min.js"></script>
<!-- or -->
<!-- script src="https://cdn.jsdelivr.net/npm/rdflib/dist/rdflib.min.js"></script -->
<!-- Load solid-logic UMD bundle -->
<script src="https://unpkg.com/solid-logic/dist/solid-logic.min.js"></script>
<!-- or -->
<!-- script src="https://cdn.jsdelivr.net/npm/solid-logic/dist/solid-logic.min.js"></script -->
<!-- or -->
<!-- script src="dist/solid-logic.js"></script -->
<script>
// Access via global variable
const logic = window.SolidLogic;
// Example usage
// logic.someFunction(...)
</script>
```


### ESM bundle (import as module)

```html
<script type="module">
import * as $rdf from 'https://esm.sh/rdflib'
import { someFunction } from 'https://esm.sh/solid-logic'

// Example usage
// someFunction(...)
</script>
```

or

### ESM bundle with import map (bare specifiers)

```html
<script type="importmap">
{
"imports": {
"rdflib": "https://esm.sh/rdflib",
"solid-logic": "https://esm.sh/solid-logic"
}
}
</script>
<script type="module">
import * as $rdf from 'rdflib'
import { someFunction } from 'solid-logic'

// Example usage
// someFunction(...)
</script>
```

# How to develop

Check the scripts in the `package.json` for build, watch, lint and test.

# Used stack

* TypeScript + Babel
* Jest
* ESLint
* Webpack

# How to release

Change version and push directly to main. This will trigger the npm release latest script in CI.

# History

Solid-logic was a move to separate business logic from UI functionality so that people using different UI frameworks could use logic code.

Expand Down
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript'
]
}
68 changes: 44 additions & 24 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,49 @@
const {
defineConfig,
} = require("eslint/config");
import tsParser from '@typescript-eslint/parser'
import tseslintPlugin from '@typescript-eslint/eslint-plugin'
import importPlugin from 'eslint-plugin-import'

const tsParser = require("@typescript-eslint/parser");
const typescriptEslint = require("@typescript-eslint/eslint-plugin");
const js = require("@eslint/js");

const {
FlatCompat,
} = require("@eslint/eslintrc");

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

module.exports = defineConfig([{
export default [
{
ignores: [
'dist/**',
'node_modules/**',
'coverage/**'
],
},
{
files: ['src/**/*.js', 'src/**/*.ts', 'src/**/*.cjs', 'src/**/*.mjs'],
languageOptions: {
parser: tsParser,
parser: tsParser,
parserOptions: {
project: ['./tsconfig.json'],
sourceType: 'module',
},
},

plugins: {
"@typescript-eslint": typescriptEslint,
'@typescript-eslint': tseslintPlugin,
import: importPlugin,
},

extends: compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
}]);
rules: {
semi: ['error', 'never'],
quotes: ['error', 'single'],
'no-unused-vars': 'off', // handled by TS
'@typescript-eslint/no-unused-vars': ['warn'],
'@typescript-eslint/no-explicit-any': 'warn',
},
},
{
files: ['test/**/*.js', 'test/**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: ['./tsconfig.test.json'],
},
},
rules: {
semi: ['error', 'never'],
quotes: ['error', 'single'],
'no-console': 'off', // Allow console in tests
'no-undef': 'off', // Tests may define globals
}
}
]
21 changes: 14 additions & 7 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
module.exports = {
verbose: true,
/** @type {import('jest').Config} */
export default {
// verbose: true, // Uncomment for detailed test output
collectCoverage: true,
coverageDirectory: 'coverage',
testEnvironment: 'jsdom',
testEnvironmentOptions: {
customExportConditions: ['node']
customExportConditions: ['node'],
},
setupFilesAfterEnv: [
'./test/helpers/setup.ts'
]
}
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
transform: {
'^.+\\.[tj]sx?$': ['babel-jest', { configFile: './babel.config.js' }],
},
setupFilesAfterEnv: ['./test/helpers/setup.ts'],
testMatch: ['**/__tests__/**/*.ts?(x)', '**/?(*.)+(spec|test).ts?(x)'],
roots: ['<rootDir>/src', '<rootDir>/test'],
}
Loading