Skip to content

Commit b0e87b8

Browse files
author
Daniil Ryazanov
authored
Merge pull request #219 from keindev/dev
build: release v3.0.0
2 parents fb27891 + d035002 commit b0e87b8

30 files changed

+2325
-2267
lines changed

.dependabot/config.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 1
2+
update_configs:
3+
- package_manager: 'javascript'
4+
directory: '/'
5+
update_schedule: 'daily'
6+
target_branch: 'dev'
7+
default_assignees:
8+
- keindev
9+
default_labels:
10+
- dependencies

.eslintrc

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
"commonjs": true
66
},
77
"parser": "@typescript-eslint/parser",
8-
"parserOptions": {
9-
"project": "./tsconfig.eslint.json"
10-
},
118
"extends": [
129
"airbnb-base",
1310
"plugin:@typescript-eslint/recommended",
@@ -18,23 +15,16 @@
1815
"plugins": ["@typescript-eslint", "jest"],
1916
"rules": {
2017
"@typescript-eslint/member-ordering": "error",
18+
"@typescript-eslint/interface-name-prefix": ["error", { "prefixWithI": "always" }],
19+
"max-lines-per-function": ["error", { "max": 40 }],
2120
"import/prefer-default-export": 0,
22-
"max-len": [
23-
"error",
24-
{
25-
"code": 120
26-
}
27-
],
21+
"import/extensions": 0,
22+
"max-len": ["error", { "code": 120 }],
2823
"indent": ["error", 4, { "SwitchCase": 1 }],
2924
"lines-between-class-members": 0,
3025
"no-bitwise": 0,
3126
"no-plusplus": 0,
32-
"no-underscore-dangle": [
33-
"error",
34-
{
35-
"allowAfterThis": true
36-
}
37-
],
27+
"no-underscore-dangle": ["error", { "allowAfterThis": true }],
3828
"padding-line-between-statements": [
3929
"error",
4030
{ "blankLine": "always", "prev": "*", "next": "return" },
@@ -44,11 +34,19 @@
4434
{ "blankLine": "any", "prev": "if", "next": "if" }
4535
]
4636
},
37+
"overrides": [
38+
{
39+
"files": "*.test.ts",
40+
"rules": {
41+
"max-lines-per-function": ["error", { "max": 200 }]
42+
}
43+
}
44+
],
4745
"settings": {
4846
"import/resolver": {
4947
"node": {
50-
"paths": ["src", "test"],
51-
"extensions": [".js", ".jsx", ".ts", ".tsx"]
48+
"paths": ["src"],
49+
"extensions": [".ts", ".d.ts", ".js"]
5250
}
5351
}
5452
}

.ghinfo

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "tasktree-cli",
3+
"version": "3.0.0",
4+
"description": "Simple terminal task tree - helps you keep track of your tasks in a tree structure.",
5+
"keywords": [
6+
"cli",
7+
"task",
8+
"tree",
9+
"terminal",
10+
"term",
11+
"console",
12+
"ascii",
13+
"loading",
14+
"indicator",
15+
"progress",
16+
"busy",
17+
"wait",
18+
"idle"
19+
],
20+
"repo": "keindev/tasktree",
21+
"type": "utils",
22+
"links": {
23+
"git": "https://github.com/keindev/tasktree",
24+
"npm": "https://www.npmjs.com/package/tasktree-cli",
25+
"homepage": "https://github.com/keindev/tasktree#readme"
26+
},
27+
"files": {
28+
"demo": "media/demo.gif",
29+
"logo": "media/logo.svg",
30+
"social-preview": "media/social-preview.png"
31+
}
32+
}

.huskyrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"hooks": {
3-
"pre-commit": "npm-run-all clean test",
4-
"commit-msg": "changelog lint --message HUSKY_GIT_PARAMS --lowercase-only"
3+
"pre-commit": "yarn util:pre-commit",
4+
"commit-msg": "yarn util:commit-msg"
55
}
66
}

.npmignore

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Src folders
2-
test/
1+
2+
# folders
3+
**/__mocks__/**
4+
**/__tests__/**
5+
node_modules/
36
coverage/
47
media/
58
src/
69
docs/
710

8-
# Dependency directories
9-
node_modules/
10-
11-
# Configs
11+
# configs
1212
.github
1313
.vscode
1414
.env
@@ -22,14 +22,16 @@ node_modules/
2222
.travis.yml
2323
.yarnclean
2424
.changelogrc.yml
25+
.ghinfo
26+
.dependabot
2527
jest.config.js
2628
tsconfig.json
2729
yarn.lock
2830

29-
# Docs
31+
# docs
3032
README.md
3133
CHANGELOG.md
3234
CODE_OF_CONDUCT.md
3335

34-
# Yarn logs
36+
# logs
3537
yarn-error.log

.travis.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
language: node_js
2-
sudo: false
32
node_js:
43
- 12
5-
- 10
64
os:
75
- linux
86
- osx
7+
- windows
8+
env:
9+
- YARN_GPG=no
910
cache: yarn
1011
install: yarn
1112
script:
@@ -17,14 +18,15 @@ jobs:
1718
include:
1819
- stage: npm release
1920
if: tag IS present
20-
node_js: 10
21+
node_js: 12
2122
os: linux
2223
script: yarn build
2324
deploy:
2425
provider: npm
2526
email: $NPM_EMAIL
26-
api_key: $NPM_TOKEN
27-
skip_cleanup: true
27+
api_token: $NPM_TOKEN
28+
cleanup: false
29+
edge: true
2830
on:
2931
tags: true
3032
notifications:

example/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { TaskTree } = require('../lib/tasktree');
1+
const { TaskTree } = require('../lib/TaskTree');
22
const tree = TaskTree.tree();
33

44
// start task tree log update in terminal

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ module.exports = {
33
testEnvironment: 'node',
44
collectCoverage: true,
55
coverageReporters: ['text-summary', 'json'],
6+
testRegex: '(/__tests__/.*|(\\.|/)(test))\\.(tsx?)$',
7+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
8+
testPathIgnorePatterns: ['/lib/', '/node_modules/'],
69
};
File renamed without changes.

media/social-preview.png

16.9 KB
Loading

package.json

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tasktree-cli",
3-
"version": "2.0.2",
3+
"version": "3.0.0",
44
"description": "Simple terminal task tree - helps you keep track of your tasks in a tree structure.",
55
"homepage": "https://github.com/keindev/tasktree#readme",
66
"license": "MIT",
@@ -20,9 +20,9 @@
2020
"wait",
2121
"idle"
2222
],
23-
"main": "lib/tasktree.js",
24-
"types": "lib/tasktree.d.ts",
25-
"module": "lib/tasktree.js",
23+
"main": "lib/TaskTree.js",
24+
"types": "lib/TaskTree.d.ts",
25+
"module": "lib/TaskTree.js",
2626
"repository": {
2727
"type": "git",
2828
"url": "https://github.com/keindev/tasktree.git"
@@ -31,44 +31,48 @@
3131
"url": "https://github.com/keindev/tasktree/issues"
3232
},
3333
"scripts": {
34-
"clean": "rimraf rmdir lib coverage",
35-
"lint": "eslint src/**/*.ts test/**/*.ts",
36-
"spellcheck": "cspell -c .vscode/cspell.json --no-summary \"*.*\" \"docs/**/*\" \"**/*.ts\" \"**/*.js\"",
37-
"test": "jest",
38-
"changelog": "changelog generate",
34+
"prepare:clean": "rimraf lib coverage",
35+
"check:lint": "eslint src/**/*.ts --fix",
36+
"check:spell": "cspell -c .vscode/cspell.json --no-summary \"*.*\" \"**/*.ts\" \"**/*.js\"",
37+
"check:test": "jest",
3938
"build:ts": "tsc",
40-
"build": "npm-run-all clean spellcheck lint build:* test"
39+
"build:ghinfo": "ghinfo generate -d media -t utils",
40+
"build": "npm-run-all prepare:* check:* build:*",
41+
"util:changelog": "changelog generate",
42+
"util:commit-msg": "changelog lint --message HUSKY_GIT_PARAMS --lowercase-only",
43+
"util:pre-commit": "npm-run-all check:*"
4144
},
4245
"engines": {
4346
"node": ">=10.0.0"
4447
},
4548
"dependencies": {
46-
"chalk": "^2.4.2",
49+
"chalk": "^3.0.0",
4750
"color-convert": "^2.0.1",
4851
"elegant-spinner": "^2.0.0",
49-
"figures": "^3.0.0",
50-
"stdout-update": "^1.3.7"
52+
"figures": "^3.1.0",
53+
"stdout-update": "^1.4.1"
5154
},
5255
"devDependencies": {
5356
"@types/color-convert": "^1.9.0",
54-
"@types/jest": "^24.0.18",
55-
"@types/node": "^12.7.4",
56-
"@typescript-eslint/eslint-plugin": "^2.1.0",
57-
"@typescript-eslint/parser": "^2.1.0",
57+
"@types/jest": "^25.1.0",
58+
"@types/node": "^13.5.1",
59+
"@typescript-eslint/eslint-plugin": "^2.18.0",
60+
"@typescript-eslint/parser": "^2.18.0",
5861
"changelog-guru": "^1.0.0",
59-
"cspell": "^4.0.30",
60-
"eslint": "^6.3.0",
62+
"cspell": "^4.0.46",
63+
"eslint": "^6.8.0",
6164
"eslint-config-airbnb-base": "^14.0.0",
62-
"eslint-config-prettier": "^6.2.0",
63-
"eslint-plugin-import": "^2.18.2",
64-
"eslint-plugin-jest": "^22.17.0",
65-
"husky": "^3.0.5",
66-
"jest": "^24.9.0",
65+
"eslint-config-prettier": "^6.10.0",
66+
"eslint-plugin-import": "^2.20.0",
67+
"eslint-plugin-jest": "^23.6.0",
68+
"ghinfo": "^1.0.6",
69+
"husky": "^4.2.1",
70+
"jest": "^25.1.0",
6771
"npm-run-all": "^4.1.5",
68-
"prettier": "^1.18.2",
69-
"rimraf": "^3.0.0",
70-
"strip-ansi": "^5.2.0",
71-
"ts-jest": "^24.0.2",
72-
"typescript": "^3.6.2"
72+
"prettier": "^1.19.1",
73+
"rimraf": "^3.0.1",
74+
"strip-ansi": "^6.0.0",
75+
"ts-jest": "^25.0.0",
76+
"typescript": "^3.7.5"
7377
}
7478
}

src/progress-bar.ts renamed to src/ProgressBar.ts

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Wrapper } from 'stdout-update/lib/wrapper';
22
import * as Figures from 'figures';
3-
import { Theme, IndicationType } from './theme';
4-
import { TaskStatus } from './task';
3+
import { Theme, IndicationType } from './Theme';
4+
import { TaskStatus } from './Task';
55

66
export enum Progress {
77
Default = -1,
@@ -26,7 +26,7 @@ export enum TemplateToken {
2626
Rate = ':rate',
2727
}
2828

29-
export interface ProgressBarOptions {
29+
export interface IProgressBarOptions {
3030
// current completed index
3131
current?: number;
3232
// total number of ticks to complete
@@ -45,7 +45,7 @@ export interface ProgressBarOptions {
4545
gradient?: boolean;
4646
}
4747

48-
export interface ProgressBarToken {
48+
export interface IProgressBarToken {
4949
[key: string]: string;
5050
}
5151

@@ -74,7 +74,7 @@ export class ProgressBar {
7474
private status = TaskStatus.Pending;
7575
private tokens: Map<TemplateToken | string, string> = new Map();
7676

77-
public constructor(template?: string, options?: ProgressBarOptions) {
77+
public constructor(template?: string, options?: IProgressBarOptions) {
7878
this.template =
7979
template ||
8080
Theme.join(
@@ -130,7 +130,7 @@ export class ProgressBar {
130130
return this.current >= this.total || !!this.end;
131131
}
132132

133-
public tick(step?: number, tokens?: ProgressBarToken): ProgressBar {
133+
public tick(step?: number, tokens?: IProgressBarToken): ProgressBar {
134134
this.current = Math.min(this.total, this.current + (step || ProgressBar.TICK));
135135
this.tokens = typeof tokens === 'object' ? new Map(Object.entries(tokens)) : new Map();
136136

@@ -162,17 +162,6 @@ export class ProgressBar {
162162
public render(theme: Theme): string {
163163
const length = Math.round(this.width * this.getRatio());
164164
const type = Theme.type(this.status);
165-
let blocks = Wrapper.EMPTY.padStart(length, this.completeBlock);
166-
167-
if (!this.isCompleted() && this.gradient) {
168-
blocks = theme.gradient(blocks, {
169-
position: this.getRatio(),
170-
begin: Theme.type(this.status),
171-
end: IndicationType.Success,
172-
});
173-
} else {
174-
blocks = theme.paint(blocks, type);
175-
}
176165

177166
let result = this.template
178167
.replace(TemplateToken.Current, this.current.toString())
@@ -191,7 +180,7 @@ export class ProgressBar {
191180
TemplateToken.Bar,
192181
Theme.join(
193182
Wrapper.EMPTY,
194-
blocks,
183+
this.getBlocks(theme, type, length),
195184
theme.paint(
196185
Wrapper.EMPTY.padStart(this.width - length, this.incompleteBlock),
197186
IndicationType.Subtask
@@ -205,4 +194,20 @@ export class ProgressBar {
205194

206195
return this.badges ? Theme.join(Wrapper.SPACE, result, theme.badge(type)) : result;
207196
}
197+
198+
private getBlocks(theme: Theme, type: IndicationType, length: number): string {
199+
let blocks = Wrapper.EMPTY.padStart(length, this.completeBlock);
200+
201+
if (!this.isCompleted() && this.gradient) {
202+
blocks = theme.gradient(blocks, {
203+
position: this.getRatio(),
204+
begin: Theme.type(this.status),
205+
end: IndicationType.Success,
206+
});
207+
} else {
208+
blocks = theme.paint(blocks, type);
209+
}
210+
211+
return blocks;
212+
}
208213
}

0 commit comments

Comments
 (0)