Skip to content

Commit ad2e267

Browse files
committed
build: 2.0.0
1 parent e56123f commit ad2e267

File tree

11 files changed

+1062
-53
lines changed

11 files changed

+1062
-53
lines changed

.eslintignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
#IDE
21
.vscode
3-
#
2+
api
43
node_modules
4+
samples
5+
*.md
6+
*.json
7+
LICENSE

.eslintrc.json

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,22 @@
33
"browser": true,
44
"node": true
55
},
6-
"extends": "eslint:recommended",
6+
"extends": ["plugin:prettier/recommended"],
77
"globals": {
88
"Promise": true,
99
"global": true
1010
},
1111
"parserOptions": {
12-
"ecmaVersion": 2017,
12+
"ecmaVersion": 2020,
1313
"sourceType": "module",
1414
"ecmaFeatures": {
1515
"jsx": true
1616
}
1717
},
1818
"rules": {
19-
"indent": ["error", 2, {"SwitchCase":1}],
19+
"indent": ["error", 2, { "SwitchCase": 1 }],
2020
"default-case": "error",
21-
"linebreak-style": [
22-
"error",
23-
"unix"
24-
],
25-
"quotes": [
26-
"error",
27-
"double"
28-
],
29-
"semi": [
30-
"error",
31-
"always"
32-
]
21+
"linebreak-style": ["error", "unix"],
22+
"semi": ["error", "always"]
3323
}
34-
}
24+
}

.gitignore

100644100755
File mode changed.

.prettierignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
.all-contributorsrc
3+
.eslintignore
4+
.gitignore
5+
.prettierignore
6+
LICENSE
7+
*.png
8+
*.txt
9+
TODO
10+
docs/functions.md
11+
*.md
12+
.DS_Store

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"useTabs": false,
5+
"tabWidth": 2,
6+
"semi": true,
7+
"bracketSpacing": true,
8+
"trailingComma": "none",
9+
"arrowParens": "avoid"
10+
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 Coderty S.L.
3+
Copyright (c) 2020 Runnerty Tech S.L
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,43 @@
1-
# Wait executor for [Runnerty]:
1+
<p align="center">
2+
<a href="http://runnerty.io">
3+
<img height="257" src="https://runnerty.io/assets/header/logo-stroked.png">
4+
</a>
5+
<p align="center">Smart Processes Management</p>
6+
</p>
7+
8+
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url]
9+
<a href="#badge">
10+
<img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg">
11+
</a>
212

3-
### Configuration sample:
13+
# Wait executor for [Runnerty]:
14+
Module for the creation of waiting processes.
15+
### Installation:
16+
```bash
17+
npm i @runnerty/executor-wait
18+
```
19+
### Configuration:
20+
Add in [config.json]:
421
```json
522
{
623
"id": "wait_default",
724
"type": "@runnerty-executor-wait",
8-
"seconds":60
25+
"time": "1 min"
926
}
1027
```
11-
12-
### Plan sample:
28+
### Plan:
29+
Add in [plan.json]:
1330
```json
1431
{
15-
"id":"wait_default",
16-
"seconds":30
32+
"id": "wait_default",
33+
"time": "30s"
1734
}
1835
```
1936

20-
2137
[Runnerty]: http://www.runnerty.io
38+
[downloads-image]: https://img.shields.io/npm/dm/@runnerty/executor-wait.svg
39+
[npm-url]: https://www.npmjs.com/package/@runnerty/executor-wait
40+
[npm-image]: https://img.shields.io/npm/v/@runnerty/executor-wait.svg
41+
[config.json]: http://docs.runnerty.io/config/
42+
[plan.json]: http://docs.runnerty.io/plan/
43+

index.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
1-
"use strict";
1+
'use strict';
22

3-
var Execution = global.ExecutionClass;
3+
const ms = require('ms');
4+
5+
const Execution = global.ExecutionClass;
46

57
class waitExecutor extends Execution {
68
constructor(process) {
79
super(process);
810
}
911

1012
exec(params) {
11-
var _this = this;
12-
var seconds = params.seconds || 60;
13+
// Backward compatibility with version 1:
14+
if (params.seconds && !params.time) {
15+
params.time = `${params.seconds}`;
16+
}
17+
// 60s default value:
18+
if (!params.seconds && !params.time) {
19+
params.time = `60s`;
20+
}
1321

14-
setTimeout(function () {
15-
_this.end();
16-
}, seconds * 1000 || 0);
22+
setTimeout(() => {
23+
this.end();
24+
}, ms(params.time) || 0);
1725
}
1826
}
1927

20-
module.exports = waitExecutor;
28+
module.exports = waitExecutor;

0 commit comments

Comments
 (0)