fix(core): update

This commit is contained in:
Philipp Kunz 2021-08-10 11:49:39 +02:00
parent 75394aaf8b
commit 1907d253be
9 changed files with 24570 additions and 563 deletions

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds # builds
dist/ dist/
dist_web/ dist_*/
dist_serve/
dist_ts_web/
# custom # custom

View File

@ -19,22 +19,36 @@ mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
only:
- tags
tags: tags:
- lossless - lossless
- docker - docker
- notpriv - notpriv
snyk: auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command snyk test - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags: tags:
- lossless
- docker - docker
- notpriv allow_failure: true
# ==================== # ====================
# test stage # test stage
@ -49,9 +63,7 @@ testStable:
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- priv
testBuild: testBuild:
stage: test stage: test
@ -62,9 +74,7 @@ testBuild:
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- notpriv
release: release:
stage: release stage: release
@ -84,6 +94,8 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare - npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": { "properties": {
"projectType": { "projectType": {
"type": "string", "type": "string",
"enum": ["website", "element", "service", "npm"] "enum": ["website", "element", "service", "npm", "wcc"]
} }
} }
} }

25010
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,8 @@
"version": "1.0.3", "version": "1.0.3",
"private": false, "private": false,
"description": "a module to detect mime types", "description": "a module to detect mime types",
"main": "dist/index.js", "main": "dist_ts/index.js",
"typings": "dist/index.d.ts", "typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
@ -13,26 +13,30 @@
"format": "(gitzone format)" "format": "(gitzone format)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.0.22", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.15", "@gitzone/tstest": "^1.0.54",
"@pushrocks/tapbundle": "^3.0.7", "@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^10.11.7", "@types/node": "^16.4.13",
"tslint": "^5.11.0", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@types/mime-types": "^2.1.0", "@types/mime-types": "^2.1.0",
"mime-types": "^2.1.26" "mime-types": "^2.1.32"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
"ts_web/**/*", "ts_web/**/*",
"dist/**/*", "dist/**/*",
"dist_web/**/*", "dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*", "dist_ts_web/**/*",
"assets/**/*", "assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"browserslist": [
"last 1 chrome versions"
] ]
} }

View File

@ -8,13 +8,20 @@ a module to detect mime types
* [docs (typedoc)](https://pushrocks.gitlab.io/smartmime/) * [docs (typedoc)](https://pushrocks.gitlab.io/smartmime/)
## Status for master ## Status for master
[![pipeline status](https://gitlab.com/pushrocks/smartmime/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartmime/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartmime/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartmime/commits/master) Status Category | Status Badge
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartmime.svg)](https://www.npmjs.com/package/@pushrocks/smartmime) -- | --
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartmime/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartmime) GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartmime/badges/master/pipeline.svg)](https://lossless.cloud)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartmime/badges/master/coverage.svg)](https://lossless.cloud)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartmime)](https://lossless.cloud)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartmime)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartmime)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartmime)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartmime)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage

View File

@ -25,6 +25,21 @@ tap.test('should detect json', async () => {
tap.test('should detect html', async () => { tap.test('should detect html', async () => {
const filePath = 'file.html'; const filePath = 'file.html';
const fileType = smartmime.detectMimeType(filePath); const fileType = smartmime.detectMimeType(filePath);
expect(fileType).to.equal('text/html');
console.log(fileType);
});
tap.test('should detect woff', async () => {
const filePath = 'file.woff';
const fileType = smartmime.detectMimeType(filePath);
expect(fileType).to.equal('font/woff');
console.log(fileType);
});
tap.test('should detect woff2', async () => {
const filePath = 'file.woff2';
const fileType = smartmime.detectMimeType(filePath);
expect(fileType).to.equal('font/woff2');
console.log(fileType); console.log(fileType);
}); });

View File

@ -1,19 +1,8 @@
import * as plugins from './smartmime.plugins'; import * as plugins from './smartmime.plugins';
export const binaryFileTypes = [ export const binaryFileTypes = ['jpg', 'png', 'pdf'];
'jpg',
'png',
'pdf'
];
export const supportedFileTypes = [ export const supportedFileTypes = ['json', 'html', 'svg', 'jpg', 'ts', 'js'];
'json',
'html',
'svg',
'jpg',
'ts',
'js',
];
export type TMimeTypes = 'image/jpeg' | 'image/svg+xml' | 'application/json' | 'text/html'; export type TMimeTypes = 'image/jpeg' | 'image/svg+xml' | 'application/json' | 'text/html';
@ -30,8 +19,8 @@ export const isBinary = (pathArg: string) => {
isBinary = pathArg.endsWith(`.${binaryFileType}`); isBinary = pathArg.endsWith(`.${binaryFileType}`);
} }
return isBinary; return isBinary;
} };
export const getEncoding = (pathArg: string) => { export const getEncoding = (pathArg: string) => {
return isBinary(pathArg) ? 'binary' : 'utf8'; return isBinary(pathArg) ? 'binary' : 'utf8';
} };

View File

@ -1,13 +1,9 @@
// node native scope // node native scope
import * as path from 'path'; import * as path from 'path';
export { export { path };
path
};
// thirdparty scope // thirdparty scope
import mimeTypes from 'mime-types'; import mimeTypes from 'mime-types';
export { export { mimeTypes };
mimeTypes
};