Skip to content

Commit

Permalink
Package sqlite from the Node.js module instead of a subrepo.
Browse files Browse the repository at this point in the history
  • Loading branch information
rblank committed Sep 7, 2024
1 parent 92dadbe commit 0e7c5ae
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion ext/sqlite-wasm
Submodule sqlite-wasm deleted from 099eac
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ artifacts = [

[tool.hatch.build.targets.wheel]
only-include = [
"ext/sqlite-wasm/sqlite-wasm/jswasm",
"tdoc",
]
artifacts = [
"/tdoc/common/static.gen/",
]
sources."ext/sqlite-wasm/sqlite-wasm" = "tdoc/common/static"
9 changes: 5 additions & 4 deletions tdoc/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sphinx.util import logging

__project__ = 't-doc-common'
__version__ = '0.6'
__version__ = '0.7.dev1'

_common = pathlib.Path(__file__).absolute().parent
_root = _common.parent.parent
Expand Down Expand Up @@ -66,9 +66,10 @@ def on_builder_inited(app):
# Add our own static paths.
app.config.html_static_path.append(str(_common / 'static'))
app.config.html_static_path.append(str(_common / 'static.gen'))
sw = _root / 'ext' / 'sqlite-wasm' / 'sqlite-wasm'
if (sw / 'jswasm').is_dir():
app.config.html_static_path.append(str(sw))
sqlite_path = (_root / 'node_modules' / '@sqlite.org' / 'sqlite-wasm'
/ 'sqlite-wasm' / 'jswasm')
if sqlite_path.is_dir():
app.config.html_static_path.append(str(sqlite_path))


def on_html_page_context(app, page, template, context, doctree):
Expand Down
2 changes: 1 addition & 1 deletion tdoc/common/static/tdoc-sql.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024 Remy Blank <[email protected]>
// SPDX-License-Identifier: MIT

import {default as sqlite3_init} from './jswasm/sqlite3-worker1-promiser.mjs';
import {default as sqlite3_init} from './sqlite3-worker1-promiser.mjs';
import {addEditor, findEditor} from './tdoc-editor.js';

function waitLoaded() {
Expand Down
7 changes: 5 additions & 2 deletions tools/hatch_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ def initialize(self, version, build_data):
self.run(['npm', 'install'])
self.app.display_info("Removing generated files")
root = pathlib.Path(self.root)
shutil.rmtree(root / 'tdoc' / 'common' / 'static.gen',
ignore_errors=True)
static_gen = root / 'tdoc' / 'common' / 'static.gen'
shutil.rmtree(static_gen, ignore_errors=True)
(root / LICENSES).unlink(missing_ok=True)
self.app.display_info("Generating files")
shutil.copytree(root / 'node_modules' / '@sqlite.org' / 'sqlite-wasm'
/ 'sqlite-wasm' / 'jswasm',
static_gen, symlinks=True)
self.run(['npm', 'run', 'build'])

def run(self, args):
Expand Down

0 comments on commit 0e7c5ae

Please sign in to comment.