Skip to content

Commit dfff6a8

Browse files
authored
Merge branch 'main' into master
2 parents 61c03d5 + 3eff727 commit dfff6a8

File tree

10 files changed

+4304
-1507
lines changed

10 files changed

+4304
-1507
lines changed

.devcontainer/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/typescript-node/.devcontainer/base.Dockerfile
2+
3+
# [Choice] Node.js version: 16, 14, 12
4+
ARG VARIANT="16-buster"
5+
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
6+
7+
# [Optional] Uncomment this section to install additional OS packages.
8+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9+
# && apt-get -y install --no-install-recommends <your-package-list-here>
10+
11+
# [Optional] Uncomment if you want to install an additional version of node using nvm
12+
# ARG EXTRA_NODE_VERSION=10
13+
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
14+
15+
# [Optional] Uncomment if you want to install more global node packages
16+
# RUN su node -c "npm install -g <your-package-list -here>"

.devcontainer/devcontainer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.183.0/containers/typescript-node
3+
{
4+
"name": "Node.js & TypeScript",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
// Update 'VARIANT' to pick a Node version: 12, 14, 16
8+
"args": {
9+
"VARIANT": "16"
10+
}
11+
},
12+
// Set *default* container specific settings.json values on container create.
13+
"settings": {},
14+
// Add the IDs of extensions you want installed when the container is created.
15+
"extensions": [
16+
"dbaeumer.vscode-eslint"
17+
],
18+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
19+
// "forwardPorts": [],
20+
// Use 'postCreateCommand' to run commands after the container is created.
21+
// "postCreateCommand": "yarn install",
22+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
23+
// "remoteUser": "node"
24+
}

.github/workflows/publish.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 14
15+
registry-url: 'https://registry.npmjs.org'
16+
- run: npm ci
17+
- run: npm publish
18+
env:
19+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
20+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/tests.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
tests:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [16.x]
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
- run: npm ci
28+
- run: npm test

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# smartcrop-sharp
22

3-
[![Build Status](https://travis-ci.org/jwagner/smartcrop-sharp.svg?branch=master)](https://travis-ci.org/jwagner/smartcrop-sharp)
3+
[![Tests](https://github.com/jwagner/smartcrop-sharp/actions/workflows/tests.yml/badge.svg)](https://github.com/jwagner/smartcrop-sharp/actions/workflows/tests.yml)
44

55
This is an adapter module for using [smartcrop.js](https://github.com/jwagner/smartcrop.js)
66
with node.js using [sharp](https://github.com/lovell/sharp) for image decoding.

index.d.ts

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,6 @@
1-
/**
2-
* Describes a region to boost. A usage example of this is to take into account
3-
* faces in the image. See `smartcrop-cli` for an example on how to integrate
4-
* face detection in Node.js using ImageMagick with `smartcrop-gm`.
5-
* @see {@link https://github.com/jwagner/smartcrop.js#boost}
6-
* @see {@link https://github.com/jwagner/smartcrop-cli}
7-
*/
8-
export interface Boost {
9-
x: number;
10-
y: number;
11-
width: number;
12-
height: number;
13-
weight: number;
14-
}
15-
16-
/**
17-
* All of the documented crop options. Note that there are many more (for now
18-
* undocumented) options available. Check the source and be advised that they
19-
* might change in the future.
20-
* @see {@link https://github.com/jwagner/smartcrop.js#cropoptions}
21-
* @see {@link https://github.com/jwagner/smartcrop.js/blob/master/smartcrop.js#L32}
22-
*/
23-
export interface CropOptions {
24-
minScale?: number;
25-
width: number;
26-
height: number;
27-
boost?: Boost[];
28-
ruleOfThirds?: boolean;
29-
debug?: boolean;
30-
}
1+
/// <reference types="smartcrop" />
312

32-
/**
33-
* Result of the promise returned by `smartcrop.crop`. Contains a single
34-
* individual crop that can then be used by `sharp` to extract your image.
35-
* @see {@link https://github.com/jwagner/smartcrop.js#cropresult}
36-
* @see {@link https://github.com/jwagner/smartcrop.js#crop}
37-
*/
38-
export interface CropResult {
39-
topCrop: { x: number; y: number; width: number; height: number; };
40-
}
3+
import { CropOptions, CropResult } from "smartcrop";
414

425
/**
436
* Find the best crop for *image* using *options*.
@@ -47,3 +10,4 @@ export interface CropResult {
4710
* used by `sharp` to extract your final image.
4811
*/
4912
export function crop(image: Buffer | string, cropOptions: CropOptions): Promise<CropResult>;
13+

0 commit comments

Comments
 (0)