Compare commits

..

No commits in common. "main" and "52898734ab35e6fa6f7c4d1404b5fec769b0c19e" have entirely different histories.

11 changed files with 33 additions and 180 deletions

View File

@ -1,15 +0,0 @@
kind: pipeline
type: docker
name: ci
steps:
- name: test
image: node
environment:
DOCKER_REGISTRY:
from_secret: docker_registry
commands:
- echo $DOCKER_REGISTRY
- yarn
- yarn
- yarn test

20
.vscode/launch.json vendored
View File

@ -1,20 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${relativeFile}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
}
}
]
}

View File

@ -1,7 +1,4 @@
# CUBETIQ TypeScript Utils
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![Build Status](https://dci.osa.cubetiqs.com/api/badges/CUBETIQ/cubetiq-ts-utils/status.svg)](https://dci.osa.cubetiqs.com/CUBETIQ/cubetiq-ts-utils)
- Function Utils
- General Functions for TypeScript project(s)
- Extends more

View File

@ -1,6 +0,0 @@
module.exports = {
transform: { '^.+\\.ts?$': 'ts-jest' },
testEnvironment: 'node',
testRegex: '/tests/.*\\.(test|spec)?\\.(ts|tsx)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
};

View File

@ -1,42 +1,25 @@
{
"name": "@cubetiq/tsutil",
"version": "1.0.0",
"description": "CUBETIQ TypeScript Utils",
"main": "dist/index.js.umd.js",
"module": "dist/index.es5.js",
"typings": "dist/types/index.d.ts",
"files": [
"dist"
],
"repository": "https://github.com/CUBETIQ/cubetiq-ts-utils.git",
"author": "Sambo Chea <sombochea@cubetiqs.com>",
"license": "MIT",
"private": false,
"dependencies": {},
"devDependencies": {
"@types/jest": "^26.0.20",
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"eslint": "^7.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3",
"lodash.camelcase": "^4.3.0",
"prettier": "^2.2.1",
"rollup": "^2.41.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^26.5.3",
"typescript": "^4.2.3"
},
"scripts": {
"build": "tsc --module commonjs && rollup -c rollup.config.ts",
"lint": "eslint . --ext .ts",
"prettier": "prettier --config .prettierrc 'src/**/*.ts' --write",
"test": "jest",
"coverage": "jest --coverage"
}
"name": "cubetiq-ts-utils",
"version": "1.0.0",
"description": "CUBETIQ TypeScript Utils",
"main": "index.ts",
"repository": "https://github.com/CUBETIQ/cubetiq-ts-utils.git",
"author": "Sambo Chea",
"license": "MIT",
"private": false,
"dependencies": {},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"eslint": "^7.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"prettier": "^2.2.1",
"typescript": "^4.2.3"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"lint": "eslint . --ext .ts",
"prettier": "prettier --config .prettierrc 'src/**/*.ts' --write"
}
}

View File

@ -1,28 +0,0 @@
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import sourceMaps from 'rollup-plugin-sourcemaps'
import camelCase from 'lodash.camelcase'
import typescript from 'rollup-plugin-typescript2'
import json from 'rollup-plugin-json'
const pkg = require('./package.json')
const libraryName = 'tsutil'
export default {
input: `src/index.ts`,
output: [
{ file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
],
external: [],
watch: {
include: 'src/**',
},
plugins: [
json(),
typescript({ useTsconfigDeclarationDir: true }),
commonjs(),
resolve(),
sourceMaps(),
],
}

View File

@ -1 +1,5 @@
export * as Log from './log/index'
const Index = (): void => {
console.log('Index', 'Hello, you are init the default function!');
};
export default Index;

View File

@ -1,31 +0,0 @@
import { Loggable } from './interfaces';
class Log {
static log(loggable: Loggable): void {
switch (loggable.type) {
case 'error':
this.error(loggable.from, loggable.data);
break;
case 'warn':
this.warn(loggable.from, loggable.data);
break;
default:
this.info(loggable.from, loggable.data);
break;
}
}
static info(...data: any[]): void {
console.log(data);
}
static error(...data: any[]): void {
console.error(data);
}
static warn(...data: any[]): void {
console.warn(data);
}
}
export default Log;

View File

@ -1,7 +0,0 @@
export type LogType = 'info' | 'error' | 'warn';
export interface Loggable {
type: LogType;
from?: string;
data?: any;
}

View File

@ -1,23 +0,0 @@
import Log from '../src/log'
describe('logging into console', function () {
it('info', function () {
Log.info('I am an info!');
});
it('warn', function () {
Log.info('I am a warn!');
});
it('error', function () {
Log.info('I am an error!');
});
it('loggable', function () {
Log.log({
type: 'info',
from: 'log.test.ts',
data: 'I am loggable called'
});
});
});

View File

@ -8,15 +8,14 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"declaration": true,
"outDir": "dist/lib",
"rootDir": "src",
"lib": ["es2015", "es2016", "es2017", "dom"]
"outDir": "dist",
"rootDir": "src"
},
"include": ["src"],
"exclude": ["node_modules"]
"include": ["src/**/*"]
}