mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-21 19:53:06 +00:00
remove extra files from repo root and move package.json into etc
This commit is contained in:
parent
00a91e09c6
commit
db10a2142e
17 changed files with 44 additions and 6370 deletions
10
Dockerfile
10
Dockerfile
|
@ -79,9 +79,9 @@ SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-o", "errtrace", "-o", "
|
|||
|
||||
######### System Environment ####################################
|
||||
|
||||
# Detect ArchiveBox version number by reading package.json
|
||||
COPY --chown=root:root --chmod=755 package.json "$CODE_DIR/"
|
||||
RUN grep '"version": ' "${CODE_DIR}/package.json" | awk -F'"' '{print $4}' > /VERSION.txt
|
||||
# Detect ArchiveBox version number by reading pyproject.toml
|
||||
COPY --chown=root:root --chmod=755 pyproject.toml "$CODE_DIR/"
|
||||
RUN grep '^version = ' "${CODE_DIR}/pyproject.toml" | awk -F'"' '{print $2}' > /VERSION.txt
|
||||
|
||||
# Force apt to leave downloaded binaries in /var/cache/apt (massively speeds up Docker builds)
|
||||
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "1";' > /etc/apt/apt.conf.d/99keep-cache \
|
||||
|
@ -238,10 +238,10 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T
|
|||
|
||||
# Install Node dependencies
|
||||
WORKDIR "$CODE_DIR/lib/npm"
|
||||
COPY --chown=root:root --chmod=755 "package.json" "package-lock.json" "$CODE_DIR/lib/npm"
|
||||
COPY --chown=root:root --chmod=755 "etc/package.json" "$CODE_DIR/lib/npm"
|
||||
RUN --mount=type=cache,target=/root/.npm,sharing=locked,id=npm-$TARGETARCH$TARGETVARIANT \
|
||||
echo "[+] Installing NPM extractor dependencies from package.json..." \
|
||||
&& npm ci --prefix="$CODE_DIR/lib/npm" --prefer-offline --no-audit --cache /root/.npm \
|
||||
&& npm install --prefix="$CODE_DIR/lib/npm" --prefer-offline --no-fund --no-audit --cache /root/.npm \
|
||||
&& chown -R "$DEFAULT_PUID:$DEFAULT_PGID" "$CODE_DIR/lib" \
|
||||
&& ( \
|
||||
which node && node --version \
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
../LICENSE
|
|
@ -4,7 +4,6 @@ __package__ = 'archivebox.config'
|
|||
import os
|
||||
import re
|
||||
import platform
|
||||
import machineid
|
||||
import tempfile
|
||||
|
||||
from typing import Dict
|
||||
|
@ -40,15 +39,6 @@ def _detect_installed_version(PACKAGE_DIR: Path):
|
|||
# building docs, pyproject.toml is not available
|
||||
pass
|
||||
|
||||
try:
|
||||
# if in dev but not in Git repo dir, fallback to using package.json file
|
||||
package_json = (PACKAGE_DIR / 'package.json').read_text().split('\n')
|
||||
for line in package_json:
|
||||
if '"version": "' in line:
|
||||
return line.replace('"', '').split(':')[-1].strip(',').strip()
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
# raise Exception('Failed to detect installed archivebox version!')
|
||||
return 'dev'
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class ShellConfig(BaseConfigSet):
|
|||
docker_build_end_time = Path('/VERSION.txt').read_text().rsplit('BUILD_END_TIME=')[-1].split('\n', 1)[0]
|
||||
return docker_build_end_time
|
||||
|
||||
src_last_modified_unix_timestamp = (PACKAGE_DIR / 'package.json').stat().st_mtime
|
||||
src_last_modified_unix_timestamp = (PACKAGE_DIR / 'README.md').stat().st_mtime
|
||||
return datetime.fromtimestamp(src_last_modified_unix_timestamp).strftime('%Y-%m-%d %H:%M:%S %s')
|
||||
|
||||
|
||||
|
|
3120
archivebox/package-lock.json
generated
3120
archivebox/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"name": "archivebox",
|
||||
"version": "0.8.5rc1",
|
||||
"description": "ArchiveBox: The self-hosted internet archive",
|
||||
"author": "Nick Sweeting <archivebox-npm@sweeting.me>",
|
||||
"repository": "github:ArchiveBox/ArchiveBox",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@postlight/parser": "^2.2.3",
|
||||
"readability-extractor": "github:ArchiveBox/readability-extractor",
|
||||
"single-file-cli": "^1.1.54",
|
||||
"puppeteer": "^23.5.0",
|
||||
"@puppeteer/browsers": "^2.4.0"
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# ./bin/build_docker.sh dev 'linux/arm/v7'
|
||||
|
||||
### Bash Environment Setup
|
||||
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||||
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
||||
# set -o xtrace
|
||||
set -o errexit
|
||||
set -o errtrace
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
IFS=$'\n'
|
||||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
cd "$REPO_DIR"
|
||||
which docker > /dev/null || exit 1
|
||||
|
||||
|
||||
TAG_NAME="${1:-$(git rev-parse --abbrev-ref HEAD)}"
|
||||
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
SHORT_VERSION="$(echo "$VERSION" | perl -pe 's/(\d+)\.(\d+)\.(\d+)/$1.$2/g')"
|
||||
REQUIRED_PLATFORMS="${2:-"linux/arm64,linux/amd64,linux/arm/v7"}"
|
||||
|
||||
|
||||
# Build python package lists
|
||||
# https://pdm-project.org/latest/usage/lockfile/
|
||||
echo "[+] Generating requirements.txt and pdm.lock from pyproject.toml..."
|
||||
pdm lock --group=':all' --production --lockfile pdm.lock --strategy="cross_platform"
|
||||
pdm sync --group=':all' --production --lockfile pdm.lock --clean || pdm sync --group=':all' --production --lockfile pdm.lock --clean
|
||||
pdm export --group=':all' --production --lockfile pdm.lock --without-hashes -o requirements.txt
|
||||
|
||||
pdm lock --group=':all' --dev --lockfile pdm.dev.lock --strategy="cross_platform"
|
||||
pdm sync --group=':all' --dev --lockfile pdm.dev.lock --clean || pdm sync --group=':all' --dev --lockfile pdm.dev.lock --clean
|
||||
pdm export --group=':all' --dev --lockfile pdm.dev.lock --without-hashes -o requirements-dev.txt
|
||||
|
||||
|
||||
|
||||
echo "[+] Building Docker image: tag=$TAG_NAME version=$SHORT_VERSION arch=$REQUIRED_PLATFORMS"
|
||||
|
||||
|
||||
echo "[+] Building archivebox:$VERSION docker image..."
|
||||
# docker builder prune
|
||||
docker build . --no-cache -t archivebox-dev --load
|
||||
|
||||
# docker buildx build --platform "$REQUIRED_PLATFORMS" --load . \
|
||||
# -t archivebox \
|
||||
# -t archivebox:$TAG_NAME \
|
||||
# -t archivebox:$VERSION \
|
||||
# -t archivebox:$SHORT_VERSION
|
|
@ -20,7 +20,7 @@ which jq > /dev/null || exit 1
|
|||
|
||||
declare -a TAG_NAMES="$*"
|
||||
BRANCH_NAME="${1:-$(git rev-parse --abbrev-ref HEAD)}"
|
||||
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
VERSION="$(grep '^version = ' "${REPO_DIR}/pyproject.toml" | awk -F'"' '{print $2}')"
|
||||
GIT_SHA=sha-"$(git rev-parse --short HEAD)"
|
||||
SELECTED_PLATFORMS="linux/amd64,linux/arm64"
|
||||
|
||||
|
|
|
@ -30,9 +30,6 @@ function bump_semver {
|
|||
echo "$1" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g'
|
||||
}
|
||||
|
||||
OLD_VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
NEW_VERSION="$(bump_semver "$OLD_VERSION")"
|
||||
echo "[*] Bumping VERSION from $OLD_VERSION to $NEW_VERSION"
|
||||
contents="$(jq ".version = \"$NEW_VERSION\"" "$REPO_DIR/package.json")" && \
|
||||
echo "${contents}" > package.json
|
||||
# OLD_VERSION="$(grep '^version = ' "${REPO_DIR}/pyproject.toml" | awk -F'"' '{print $2}')"
|
||||
# NEW_VERSION="$(bump_semver "$OLD_VERSION")"
|
||||
|
||||
|
|
|
@ -15,17 +15,17 @@ REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && p
|
|||
cd "$REPO_DIR"
|
||||
|
||||
py_version="$(grep -E '^version = ' pyproject.toml | awk '{print $3}' | jq -r)"
|
||||
js_version="$(jq -r '.version' package.json)"
|
||||
# js_version="$(jq -r '.version' ${REPO_DIR}/etc/package.json)"
|
||||
|
||||
if [[ "$py_version" != "$js_version" ]]; then
|
||||
echo "[❌] Version in pyproject.toml ($py_version) does not match version in package.json ($js_version)!"
|
||||
exit 1
|
||||
fi
|
||||
# if [[ "$py_version" != "$js_version" ]]; then
|
||||
# echo "[❌] Version in pyproject.toml ($py_version) does not match version in etc/package.json ($js_version)!"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
echo "[🔒] Locking all ArchiveBox dependencies (pip, npm)"
|
||||
echo
|
||||
echo "pyproject.toml: archivebox $py_version"
|
||||
echo "package.json: archivebox $js_version"
|
||||
# echo "package.json: archivebox $js_version"
|
||||
echo
|
||||
echo
|
||||
|
||||
|
@ -34,9 +34,9 @@ deactivate 2>/dev/null || true
|
|||
rm -Rf build dist
|
||||
rm -f uv.lock
|
||||
rm -f requirements.txt
|
||||
rm -f package-lock.json
|
||||
rm -f archivebox/package.json
|
||||
rm -f archivebox/package-lock.json
|
||||
# rm -f package-lock.json
|
||||
# rm -f archivebox/package.json
|
||||
# rm -f archivebox/package-lock.json
|
||||
# rm -Rf ./.venv
|
||||
# rm -Rf ./node_modules
|
||||
# rm -Rf ./archivebox/node_modules
|
||||
|
@ -59,23 +59,20 @@ uv lock
|
|||
uv pip compile pyproject.toml --all-extras -o requirements.txt >/dev/null
|
||||
uv sync --all-extras --frozen 2>/dev/null
|
||||
|
||||
echo
|
||||
echo "[+] Generating package-lock.json from package.json..."
|
||||
npm install -g npm
|
||||
npm config set fund false --location=global &
|
||||
npm config set fund false &
|
||||
npm config set audit false --location=global &
|
||||
npm config set audit false &
|
||||
echo
|
||||
echo "package.json: archivebox $(jq -r '.version' package.json)"
|
||||
echo
|
||||
echo "$(which node): $(node --version | head -n 1)"
|
||||
echo "$(which npm): $(npm --version | head -n 1)"
|
||||
# echo
|
||||
# echo "[+] Generating package-lock.json from etc/package.json..."
|
||||
# npm install -g npm
|
||||
# npm config set fund false --location=global
|
||||
# npm config set audit false --location=global
|
||||
# cd etc
|
||||
# echo
|
||||
# echo "etc/package.json: archivebox $(jq -r '.version' etc/package.json)"
|
||||
# echo
|
||||
# echo "$(which node): $(node --version | head -n 1)"
|
||||
# echo "$(which npm): $(npm --version | head -n 1)"
|
||||
|
||||
echo
|
||||
npm install --package-lock-only --prefer-offline
|
||||
cp package.json archivebox/package.json
|
||||
cp package-lock.json archivebox/package-lock.json
|
||||
# echo
|
||||
# npm install --package-lock-only --prefer-offline
|
||||
|
||||
echo
|
||||
echo "[√] Finished. Don't forget to commit the new lockfiles:"
|
||||
|
@ -83,8 +80,8 @@ echo
|
|||
ls "pyproject.toml" | cat
|
||||
ls "requirements.txt" | cat
|
||||
ls "uv.lock" | cat
|
||||
echo
|
||||
ls "package.json" | cat
|
||||
ls "package-lock.json" | cat
|
||||
ls "archivebox/package.json" | cat
|
||||
ls "archivebox/package-lock.json" | cat
|
||||
# echo
|
||||
# ls "package.json" | cat
|
||||
# ls "package-lock.json" | cat
|
||||
# ls "archivebox/package.json" | cat
|
||||
# ls "archivebox/package-lock.json" | cat
|
||||
|
|
|
@ -30,5 +30,5 @@ cd "$REPO_DIR"
|
|||
./bin/release_pip.sh
|
||||
./bin/release_docker.sh
|
||||
|
||||
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
VERSION="$(grep '^version = ' "${REPO_DIR}/pyproject.toml" | awk -F'"' '{print $2}')"
|
||||
echo "[√] Done. Published version v$VERSION"
|
||||
|
|
|
@ -15,7 +15,7 @@ cd "$REPO_DIR"
|
|||
|
||||
declare -a TAG_NAMES="$*"
|
||||
BRANCH_NAME="${1:-$(git rev-parse --abbrev-ref HEAD)}"
|
||||
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
VERSION="$(grep '^version = ' "${REPO_DIR}/pyproject.toml" | awk -F'"' '{print $2}')"
|
||||
GIT_SHA=sha-"$(git rev-parse --short HEAD)"
|
||||
SELECTED_PLATFORMS="linux/amd64,linux/arm64"
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ set -o pipefail
|
|||
IFS=$'\n'
|
||||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
VERSION="$(grep '^version = ' "${REPO_DIR}/pyproject.toml" | awk -F'"' '{print $2}')"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ set -o pipefail
|
|||
IFS=$'\n'
|
||||
|
||||
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
|
||||
VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
|
||||
VERSION="$(grep '^version = ' "${REPO_DIR}/pyproject.toml" | awk -F'"' '{print $2}')"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
"name": "archivebox",
|
||||
"version": "0.8.5rc2",
|
||||
"description": "ArchiveBox: The self-hosted internet archive",
|
||||
"author": "Nick Sweeting <archivebox-npm@sweeting.me>",
|
||||
"version": "0.0.1",
|
||||
"repository": "github:ArchiveBox/ArchiveBox",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
3120
package-lock.json
generated
3120
package-lock.json
generated
File diff suppressed because it is too large
Load diff
9
uv.lock
9
uv.lock
|
@ -41,7 +41,7 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "archivebox"
|
||||
version = "0.8.5rc1"
|
||||
version = "0.8.5rc2"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "atomicwrites" },
|
||||
|
@ -76,6 +76,7 @@ dependencies = [
|
|||
{ name = "rich" },
|
||||
{ name = "rich-argparse" },
|
||||
{ name = "setuptools" },
|
||||
{ name = "sonic-client" },
|
||||
{ name = "supervisor" },
|
||||
{ name = "typeid-python" },
|
||||
{ name = "ulid-py" },
|
||||
|
@ -87,15 +88,11 @@ dependencies = [
|
|||
all = [
|
||||
{ name = "django-auth-ldap" },
|
||||
{ name = "python-ldap" },
|
||||
{ name = "sonic-client" },
|
||||
]
|
||||
ldap = [
|
||||
{ name = "django-auth-ldap" },
|
||||
{ name = "python-ldap" },
|
||||
]
|
||||
sonic = [
|
||||
{ name = "sonic-client" },
|
||||
]
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
|
@ -160,7 +157,7 @@ requires-dist = [
|
|||
{ name = "rich", specifier = ">=13.8.0" },
|
||||
{ name = "rich-argparse", specifier = ">=1.5.2" },
|
||||
{ name = "setuptools", specifier = ">=74.1.0" },
|
||||
{ name = "sonic-client", marker = "extra == 'sonic'", specifier = ">=1.0.0" },
|
||||
{ name = "sonic-client", specifier = ">=1.0.0" },
|
||||
{ name = "supervisor", specifier = ">=4.2.5" },
|
||||
{ name = "typeid-python", specifier = ">=0.3.1" },
|
||||
{ name = "ulid-py", specifier = ">=1.1.0" },
|
||||
|
|
Loading…
Reference in a new issue