@vamship/build-utils 1.6.1 → 2.0.0-1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/package.json +40 -40
  2. package/src/directory.js +20 -24
  3. package/src/index.js +5 -17
  4. package/src/project.js +160 -433
  5. package/src/schema/project-definition.js +137 -0
  6. package/src/task-builder.js +100 -0
  7. package/src/task-builders/build-js-task-builder.js +57 -0
  8. package/src/task-builders/build-task-builder.js +78 -0
  9. package/src/task-builders/build-ts-task-builder.js +63 -0
  10. package/src/task-builders/build-ui-task-builder.js +45 -0
  11. package/src/task-builders/clean-task-builder.js +39 -0
  12. package/src/task-builders/copy-files-task-builder.js +78 -0
  13. package/src/task-builders/docs-js-task-builder.js +74 -0
  14. package/src/task-builders/docs-task-builder.js +74 -0
  15. package/src/task-builders/docs-ts-task-builder.js +52 -0
  16. package/src/task-builders/format-task-builder.js +61 -0
  17. package/src/task-builders/index.js +21 -17
  18. package/src/task-builders/lint-fix-task-builder.js +61 -0
  19. package/src/task-builders/lint-task-builder.js +56 -0
  20. package/src/task-builders/not-supported-task-builder.js +48 -0
  21. package/src/task-builders/package-aws-task-builder.js +105 -0
  22. package/src/task-builders/package-container-task-builder.js +132 -0
  23. package/src/task-builders/package-npm-task-builder.js +83 -0
  24. package/src/task-builders/package-task-builder.js +101 -0
  25. package/src/task-builders/publish-aws-task-builder.js +111 -0
  26. package/src/task-builders/publish-container-task-builder.js +103 -0
  27. package/src/task-builders/publish-npm-task-builder.js +60 -0
  28. package/src/task-builders/publish-task-builder.js +98 -0
  29. package/src/task-builders/test-task-builder.js +85 -0
  30. package/src/task-builders/test-ui-task-builder.js +65 -0
  31. package/src/task-builders/watch-task-builder.js +109 -0
  32. package/src/task-factories/api-task-factory.js +67 -0
  33. package/src/task-factories/aws-microservice-task-factory.js +53 -0
  34. package/src/task-factories/cli-task-factory.js +68 -0
  35. package/src/task-factories/container-task-factory.js +64 -0
  36. package/src/task-factories/index.js +8 -0
  37. package/src/task-factories/lib-task-factory.js +52 -0
  38. package/src/task-factories/ui-task-factory.js +48 -0
  39. package/src/task-factory.js +52 -0
  40. package/src/utils/semver-utils.js +29 -0
  41. package/src/utils/task-factory-utils.js +70 -0
  42. package/src/task-builders/build/build-js.js +0 -66
  43. package/src/task-builders/build/build-ts.js +0 -70
  44. package/src/task-builders/build/build-types.js +0 -47
  45. package/src/task-builders/build/build-ui.js +0 -67
  46. package/src/task-builders/build/index.js +0 -60
  47. package/src/task-builders/clean.js +0 -57
  48. package/src/task-builders/docs/docs-js.js +0 -41
  49. package/src/task-builders/docs/docs-ts.js +0 -40
  50. package/src/task-builders/docs/index.js +0 -32
  51. package/src/task-builders/format.js +0 -58
  52. package/src/task-builders/lint.js +0 -56
  53. package/src/task-builders/package/index.js +0 -50
  54. package/src/task-builders/package/package-aws.js +0 -58
  55. package/src/task-builders/package/package-docker.js +0 -128
  56. package/src/task-builders/package/package-npm.js +0 -25
  57. package/src/task-builders/package/package-types.js +0 -54
  58. package/src/task-builders/package/utils.js +0 -50
  59. package/src/task-builders/publish/index.js +0 -50
  60. package/src/task-builders/publish/publish-aws.js +0 -62
  61. package/src/task-builders/publish/publish-docker.js +0 -79
  62. package/src/task-builders/publish/publish-npm.js +0 -36
  63. package/src/task-builders/publish/publish-types.js +0 -36
  64. package/src/task-builders/test/index.js +0 -39
  65. package/src/task-builders/test/test-ui.js +0 -39
  66. package/src/task-builders/test/test.js +0 -67
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- const _gulp = require('gulp');
4
- const _execa = require('execa');
5
-
6
- /**
7
- * Builder function that can be used to generate a gulp task to execute
8
- * instrumented unit/api tests.
9
- *
10
- * @param {Object} project Reference to an object that contains project metadata
11
- * that can be used to customize build outputs.
12
- * @param {Object} options An options object that can be used to customize the
13
- * task.
14
- *
15
- * @returns {Function} A gulp task.
16
- */
17
- module.exports = (project, options) => {
18
- const { testType, watch } = Object.assign(
19
- { testType: 'unit', watch: false },
20
- options
21
- );
22
-
23
- const rootDir = project.jsRootDir;
24
- const jestBin = project.rootDir.getFilePath('node_modules/.bin/jest');
25
- let args = ['--config', 'jest.config.js', '--coverage'];
26
-
27
- if (watch) {
28
- args.push('--watchAll');
29
- const watchTask = () => _execa(jestBin, args, { stdio: 'inherit' });
30
- watchTask.displayName = `watch-test-${testType}`;
31
- watchTask.description = `Automatically execute ${testType} tests on change`;
32
- return watchTask;
33
- }
34
-
35
- const task = () => _execa(jestBin, args, { stdio: 'inherit' });
36
- task.displayName = `test-${testType}`;
37
- task.description = `Execute ${testType} tests`;
38
- return task;
39
- };
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- const _gulp = require('gulp');
4
- const _execa = require('execa');
5
-
6
- /**
7
- * Builder function that can be used to generate a gulp task to execute
8
- * instrumented unit/api tests.
9
- *
10
- * @param {Object} project Reference to an object that contains project metadata
11
- * that can be used to customize build outputs.
12
- * @param {Object} options An options object that can be used to customize the
13
- * task.
14
- *
15
- * @returns {Function} A gulp task.
16
- */
17
- module.exports = (project, options) => {
18
- const { testType, watch } = Object.assign(
19
- { testType: 'unit', watch: false },
20
- options
21
- );
22
-
23
- if (testType === 'api' && project.projectType === 'lib') {
24
- return;
25
- }
26
-
27
- const rootDir = project.jsRootDir;
28
- const mochaBin = project.rootDir.getFilePath('node_modules/.bin/mocha');
29
- const nycBin = project.rootDir.getFilePath('node_modules/.bin/nyc');
30
-
31
- const paths = rootDir.getChild(`test/${testType}`).getAllFilesGlob('js');
32
-
33
- const args = [
34
- '--reporter',
35
- 'text-summary',
36
- '--reporter',
37
- 'html',
38
- '--temp-dir',
39
- rootDir.getFilePath('coverage'),
40
- ];
41
-
42
- if (project.hasTypescript) {
43
- ['--extension', '.ts'].map((arg) => args.push(arg));
44
- }
45
-
46
- [mochaBin, '--color', '-R', 'spec', '--recursive', paths].map((arg) =>
47
- args.push(arg)
48
- );
49
-
50
- const task = () => _execa(nycBin, args, { stdio: 'inherit' });
51
- task.displayName = `test-${testType}`;
52
- task.description = `Execute ${testType} tests`;
53
-
54
- if (watch) {
55
- const watchPaths = ['src', 'test']
56
- .map((dir) => rootDir.getChild(dir))
57
- .map((dir) => dir.getAllFilesGlob('js'));
58
-
59
- const watchTask = () => _gulp.watch(watchPaths, task);
60
- watchTask.displayName = `watch-test-${testType}`;
61
- watchTask.description = `Automatically execute ${testType} tests on change`;
62
-
63
- return watchTask;
64
- }
65
-
66
- return task;
67
- };