gancio: remove mkYarnPackage usage

This commit is contained in:
TomaSajt 2024-10-29 12:15:53 +01:00
parent 5b13e7dfe6
commit 6bd3ff7838
No known key found for this signature in database
GPG Key ID: F011163C050122A1
3 changed files with 41 additions and 223 deletions

View File

@ -1,145 +0,0 @@
{
"name": "gancio",
"version": "1.19.4",
"description": "A shared agenda for local communities",
"author": "lesion",
"scripts": {
"build": "nuxt build --modern",
"start:inspect": "NODE_ENV=production node --inspect node_modules/.bin/nuxt start --modern",
"dev": "nuxt dev",
"dev:inspect": "node --inspect node_modules/.bin/nuxt dev",
"test-sqlite": "export NODE_ENV=test; export DB=sqlite; jest --forceExit --runInBand --bail=1 --testTimeout=10000",
"test-mariadb": "export NODE_ENV=test; export DB=mariadb; jest --runInBand --bail=1",
"test-postgresql": "export NODE_ENV=test; export DB=postgresql; jest --runInBand --bail=1",
"start": "nuxt start --modern",
"doc": "cd docs && bundle exec jekyll b",
"doc:dev": "cd docs && bundle exec jekyll s --drafts",
"migrate": "NODE_ENV=production sequelize db:migrate",
"migrate:dev": "sequelize db:migrate",
"analyze": "nuxt build --analyze",
"build:wc": "cd webcomponents; yarn build:lib; cp dist/gancio-events.js ../wp-plugin/js/gancio-events.es.js; cp dist/gancio-events.js ../assets/gancio-events.es.js; cp dist/gancio-events.js ../docs/assets/js/gancio-events.es.js; cp dist/gancio-events.js ../static/gancio-events.es.js;"
},
"files": [
"server/",
"assets/",
"modules/",
"nuxt.config.js",
"static/",
"views/",
"locales/email/",
"locales/",
"store/",
".nuxt/",
"gancio_plugins",
"yarn.lock"
],
"engines": {
"node": ">=14 <=22"
},
"dependencies": {
"@mdi/js": "^7.4.47",
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/i18n": "^7.3.1",
"@nuxtjs/sitemap": "^2.4.0",
"@peertube/http-signature": "^1.7.0",
"accept-language": "^3.0.18",
"bcryptjs": "^2.4.3",
"body-parser": "^2.0.0-beta.2",
"cookie-parser": "^1.4.6",
"cookie-session": "^2.1.0",
"cookie-universal-nuxt": "^2.2.2",
"cors": "^2.8.5",
"dayjs": "^1.11.11",
"dompurify": "^3.1.5",
"email-templates": "^11.1.1",
"express": "^4.19.2",
"express-async-errors": "^3.1.1",
"express-rate-limit": "^7.3.1",
"https-proxy-agent": "^7.0.4",
"ical.js": "^2.0.1",
"ics": "^3.7.6",
"jsdom": "^24.1.0",
"leaflet": "^1.9.4",
"linkify-html": "^4.1.3",
"linkifyjs": "4.1.3",
"lodash": "^4.17.21",
"luxon": "^3.4.4",
"mariadb": "^2.5.6",
"memory-cache": "^0.2.0",
"microformat-node": "^2.0.4",
"minify-css-string": "^1.0.0",
"mkdirp": "^3.0.1",
"multer": "^1.4.5-lts.1",
"nuxt-edge": "2.17.2-28258581.6132947",
"oauth2orize": "^1.12.0",
"passport": "^0.7.0",
"passport-anonymous": "^1.0.1",
"passport-custom": "^1.1.1",
"passport-http": "^0.3.0",
"passport-http-bearer": "^1.0.1",
"passport-oauth2-client-password": "^0.1.2",
"passport-oauth2-client-public": "^0.0.1",
"pg": "^8.12.0",
"semver": "^7.6.2",
"sequelize": "^6.37.3",
"sequelize-slugify": "^1.6.2",
"sharp": "^0.27.2",
"sqlite3": "^5.1.7",
"telegraf": "^4.16.3",
"tiptap": "^1.32.2",
"tiptap-extensions": "^1.35.2",
"umzug": "^2.3.0",
"v-calendar": "^2.4.2",
"vue2-leaflet": "^2.7.1",
"vuetify": "2.6.14",
"winston": "^3.13.0",
"winston-daily-rotate-file": "^5.0.0",
"yargs": "^17.7.2"
},
"devDependencies": {
"@nuxtjs/vuetify": "^1.12.3",
"@vue/language-plugin-pug": "^1.8.27",
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"prettier": "^2.8.8",
"pug": "^3.0.3",
"pug-plain-loader": "^1.1.0",
"sass": "^1.77.6",
"sequelize-cli": "^6.6.2",
"supertest": "^6.3.4",
"webpack": "^4.47.0",
"webpack-cli": "^4.10.0"
},
"resolutions": {
"vue": "2.7.16",
"vue-template-compiler": "2.7.16",
"vue-server-renderer": "2.7.16"
},
"bin": {
"gancio": "server/cli.js"
},
"bugs": {
"email": "lesion@autistici.org",
"url": "https://framagit.org/les/gancio/issues"
},
"homepage": "https://gancio.org",
"keywords": [
"AP",
"gancio",
"events",
"federation",
"activitypub",
"event",
"server",
"self-host",
"app"
],
"license": "AGPL-3.0",
"repository": {
"type": "git",
"url": "https://framagit.org/les/gancio"
},
"snyk": true,
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

View File

@ -1,89 +1,71 @@
{ {
mkYarnPackage, lib,
stdenv,
fetchFromGitLab, fetchFromGitLab,
fetchYarnDeps, fetchYarnDeps,
python3,
yarnConfigHook,
yarnBuildHook,
yarnInstallHook,
nodejs,
pkg-config, pkg-config,
nodePackages,
node-gyp,
vips, vips,
lib, sqlite,
nixosTests, nixosTests,
}: }:
mkYarnPackage rec {
inherit (nodePackages) nodejs; stdenv.mkDerivation (finalAttrs: {
pname = "gancio";
version = "1.19.4"; version = "1.19.4";
src = fetchFromGitLab { src = fetchFromGitLab {
domain = "framagit.org"; domain = "framagit.org";
owner = "les"; owner = "les";
repo = "gancio"; repo = "gancio";
rev = "v${version}"; rev = "v${finalAttrs.version}";
hash = "sha256-x8s7eBVmHCY3kAjHjACotCncvZq6OBiLPJGF6hvfawE="; hash = "sha256-x8s7eBVmHCY3kAjHjACotCncvZq6OBiLPJGF6hvfawE=";
}; };
offlineCache = fetchYarnDeps { offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock"; yarnLock = finalAttrs.src + "/yarn.lock";
hash = "sha256-LXeAyxZSZOm6GxRuJb5rlHTlQpYa1fdKSENVjwLY4tU="; hash = "sha256-LXeAyxZSZOm6GxRuJb5rlHTlQpYa1fdKSENVjwLY4tU=";
}; };
packageJSON = ./package.json;
# for pkg-config dependencies:
yarnPreBuild = ''
export npm_config_nodedir=${nodePackages.nodejs}
'';
# So that sqlite can be found:
pkgConfig.sqlite3 = {
nativeBuildInputs = [ nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
yarnInstallHook
nodejs
(nodejs.python.withPackages (ps: [ ps.setuptools ]))
pkg-config pkg-config
nodePackages.prebuild-install
node-gyp
python3
]; ];
postInstall = ''
yarn --offline run install buildInputs = [
''; vips
}; sqlite
# Sharp need to find a vips library
pkgConfig.sharp = {
nativeBuildInputs = [
pkg-config
python3
node-gyp
nodePackages.semver
]; ];
buildInputs = [ vips ];
# generate .node binaries
preBuild = ''
npm rebuild --verbose --nodedir=${nodejs} --sqlite=${lib.getDev sqlite}
'';
# the node_modules directory will be regenerated by yarnInstallHook, so we save our .node binaries
preInstall = ''
cp node_modules/sharp/build/Release/sharp.node .
cp node_modules/sqlite3/build/Release/node_sqlite3.node .
'';
# and then place them where they belong
postInstall = '' postInstall = ''
yarn --offline run install install -Dm755 sharp.node -t $out/lib/node_modules/gancio/node_modules/sharp/build/Release
''; install -Dm755 node_sqlite3.node -t $out/lib/node_modules/gancio/node_modules/sqlite3/build/Release
};
# build need a writeable node_modules
configurePhase = ''
runHook preConfigure
cp -r $node_modules node_modules
chmod -R +w node_modules
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
yarn --offline build
yarn --offline pack --filename gancio.tgz
mkdir -p deps/gancio
tar -C deps/gancio/ --strip-components=1 -xf gancio.tgz
rm gancio.tgz
runHook postBuild
''; '';
passthru = { passthru = {
updateScript = ./update.sh; inherit nodejs;
tests = { tests = {
inherit (nixosTests) gancio; inherit (nixosTests) gancio;
}; };
@ -98,4 +80,4 @@ mkYarnPackage rec {
mainProgram = "gancio"; mainProgram = "gancio";
maintainers = with lib.maintainers; [ jbgi ]; maintainers = with lib.maintainers; [ jbgi ];
}; };
} })

View File

@ -1,19 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts jq nix prefetch-yarn-deps
set -eux -o pipefail
latest_version=$(curl -s https://framagit.org/api/v4/projects/48668/repository/tags | jq --raw-output '.[0].name' | sed 's/^v//')
nixFile=$(nix-instantiate --eval --strict -A "gancio.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
nixFolder=$(dirname "$nixFile")
curl -o "$nixFolder/package.json" -s "https://framagit.org/les/gancio/-/raw/v$latest_version/package.json"
curl -o "$nixFolder/yarn.lock" -s "https://framagit.org/les/gancio/-/raw/v$latest_version/yarn.lock"
old_yarn_hash=$(nix-instantiate --eval --strict -A "gancio.offlineCache.outputHash" | tr -d '"' | sed -re 's|[+]|\\&|g')
new_yarn_hash=$(nix hash to-sri --type sha256 $(prefetch-yarn-deps "$nixFolder/yarn.lock"))
sed -i "$nixFile" -re "s|\"$old_yarn_hash\"|\"$new_yarn_hash\"|"
rm "$nixFolder/yarn.lock"
update-source-version gancio "$latest_version"