@outliant/sunrise-utils 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc +53 -0
  3. package/.github/workflows/pr-dev-workflow.yml +16 -0
  4. package/.nvmrc +1 -0
  5. package/.release-it.js +26 -0
  6. package/.vscode/launch.json +24 -0
  7. package/.vscode/settings.json +7 -0
  8. package/CHANGELOG.md +12 -0
  9. package/README.md +19 -0
  10. package/changelog.hbs +13 -0
  11. package/helpers/es.js +6 -0
  12. package/helpers/projectFilter/projectFieldFilter.js +587 -0
  13. package/helpers/searchFilter.js +86 -0
  14. package/helpers/taskFilter/criticalPathFilter.js +144 -0
  15. package/helpers/taskFilter/index.js +228 -0
  16. package/helpers/taskFilter/onHoldFilter.js +101 -0
  17. package/helpers/taskFilter/ownerFilter.js +148 -0
  18. package/helpers/taskFilter/pathAgeFilter.js +18 -0
  19. package/helpers/taskFilter/regionFilter.js +82 -0
  20. package/helpers/taskFilter/statusFilter.js +177 -0
  21. package/helpers/taskFilter/taskFieldFilter.js +309 -0
  22. package/helpers/taskSortScript.js +356 -0
  23. package/index.d.ts +11 -0
  24. package/index.js +9 -0
  25. package/lib/fieldConditions.js +166 -0
  26. package/lib/logger.js +48 -0
  27. package/lib/taskPipeline.js +137 -0
  28. package/package.json +73 -0
  29. package/test/helpers/projectFilter/projectFieldFilter.spec.js +881 -0
  30. package/test/helpers/taskFilter/criticalPathFilter.spec.js +174 -0
  31. package/test/helpers/taskFilter/index.spec.js +339 -0
  32. package/test/helpers/taskFilter/onHoldFilter.spec.js +112 -0
  33. package/test/helpers/taskFilter/ownerFilter.spec.js +226 -0
  34. package/test/helpers/taskFilter/pathAgeFilter.spec.js +47 -0
  35. package/test/helpers/taskFilter/regionFilter.spec.js +131 -0
  36. package/test/helpers/taskFilter/statusFilter.spec.js +197 -0
  37. package/test/helpers/taskFilter/taskFieldFilter.spec.js +355 -0
  38. package/test/lib/fieldConditions.spec.js +17 -0
  39. package/test/lib/logger.spec.js +117 -0
  40. package/test/lib/taskPipeline.spec.js +162 -0
package/.eslintignore ADDED
@@ -0,0 +1,5 @@
1
+ # Dependency directories
2
+ node_modules/
3
+
4
+ # Output directory for project builds
5
+ dist
package/.eslintrc ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "env": {
3
+ "es6": true,
4
+ "node": true,
5
+ "mocha": true
6
+ },
7
+ "extends": ["prettier"],
8
+ "plugins": ["promise"],
9
+ "rules": {
10
+ "no-console": "off",
11
+ "import/no-dynamic-require": "off",
12
+ "func-names": "off",
13
+ "global-require": "off",
14
+ "consistent-return": "off",
15
+ "no-restricted-syntax": "off",
16
+ "no-await-in-loop": "off",
17
+ "no-underscore-dangle": "off",
18
+ "no-param-reassign": "off",
19
+ "no-plusplus": "off",
20
+ "new-cap": "off",
21
+ "prefer-destructuring": "off",
22
+ "camelcase": "off",
23
+ "no-continue": "off",
24
+ "no-unsafe-finally": "off",
25
+ "radix": "off",
26
+ "no-useless-escape": "off",
27
+ "no-nested-ternary": "off",
28
+ "no-unused-expressions": "off",
29
+ "no-sequences": "off",
30
+ "no-use-before-define": "off",
31
+ "no-extra-boolean-cast": "off",
32
+ "no-loop-func": "off",
33
+ "no-lonely-if": "off",
34
+ "no-return-await": "off",
35
+ "no-prototype-builtins": "off",
36
+ "prefer-template": "off",
37
+ "no-case-declarations": "off",
38
+ "no-return-assign": "off",
39
+ "eqeqeq": "off",
40
+ "prefer-const": "off",
41
+ "no-multi-assign": "off",
42
+ "import/no-extraneous-dependencies": "off",
43
+ "no-shadow": "off",
44
+ "no-else-return": "off",
45
+ "no-restricted-globals": "off"
46
+ },
47
+ "parser": "@babel/eslint-parser",
48
+ "parserOptions": {
49
+ "requireConfigFile": false,
50
+ "ecmaVersion": 6,
51
+ "ecmaFeatures": {}
52
+ }
53
+ }
@@ -0,0 +1,16 @@
1
+ name: Linting And Unit Testing
2
+ on:
3
+ pull_request:
4
+ branches: [develop]
5
+ jobs:
6
+ lint-test:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Use Node.js
11
+ uses: actions/setup-node@v1
12
+ with:
13
+ node-version: '12.x'
14
+ - run: npm ci
15
+ - run: npm run lint
16
+ - run: npm run test
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 16.14
package/.release-it.js ADDED
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ hooks: {
3
+ 'after:bump': ['npx auto-changelog -p'],
4
+ 'after:git:release': ['']
5
+ },
6
+ git: {
7
+ requireBranch: 'main',
8
+ commit: true,
9
+ commitMessage: 'chore(release): ${version}',
10
+ commitArgs: '',
11
+ tag: true,
12
+ tagName: '${version}',
13
+ tagAnnotation: '${version}',
14
+ push: true,
15
+ requireCommits: true,
16
+ changelog:
17
+ 'npx auto-changelog --stdout --commit-limit false -u --template ./changelog.hbs'
18
+ },
19
+ github: {
20
+ release: false,
21
+ releaseName: '${version}'
22
+ },
23
+ npm: {
24
+ publish: true
25
+ }
26
+ };
@@ -0,0 +1,24 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Debug Mocha Tests",
9
+ "type": "node",
10
+ "request": "launch",
11
+ "program": "${workspaceRoot}/node_modules/.bin/_mocha",
12
+ "args": [
13
+ "--exit",
14
+ "-t",
15
+ "8800000",
16
+ "--recursive",
17
+ "${workspaceRoot}/test/**/*.spec.js",
18
+ "--colors"
19
+ ],
20
+ "cwd": "${workspaceRoot}",
21
+ "protocol": "inspector"
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.codeActionsOnSave": {
4
+ "source.fixAll.eslint": true,
5
+ "source.organizeImports": false
6
+ }
7
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ ### Changelog
2
+
3
+ All notable changes to this project will be documented in this file. Dates are displayed in UTC.
4
+
5
+ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
+
7
+ #### 1.0.0
8
+
9
+ - chore: task pipeline fixes #860pt9g1t [`#860`](https://github.com/outliant/sunrise-utils/issues/860)
10
+ - chore: initial setup [`4e2206c`](https://github.com/outliant/sunrise-utils/commit/4e2206c5a002629fca7b608ed9cf6c60f3e6be37)
11
+ - chore: task pipeline filter query and sorting script #860pt9g1t [`3bae8e1`](https://github.com/outliant/sunrise-utils/commit/3bae8e1aa6e02e6734ebaa6cdb3d822a7992aa21)
12
+ - chore: added logger unit test [`bdc7535`](https://github.com/outliant/sunrise-utils/commit/bdc7535224d3ab0b95002f7c41b3b61abc2054ac)
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Sunrise Utils
2
+
3
+ A Node.js package that contains code which is commonly used Project Sunrise
4
+
5
+ You have the following utils available:
6
+
7
+ - `log`: Custom logging for sunrise projects
8
+ - `fieldConditions`: Returns an array for sunrise column filters
9
+ - `taskPipeline`: Class for task pipeline reusable codes
10
+ - `taskStatusOptions`: Array of task status column options
11
+ - `defaultCustomColumns`: Array of task pipeline custom columns
12
+ - `buildFiltersQuery()`: Function to build task pipeline filter ES query
13
+ - `buildSortScript()`: Function to build task pipeline sort script
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm i @outliant/sunrise-utils
19
+ ```
package/changelog.hbs ADDED
@@ -0,0 +1,13 @@
1
+ {{#each releases}}
2
+ {{#if @first}}
3
+ {{#each merges}}
4
+ - {{{message}}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}
5
+ {{/each}}
6
+ {{#each fixes}}
7
+ - {{{commit.subject}}}{{#each fixes}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}{{/each}}
8
+ {{/each}}
9
+ {{#each commits}}
10
+ - {{#if breaking}}**Breaking change:** {{/if}}{{{subject}}}{{#if href}} [`{{shorthash}}`]({{href}}){{/if}}
11
+ {{/each}}
12
+ {{/if}}
13
+ {{/each}}
package/helpers/es.js ADDED
@@ -0,0 +1,6 @@
1
+ module.exports.escapeElasticQuery = (query) => {
2
+ return query.replace(
3
+ /(\+|\=|&&|\|\||\>|\<|\!|\(|\)|\{|\}|\[|\]|\^|'|~|\*|\?|\:|\\|\/)/g,
4
+ '\\$&'
5
+ );
6
+ };