Skip to content
Open

Esm #1834

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6f6e708
mixed ESM
bourgeoa Nov 13, 2025
6e0b966
more mixed for app
bourgeoa Nov 13, 2025
78c0558
more mixed for app and test
bourgeoa Nov 13, 2025
f3f3968
index.mjs
bourgeoa Nov 13, 2025
d5d0e75
Fix line endings in bin/solid for Docker compatibility
Nov 13, 2025
13e5054
package.json
Nov 13, 2025
0357fea
.gitattributes
Nov 13, 2025
5b65f43
test/ migrated to esm in test-esm/
Nov 13, 2025
ac4eec7
ESM Migration: Convert main lib files and lib/api to ESM
Nov 13, 2025
73b2626
ESM Migration: Complete lib/api/ and lib/handlers/ conversion
Nov 13, 2025
277633e
Add ESM test command to CI workflow
bourgeoa Nov 14, 2025
562a91b
add missing test-esm/resources
Nov 20, 2025
d2ebe52
update esm and tests
Nov 20, 2025
86da28f
add missing .mjs files
Nov 22, 2025
04fef95
missing mjs file
Nov 25, 2025
f3d0a1b
add esm entry point
Nov 25, 2025
60e2f93
missing content in ldp.mjs
Nov 25, 2025
53c8278
miscellaneous updates
Nov 25, 2025
635f7b2
updates lib/api
Nov 25, 2025
ebf457f
updates to lib/srvices
Nov 25, 2025
7bd6cdd
updates to lib/models
Nov 25, 2025
aba64d9
updates to lib/payment-pointer-discovery.mjs
Nov 25, 2025
b935bdf
updates to lib/ldp-container.mjs
Nov 25, 2025
3f536ab
updates to lib/requests/auth-request.mjs
Nov 25, 2025
beb6dad
updates to lib/rdf-notification-template.mjs
Nov 25, 2025
c668ad3
updates to lib/handlers
Nov 25, 2025
5c258b2
lib/server-config.mjs
Nov 25, 2025
b370ff7
updates .mjs
Nov 30, 2025
1bf6b36
Revert "updates .mjs"
Nov 30, 2025
fd1a323
fix critical node-forge
Nov 30, 2025
f8ff940
esm account-manager and test
Dec 1, 2025
1706ce9
add default-templates/emails .mjs
Dec 2, 2025
ec340b2
update unit test to esm
Dec 2, 2025
32e473c
return to CJS utils.js
Dec 2, 2025
7afef98
update to esm only
Dec 6, 2025
21798f6
lint issues
Dec 6, 2025
128fc7c
add nyc-esm
Dec 6, 2025
be487db
some cleaning
Dec 6, 2025
89395b3
standard lint issues
Dec 8, 2025
924d4b8
Merge branch 'main' into nss2esm-hybrid
bourgeoa Dec 8, 2025
1e3025d
update require() and debug's
bourgeoa Dec 21, 2025
3f1fba3
delete patch.mjs.old
bourgeoa Dec 21, 2025
6db0f28
updates
bourgeoa Dec 22, 2025
7610c97
resources/config
bourgeoa Dec 22, 2025
23f2403
rename test-esm to test
bourgeoa Dec 23, 2025
94454d1
standard issues
bourgeoa Dec 23, 2025
951d712
remove test-esm from workflow
bourgeoa Dec 23, 2025
9424280
rm *.js to keep *.mjs
bourgeoa Dec 23, 2025
e1b12bb
update bin/solid and import index.mjs
bourgeoa Dec 23, 2025
3544e9b
c8 in CI workflow
bourgeoa Dec 23, 2025
40da84a
add missing test files
bourgeoa Dec 23, 2025
c65a248
some cleaning
bourgeoa Dec 23, 2025
bb700b5
mashlib was not loading and server OIDC listening issue
bourgeoa Dec 24, 2025
f1cbcc9
npm publish
bourgeoa Dec 24, 2025
4d031e4
Change test suite runner to ubuntu-latest
bourgeoa Dec 24, 2025
822b18b
Refactor CI workflow by removing test-suite job
bourgeoa Dec 24, 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
19 changes: 19 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Force bash scripts to have unix line endings
*.sh text eol=lf

# Force bin files (executable scripts) to have unix line endings
bin/* text eol=lf

# Ensure batch files on Windows keep CRLF line endings
*.bat text eol=crlf

# Binary files should not be modified
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.pdf binary
*.zip binary
*.tar.gz binary
*.tgz binary
56 changes: 53 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,65 @@ jobs:
# test code
- run: npm run standard
- run: npm run validate
- run: npm run nyc
- run: npm run c8
# Test global install of the package
- run: npm pack .
- run: npm install -g solid-server-*.tgz
# Run the Solid test-suite
- run: bash test/surface/run-solid-test-suite.sh $BRANCH_NAME $REPO_NAME
- name: Save build
# if: matrix.node-version == '20.x'
uses: actions/upload-artifact@v5
with:
name: build
path: |
.
!node_modules
retention-days: 1

# The pipeline automate publication to npm, so that the docker build gets the correct version
npm-publish-build:
needs: [build]
name: Publish to npm
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v6
with:
name: build
- uses: actions/setup-node@v6
with:
node-version: 22.x
- uses: rlespinasse/github-slug-action@v3.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@v4.1.0
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ env.GITHUB_REF_SLUG }}

npm-publish-latest:
needs: [build, npm-publish-build]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@v6
with:
name: build
- uses: actions/setup-node@v6
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@v4.1.0
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
with:
token: ${{ secrets.NPM_TOKEN }}
tag: latest

# TODO: The pipeline should automate publication to npm, so that the docker build gets the correct version
# This job will only dockerize solid-server@latest / solid-server@<tag-name> from npmjs.com!
# This job will only dockerize solid-server@latest / solid-server@<tag-name> from npmjs.com!
docker-hub:
needs: build
name: Publish to docker hub
Expand Down
85 changes: 0 additions & 85 deletions bin/lib/cli-utils.js

This file was deleted.

54 changes: 54 additions & 0 deletions bin/lib/cli-utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import fs from 'fs-extra'
import { red, cyan, bold } from 'colorette'
import { URL } from 'url'
import LDP from '../../lib/ldp.mjs'
import AccountManager from '../../lib/models/account-manager.mjs'
import SolidHost from '../../lib/models/solid-host.mjs'

export function getAccountManager (config, options = {}) {
const ldp = options.ldp || new LDP(config)
const host = options.host || SolidHost.from({ port: config.port, serverUri: config.serverUri })
return AccountManager.from({
host,
store: ldp,
multiuser: config.multiuser
})
}

export function loadConfig (program, options) {
let argv = {
...options,
version: program.version()
}
const configFile = argv.configFile || './config.json'
try {
const file = fs.readFileSync(configFile)
const config = JSON.parse(file)
argv = { ...config, ...argv }
} catch (err) {
if (typeof argv.configFile !== 'undefined') {
if (!fs.existsSync(configFile)) {
console.log(red(bold('ERR')), 'Config file ' + configFile + " doesn't exist.")
process.exit(1)
}
}
if (fs.existsSync(configFile)) {
console.log(red(bold('ERR')), 'config file ' + configFile + " couldn't be parsed: " + err)
process.exit(1)
}
console.log(cyan(bold('TIP')), 'create a config.json: `$ solid init`')
}
return argv
}

export function loadAccounts ({ root, serverUri, hostname }) {
const files = fs.readdirSync(root)
hostname = hostname || new URL(serverUri).hostname
const isUserDirectory = new RegExp(`.${hostname}$`)
return files.filter(file => isUserDirectory.test(file))
}

export function loadUsernames ({ root, serverUri }) {
const hostname = new URL(serverUri).hostname
return loadAccounts({ root, hostname }).map(userDirectory => userDirectory.substr(0, userDirectory.length - hostname.length - 1))
}
39 changes: 0 additions & 39 deletions bin/lib/cli.js

This file was deleted.

44 changes: 44 additions & 0 deletions bin/lib/cli.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Command } from 'commander'
import loadInit from './init.mjs'
import loadStart from './start.mjs'
import loadInvalidUsernames from './invalidUsernames.mjs'
import loadMigrateLegacyResources from './migrateLegacyResources.mjs'
import loadUpdateIndex from './updateIndex.mjs'
import { spawnSync } from 'child_process'
import path from 'path'
import fs from 'fs'
import { fileURLToPath } from 'url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

export default function startCli (server) {
const program = new Command()
program.version(getVersion())

loadInit(program)
loadStart(program, server)
loadInvalidUsernames(program)
loadMigrateLegacyResources(program)
loadUpdateIndex(program)

program.parse(process.argv)
if (program.args.length === 0) program.help()
}

function getVersion () {
try {
const options = { cwd: __dirname, encoding: 'utf8' }
const { stdout } = spawnSync('git', ['describe', '--tags'], options)
const { stdout: gitStatusStdout } = spawnSync('git', ['status'], options)
const version = stdout.trim()
if (version === '' || gitStatusStdout.match('Not currently on any branch')) {
throw new Error('No git version here')
}
return version
} catch (e) {
const pkgPath = path.join(__dirname, '../../package.json')
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
return pkg.version
}
}
Loading