Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# See here for image contents: https://github.com/devcontainers/images/tree/main/src/typescript-node
# [Choice] Node.js version comes from the base devcontainer variant
ARG VARIANT="24-bookworm"
ARG VARIANT="24-trixie"
FROM mcr.microsoft.com/devcontainers/typescript-node:${VARIANT}

# [Optional] Uncomment if you want to install an additional version of node using nvm
Expand All @@ -22,11 +22,11 @@ FROM mcr.microsoft.com/devcontainers/typescript-node:${VARIANT}
# --------------------------------------------------------------------
# BEGIN EMSDK
# Install EMSDK to /emsdk just like the EMSDK Dockerfile: https://github.com/emscripten-core/emsdk/blob/master/docker/Dockerfile
ENV EMSDK /emsdk
ENV EMSDK=/emsdk
# We pin the EMSDK version rather than 'latest' so that everyone is using the same compiler version
ENV EMSCRIPTEN_VERSION 5.0.0
ENV EMSCRIPTEN_VERSION=6.0.12

RUN git clone https://github.com/emscripten-core/emsdk.git $EMSDK
RUN git clone --depth 1 --branch ${EMSCRIPTEN_VERSION} https://github.com/emscripten-core/emsdk.git $EMSDK

RUN echo "## Install Emscripten" \
&& cd ${EMSDK} \
Expand All @@ -44,7 +44,7 @@ RUN cd ${EMSDK} \
&& cat ${EMSDK}/upstream/emscripten/cache/sanity.txt \
&& echo "## Done"

ENV PATH $EMSDK:$EMSDK/upstream/emscripten/:$PATH
ENV PATH=$EMSDK:$EMSDK/upstream/emscripten/:$PATH

# Cleanup Emscripten installation and strip some symbols
# Copied directly from https://github.com/emscripten-core/emsdk/blob/master/docker/Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.155.1/containers/typescript-node
// https://github.com/devcontainers/images/tree/main/src/typescript-node
{
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version
"args": {
"VARIANT": "24-bookworm"
"VARIANT": "24-trixie"
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand Down
68 changes: 0 additions & 68 deletions .eslintrc.js

This file was deleted.

50 changes: 41 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,56 @@ name: CI

on: [push, pull_request]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: npm
- name: make
uses: ./.github/actions/build-sqljs
- uses: actions/upload-artifact@v4
with: {name: dist, path: dist}
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist
path: dist
archive: true
if-no-files-found: error
- name: test WebAssembly builds and distribution behavior
run: npm ci && npm test
- name: generate documentation
run: npm run doc
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: documentation
path: documentation
archive: true
if-no-files-found: error

deploy-pages:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist
path: dist
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: documentation
path: documentation
- name: Update github pages
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@3.6.2
uses: JamesIves/github-pages-deploy-action@fa24774553152dd7873cd16ebd8d959b010c5445 # v4.9.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: "." # The folder the action should deploy.
CLEAN: false # Automatically remove deleted files from the deploy branch
branch: gh-pages
folder: "."
clean: false
93 changes: 25 additions & 68 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Create a release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create a release
- 'v*'

permissions:
contents: write
Expand All @@ -15,73 +14,31 @@ jobs:
name: Create a release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: npm
- name: make
uses: ./.github/actions/build-sqljs
- name: Create Release
id: create_release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- run: cd dist && zip sqljs-wasm.zip sql-wasm.{js,wasm}
- name: Upload Release Asset (wasm)
uses: lovasoa/upload-release-asset@851d9cc59fe8113912edffbd8fddaa09470a5ac0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/sqljs-wasm.zip
asset_name: sqljs-wasm.zip
asset_label: wasm version, best runtime performance, smaller assets, requires configuration
asset_content_type: application/zip
- name: Upload Release Asset (inline wasm)
uses: lovasoa/upload-release-asset@851d9cc59fe8113912edffbd8fddaa09470a5ac0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/sql-wasm-inline.js
asset_name: sql-wasm-inline.js
asset_label: single JavaScript file with embedded WebAssembly, no configuration required
asset_content_type: text/javascript
- run: cd dist && zip sqljs-worker-wasm.zip worker.sql-wasm.js sql-wasm.wasm
- name: Upload Release Asset (worker wasm)
uses: lovasoa/upload-release-asset@851d9cc59fe8113912edffbd8fddaa09470a5ac0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/sqljs-worker-wasm.zip
asset_name: sqljs-worker-wasm.zip
asset_label: webworker wasm version, to be loaded as a web worker
asset_content_type: application/zip
- name: Upload Release Asset (worker inline wasm)
uses: lovasoa/upload-release-asset@851d9cc59fe8113912edffbd8fddaa09470a5ac0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/worker.sql-wasm-inline.js
asset_name: worker.sql-wasm-inline.js
asset_label: single-file WebAssembly version, to be loaded as a web worker
asset_content_type: text/javascript
- run: cd dist && zip sqljs-all.zip *.{js,wasm}
- name: Upload Release Asset (all)
uses: lovasoa/upload-release-asset@851d9cc59fe8113912edffbd8fddaa09470a5ac0
- name: Package release assets
working-directory: dist
run: |
zip sqljs-wasm.zip sql-wasm.{js,wasm}
zip sqljs-worker-wasm.zip worker.sql-wasm.js sql-wasm.wasm
zip sqljs-all.zip *.{js,wasm}
- name: Create release and upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/sqljs-all.zip
asset_name: sqljs-all.zip
asset_label: all versions, including non-minified javascript
asset_content_type: application/zip
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
gh release create "$RELEASE_TAG" --verify-tag --title "Release $RELEASE_TAG" --notes "" \
'dist/sqljs-wasm.zip#wasm version, best runtime performance, smaller assets, requires configuration' \
'dist/sql-wasm-inline.js#single JavaScript file with embedded WebAssembly, no configuration required' \
'dist/sqljs-worker-wasm.zip#webworker wasm version, to be loaded as a web worker' \
'dist/worker.sql-wasm-inline.js#single-file WebAssembly version, to be loaded as a web worker' \
'dist/sqljs-all.zip#all versions, including non-minified javascript'
- name: publish the package to NPM
run: |
npm install -g npm@latest
npm install -g npm@12.2.0
npm publish --provenance
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ tmp/
c/
emsdk/
sqljs.zip

# Generated API documentation:
documentation/
50 changes: 27 additions & 23 deletions .jsdoc.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,32 @@
"encoding": "utf8",
"destination": "./documentation/",
"readme": "documentation_index.md",
"template": "./node_modules/clean-jsdoc-theme",
"theme_opts": {
"title": "sql.js",
"meta": [
"<title>sql.js API documentation</title>",
"<meta name=\"author\" content=\"Ophir Lojkine\">",
"<meta name=\"description\" content=\"Documentation for sql.js: an in-memory SQL database for the browser based on SQLite.\">"
],
"menu": [
{
"title": "Website",
"link": "https://sql.js.org/"
},
{
"title": "Github",
"link": "https://github.com/sql-js/sql.js"
},
{
"title": "Demo",
"link": "https://sql.js.org/examples/GUI/"
}
]
}
"template": "./node_modules/clean-jsdoc-theme/dist",
"siteName": "sql.js",
"meta": [
{
"name": "author",
"content": "Ophir Lojkine"
},
{
"name": "description",
"content": "Documentation for sql.js: an in-memory SQL database for the browser based on SQLite."
}
],
"menu": [
{
"title": "Website",
"link": "https://sql.js.org/"
},
{
"title": "Github",
"link": "https://github.com/sql-js/sql.js"
},
{
"title": "Demo",
"link": "https://sql.js.org/examples/GUI/"
}
],
"basePath": "/documentation/"
}
}
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.21.0
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ index.html
Makefile
emsdk_set_env.sh
sqljs.zip

# Contributor tooling:
scripts/
.node-version
DEPENDENCIES.md
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ Instructions:
5. Run `$ npm run rebuild` to re-compile the project from scratch (using the version of EMSDK installed in the container).
6. Run `$ npm test` to ensure all tests pass after said rebuild

## Updating dependencies

The build depends on more than npm packages. See [DEPENDENCIES.md](DEPENDENCIES.md)
for the compiler, SQLite source, container, CI actions, release tools, CDN assets,
and transitive dependencies that need to be reviewed together. CI uses the Node
24 LTS version pinned in `.node-version`; the devcontainer supplies the same
Node major and the pinned Emscripten SDK.

## Compiling SQLite with different options

In order to enable extensions like FTS5, change the CFLAGS in the [Makefile](Makefile) and run `npm run rebuild`:
Expand Down
Loading
Loading