Compare commits

...

6 Commits

Author SHA1 Message Date
Romain f65afab9eb test: add failing test for files starting with a hash sign (#342) 6 months ago
Romain 3590b15cfb chore: use node prefix for all builtin modules 6 months ago
Romain 2c669bda99 chore: remove unused devDependencies 6 months ago
Romain b3d79838db chore: replace require-lint with depcheck
Depcheck is more actively maintained and supports "node:" prefixes.
It also scans devDependencies which found unused modules.
However it can't tell if a prod module should have been a devDependency.
6 months ago
Romain 02d33b2cd7 test: simplify setup with npm pretest 6 months ago
Romain 0b1b8e2f42 test: use npm ci for more deterministic tests 6 months ago

@ -0,0 +1,6 @@
ignores:
# dynamically loaded themes
- "@thumbsup/theme-cards"
- "@thumbsup/theme-classic"
- "@thumbsup/theme-mosaic"
- "@thumbsup/theme-flow"

@ -1 +0,0 @@
ignore-extra=@thumbsup/theme-cards,@thumbsup/theme-classic,@thumbsup/theme-mosaic,@thumbsup/theme-flow

@ -1,7 +1,7 @@
const fs = require('node:fs')
const util = require('node:util')
const tty = require('node:tty')
const debug = require('debug') const debug = require('debug')
const fs = require('fs')
const util = require('util')
const tty = require('tty')
/* /*
Thumbsup uses the <debug> package for logging. Thumbsup uses the <debug> package for logging.

@ -10,7 +10,7 @@ USER tester
# Install and cache dependencies # Install and cache dependencies
COPY --chown=tester package*.json /app COPY --chown=tester package*.json /app
RUN npm install RUN npm ci
# Copy the entire source code # Copy the entire source code
COPY --chown=tester . /app COPY --chown=tester . /app

2859
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -27,9 +27,8 @@
"bin" "bin"
], ],
"scripts": { "scripts": {
"lint": "standard && require-lint", "pretest": "standard && depcheck",
"unit": "c8 mocha", "test": "c8 mocha"
"test": "npm run lint && npm run unit"
}, },
"dependencies": { "dependencies": {
"@thumbsup/theme-cards": "^1.3.0", "@thumbsup/theme-cards": "^1.3.0",
@ -64,13 +63,11 @@
}, },
"devDependencies": { "devDependencies": {
"c8": "^8.0.1", "c8": "^8.0.1",
"depcheck": "^1.4.7",
"glob": "^10.3.10", "glob": "^10.3.10",
"gm": "^1.25.0",
"markdown-toc": "^1.2.0",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"mock-fs": "^5.2.0", "mock-fs": "^5.2.0",
"mock-spawn": "^0.2.6", "mock-spawn": "^0.2.6",
"require-lint": "^2.0.3",
"should": "^13.2.3", "should": "^13.2.3",
"sinon": "^17.0.1", "sinon": "^17.0.1",
"standard": "^17.1.0", "standard": "^17.1.0",

@ -1,9 +1,9 @@
/* eslint-disable quote-props */ /* eslint-disable quote-props */
const messages = require('./messages') const path = require('node:path')
const path = require('path') const os = require('node:os')
const yargs = require('yargs')
const os = require('os')
const _ = require('lodash') const _ = require('lodash')
const yargs = require('yargs')
const messages = require('./messages')
const OPTIONS = { const OPTIONS = {

@ -1,8 +1,8 @@
const os = require('node:os')
const _ = require('lodash') const _ = require('lodash')
const debug = require('debug')('thumbsup:debug') const debug = require('debug')('thumbsup:debug')
const es = require('event-stream') const es = require('event-stream')
const exiftool = require('./stream.js') const exiftool = require('./stream.js')
const os = require('os')
/* /*
Fans out the list of files to multiple exiftool processes (default = CPU count) Fans out the list of files to multiple exiftool processes (default = CPU count)

@ -1,4 +1,4 @@
const childProcess = require('child_process') const childProcess = require('node:child_process')
const trace = require('debug')('thumbsup:trace') const trace = require('debug')('thumbsup:trace')
const debug = require('debug')('thumbsup:debug') const debug = require('debug')('thumbsup:debug')
const error = require('debug')('thumbsup:error') const error = require('debug')('thumbsup:error')

@ -1,12 +1,12 @@
const EventEmitter = require('node:events')
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const Database = require('better-sqlite3') const Database = require('better-sqlite3')
const fs = require('fs-extra')
const moment = require('moment')
const delta = require('./delta') const delta = require('./delta')
const EventEmitter = require('events')
const exiftool = require('../exiftool/parallel') const exiftool = require('../exiftool/parallel')
const fs = require('fs-extra')
const globber = require('./glob') const globber = require('./glob')
const moment = require('moment')
const path = require('path')
const EXIF_DATE_FORMAT = 'YYYY:MM:DD HH:mm:ssZ' const EXIF_DATE_FORMAT = 'YYYY:MM:DD HH:mm:ssZ'

@ -1,5 +1,5 @@
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const path = require('path')
const micromatch = require('micromatch') const micromatch = require('micromatch')
class GlobPattern { class GlobPattern {

@ -5,8 +5,8 @@ based on the --albums-from array of patterns provided
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
*/ */
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const path = require('path')
const albumPattern = require('./album-pattern') const albumPattern = require('./album-pattern')
class AlbumMapper { class AlbumMapper {

@ -5,8 +5,8 @@ Can be based on anything, e.g. directory name, date, metadata keywords...
e.g. `Holidays/London/IMG_00001.jpg` -> `Holidays/London` e.g. `Holidays/London/IMG_00001.jpg` -> `Holidays/London`
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
*/ */
const path = require('node:path')
const moment = require('moment') const moment = require('moment')
const path = require('path')
const TOKEN_REGEX = /%[a-z]+/g const TOKEN_REGEX = /%[a-z]+/g
const DATE_REGEX = /{[^}]+}/g const DATE_REGEX = /{[^}]+}/g

@ -1,5 +1,5 @@
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const path = require('path')
const Album = require('../model/album') const Album = require('../model/album')
exports.createAlbums = function (collection, mapper, opts, picasaReader) { exports.createAlbums = function (collection, mapper, opts, picasaReader) {

@ -4,9 +4,9 @@ Provides Picasa metadata based on <picasa.ini> files in the input folder
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
*/ */
const fs = require('node:fs')
const path = require('node:path')
const ini = require('ini') const ini = require('ini')
const fs = require('fs')
const path = require('path')
class Picasa { class Picasa {
constructor () { constructor () {

@ -6,8 +6,8 @@ A single photo/video could exist in multiple albums
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
*/ */
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const path = require('path')
const slugify = require('slugify') const slugify = require('slugify')
const url = require('./url') const url = require('./url')

@ -5,8 +5,8 @@ Also includes how it maps to the different output files
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
*/ */
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const path = require('path')
const moment = require('moment') const moment = require('moment')
const output = require('./output') const output = require('./output')
const url = require('./url') const url = require('./url')

@ -5,9 +5,9 @@ This is based on parsing "provider data" such as Exiftool or Picasa
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
*/ */
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const moment = require('moment') const moment = require('moment')
const path = require('path')
// mime type for videos // mime type for videos
const MIME_VIDEO_REGEX = /^video\/.*$/ const MIME_VIDEO_REGEX = /^video\/.*$/

@ -1,4 +1,4 @@
const path = require('path') const path = require('node:path')
const urljoin = require('url-join') const urljoin = require('url-join')
const url = require('./url') const url = require('./url')

@ -1,5 +1,5 @@
const path = require('path') const path = require('node:path')
const process = require('process') const process = require('node:process')
exports.fromPath = function (filepath) { exports.fromPath = function (filepath) {
// already a URL (typically provided as a CLI argument, e.g. link prefix) // already a URL (typically provided as a CLI argument, e.g. link prefix)

@ -1,7 +1,7 @@
const path = require('node:path')
const childProcess = require('node:child_process')
const async = require('async') const async = require('async')
const childProcess = require('child_process')
const Observable = require('zen-observable') const Observable = require('zen-observable')
const path = require('path')
const trace = require('debug')('thumbsup:trace') const trace = require('debug')('thumbsup:trace')
const debug = require('debug')('thumbsup:debug') const debug = require('debug')('thumbsup:debug')
const error = require('debug')('thumbsup:error') const error = require('debug')('thumbsup:error')

@ -1,8 +1,8 @@
const fs = require('node:fs')
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const fs = require('fs')
const debug = require('debug')('thumbsup:debug') const debug = require('debug')('thumbsup:debug')
const Observable = require('zen-observable') const Observable = require('zen-observable')
const path = require('path')
const readdir = require('fs-readdir-recursive') const readdir = require('fs-readdir-recursive')
exports.run = function (fileCollection, outputRoot, dryRun) { exports.run = function (fileCollection, outputRoot, dryRun) {

@ -5,7 +5,7 @@ Caches the results in <thumbsup.db> for faster re-runs
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
*/ */
const path = require('path') const path = require('node:path')
const hierarchy = require('../input/hierarchy.js') const hierarchy = require('../input/hierarchy.js')
const Index = require('../components/index/index') const Index = require('../components/index/index')
const info = require('debug')('thumbsup:info') const info = require('debug')('thumbsup:info')

@ -1,9 +1,9 @@
const path = require('node:path')
const fs = require('fs-extra')
const debug = require('debug')('thumbsup:debug') const debug = require('debug')('thumbsup:debug')
const error = require('debug')('thumbsup:error') const error = require('debug')('thumbsup:error')
const fs = require('fs-extra')
const info = require('debug')('thumbsup:info') const info = require('debug')('thumbsup:info')
const ListrWorkQueue = require('../components/listr-work-queue/index') const ListrWorkQueue = require('../components/listr-work-queue/index')
const path = require('path')
const actions = require('./actions') const actions = require('./actions')
exports.run = function (files, problems, opts, parentTask) { exports.run = function (files, problems, opts, parentTask) {

@ -1,5 +1,5 @@
const fs = require('fs') const fs = require('node:fs')
const path = require('path') const path = require('node:path')
class SEO { class SEO {
constructor (output, seoLocation, rootAlbum) { constructor (output, seoLocation, rootAlbum) {

@ -1,4 +1,4 @@
const path = require('path') const path = require('node:path')
module.exports = (target, options) => { module.exports = (target, options) => {
// if already an absolute URL, do nothing // if already an absolute URL, do nothing

@ -1,9 +1,9 @@
const path = require('node:path')
const async = require('async') const async = require('async')
const debug = require('debug')('thumbsup:debug') const debug = require('debug')('thumbsup:debug')
const fs = require('fs-extra') const fs = require('fs-extra')
const handlebars = require('handlebars') const handlebars = require('handlebars')
const less = require('less') const less = require('less')
const path = require('path')
class Theme { class Theme {
constructor (themeDir, destDir, opts) { constructor (themeDir, destDir, opts) {

@ -1,5 +1,5 @@
const fs = require('fs') const fs = require('node:fs')
const path = require('path') const path = require('node:path')
const async = require('async') const async = require('async')
const resolvePkg = require('resolve-pkg') const resolvePkg = require('resolve-pkg')
const Theme = require('./theme') const Theme = require('./theme')

@ -1,5 +1,5 @@
const path = require('path') const path = require('node:path')
const process = require('process') const process = require('node:process')
const should = require('should/as-function') const should = require('should/as-function')
const sinon = require('sinon') const sinon = require('sinon')
const options = require('../../src/cli/options.js') const options = require('../../src/cli/options.js')

@ -1,4 +1,4 @@
const path = require('path') const path = require('node:path')
const should = require('should/as-function') const should = require('should/as-function')
const fixtures = require('../../fixtures') const fixtures = require('../../fixtures')
const exiftool = require('../../../src/components/exiftool/parallel') const exiftool = require('../../../src/components/exiftool/parallel')
@ -44,6 +44,26 @@ describe('exiftool', function () {
}) })
}) })
xit('can process files starting with a # sign', (done) => {
// they are currently ignored by Exiftool for an unknown reason
const structure = {
'photo1.jpg': fixtures.fromDisk('photo.jpg'),
'#photo2.jpg': fixtures.fromDisk('photo.jpg')
}
const tmpdir = fixtures.createTempStructure(structure)
const processed = []
// force concurrency of 1 to ensure there's a single exiftool instance
// otherwise, once instance will receive '#photo2.jpg' and think it has nothing to process
// which generates an unrelated error
const stream = exiftool.parse(tmpdir, Object.keys(structure), 1)
stream.on('data', entry => {
processed.push(entry.SourceFile)
}).on('end', () => {
should(processed).eql(['photo1.jpg', '#photo2.jpg'])
done()
})
})
it('can process badly encoded fields', (done) => { it('can process badly encoded fields', (done) => {
// here we test with an XMP file because it's easier to see what's wrong // here we test with an XMP file because it's easier to see what's wrong
// but the problem will more likely be with a badly encoded XMP section inside a JPG file // but the problem will more likely be with a badly encoded XMP section inside a JPG file

@ -1,4 +1,4 @@
const childProcess = require('child_process') const childProcess = require('node:child_process')
const debug = require('debug') const debug = require('debug')
const mockSpawn = require('mock-spawn') const mockSpawn = require('mock-spawn')
const should = require('should/as-function') const should = require('should/as-function')

@ -1,9 +1,9 @@
const fs = require('fs') const fs = require('node:fs')
const glob = require('../../../src/components/index/glob') const { sep } = require('node:path')
const { sep } = require('path') const os = require('node:os')
const os = require('os')
const should = require('should/as-function') const should = require('should/as-function')
const tmp = require('tmp') const tmp = require('tmp')
const glob = require('../../../src/components/index/glob')
describe('Index: glob', function () { describe('Index: glob', function () {
this.slow(500) this.slow(500)

@ -1,4 +1,4 @@
const path = require('path') const path = require('node:path')
const should = require('should/as-function') const should = require('should/as-function')
const Index = require('../../../src/components/index/index') const Index = require('../../../src/components/index/index')
const fixtures = require('../../fixtures') const fixtures = require('../../fixtures')

@ -1,7 +1,7 @@
const path = require('node:path')
const _ = require('lodash') const _ = require('lodash')
const fs = require('fs-extra') const fs = require('fs-extra')
const moment = require('moment') const moment = require('moment')
const path = require('path')
const tmp = require('tmp') const tmp = require('tmp')
const File = require('../src/model/file') const File = require('../src/model/file')
const Metadata = require('../src/model/metadata') const Metadata = require('../src/model/metadata')

@ -1,5 +1,5 @@
const fs = require('fs') const fs = require('node:fs')
const path = require('path') const path = require('node:path')
const should = require('should/as-function') const should = require('should/as-function')
const tmp = require('tmp') const tmp = require('tmp')
const AlbumMapper = require('../../src/input/album-mapper.js') const AlbumMapper = require('../../src/input/album-mapper.js')

@ -1,4 +1,4 @@
const path = require('path') const path = require('node:path')
const should = require('should/as-function') const should = require('should/as-function')
const sinon = require('sinon') const sinon = require('sinon')
const hierarchy = require('../../src/input/hierarchy.js') const hierarchy = require('../../src/input/hierarchy.js')

@ -1,4 +1,4 @@
const fs = require('fs') const fs = require('node:fs')
const sinon = require('sinon') const sinon = require('sinon')
const should = require('should/as-function') const should = require('should/as-function')
const Picasa = require('../../src/input/picasa.js') const Picasa = require('../../src/input/picasa.js')

@ -1,7 +1,7 @@
const fs = require('fs') const fs = require('node:fs')
const path = require('node:path')
const debug = require('debug') const debug = require('debug')
const glob = require('glob') const glob = require('glob')
const path = require('path')
const YAML = require('yaml') const YAML = require('yaml')
const should = require('should/as-function') const should = require('should/as-function')
const fixtures = require('../fixtures') const fixtures = require('../fixtures')

@ -1,5 +1,5 @@
const util = require('node:util')
const debug = require('debug') const debug = require('debug')
const util = require('util')
debug.recorded = [] debug.recorded = []

@ -1,4 +1,4 @@
const fs = require('fs') const fs = require('node:fs')
const sinon = require('sinon') const sinon = require('sinon')
const debug = require('debug') const debug = require('debug')
const should = require('should/as-function') const should = require('should/as-function')

@ -1,5 +1,5 @@
const path = require('node:path')
const fs = require('fs-extra') const fs = require('fs-extra')
const path = require('path')
const should = require('should/as-function') const should = require('should/as-function')
const fixtures = require('../fixtures') const fixtures = require('../fixtures')
const Theme = require('../../src/website/theme') const Theme = require('../../src/website/theme')

Loading…
Cancel
Save