install-task.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.dev/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. exports.NodePackageInstallTask = void 0;
  11. const options_1 = require("./options");
  12. class NodePackageInstallTask {
  13. quiet = true;
  14. hideOutput = true;
  15. allowScripts = false;
  16. workingDirectory;
  17. packageManager;
  18. packageName;
  19. constructor(options) {
  20. if (typeof options === 'string') {
  21. this.workingDirectory = options;
  22. }
  23. else if (typeof options === 'object') {
  24. if (options.quiet != undefined) {
  25. this.quiet = options.quiet;
  26. }
  27. if (options.hideOutput != undefined) {
  28. this.hideOutput = options.hideOutput;
  29. }
  30. if (options.workingDirectory != undefined) {
  31. this.workingDirectory = options.workingDirectory;
  32. }
  33. if (options.packageManager != undefined) {
  34. this.packageManager = options.packageManager;
  35. }
  36. if (options.packageName != undefined) {
  37. this.packageName = options.packageName;
  38. }
  39. if (options.allowScripts !== undefined) {
  40. this.allowScripts = options.allowScripts;
  41. }
  42. }
  43. }
  44. toConfiguration() {
  45. return {
  46. name: options_1.NodePackageName,
  47. options: {
  48. command: 'install',
  49. quiet: this.quiet,
  50. hideOutput: this.hideOutput,
  51. workingDirectory: this.workingDirectory,
  52. packageManager: this.packageManager,
  53. packageName: this.packageName,
  54. allowScripts: this.allowScripts,
  55. },
  56. };
  57. }
  58. }
  59. exports.NodePackageInstallTask = NodePackageInstallTask;