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
dist/
dist_web/
dist_serve/
dist_ts_web/
dist_*/
# custom

View File

@ -19,22 +19,36 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- notpriv
snyk:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
auditProductionDependencies:
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
script:
- npmci npm prepare
- 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:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -49,9 +63,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -62,9 +74,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -84,6 +94,8 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": {
"projectType": {
"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",
"private": false,
"description": "a module to detect mime types",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
@ -13,26 +13,30 @@
"format": "(gitzone format)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.11.7",
"tslint": "^5.11.0",
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.54",
"@pushrocks/tapbundle": "^3.2.14",
"@types/node": "^16.4.13",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@types/mime-types": "^2.1.0",
"mime-types": "^2.1.26"
"mime-types": "^2.1.32"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_web/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"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/)
## 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)
[![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)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartmime/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartmime/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartmime)](https://lossless.cloud)
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

View File

@ -25,6 +25,21 @@ tap.test('should detect json', async () => {
tap.test('should detect html', async () => {
const filePath = 'file.html';
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);
});

View File

@ -1,19 +1,8 @@
import * as plugins from './smartmime.plugins';
export const binaryFileTypes = [
'jpg',
'png',
'pdf'
];
export const binaryFileTypes = ['jpg', 'png', 'pdf'];
export const supportedFileTypes = [
'json',
'html',
'svg',
'jpg',
'ts',
'js',
];
export const supportedFileTypes = ['json', 'html', 'svg', 'jpg', 'ts', 'js'];
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}`);
}
return isBinary;
}
};
export const getEncoding = (pathArg: string) => {
return isBinary(pathArg) ? 'binary' : 'utf8';
}
};

View File

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