Skip to content
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
55 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
45245b2
alligned bundle name with entries in package.json
timea-solid Oct 23, 2025
b176235
merge
timea-solid Oct 23, 2025
2e1ed31
renamed rdflib
timea-solid Oct 23, 2025
da65b2c
imporved bundles for window case
timea-solid Oct 24, 2025
f7eee1f
improved webpack
timea-solid Oct 24, 2025
696775b
removed some unused dep
timea-solid Nov 6, 2025
f480b7d
merge main
timea-solid Nov 6, 2025
bc0ea8f
readme improvement
timea-solid Nov 6, 2025
dbb83f7
Merge branch 'main' into newFace
timea-solid Nov 6, 2025
6fd7192
renamed esm bundles
timea-solid Nov 6, 2025
536a3ae
Merge branch 'newFace' of https://github.com/SolidOS/solid-logic into…
timea-solid Nov 6, 2025
d167ace
ensure singleton
timea-solid Nov 6, 2025
28e29fd
library name chnaged to solid-logic
timea-solid Nov 7, 2025
db26ace
updated dep
timea-solid Nov 7, 2025
3343cc7
revert to SolidLogic
timea-solid Nov 7, 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.

15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ jobs:
strategy:
matrix:
node-version:
- 18.x
- 20.x
- 22.x

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
Expand All @@ -51,15 +50,15 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: build
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: rlespinasse/github-slug-action@v3.x
- uses: rlespinasse/github-slug-action@v4.x
- name: Append commit hash to package version
run: 'sed -i -E "s/(\"version\": *\"[^\"]+)/\1-${GITHUB_SHA_SHORT}/" package.json'
- name: Disable pre- and post-publish actions
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
- uses: JS-DevTools/npm-publish@v1
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ env.GITHUB_REF_SLUG }}
Expand All @@ -72,12 +71,12 @@ jobs:
- uses: actions/download-artifact@v4
with:
name: build
- uses: actions/setup-node@v1
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Disable pre- and post-publish actions
run: 'sed -i -E "s/\"((pre|post)publish)/\"ignore:\1/" package.json'
- uses: JS-DevTools/npm-publish@v1
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
tag: latest
17 changes: 0 additions & 17 deletions .github/workflows/release.yml

This file was deleted.

7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
node_modules
lib
dist
coverage

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

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 npm/ESM: `dist/solid-logic.esm.js` (referenced automatically in npm projects)
- For browser UMD, bundled with rdflib: `dist/solid-logic.umd.js` (global `window.SolidLogic`)
- For browser UMD, without rdflib: `dist/solid-logic.umd.external.js` (global `window.SolidLogic`)
- For browser ESM, without rdflib: `dist/solid-logic.esm.external.js` (import as module)
- also, both flabours, ESM and UMD come in chunked files.


### 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.umd.min.js"></script>
<!-- or -->
<!-- script src="https://cdn.jsdelivr.net/npm/solid-logic/dist/solid-logic.umd.min.js"></script -->
<!-- or -->
<!-- script src="dist/solid-logic.umd.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
* Rollup

# 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'
]
}
49 changes: 25 additions & 24 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
const {
defineConfig,
} = require("eslint/config");
import tsParser from '@typescript-eslint/parser'
import tseslintPlugin from '@typescript-eslint/eslint-plugin'
import tseslint from 'typescript-eslint'
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 [
...tseslint.configs.recommended,
{
files: ['src/**/*.ts', 'test/**/*.test.ts'],
ignores: ['dist/**', 'node_modules/**'],
languageOptions: {
parser: tsParser,
parser: tsParser,
parserOptions: {
project: ['./tsconfig.json', './tsconfig.test.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',
},
},
]
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