1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

adding switch to force optDeps for docker

This commit is contained in:
Patrik J. Braun 2019-12-22 00:04:52 +01:00
parent fb99df6157
commit 5c6919bf27
3 changed files with 33 additions and 16 deletions

View File

@ -22,7 +22,7 @@ jobs:
run: npm install --unsafe-perm run: npm install --unsafe-perm
- -
name: Create Release name: Create Release
run: npm run create-release -- --skip-opt-packages=ffmpeg,ffprobe run: npm run create-release -- --skip-opt-packages=ffmpeg,ffprobe --force-opt-packages
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
with: with:
name: pigallery2-release name: pigallery2-release

View File

@ -12,14 +12,17 @@ const translationFolder = 'translate';
const tsBackendProject = ts.createProject('tsconfig.json'); const tsBackendProject = ts.createProject('tsconfig.json');
declare var process: NodeJS.Process; declare var process: NodeJS.Process;
const getSwitch = (name: string, def: string = null) => { const getSwitch = (name: string, def: string = null): string => {
name = '--' + name; name = '--' + name;
for (let i = 0; i < process.argv.length; i++) { for (let i = 0; i < process.argv.length; i++) {
if (process.argv[i].startsWith(name + '=')) { if (process.argv[i].startsWith(name + '=')) {
return process.argv[i].replace(name + '=', '').trim(); return process.argv[i].replace(name + '=', '').trim();
} }
if (process.argv[i].startsWith(name) && i + 1 < process.argv.length) { if (process.argv[i].startsWith(name)) {
return process.argv[i + 1].trim(); if (i + 1 < process.argv.length) {
return process.argv[i + 1].trim();
}
return 'true';
} }
} }
return def; return def;
@ -129,6 +132,13 @@ gulp.task('copy-package', function () {
} }
} }
} }
if (!!getSwitch('force-opt-packages')) {
for (const key of Object.keys(json.optionalDependencies)) {
json.dependencies[key] = json.optionalDependencies[key];
}
delete json.optionalDependencies;
}
return json; return json;
})) }))
.pipe(gulp.dest('./release')); .pipe(gulp.dest('./release'));

View File

@ -81,22 +81,30 @@ export class ConfigDiagnostics {
} }
} }
static async testSharp() {
const sharp = require('sharp');
sharp();
}
static async testGM() {
const gm = require('gm');
await new Promise((resolve, reject) => {
gm(ProjectPath.FrontendFolder + '/assets/icon.png').size((err: Error) => {
if (err) {
return reject(err.toString());
}
return resolve();
});
});
}
static async testThumbnailLib(processingLibrary: ServerConfig.PhotoProcessingLib) { static async testThumbnailLib(processingLibrary: ServerConfig.PhotoProcessingLib) {
switch (processingLibrary) { switch (processingLibrary) {
case ServerConfig.PhotoProcessingLib.sharp: case ServerConfig.PhotoProcessingLib.sharp:
const sharp = require('sharp'); await this.testSharp();
sharp();
break; break;
case ServerConfig.PhotoProcessingLib.gm: case ServerConfig.PhotoProcessingLib.gm:
const gm = require('gm'); await this.testGM();
await new Promise((resolve, reject) => {
gm(ProjectPath.FrontendFolder + '/assets/icon.png').size((err: Error) => {
if (err) {
return reject(err.toString());
}
return resolve();
});
});
break; break;
} }
} }
@ -120,7 +128,6 @@ export class ConfigDiagnostics {
} }
static async testServerPhotoConfig(server: ServerConfig.PhotoConfig) { static async testServerPhotoConfig(server: ServerConfig.PhotoConfig) {
} }