Merge pull request #253687 from dotlambda/plausible-2.0.0
plausible: 1.4.4 -> 2.0.0
This commit is contained in:
commit
728bae020d
6 changed files with 42 additions and 12110 deletions
|
@ -248,11 +248,10 @@ in {
|
||||||
# setup
|
# setup
|
||||||
${cfg.package}/createdb.sh
|
${cfg.package}/createdb.sh
|
||||||
${cfg.package}/migrate.sh
|
${cfg.package}/migrate.sh
|
||||||
|
export IP_GEOLOCATION_DB=${pkgs.dbip-country-lite}/share/dbip/dbip-country-lite.mmdb
|
||||||
${cfg.package}/bin/plausible eval "(Plausible.Release.prepare() ; Plausible.Auth.create_user(\"$ADMIN_USER_NAME\", \"$ADMIN_USER_EMAIL\", \"$ADMIN_USER_PWD\"))"
|
${cfg.package}/bin/plausible eval "(Plausible.Release.prepare() ; Plausible.Auth.create_user(\"$ADMIN_USER_NAME\", \"$ADMIN_USER_EMAIL\", \"$ADMIN_USER_PWD\"))"
|
||||||
${optionalString cfg.adminUser.activate ''
|
${optionalString cfg.adminUser.activate ''
|
||||||
if ! ${cfg.package}/init-admin.sh | grep 'already exists'; then
|
psql -d plausible <<< "UPDATE users SET email_verified=true where email = '$ADMIN_USER_EMAIL';"
|
||||||
psql -d plausible <<< "UPDATE users SET email_verified=true;"
|
|
||||||
fi
|
|
||||||
''}
|
''}
|
||||||
|
|
||||||
exec plausible start
|
exec plausible start
|
||||||
|
|
|
@ -30,6 +30,8 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
||||||
|
|
||||||
machine.succeed("curl -f localhost:8000 >&2")
|
machine.succeed("curl -f localhost:8000 >&2")
|
||||||
|
|
||||||
|
machine.succeed("curl -f localhost:8000/js/script.js >&2")
|
||||||
|
|
||||||
csrf_token = machine.succeed(
|
csrf_token = machine.succeed(
|
||||||
"curl -c /tmp/cookies localhost:8000/login | grep '_csrf_token' | sed -E 's,.*value=\"(.*)\".*,\\1,g'"
|
"curl -c /tmp/cookies localhost:8000/login | grep '_csrf_token' | sed -E 's,.*value=\"(.*)\".*,\\1,g'"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,53 +1,61 @@
|
||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
|
||||||
, beamPackages
|
, beamPackages
|
||||||
|
, buildNpmPackage
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, glibcLocales
|
|
||||||
, cacert
|
|
||||||
, mkYarnModules
|
|
||||||
, fetchYarnDeps
|
|
||||||
, nodejs
|
, nodejs
|
||||||
, nixosTests
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
pname = "plausible";
|
pname = "plausible";
|
||||||
version = "1.5.1";
|
version = "2.0.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "plausible";
|
owner = "plausible";
|
||||||
repo = "analytics";
|
repo = "analytics";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-KcIZMsWlKGCZFi7DrTS8JMWEahdERoExtpBj+7Ec+FQ=";
|
hash = "sha256-yrTwxBguAZbfEKucUL+w49Hr6D7v9/2OjY1h27+w5WI=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO consider using `mix2nix` as soon as it supports git dependencies.
|
# TODO consider using `mix2nix` as soon as it supports git dependencies.
|
||||||
mixFodDeps = beamPackages.fetchMixDeps {
|
mixFodDeps = beamPackages.fetchMixDeps {
|
||||||
pname = "${pname}-deps";
|
pname = "${pname}-deps";
|
||||||
inherit src version;
|
inherit src version;
|
||||||
hash = "sha256-rLkD2FuNFKU3nB8FT/qPgSVP8H60qEmHtPvcdw4JUF8=";
|
hash = "sha256-CAyZLpjmw1JreK3MopqI0XsWhP+fJEMpXlww7CibSaM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
yarnDeps = mkYarnModules {
|
assets = buildNpmPackage {
|
||||||
pname = "${pname}-yarn-deps";
|
pname = "${pname}-assets";
|
||||||
inherit version;
|
inherit version;
|
||||||
packageJSON = ./package.json;
|
src = "${src}/assets";
|
||||||
yarnLock = ./yarn.lock;
|
npmDepsHash = "sha256-2t1M6RQhBjZxx36qawVUVC+ob9SvQIq5dy4HgVeY2Eo=";
|
||||||
yarnNix = ./yarn.nix;
|
dontNpmBuild = true;
|
||||||
preBuild = ''
|
installPhase = ''
|
||||||
mkdir -p tmp/deps
|
runHook preInstall
|
||||||
cp -r ${mixFodDeps}/phoenix tmp/deps/phoenix
|
cp -r . "$out"
|
||||||
cp -r ${mixFodDeps}/phoenix_html tmp/deps/phoenix_html
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
postBuild = ''
|
};
|
||||||
echo 'module.exports = {}' > $out/node_modules/flatpickr/dist/postcss.config.js
|
|
||||||
|
tracker = buildNpmPackage {
|
||||||
|
pname = "${pname}-tracker";
|
||||||
|
inherit version;
|
||||||
|
src = "${src}/tracker";
|
||||||
|
npmDepsHash = "sha256-y09jVSwUrxF0nLpLqS1yQweYL+iMF6jVx0sUdQtvrpc=";
|
||||||
|
dontNpmBuild = true;
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
cp -r . "$out"
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
beamPackages.mixRelease {
|
beamPackages.mixRelease {
|
||||||
inherit pname version src mixFodDeps;
|
inherit pname version src mixFodDeps;
|
||||||
|
|
||||||
nativeBuildInputs = [ nodejs ];
|
nativeBuildInputs = [
|
||||||
|
nodejs
|
||||||
|
];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests = { inherit (nixosTests) plausible; };
|
tests = { inherit (nixosTests) plausible; };
|
||||||
|
@ -58,11 +66,16 @@ beamPackages.mixRelease {
|
||||||
substituteInPlace lib/plausible_release.ex --replace 'defp prepare do' 'def prepare do'
|
substituteInPlace lib/plausible_release.ex --replace 'defp prepare do' 'def prepare do'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
rm -r assets tracker
|
||||||
|
cp -r ${assets} assets
|
||||||
|
cp -r ${tracker} tracker
|
||||||
|
'';
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
export HOME=$TMPDIR
|
|
||||||
export NODE_OPTIONS=--openssl-legacy-provider # required for webpack compatibility with OpenSSL 3 (https://github.com/webpack/webpack/issues/14532)
|
export NODE_OPTIONS=--openssl-legacy-provider # required for webpack compatibility with OpenSSL 3 (https://github.com/webpack/webpack/issues/14532)
|
||||||
ln -sf ${yarnDeps}/node_modules assets/node_modules
|
|
||||||
npm run deploy --prefix ./assets
|
npm run deploy --prefix ./assets
|
||||||
|
npm run deploy --prefix ./tracker
|
||||||
|
|
||||||
# for external task you need a workaround for the no deps check flag
|
# for external task you need a workaround for the no deps check flag
|
||||||
# https://github.com/phoenixframework/phoenix/issues/2690
|
# https://github.com/phoenixframework/phoenix/issues/2690
|
||||||
|
@ -72,8 +85,9 @@ beamPackages.mixRelease {
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
license = licenses.agpl3Plus;
|
license = licenses.agpl3Plus;
|
||||||
homepage = "https://plausible.io/";
|
homepage = "https://plausible.io/";
|
||||||
description = " Simple, open-source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics.";
|
changelog = "https://github.com/plausible/analytics/blob/${src.rev}/CHANGELOG.md";
|
||||||
maintainers = with maintainers; [ ];
|
description = " Simple, open-source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics";
|
||||||
|
maintainers = with maintainers; [ softinio ];
|
||||||
platforms = platforms.unix;
|
platforms = platforms.unix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
{
|
|
||||||
"repository": {},
|
|
||||||
"version": "v1.5.1",
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"scripts": {
|
|
||||||
"deploy": "webpack --mode production",
|
|
||||||
"watch": "webpack --mode development --watch",
|
|
||||||
"format": "prettier --write {css,js}/**",
|
|
||||||
"check-format": "prettier --check {css,js}/**",
|
|
||||||
"lint": "eslint js/**",
|
|
||||||
"bundlemon": "bundlemon"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/core": "^7.14.3",
|
|
||||||
"@babel/preset-env": "^7.14.4",
|
|
||||||
"@babel/preset-react": "^7.13.13",
|
|
||||||
"@headlessui/react": "^1.3.0",
|
|
||||||
"@heroicons/react": "^2.0.11",
|
|
||||||
"@juggle/resize-observer": "^3.3.1",
|
|
||||||
"@kunukn/react-collapse": "^2.2.9",
|
|
||||||
"@popperjs/core": "^2.11.6",
|
|
||||||
"@tailwindcss/aspect-ratio": "^0.2.1",
|
|
||||||
"@tailwindcss/forms": "^0.3.2",
|
|
||||||
"@tailwindcss/typography": "^0.4.1",
|
|
||||||
"abortcontroller-polyfill": "^1.7.3",
|
|
||||||
"alpinejs": "^2.8.2",
|
|
||||||
"autoprefixer": "^10.2.6",
|
|
||||||
"babel-loader": "^8.2.2",
|
|
||||||
"chart.js": "^3.3.2",
|
|
||||||
"classnames": "^2.3.1",
|
|
||||||
"copy-webpack-plugin": "^9.0.0",
|
|
||||||
"css-loader": "^5.2.6",
|
|
||||||
"css-minimizer-webpack-plugin": "^3.2.0",
|
|
||||||
"datamaps": "^0.5.9",
|
|
||||||
"debounce-promise": "^3.1.2",
|
|
||||||
"downshift": "^6.1.3",
|
|
||||||
"iframe-resizer": "^4.3.2",
|
|
||||||
"mini-css-extract-plugin": "^1.6.0",
|
|
||||||
"phoenix": "1.5.0",
|
|
||||||
"phoenix_html": "2.12",
|
|
||||||
"postcss": "^8.3.0",
|
|
||||||
"postcss-loader": "^6.1.1",
|
|
||||||
"react": "^16.13.1",
|
|
||||||
"react-dom": "^16.13.1",
|
|
||||||
"react-flatpickr": "3.10.5",
|
|
||||||
"react-flip-move": "^3.0.4",
|
|
||||||
"react-popper": "^2.3.0",
|
|
||||||
"react-router-dom": "^5.2.0",
|
|
||||||
"react-transition-group": "^4.4.2",
|
|
||||||
"tailwindcss": "^2.1.2",
|
|
||||||
"terser-webpack-plugin": "^5.1.2",
|
|
||||||
"url-search-params-polyfill": "^8.1.1",
|
|
||||||
"webpack": "5.38.1",
|
|
||||||
"webpack-cli": "^4.7.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"babel-eslint": "^10.1.0",
|
|
||||||
"bundlemon": "^1.4.0",
|
|
||||||
"eslint": "^7.2.0",
|
|
||||||
"eslint-config-prettier": "^7.0.0",
|
|
||||||
"eslint-plugin-import": "^2.26.0",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
||||||
"eslint-plugin-prettier": "^3.3.0",
|
|
||||||
"eslint-plugin-react": "^7.21.5",
|
|
||||||
"eslint-plugin-react-hooks": "^4.2.0",
|
|
||||||
"stylelint": "^14.1.0",
|
|
||||||
"stylelint-config-prettier": "^9.0.3",
|
|
||||||
"stylelint-config-standard": "^24.0.0",
|
|
||||||
"webpack-bundle-analyzer": "^4.4.2"
|
|
||||||
},
|
|
||||||
"name": "plausible"
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue