@microsoft/generator-sharepoint 1.14.0 → 1.15.0-rc.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 (108) hide show
  1. package/lib/common/BaseGenerator.d.ts +5 -7
  2. package/lib/common/BaseGenerator.d.ts.map +1 -1
  3. package/lib/common/BaseGenerator.js +38 -57
  4. package/lib/common/JsonManager.d.ts +1 -1
  5. package/lib/common/JsonManager.d.ts.map +1 -1
  6. package/lib/common/JsonManager.js +6 -2
  7. package/lib/common/ServeJsonManager.js +6 -2
  8. package/lib/common/YeomanConfiguration.d.ts +2 -0
  9. package/lib/common/YeomanConfiguration.d.ts.map +1 -1
  10. package/lib/common/YeomanConfiguration.js +8 -1
  11. package/lib/common/dependencies.json +228 -0
  12. package/lib/common/spsay.d.ts +1 -1
  13. package/lib/common/spsay.d.ts.map +1 -1
  14. package/lib/common/spsay.js +9 -9
  15. package/lib/common/utilities.d.ts.map +1 -1
  16. package/lib/common/utilities.js +21 -16
  17. package/lib/generators/adaptiveCardExtension/index.d.ts.map +1 -1
  18. package/lib/generators/adaptiveCardExtension/index.js +19 -16
  19. package/lib/generators/adaptiveCardExtension/templates/manifestTemplate/baseTemplate/{componentClassName}.manifest.json +3 -3
  20. package/lib/generators/adaptiveCardExtension/templates/manifestTemplate/imageTemplate/{componentClassName}.manifest.json +1 -2
  21. package/lib/generators/adaptiveCardExtension/templates/none/quickView/QuickView.ts +1 -1
  22. package/lib/generators/app/index.d.ts.map +1 -1
  23. package/lib/generators/app/index.js +13 -3
  24. package/lib/generators/applicationCustomizer/index.d.ts.map +1 -1
  25. package/lib/generators/applicationCustomizer/index.js +10 -7
  26. package/lib/generators/applicationCustomizer/templates/none/{componentClassName}.ts +3 -1
  27. package/lib/generators/commandSet/index.d.ts.map +1 -1
  28. package/lib/generators/commandSet/index.js +10 -7
  29. package/lib/generators/commandSet/templates/none/{componentClassName}.ts +27 -13
  30. package/lib/generators/component/BaseComponentGenerator.d.ts +3 -0
  31. package/lib/generators/component/BaseComponentGenerator.d.ts.map +1 -1
  32. package/lib/generators/component/BaseComponentGenerator.js +94 -76
  33. package/lib/generators/component/index.d.ts.map +1 -1
  34. package/lib/generators/component/index.js +20 -25
  35. package/lib/generators/component/templates/eslint/default.eslintrc.js +5 -0
  36. package/lib/generators/component/templates/eslint/react.eslintrc.js +5 -0
  37. package/lib/generators/extension/BaseExtensionGenerator.d.ts +2 -2
  38. package/lib/generators/extension/BaseExtensionGenerator.d.ts.map +1 -1
  39. package/lib/generators/extension/BaseExtensionGenerator.js +14 -8
  40. package/lib/generators/extension/index.d.ts +2 -1
  41. package/lib/generators/extension/index.d.ts.map +1 -1
  42. package/lib/generators/extension/index.js +24 -15
  43. package/lib/generators/fieldCustomizer/index.d.ts.map +1 -1
  44. package/lib/generators/fieldCustomizer/index.js +10 -7
  45. package/lib/generators/fieldCustomizer/templates/minimal/{componentClassName}.module.scss +1 -1
  46. package/lib/generators/fieldCustomizer/templates/minimal/{componentClassName}.ts +1 -1
  47. package/lib/generators/fieldCustomizer/templates/none/{componentClassName}.module.scss +1 -1
  48. package/lib/generators/fieldCustomizer/templates/none/{componentClassName}.ts +1 -1
  49. package/lib/generators/fieldCustomizer/templates/react/components/{componentName}.module.scss +1 -1
  50. package/lib/generators/fieldCustomizer/templates/react/components/{componentName}.tsx +1 -1
  51. package/lib/generators/formCustomizer/index.d.ts +24 -0
  52. package/lib/generators/formCustomizer/index.d.ts.map +1 -0
  53. package/lib/generators/formCustomizer/index.js +142 -0
  54. package/lib/generators/formCustomizer/templates/base/{componentClassName}.manifest.json +17 -0
  55. package/lib/generators/formCustomizer/templates/loc/en-us.js +7 -0
  56. package/lib/generators/formCustomizer/templates/loc/myStrings.d.ts +10 -0
  57. package/lib/generators/formCustomizer/templates/none/{componentClassName}.module.scss +5 -0
  58. package/lib/generators/formCustomizer/templates/none/{componentClassName}.ts +53 -0
  59. package/lib/generators/formCustomizer/templates/react/components/{componentName}.module.scss +5 -0
  60. package/lib/generators/formCustomizer/templates/react/components/{componentName}.tsx +28 -0
  61. package/lib/generators/formCustomizer/templates/react/{componentClassName}.ts +64 -0
  62. package/lib/generators/library/index.d.ts.map +1 -1
  63. package/lib/generators/library/index.js +10 -7
  64. package/lib/generators/searchQueryModifier/index.d.ts.map +1 -1
  65. package/lib/generators/searchQueryModifier/index.js +10 -7
  66. package/lib/generators/solution/heft.package.json +14 -0
  67. package/lib/generators/solution/index.d.ts +1 -0
  68. package/lib/generators/solution/index.d.ts.map +1 -1
  69. package/lib/generators/solution/index.js +102 -68
  70. package/lib/generators/solution/{initial.package.json → non-heft.package.json} +0 -0
  71. package/lib/generators/solution/templates/base/README.md +10 -10
  72. package/lib/generators/solution/templates/base/_gitignore +1 -0
  73. package/lib/generators/solution/templates/{base → gulp}/.vscode/launch.json +0 -0
  74. package/lib/generators/solution/templates/{base → gulp}/_npmignore +0 -0
  75. package/lib/generators/solution/templates/{base → gulp}/gulpfile.js +0 -0
  76. package/lib/generators/solution/templates/{base → gulp}/src/index.ts +0 -0
  77. package/lib/generators/solution/templates/heft/_npmignore +16 -0
  78. package/lib/generators/solution/templates/heft/config/rig.json +7 -0
  79. package/lib/generators/solution/templates/heft/config/typescript.json +21 -0
  80. package/lib/generators/solution/templates/heft/tsconfig.json +6 -0
  81. package/lib/generators/solution/templates/spo/tsconfig.json +1 -1
  82. package/lib/generators/webpart/index.d.ts.map +1 -1
  83. package/lib/generators/webpart/index.js +10 -7
  84. package/lib/generators/webpart/initial.teamsManifest.json +6 -0
  85. package/lib/generators/webpart/templates/minimal/{componentClassName}.ts +3 -4
  86. package/lib/generators/webpart/templates/none/{componentClassName}.ts +14 -9
  87. package/lib/generators/webpart/templates/react/components/{componentName}.tsx +8 -8
  88. package/lib/generators/webpart/templates/react/{componentClassName}.ts +12 -9
  89. package/package.json +5 -5
  90. package/lib/common/dependency/adaptiveCardExtension/firstParty.json +0 -13
  91. package/lib/common/dependency/adaptiveCardExtension/firstPartyPlusBeta.json +0 -13
  92. package/lib/common/dependency/applicationCustomizer.json +0 -6
  93. package/lib/common/dependency/applicationCustomizerPlusBeta.json +0 -6
  94. package/lib/common/dependency/commandSet.json +0 -6
  95. package/lib/common/dependency/commandSetPlusBeta.json +0 -6
  96. package/lib/common/dependency/extension/firstParty.json +0 -12
  97. package/lib/common/dependency/extension/firstPartyPlusBeta.json +0 -12
  98. package/lib/common/dependency/fieldCustomizer.json +0 -5
  99. package/lib/common/dependency/fieldCustomizerPlusBeta.json +0 -5
  100. package/lib/common/dependency/library/firstParty.json +0 -9
  101. package/lib/common/dependency/library/firstPartyPlusBeta.json +0 -9
  102. package/lib/common/dependency/react.json +0 -11
  103. package/lib/common/dependency/searchQueryModifier.json +0 -5
  104. package/lib/common/dependency/searchQueryModifierPlusBeta.json +0 -5
  105. package/lib/common/dependency/thirdParty.json +0 -8
  106. package/lib/common/dependency/webpart/firstParty.json +0 -15
  107. package/lib/common/dependency/webpart/firstPartyPlusBeta.json +0 -15
  108. package/lib/generators/solution/templates/base/tslint.json +0 -29
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/adaptiveCardExtension/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAE7F,OAAO,KAAK,aAAa,MAAM,qCAAqC,CAAC;AAGrE,aAAK,gBAAgB,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC;AAC1D,MAAM,WAAW,WAAY,SAAQ,aAAa,CAAC,qBAAqB;IACtE,eAAe,EAAE,gBAAgB,CAAC;CACnC;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAE3E,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,IA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AAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,IAAI,CAEN;AAED,wBAAgB,aAAa,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACnE,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAC3C,IAAI,CAEN;AAED,qBAAa,8BAA+B,SAAQ,aAAa,CAAC,sBAAsB,CACtF,WAAW,EACX,WAAW,CACZ;IACC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAA6B;IACpE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAA2B;IAC9D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,CAAM;IAC/D,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAA4B;IAE1D,YAAY,IAAI,IAAI;IAId,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA8ChC,WAAW,IAAI,IAAI;IAenB,OAAO,IAAI,IAAI;IAkBf,OAAO,IAAI,IAAI;IAMf,GAAG,IAAI,IAAI;IAIlB,SAAS,aAAa,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW;IAKnE,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,wBAAwB;CAOjC"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
14
18
  var __importStar = (this && this.__importStar) || function (mod) {
15
19
  if (mod && mod.__esModule) return mod;
16
20
  var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
22
  __setModuleDefault(result, mod);
19
23
  return result;
20
24
  };
@@ -48,10 +52,10 @@ class AdaptiveCardExtensionGenerator extends BaseComponent.BaseComponentGenerato
48
52
  initializing() {
49
53
  /* no-op */
50
54
  }
51
- prompting() {
55
+ async prompting() {
52
56
  this.ensureCorrectFolder();
53
57
  if (!this.shouldExecute()) {
54
- return Promise.resolve();
58
+ return;
55
59
  }
56
60
  const choices = [
57
61
  {
@@ -67,7 +71,7 @@ class AdaptiveCardExtensionGenerator extends BaseComponent.BaseComponentGenerato
67
71
  value: 'PrimaryText'
68
72
  }
69
73
  ];
70
- return this.prompt([
74
+ const answers = await this.prompt([
71
75
  {
72
76
  type: 'list',
73
77
  name: 'aceTemplateType',
@@ -76,16 +80,15 @@ class AdaptiveCardExtensionGenerator extends BaseComponent.BaseComponentGenerato
76
80
  message: 'Which template do you want to use?',
77
81
  choices
78
82
  }
79
- ]).then((answers) => {
80
- const templateType = answers.aceTemplateType || this.config.get('aceTemplateType');
81
- if (!(templateType === 'Basic' || templateType === 'Image' || templateType === 'PrimaryText')) {
82
- this.log(colors_1.default.red(`Invalid template type: '${templateType}'`));
83
- }
84
- else {
85
- this.config.set('aceTemplateType', templateType);
86
- }
87
- return super.prompting();
88
- });
83
+ ]);
84
+ const templateType = answers.aceTemplateType || this.config.get('aceTemplateType');
85
+ if (!(templateType === 'Basic' || templateType === 'Image' || templateType === 'PrimaryText')) {
86
+ this.log(colors_1.default.red(`Invalid template type: '${templateType}'`));
87
+ }
88
+ else {
89
+ this.config.set('aceTemplateType', templateType);
90
+ }
91
+ return super.prompting();
89
92
  }
90
93
  configuring() {
91
94
  if (this.shouldExecute()) {
@@ -111,7 +114,7 @@ class AdaptiveCardExtensionGenerator extends BaseComponent.BaseComponentGenerato
111
114
  }
112
115
  }
113
116
  end() {
114
- /* no-op */
117
+ super.end();
115
118
  }
116
119
  shouldExecute() {
117
120
  return (this.config.get('environment') === 'spo' &&
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
2
+ "$schema": "https://developer.microsoft.com/json-schemas/spfx/adaptive-card-extension-manifest.schema.json",
3
3
  "id": "<%= componentId %>",
4
4
  "alias": "<%= componentAlias %>",
5
5
  "componentType": "AdaptiveCardExtension",
@@ -13,7 +13,6 @@
13
13
  // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
14
14
  "requiresCustomScript": false,
15
15
  "supportedHosts": ["Dashboard"],
16
- "supportsThemeVariants": true,
17
16
  "preconfiguredEntries": [{
18
17
  "groupId": "bd067b1e-3ad5-4d5d-a5fe-505f07d7f59c", // Dashboard
19
18
  "group": { "default": "Dashboard" },
@@ -22,6 +21,7 @@
22
21
  "officeFabricIconFontName": "SharePointLogo",
23
22
  "properties": {
24
23
  "title": "<%= componentNameUnescaped %>"
25
- }
24
+ },
25
+ "cardSize": "Medium"
26
26
  }]
27
27
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
2
+ "$schema": "https://developer.microsoft.com/json-schemas/spfx/adaptive-card-extension-manifest.schema.json",
3
3
  "id": "<%= componentId %>",
4
4
  "alias": "<%= componentAlias %>",
5
5
  "componentType": "AdaptiveCardExtension",
@@ -13,7 +13,6 @@
13
13
  // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
14
14
  "requiresCustomScript": false,
15
15
  "supportedHosts": ["Dashboard"],
16
- "supportsThemeVariants": true,
17
16
  "preconfiguredEntries": [{
18
17
  "groupId": "bd067b1e-3ad5-4d5d-a5fe-505f07d7f59c", // Dashboard
19
18
  "group": { "default": "Dashboard" },
@@ -15,7 +15,7 @@ export class QuickView extends BaseAdaptiveCardView<
15
15
  public get data(): IQuickViewData {
16
16
  return {
17
17
  subTitle: strings.SubTitle,
18
- title: strings.Title,
18
+ title: strings.Title
19
19
  };
20
20
  }
21
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/app/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAIzE,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAY1C,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,WACf,SAAQ,YAAY,EAClB,QAAQ,CAAC,gBAAgB,EACzB,SAAS,CAAC,yBAAyB;CAAG;AAE1C,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,WAAW,GACnB,IAAI,CAEN"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/app/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAIzE,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAa1C,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,WACf,SAAQ,YAAY,EAClB,QAAQ,CAAC,gBAAgB,EACzB,SAAS,CAAC,yBAAyB;CAAG;AAE1C,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,WAAW,GACnB,IAAI,CAEN"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
14
18
  var __importStar = (this && this.__importStar) || function (mod) {
15
19
  if (mod && mod.__esModule) return mod;
16
20
  var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
22
  __setModuleDefault(result, mod);
19
23
  return result;
20
24
  };
@@ -40,6 +44,7 @@ const FieldCustomizer = __importStar(require("../fieldCustomizer"));
40
44
  const CommandSet = __importStar(require("../commandSet"));
41
45
  const SearchQueryModifier = __importStar(require("../searchQueryModifier"));
42
46
  const ApplicationCustomizer = __importStar(require("../applicationCustomizer"));
47
+ const FormCustomizer = __importStar(require("../formCustomizer"));
43
48
  const VERSION = require('../../../package.json').version;
44
49
  function composeWith(base, options) {
45
50
  Utils.compose(path.basename(__dirname), base, options);
@@ -88,6 +93,9 @@ class AppGenerator extends BaseGenerator_1.BaseGenerator {
88
93
  if (this.options.isDomainIsolated !== undefined) {
89
94
  this.config.set('isDomainIsolated', this.options.isDomainIsolated);
90
95
  }
96
+ if (this.options.useHeft !== undefined) {
97
+ this.config.set('useHeft', this.options.useHeft);
98
+ }
91
99
  if (this.options.componentType !== undefined) {
92
100
  this.config.set('componentType', this.options.componentType);
93
101
  }
@@ -142,6 +150,7 @@ class AppGenerator extends BaseGenerator_1.BaseGenerator {
142
150
  CommandSet.composeWith(this, baseOption);
143
151
  SearchQueryModifier.composeWith(this, baseOption);
144
152
  ApplicationCustomizer.composeWith(this, baseOption);
153
+ FormCustomizer.composeWith(this, baseOption);
145
154
  }
146
155
  prompting() {
147
156
  // Configure the solution root folder before other composition.
@@ -161,7 +170,8 @@ class AppGenerator extends BaseGenerator_1.BaseGenerator {
161
170
  }
162
171
  end() {
163
172
  const libraryName = YeomanConfiguration_1.YeomanConfiguration.libraryName;
164
- this.log(spsay_1.default(libraryName));
173
+ const useHeft = YeomanConfiguration_1.YeomanConfiguration.useHeft;
174
+ this.log((0, spsay_1.default)(libraryName, useHeft));
165
175
  }
166
176
  _provideRetirementNote() {
167
177
  this.log(colors_1.default.bold(`See ${colors_1.default.underline(colors_1.default.blue('https://aka.ms/spfx-yeoman-info'))} for more information on how to use this generator.`));
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/applicationCustomizer/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAG/E,OAAO,KAAK,aAAa,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,WAAW,6BAA8B,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAC7F,MAAM,WAAW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AC7F,MAAM,WAAW,6BAA8B,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAE7F,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,IAAI,CAEN;AAED,wBAAgB,aAAa,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACnE,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAC3C,IAAI,CAEN;AAED,qBAAa,8BAA+B,SAAQ,aAAa,CAAC,sBAAsB,CACtF,6BAA6B,EAC7B,6BAA6B,CAC9B;IACC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAA4B;IACnE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAA2B;IAC9D,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,CAAM;IAExD,YAAY,IAAI,IAAI;IAId,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAOhC,WAAW,IAAI,IAAI;IAmBnB,OAAO,IAAI,IAAI;IAMf,OAAO,IAAI,IAAI;IAMf,GAAG,IAAI,IAAI;IAIlB,SAAS,aAAa,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,6BAA6B;IAKrF,SAAS,CAAC,0BAA0B,IAAI,OAAO;IAI/C,OAAO,CAAC,aAAa;CAOtB"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
14
18
  var __importStar = (this && this.__importStar) || function (mod) {
15
19
  if (mod && mod.__esModule) return mod;
16
20
  var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
22
  __setModuleDefault(result, mod);
19
23
  return result;
20
24
  };
@@ -42,12 +46,11 @@ class ApplicationCustomizerGenerator extends BaseExtension.BaseExtensionGenerato
42
46
  initializing() {
43
47
  /* no-op */
44
48
  }
45
- prompting() {
49
+ async prompting() {
46
50
  this.ensureCorrectFolder();
47
- if (!this.shouldExecute()) {
48
- return Promise.resolve();
51
+ if (this.shouldExecute()) {
52
+ await super.prompting();
49
53
  }
50
- return super.prompting();
51
54
  }
52
55
  configuring() {
53
56
  if (this.shouldExecute()) {
@@ -77,7 +80,7 @@ class ApplicationCustomizerGenerator extends BaseExtension.BaseExtensionGenerato
77
80
  }
78
81
  }
79
82
  end() {
80
- /* no-op */
83
+ super.end();
81
84
  }
82
85
  includeClientSideInstances() {
83
86
  return true;
@@ -30,7 +30,9 @@ export default class <%= componentClassName %>
30
30
  message = '(No properties were provided.)';
31
31
  }
32
32
 
33
- Dialog.alert(`Hello from ${strings.Title}:\n\n${message}`);
33
+ Dialog.alert(`Hello from ${strings.Title}:\n\n${message}`).catch(() => {
34
+ /* handle error */
35
+ });
34
36
 
35
37
  return Promise.resolve();
36
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/commandSet/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAA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AO,KAAK,aAAa,MAAM,qCAAqC,CAAC;AAErE,MAAM,WAAW,kBAAmB,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAClF,MAAM,WAAW,kBAAmB,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAElF,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,IAAI,CAEN;AAED,wBAAgB,aAAa,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACnE,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAC3C,IAAI,CAEN;AAED,qBAAa,mBAAoB,SAAQ,aAAa,CAAC,sBAAsB,CAC3E,kBAAkB,EAClB,kBAAkB,CACnB;IACC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAiB;IACxD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAgB;IACnD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,CAAM;IAExD,YAAY,IAAI,IAAI;IAId,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAOhC,WAAW,IAAI,IAAI;IAoBnB,OAAO,IAAI,IAAI;IAMf,OAAO,IAAI,IAAI;IAMf,GAAG,IAAI,IAAI;IAIlB,SAAS,aAAa,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,kBAAkB;IAK1E,SAAS,CAAC,0BAA0B,IAAI,OAAO;IAI/C,OAAO,CAAC,aAAa;CAOtB"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
14
18
  var __importStar = (this && this.__importStar) || function (mod) {
15
19
  if (mod && mod.__esModule) return mod;
16
20
  var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
22
  __setModuleDefault(result, mod);
19
23
  return result;
20
24
  };
@@ -42,12 +46,11 @@ class CommandSetGenerator extends BaseExtension.BaseExtensionGenerator {
42
46
  initializing() {
43
47
  /* no-op */
44
48
  }
45
- prompting() {
49
+ async prompting() {
46
50
  this.ensureCorrectFolder();
47
- if (!this.shouldExecute()) {
48
- return Promise.resolve();
51
+ if (this.shouldExecute()) {
52
+ await super.prompting();
49
53
  }
50
- return super.prompting();
51
54
  }
52
55
  configuring() {
53
56
  if (this.shouldExecute()) {
@@ -78,7 +81,7 @@ class CommandSetGenerator extends BaseExtension.BaseExtensionGenerator {
78
81
  }
79
82
  }
80
83
  end() {
81
- /* no-op */
84
+ super.end();
82
85
  }
83
86
  includeClientSideInstances() {
84
87
  return true;
@@ -2,13 +2,11 @@ import { Log } from '@microsoft/sp-core-library';
2
2
  import {
3
3
  BaseListViewCommandSet,
4
4
  Command,
5
- IListViewCommandSetListViewUpdatedParameters,
6
- IListViewCommandSetExecuteEventParameters
5
+ IListViewCommandSetExecuteEventParameters,
6
+ ListViewStateChangedEventArgs
7
7
  } from '@microsoft/sp-listview-extensibility';
8
8
  import { Dialog } from '@microsoft/sp-dialog';
9
9
 
10
- import * as strings from '<%= componentStrings %>';
11
-
12
10
  /**
13
11
  * If your command set uses the ClientSideComponentProperties JSON input,
14
12
  * it will be deserialized into the BaseExtension.properties object.
@@ -26,27 +24,43 @@ export default class <%= componentClassName %> extends BaseListViewCommandSet<I<
26
24
 
27
25
  public onInit(): Promise<void> {
28
26
  Log.info(LOG_SOURCE, 'Initialized <%= componentClassName %>');
29
- return Promise.resolve();
30
- }
31
27
 
32
- public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {
28
+ // initial state of the command's visibility
33
29
  const compareOneCommand: Command = this.tryGetCommand('COMMAND_1');
34
- if (compareOneCommand) {
35
- // This command should be hidden unless exactly one row is selected.
36
- compareOneCommand.visible = event.selectedRows.length === 1;
37
- }
30
+ compareOneCommand.visible = false;
31
+
32
+ this.context.listView.listViewStateChangedEvent.add(this, this._onListViewStateChanged);
33
+
34
+ return Promise.resolve();
38
35
  }
39
36
 
40
37
  public onExecute(event: IListViewCommandSetExecuteEventParameters): void {
41
38
  switch (event.itemId) {
42
39
  case 'COMMAND_1':
43
- Dialog.alert(`${this.properties.sampleTextOne}`);
40
+ Dialog.alert(`${this.properties.sampleTextOne}`).catch(() => {
41
+ /* handle error */
42
+ });
44
43
  break;
45
44
  case 'COMMAND_2':
46
- Dialog.alert(`${this.properties.sampleTextTwo}`);
45
+ Dialog.alert(`${this.properties.sampleTextTwo}`).catch(() => {
46
+ /* handle error */
47
+ });
47
48
  break;
48
49
  default:
49
50
  throw new Error('Unknown command');
50
51
  }
51
52
  }
53
+
54
+ private _onListViewStateChanged = (args: ListViewStateChangedEventArgs): void => {
55
+ Log.info(LOG_SOURCE, 'List view state changed');
56
+
57
+ const compareOneCommand: Command = this.tryGetCommand('COMMAND_1');
58
+ if (compareOneCommand) {
59
+ // This command should be hidden unless exactly one row is selected.
60
+ compareOneCommand.visible = this.context.listView.selectedRows!.length === 1;
61
+ }
62
+
63
+ // TODO: Add your logic here
64
+ // You can call this.raiseOnChage() to update the command bar
65
+ }
52
66
  }
@@ -31,11 +31,14 @@ export declare abstract class BaseComponentGenerator<IOptions extends IBaseCompo
31
31
  /** The name of the folder that this comonent should have its template copied to */
32
32
  protected abstract readonly folderName: string;
33
33
  protected abstract readonly allowedTemplates: AvailableTemplates[];
34
+ private _shouldLogESLintWarning;
34
35
  prompting(): Promise<void>;
35
36
  configuring(bundleEntry?: IConfigBundle): void;
36
37
  writing(shouldWrite?: boolean): void;
37
38
  install(): void;
39
+ end(): void;
38
40
  protected _getOutputFolder(componentNameCamelCase: string): string;
41
+ protected _writeESLintConfig(): void;
39
42
  private checkSolution;
40
43
  }
41
44
  export interface INormalizedComponentNames {
@@ -1 +1 @@
1
- {"version":3,"file":"BaseComponentGenerator.d.ts","sourceRoot":"","sources":["../../../src/generators/component/BaseComponentGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAM7D,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI7F,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB,EAAE,YAAY;IAC/E,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2BAA2B,EAAE,MAAM,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,QAAQ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M,CAAC;IAC7C,mFAAmF;IACnF,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC/C,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;IAEnE,OAAO,CAAC,uBAAuB,CAAkB;IAEpC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAuFhC,WAAW,CAAC,WAAW,CAAC,EAAE,aAAa,GAAG,IAAI;IAqC9C,OAAO,CAAC,WAAW,GAAE,OAAc,GAAG,IAAI;IAa1C,OAAO,IAAI,IAAI;IAOf,GAAG,IAAI,IAAI;IAUlB,SAAS,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM;IAIlE,SAAS,CAAC,kBAAkB,IAAI,IAAI;YAYtB,aAAa;CAQ5B;AAED,MAAM,WAAW,yBAAyB;IACxC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,2BAA2B,EAAE,MAAM,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,uBAAuB,CACrC,sBAAsB,EAAE,MAAM,EAC9B,aAAa,EAAE,MAAM,GACpB,yBAAyB,CA0C3B"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
14
18
  var __importStar = (this && this.__importStar) || function (mod) {
15
19
  if (mod && mod.__esModule) return mod;
16
20
  var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
22
  __setModuleDefault(result, mod);
19
23
  return result;
20
24
  };
@@ -51,79 +55,77 @@ function defineOptions(generator, type) {
51
55
  }
52
56
  exports.defineOptions = defineOptions;
53
57
  class BaseComponentGenerator extends BaseGenerator_1.BaseGenerator {
54
- prompting() {
55
- return this.checkSolution().then(() => {
56
- const availableTemplates = [
57
- { name: 'No framework', value: 'none' }
58
- ];
59
- if (this.allowedTemplates.indexOf('react') !== -1) {
60
- availableTemplates.push({ name: 'React', value: 'react' });
61
- }
62
- if (this.allowedTemplates.indexOf('minimal') !== -1) {
63
- availableTemplates.unshift({ name: 'Minimal', value: 'minimal' });
64
- }
65
- return this.prompt([
66
- {
67
- type: 'input',
68
- name: 'componentName',
69
- default: 'HelloWorld',
70
- when: () => !this.config.get('componentName'),
71
- message: `What is your ${this.friendlyName} name?`,
72
- validate: (input) => {
73
- const normalizedNames = normalizeComponentNames(input, this.codeName);
74
- const outputFolderPath = this._getOutputFolder(normalizedNames.componentNameCamelCase);
75
- if (node_core_library_1.FileSystem.exists(outputFolderPath)) {
76
- console.log(colors_1.default.yellow(`\nThe folder "${outputFolderPath}" already exists.` +
77
- ` Please choose a different name for your component.`));
78
- return false;
79
- }
80
- // disallow quotes, since this will mess with the JSON we put this string into
81
- if (input.indexOf('"') !== -1) {
82
- console.log(colors_1.default.yellow(`\nDo not use double quotes in your title.`));
83
- return false;
84
- }
85
- return true;
58
+ constructor() {
59
+ super(...arguments);
60
+ this._shouldLogESLintWarning = false;
61
+ }
62
+ async prompting() {
63
+ await this.checkSolution();
64
+ const availableTemplates = [{ name: 'No framework', value: 'none' }];
65
+ if (this.allowedTemplates.indexOf('react') !== -1) {
66
+ availableTemplates.push({ name: 'React', value: 'react' });
67
+ }
68
+ if (this.allowedTemplates.indexOf('minimal') !== -1) {
69
+ availableTemplates.unshift({ name: 'Minimal', value: 'minimal' });
70
+ }
71
+ const answers = await this.prompt([
72
+ {
73
+ type: 'input',
74
+ name: 'componentName',
75
+ default: 'HelloWorld',
76
+ when: () => !this.config.get('componentName'),
77
+ message: `What is your ${this.friendlyName} name?`,
78
+ validate: (input) => {
79
+ const normalizedNamesForValidation = normalizeComponentNames(input, this.codeName);
80
+ const outputFolderPathForValidation = this._getOutputFolder(normalizedNamesForValidation.componentNameCamelCase);
81
+ if (node_core_library_1.FileSystem.exists(outputFolderPathForValidation)) {
82
+ console.log(colors_1.default.yellow(`\nThe folder "${outputFolderPathForValidation}" already exists.` +
83
+ ` Please choose a different name for your component.`));
84
+ return false;
86
85
  }
87
- // required: true
88
- },
89
- {
90
- type: 'list',
91
- name: 'template',
92
- when: () => !this.config.get('framework') &&
93
- !this.config.get('template') &&
94
- availableTemplates.length !== 1,
95
- message: 'Which template would you like to use?',
96
- choices: availableTemplates
97
- }
98
- ]).then((answers) => {
99
- const componentName = this.config.get('componentName') || answers.componentName;
100
- this.context.template =
101
- this.config.get('framework') || this.config.get('template') || answers.template || 'none';
102
- this.context.componentDescription =
103
- this.config.get('componentDescription') || `${componentName} description`;
104
- this.context.componentId = Utils.generateGuid();
105
- const normalizedNames = normalizeComponentNames(componentName, this.codeName);
106
- this.context.componentNameUnescaped = normalizedNames.componentNameUnescaped;
107
- this.context.componentName = normalizedNames.componentName;
108
- this.context.componentNameCamelCase = normalizedNames.componentNameCamelCase;
109
- this.context.componentClassName = normalizedNames.componentClassName;
110
- this.context.componentStrings = normalizedNames.componentStrings;
111
- this.context.componentClassNameKebabCase = normalizedNames.componentClassNameKebabCase;
112
- this.context.componentAlias = normalizedNames.componentAlias;
113
- // the folder where we will drop the information
114
- const outputFolderPath = this._getOutputFolder(this.context.componentNameCamelCase);
115
- if (node_core_library_1.FileSystem.exists(outputFolderPath)) {
116
- throw new Error(`The folder "${outputFolderPath}" already exists.` +
117
- ` Please choose a different name for your component.`);
86
+ // disallow quotes, since this will mess with the JSON we put this string into
87
+ if (input.indexOf('"') !== -1) {
88
+ console.log(colors_1.default.yellow(`\nDo not use double quotes in your title.`));
89
+ return false;
90
+ }
91
+ return true;
118
92
  }
119
- });
120
- }, () => {
121
- // Gracefully handle the error
122
- return Promise.reject(undefined);
123
- });
93
+ // required: true
94
+ },
95
+ {
96
+ type: 'list',
97
+ name: 'template',
98
+ when: () => !this.config.get('framework') && !this.config.get('template') && availableTemplates.length !== 1,
99
+ message: 'Which template would you like to use?',
100
+ choices: availableTemplates
101
+ }
102
+ ]);
103
+ const componentName = this.config.get('componentName') || answers.componentName;
104
+ this.context.template =
105
+ this.config.get('framework') || this.config.get('template') || answers.template || 'none';
106
+ this.context.componentDescription =
107
+ this.config.get('componentDescription') || `${componentName} description`;
108
+ this.context.componentId = Utils.generateGuid();
109
+ const normalizedNames = normalizeComponentNames(componentName, this.codeName);
110
+ this.context.componentNameUnescaped = normalizedNames.componentNameUnescaped;
111
+ this.context.componentName = normalizedNames.componentName;
112
+ this.context.componentNameCamelCase = normalizedNames.componentNameCamelCase;
113
+ this.context.componentClassName = normalizedNames.componentClassName;
114
+ this.context.componentStrings = normalizedNames.componentStrings;
115
+ this.context.componentClassNameKebabCase = normalizedNames.componentClassNameKebabCase;
116
+ this.context.componentAlias = normalizedNames.componentAlias;
117
+ // the folder where we will drop the information
118
+ const outputFolderPath = this._getOutputFolder(this.context.componentNameCamelCase);
119
+ if (node_core_library_1.FileSystem.exists(outputFolderPath)) {
120
+ throw new Error(`The folder "${outputFolderPath}" already exists.` +
121
+ ` Please choose a different name for your component.`);
122
+ }
124
123
  }
125
124
  configuring(bundleEntry) {
126
- this.ensureDependencyGroup(this.context.template);
125
+ const templateName = this.context.template;
126
+ if (this.nameIsDependencyGroup(templateName)) {
127
+ this.ensureDependencyGroup(templateName);
128
+ }
127
129
  if (!this.configJson.data) {
128
130
  throw new Error(`Missing required file: "config/config.json"`);
129
131
  }
@@ -157,6 +159,8 @@ class BaseComponentGenerator extends BaseGenerator_1.BaseGenerator {
157
159
  this.copyTemplate(path.join(this.sourceRoot(), this.context.template), dest);
158
160
  this.copyTemplate(path.join(this.sourceRoot(), 'base'), dest);
159
161
  }
162
+ // we need to write the eslint config anyway
163
+ this._writeESLintConfig();
160
164
  }
161
165
  install() {
162
166
  if (!this.tryInstall()) {
@@ -164,16 +168,30 @@ class BaseComponentGenerator extends BaseGenerator_1.BaseGenerator {
164
168
  this.log(`Skipping installation of dependencies. You should run "npm install"`);
165
169
  }
166
170
  }
171
+ end() {
172
+ if (this._shouldLogESLintWarning) {
173
+ this.log(colors_1.default.yellow(`Found an existing ".eslintrc.js" file. Consider updating it if you are adding React component to non-React solution.`));
174
+ }
175
+ }
167
176
  _getOutputFolder(componentNameCamelCase) {
168
177
  return path.join(this.destinationRoot(), 'src', this.folderName, componentNameCamelCase);
169
178
  }
170
- checkSolution() {
179
+ _writeESLintConfig() {
180
+ const isReactTemplate = this.context.template === 'react';
181
+ const esLintPath = path.join(this.destinationRoot(), '.eslintrc.js');
182
+ if (node_core_library_1.FileSystem.exists(esLintPath)) {
183
+ this._shouldLogESLintWarning = isReactTemplate;
184
+ return;
185
+ }
186
+ const esLintConfigFilename = isReactTemplate ? 'react.eslintrc.js' : 'default.eslintrc.js';
187
+ this.fs.copy(`${__dirname}/templates/eslint/${esLintConfigFilename}`, esLintPath);
188
+ }
189
+ async checkSolution() {
171
190
  if (this.config.get('creatingSolution')) {
172
- return Promise.resolve(undefined);
191
+ return;
173
192
  }
174
- return Utils.checkSolutionFolder(this, YeomanConfiguration_1.YeomanConfiguration.libraryName).then((solutionName) => {
175
- this.log(`Add new ${this.friendlyName} to solution ${colors_1.default.cyan(solutionName)}.`);
176
- });
193
+ const solutionName = await Utils.checkSolutionFolder(this, YeomanConfiguration_1.YeomanConfiguration.libraryName);
194
+ this.log(`Add new ${this.friendlyName} to solution ${colors_1.default.cyan(solutionName)}.`);
177
195
  }
178
196
  }
179
197
  exports.BaseComponentGenerator = BaseComponentGenerator;