penrose 0.2.44 → 0.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.envrc ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env bash
2
+
3
+ version_gte() {
4
+ local cmd="$1"
5
+ local required_version="$2"
6
+ local installed_version=$($cmd | grep -oE "[0-9]+(\.[0-9]+)+" | head -n 1)
7
+
8
+ if [ -z "$installed_version" ]; then
9
+ return 1
10
+ fi
11
+
12
+ IFS="."
13
+ set -- $installed_version
14
+ local installed_parts="$@"
15
+ set -- $required_version
16
+ local required_parts="$@"
17
+ unset IFS
18
+
19
+ local i=1
20
+ for required_part in $required_parts; do
21
+ installed_part=$(echo "$installed_parts" | cut -d " " -f $i)
22
+ if [ "${installed_part:-0}" -lt "$required_part" ]; then
23
+ return 1
24
+ elif [ "${installed_part:-0}" -gt "$required_part" ]; then
25
+ return 0
26
+ fi
27
+ i=$((i + 1))
28
+ done
29
+
30
+ return 0
31
+ }
32
+
33
+ if type nix-shell >/dev/null 2>&1; then
34
+ if ! has devenv; then
35
+ # Install devenv v1.x. Hash from https://www.nixhub.io/packages/devenv
36
+ if version_gte "nix --version" "2.30.0"; then
37
+ nix profile add github:NixOS/nixpkgs/80d901ec0377e19ac3f7bb8c035201e2e098cc97#devenv
38
+ else
39
+ nix profile install github:NixOS/nixpkgs/80d901ec0377e19ac3f7bb8c035201e2e098cc97#devenv
40
+ fi
41
+ fi
42
+
43
+ eval "$(devenv direnvrc)"
44
+ use devenv
45
+ else
46
+ echo "nix-shell is not available. Install Nix: https://nixos.org/download"
47
+ fi
package/.eslintrc.cjs CHANGED
@@ -3,11 +3,14 @@ module.exports = {
3
3
  env: {
4
4
  browser: true,
5
5
  jquery: true,
6
- mocha: true,
7
6
  node: true
8
7
  },
9
8
  plugins: ['prettier'],
10
- extends: ['eslint:recommended', 'prettier'],
9
+ extends: [
10
+ 'eslint:recommended',
11
+ 'plugin:@typescript-eslint/recommended',
12
+ 'prettier'
13
+ ],
11
14
  rules: {
12
15
  'no-undef': 'error',
13
16
  'no-unsafe-finally': 'error',
@@ -15,9 +18,9 @@ module.exports = {
15
18
  'no-unsafe-optional-chaining': 'error',
16
19
  'no-var': 'error'
17
20
  },
18
- parser: 'espree',
21
+ parser: '@typescript-eslint/parser',
19
22
  parserOptions: {
20
- ecmaVersion: 2015,
23
+ ecmaVersion: 2017,
21
24
  requireConfigFile: true,
22
25
  sourceType: 'module'
23
26
  }
@@ -0,0 +1,29 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Install system dependencies
15
+ run: |
16
+ sudo apt-get update -qq
17
+ sudo apt-get install -y -qq graphicsmagick
18
+
19
+ - name: Install Node
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: 24.15.0
23
+ cache: npm
24
+
25
+ - name: Install Node dependencies
26
+ run: npm ci
27
+
28
+ - name: Run Node tests
29
+ run: npm test
@@ -0,0 +1,22 @@
1
+ default_language_version:
2
+ node: 24.15.0
3
+
4
+ default_stages: [pre-commit]
5
+
6
+ fail_fast: true
7
+
8
+ repos:
9
+ - repo: local
10
+ hooks:
11
+ - id: nixfmt
12
+ name: nixfmt
13
+ entry: nixfmt
14
+ language: system
15
+ files: \.nix$
16
+
17
+ - id: format-js
18
+ name: Format JS
19
+ language: system
20
+ entry: npx prettier --parser babel --write
21
+ files: ^(lib)/.*\.(js|jsx|cjs|mjs)$
22
+ pass_filenames: true
package/.prettierrc.cjs CHANGED
@@ -1,13 +1,13 @@
1
1
  module.exports = {
2
+ arrowParens: 'always',
3
+ bracketSameLine: false,
4
+ bracketSpacing: false,
5
+ endOfLine: 'lf',
2
6
  printWidth: 80,
3
- tabWidth: 2,
4
- useTabs: false,
5
7
  semi: true,
8
+ singleAttributePerLine: false,
6
9
  singleQuote: true,
10
+ tabWidth: 2,
7
11
  trailingComma: 'none',
8
- bracketSpacing: false,
9
- bracketSameLine: false,
10
- arrowParens: 'always',
11
- endOfLine: 'lf',
12
- parser: 'espree'
12
+ useTabs: false
13
13
  };
package/Makefile ADDED
@@ -0,0 +1,38 @@
1
+ ifneq ($(shell which tput),)
2
+ ifneq ($(TERM),)
3
+ RED := $(shell tput setaf 1)
4
+ GREEN := $(shell tput setaf 2)
5
+ YELLOW := $(shell tput setaf 3)
6
+ CYAN := $(shell tput setaf 6)
7
+ RESET := $(shell tput sgr0)
8
+ endif
9
+ endif
10
+
11
+ format:
12
+ @echo "Formatting code..."
13
+ pre-commit run format-js --all-files
14
+
15
+ bump-version:
16
+ @BUMP=$(word 2,$(MAKECMDGOALS)); \
17
+ VALID_BUMP="major minor patch premajor preminor prepatch prerelease"; \
18
+ if [ -z "$$BUMP" ]; then \
19
+ echo "$(RED)Error: Bump is required.$(RESET)"; \
20
+ echo "Usage: make bump-version [major|minor|patch|premajor|preminor|prepatch|prerelease]"; \
21
+ exit 1; \
22
+ fi; \
23
+ if ! echo "$$VALID_BUMP" | grep -qw "$$BUMP"; then \
24
+ echo "$(RED)Error: Invalid bump '$$BUMP'.$(RESET)"; \
25
+ echo "Must be one of: $(CYAN)$$VALID_BUMP$(RESET)"; \
26
+ exit 1; \
27
+ fi; \
28
+ npm version $$BUMP;
29
+
30
+ create-release:
31
+ @VERSION=$$(npm pkg get version --browser=false | tr -d '"'); \
32
+ gh release create $$VERSION;
33
+
34
+ # Prevent make from treating arguments to bump-version as targets
35
+ ifeq (bump-version,$(firstword $(MAKECMDGOALS)))
36
+ %:
37
+ @:
38
+ endif
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Penrose [![CircleCI](https://circleci.com/gh/netbek/penrose.svg?style=svg)](https://circleci.com/gh/netbek/penrose)
1
+ # Penrose
2
2
 
3
3
  Build derivative images.
4
4
 
package/devenv.lock ADDED
@@ -0,0 +1,123 @@
1
+ {
2
+ "nodes": {
3
+ "devenv": {
4
+ "locked": {
5
+ "dir": "src/modules",
6
+ "lastModified": 1770833792,
7
+ "owner": "cachix",
8
+ "repo": "devenv",
9
+ "rev": "1e5f2d43973d3f4a6e7bf3e13fd39e0c4d9af3de",
10
+ "type": "github"
11
+ },
12
+ "original": {
13
+ "dir": "src/modules",
14
+ "owner": "cachix",
15
+ "repo": "devenv",
16
+ "type": "github"
17
+ }
18
+ },
19
+ "flake-compat": {
20
+ "flake": false,
21
+ "locked": {
22
+ "lastModified": 1767039857,
23
+ "owner": "NixOS",
24
+ "repo": "flake-compat",
25
+ "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
26
+ "type": "github"
27
+ },
28
+ "original": {
29
+ "owner": "NixOS",
30
+ "repo": "flake-compat",
31
+ "type": "github"
32
+ }
33
+ },
34
+ "git-hooks": {
35
+ "inputs": {
36
+ "flake-compat": "flake-compat",
37
+ "gitignore": "gitignore",
38
+ "nixpkgs": [
39
+ "nixpkgs"
40
+ ]
41
+ },
42
+ "locked": {
43
+ "lastModified": 1770726378,
44
+ "owner": "cachix",
45
+ "repo": "git-hooks.nix",
46
+ "rev": "5eaaedde414f6eb1aea8b8525c466dc37bba95ae",
47
+ "type": "github"
48
+ },
49
+ "original": {
50
+ "owner": "cachix",
51
+ "repo": "git-hooks.nix",
52
+ "type": "github"
53
+ }
54
+ },
55
+ "gitignore": {
56
+ "inputs": {
57
+ "nixpkgs": [
58
+ "git-hooks",
59
+ "nixpkgs"
60
+ ]
61
+ },
62
+ "locked": {
63
+ "lastModified": 1762808025,
64
+ "owner": "hercules-ci",
65
+ "repo": "gitignore.nix",
66
+ "rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c",
67
+ "type": "github"
68
+ },
69
+ "original": {
70
+ "owner": "hercules-ci",
71
+ "repo": "gitignore.nix",
72
+ "type": "github"
73
+ }
74
+ },
75
+ "nixpkgs": {
76
+ "inputs": {
77
+ "nixpkgs-src": "nixpkgs-src"
78
+ },
79
+ "locked": {
80
+ "lastModified": 1770434727,
81
+ "owner": "cachix",
82
+ "repo": "devenv-nixpkgs",
83
+ "rev": "8430f16a39c27bdeef236f1eeb56f0b51b33d348",
84
+ "type": "github"
85
+ },
86
+ "original": {
87
+ "owner": "cachix",
88
+ "ref": "rolling",
89
+ "repo": "devenv-nixpkgs",
90
+ "type": "github"
91
+ }
92
+ },
93
+ "nixpkgs-src": {
94
+ "flake": false,
95
+ "locked": {
96
+ "lastModified": 1769922788,
97
+ "narHash": "sha256-H3AfG4ObMDTkTJYkd8cz1/RbY9LatN5Mk4UF48VuSXc=",
98
+ "owner": "NixOS",
99
+ "repo": "nixpkgs",
100
+ "rev": "207d15f1a6603226e1e223dc79ac29c7846da32e",
101
+ "type": "github"
102
+ },
103
+ "original": {
104
+ "owner": "NixOS",
105
+ "ref": "nixpkgs-unstable",
106
+ "repo": "nixpkgs",
107
+ "type": "github"
108
+ }
109
+ },
110
+ "root": {
111
+ "inputs": {
112
+ "devenv": "devenv",
113
+ "git-hooks": "git-hooks",
114
+ "nixpkgs": "nixpkgs",
115
+ "pre-commit-hooks": [
116
+ "git-hooks"
117
+ ]
118
+ }
119
+ }
120
+ },
121
+ "root": "root",
122
+ "version": 7
123
+ }
package/devenv.nix ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ pkgs,
3
+ lib,
4
+ config,
5
+ inputs,
6
+ ...
7
+ }:
8
+ {
9
+ env.DEVENV_TASKS_QUIET = 1;
10
+
11
+ packages = with pkgs; [
12
+ graphicsmagick
13
+ nixfmt
14
+ pre-commit
15
+ ];
16
+
17
+ languages = {
18
+ javascript = {
19
+ enable = true;
20
+ package = pkgs.nodejs_24;
21
+ npm = {
22
+ enable = true;
23
+ install = {
24
+ enable = true;
25
+ };
26
+ };
27
+ };
28
+ };
29
+
30
+ dotenv = {
31
+ disableHint = true;
32
+ };
33
+
34
+ enterShell = ''
35
+ if [ -d ".git" ]; then
36
+ pre-commit install --overwrite > /dev/null 2>&1
37
+ fi
38
+ '';
39
+ }
package/devenv.yaml ADDED
@@ -0,0 +1,4 @@
1
+ # yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
2
+ inputs:
3
+ nixpkgs:
4
+ url: github:cachix/devenv-nixpkgs/rolling
package/lib/penrose.js CHANGED
@@ -1,5 +1,4 @@
1
1
  const _ = require('lodash');
2
- const canonStringify = require('canonical-json/index2');
3
2
  const chalk = require('chalk');
4
3
  const cheerio = require('cheerio');
5
4
  const crypto = require('crypto');
@@ -10,6 +9,7 @@ const pkg = require('../package.json');
10
9
  const Promise = require('bluebird');
11
10
  const replaceExt = require('replace-ext');
12
11
  const sharp = require('sharp');
12
+ const stringify = require('fast-json-stable-stringify');
13
13
 
14
14
  /**
15
15
  * Constants
@@ -497,7 +497,7 @@ Penrose.prototype = {
497
497
  );
498
498
 
499
499
  const data =
500
- pkg.version + ';' + canonStringify(config) + ';' + args.input.trim();
500
+ pkg.version + ';' + stringify(config) + ';' + args.input.trim();
501
501
 
502
502
  return crypto.createHash('md5').update(data).digest('hex');
503
503
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "penrose",
3
- "version": "0.2.44",
3
+ "version": "0.2.46",
4
4
  "description": "Build derivative images",
5
5
  "main": "lib/penrose.js",
6
6
  "repository": {
@@ -20,32 +20,34 @@
20
20
  "url": "https://github.com/netbek/penrose/issues"
21
21
  },
22
22
  "dependencies": {
23
- "@babel/core": "7.26.0",
23
+ "@babel/core": "7.29.0",
24
24
  "babel-eslint": "10.1.0",
25
25
  "babel-loader": "8.4.1",
26
26
  "babel-plugin-lodash": "3.3.4",
27
27
  "babel-plugin-transform-class-properties": "6.24.1",
28
28
  "bluebird": "3.7.2",
29
- "canonical-json": "0.0.4",
30
29
  "chalk": "4.1.2",
31
- "cheerio": "0.22.0",
32
- "eslint": "8.57.1",
33
- "eslint-config-prettier": "9.1.0",
34
- "eslint-plugin-prettier": "5.2.1",
35
- "espree": "10.3.0",
36
- "fs-extra": "11.2.0",
37
- "glob": "7.2.3",
38
- "glob-promise": "4.2.2",
39
- "lodash": "4.17.21",
30
+ "cheerio": "1.2.0",
31
+ "fast-json-stable-stringify": "2.1.0",
32
+ "fs-extra": "11.3.5",
33
+ "glob-promise": "6.0.7",
34
+ "lodash": "4.18.1",
40
35
  "lodash-webpack-plugin": "0.11.6",
41
36
  "mathjax": "2.7.9",
42
37
  "mathjax-node": "0.5.2",
43
38
  "phantomjs-prebuilt": "2.1.16",
44
- "prettier": "3.3.3",
39
+ "prettier": "3.8.3",
45
40
  "replace-ext": "2.0.0",
46
- "sharp": "0.33.5"
41
+ "sharp": "0.34.5"
47
42
  },
48
43
  "devDependencies": {
49
- "vitest": "2.1.5"
44
+ "@typescript-eslint/eslint-plugin": "8.59.2",
45
+ "@typescript-eslint/parser": "8.59.2",
46
+ "eslint": "8.57.1",
47
+ "eslint-config-prettier": "9.1.2",
48
+ "eslint-plugin-prettier": "5.5.5",
49
+ "npm-check-updates": "22.1.1",
50
+ "typescript": "6.0.3",
51
+ "vitest": "3.2.4"
50
52
  }
51
53
  }
@@ -1,17 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- docker:
5
- - image: cimg/node:20.10.0-browsers
6
- steps:
7
- - checkout
8
- - run:
9
- name: Install dependencies
10
- command: |
11
- sudo npm install -g bower grunt-cli gulp-cli
12
- sudo apt-get update -qq
13
- sudo apt-get install -y -qq graphicsmagick
14
- npm ci
15
- - run:
16
- name: Run tests
17
- command: npm test