@microsoft/generator-sharepoint 1.20.0 → 1.21.0-beta.2
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.
- package/lib/common/BaseGenerator.js +161 -121
- package/lib/common/ConfigJsonManager.js +45 -29
- package/lib/common/JsonManager.js +70 -29
- package/lib/common/PackageJsonManager.js +28 -8
- package/lib/common/PackageSolutionJsonManager.js +41 -23
- package/lib/common/ServeJsonManager.js +69 -31
- package/lib/common/TeamsManifestJsonManager.js +33 -21
- package/lib/common/YeomanConfiguration.js +25 -8
- package/lib/common/bundles-versions.json +1 -4
- package/lib/common/dependencies.json +62 -100
- package/lib/common/spsay.js +32 -19
- package/lib/common/utilities.js +97 -63
- package/lib/generators/adaptiveCardExtension/BaseAdaptiveCardExtensionGenerator.js +86 -41
- package/lib/generators/adaptiveCardExtension/index.js +103 -62
- package/lib/generators/app/index.js +138 -117
- package/lib/generators/applicationCustomizer/index.js +89 -45
- package/lib/generators/commandSet/index.js +89 -45
- package/lib/generators/component/BaseComponentGenerator.js +130 -77
- package/lib/generators/component/index.js +108 -69
- package/lib/generators/dataVisualizationAdaptiveCardExtension/index.js +72 -43
- package/lib/generators/extension/BaseExtensionGenerator.js +95 -49
- package/lib/generators/extension/index.js +104 -64
- package/lib/generators/fieldCustomizer/index.js +97 -50
- package/lib/generators/formCustomizer/index.js +99 -52
- package/lib/generators/formCustomizer/templates/none/{componentClassName}.ts +6 -2
- package/lib/generators/genericAdaptiveCardExtension/index.js +80 -46
- package/lib/generators/library/index.js +89 -43
- package/lib/generators/searchAdaptiveCardExtension/index.js +72 -43
- package/lib/generators/searchQueryModifier/index.js +89 -45
- package/lib/generators/solution/heft.package.json +1 -1
- package/lib/generators/solution/index.js +110 -80
- package/lib/generators/solution/non-heft.package.json +1 -1
- package/lib/generators/webpart/index.js +99 -50
- package/lib/generators/webpart/initial.teamsManifest.json +2 -4
- package/package.json +38 -12
- package/lib/common/BaseGenerator.d.ts +0 -59
- package/lib/common/BaseGenerator.d.ts.map +0 -1
- package/lib/common/ConfigJsonManager.d.ts +0 -16
- package/lib/common/ConfigJsonManager.d.ts.map +0 -1
- package/lib/common/JsonManager.d.ts +0 -12
- package/lib/common/JsonManager.d.ts.map +0 -1
- package/lib/common/PackageJsonManager.d.ts +0 -18
- package/lib/common/PackageJsonManager.d.ts.map +0 -1
- package/lib/common/PackageSolutionJsonManager.d.ts +0 -20
- package/lib/common/PackageSolutionJsonManager.d.ts.map +0 -1
- package/lib/common/ServeJsonManager.d.ts +0 -12
- package/lib/common/ServeJsonManager.d.ts.map +0 -1
- package/lib/common/TeamsManifestJsonManager.d.ts +0 -51
- package/lib/common/TeamsManifestJsonManager.d.ts.map +0 -1
- package/lib/common/YeomanConfiguration.d.ts +0 -25
- package/lib/common/YeomanConfiguration.d.ts.map +0 -1
- package/lib/common/spsay.d.ts +0 -2
- package/lib/common/spsay.d.ts.map +0 -1
- package/lib/common/utilities.d.ts +0 -9
- package/lib/common/utilities.d.ts.map +0 -1
- package/lib/generators/adaptiveCardExtension/BaseAdaptiveCardExtensionGenerator.d.ts +0 -18
- package/lib/generators/adaptiveCardExtension/BaseAdaptiveCardExtensionGenerator.d.ts.map +0 -1
- package/lib/generators/adaptiveCardExtension/index.d.ts +0 -23
- package/lib/generators/adaptiveCardExtension/index.d.ts.map +0 -1
- package/lib/generators/app/index.d.ts +0 -10
- package/lib/generators/app/index.d.ts.map +0 -1
- package/lib/generators/applicationCustomizer/index.d.ts +0 -24
- package/lib/generators/applicationCustomizer/index.d.ts.map +0 -1
- package/lib/generators/commandSet/index.d.ts +0 -23
- package/lib/generators/commandSet/index.d.ts.map +0 -1
- package/lib/generators/component/BaseComponentGenerator.d.ts +0 -56
- package/lib/generators/component/BaseComponentGenerator.d.ts.map +0 -1
- package/lib/generators/component/index.d.ts +0 -23
- package/lib/generators/component/index.d.ts.map +0 -1
- package/lib/generators/dataVisualizationAdaptiveCardExtension/index.d.ts +0 -19
- package/lib/generators/dataVisualizationAdaptiveCardExtension/index.d.ts.map +0 -1
- package/lib/generators/extension/BaseExtensionGenerator.d.ts +0 -19
- package/lib/generators/extension/BaseExtensionGenerator.d.ts.map +0 -1
- package/lib/generators/extension/index.d.ts +0 -26
- package/lib/generators/extension/index.d.ts.map +0 -1
- package/lib/generators/fieldCustomizer/index.d.ts +0 -24
- package/lib/generators/fieldCustomizer/index.d.ts.map +0 -1
- package/lib/generators/formCustomizer/index.d.ts +0 -24
- package/lib/generators/formCustomizer/index.d.ts.map +0 -1
- package/lib/generators/genericAdaptiveCardExtension/index.d.ts +0 -21
- package/lib/generators/genericAdaptiveCardExtension/index.d.ts.map +0 -1
- package/lib/generators/library/index.d.ts +0 -23
- package/lib/generators/library/index.d.ts.map +0 -1
- package/lib/generators/searchAdaptiveCardExtension/index.d.ts +0 -19
- package/lib/generators/searchAdaptiveCardExtension/index.d.ts.map +0 -1
- package/lib/generators/searchQueryModifier/index.d.ts +0 -23
- package/lib/generators/searchQueryModifier/index.d.ts.map +0 -1
- package/lib/generators/solution/index.d.ts +0 -19
- package/lib/generators/solution/index.d.ts.map +0 -1
- package/lib/generators/webpart/index.d.ts +0 -23
- package/lib/generators/webpart/index.d.ts.map +0 -1
|
@@ -1,74 +1,114 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
17
4
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
5
|
+
Object.defineProperty(exports, "BaseGenerator", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return BaseGenerator;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _colors = /*#__PURE__*/ _interop_require_default(require("colors"));
|
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_wildcard(require("path"));
|
|
13
|
+
const _updatenotifier = /*#__PURE__*/ _interop_require_wildcard(require("update-notifier"));
|
|
14
|
+
const _yeomangenerator = /*#__PURE__*/ _interop_require_default(require("yeoman-generator"));
|
|
15
|
+
const _nodecorelibrary = require("@rushstack/node-core-library");
|
|
16
|
+
const _utilities = /*#__PURE__*/ _interop_require_wildcard(require("./utilities"));
|
|
17
|
+
const _PackageJsonManager = require("./PackageJsonManager");
|
|
18
|
+
const _ConfigJsonManager = require("./ConfigJsonManager");
|
|
19
|
+
const _ServeJsonManager = require("./ServeJsonManager");
|
|
20
|
+
const _PackageSolutionJsonManager = require("./PackageSolutionJsonManager");
|
|
21
|
+
const _YeomanConfiguration = require("./YeomanConfiguration");
|
|
22
|
+
function _define_property(obj, key, value) {
|
|
23
|
+
if (key in obj) {
|
|
24
|
+
Object.defineProperty(obj, key, {
|
|
25
|
+
value: value,
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
obj[key] = value;
|
|
32
|
+
}
|
|
33
|
+
return obj;
|
|
34
|
+
}
|
|
35
|
+
function _interop_require_default(obj) {
|
|
36
|
+
return obj && obj.__esModule ? obj : {
|
|
37
|
+
default: obj
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
41
|
+
if (typeof WeakMap !== "function") return null;
|
|
42
|
+
var cacheBabelInterop = new WeakMap();
|
|
43
|
+
var cacheNodeInterop = new WeakMap();
|
|
44
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
45
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
46
|
+
})(nodeInterop);
|
|
47
|
+
}
|
|
48
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
49
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
50
|
+
return obj;
|
|
51
|
+
}
|
|
52
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
53
|
+
return {
|
|
54
|
+
default: obj
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
58
|
+
if (cache && cache.has(obj)) {
|
|
59
|
+
return cache.get(obj);
|
|
60
|
+
}
|
|
61
|
+
var newObj = {
|
|
62
|
+
__proto__: null
|
|
63
|
+
};
|
|
64
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
65
|
+
for(var key in obj){
|
|
66
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
67
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
68
|
+
if (desc && (desc.get || desc.set)) {
|
|
69
|
+
Object.defineProperty(newObj, key, desc);
|
|
70
|
+
} else {
|
|
71
|
+
newObj[key] = obj[key];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
newObj.default = obj;
|
|
76
|
+
if (cache) {
|
|
77
|
+
cache.set(obj, newObj);
|
|
78
|
+
}
|
|
79
|
+
return newObj;
|
|
80
|
+
}
|
|
81
|
+
class BaseGenerator extends _yeomangenerator.default {
|
|
42
82
|
get packageJsonManager() {
|
|
43
|
-
if (!
|
|
44
|
-
|
|
83
|
+
if (!_PackageJsonManager.PackageJsonManager.instance) {
|
|
84
|
+
_PackageJsonManager.PackageJsonManager.load(this.destinationPath('package.json'), this.fs);
|
|
45
85
|
}
|
|
46
|
-
if (!this.allowEmptyPackageJson && !
|
|
86
|
+
if (!this.allowEmptyPackageJson && !_PackageJsonManager.PackageJsonManager.instance.data) {
|
|
47
87
|
throw new Error(`Cannot find "package.json" file required by this generator`);
|
|
48
88
|
}
|
|
49
|
-
return
|
|
89
|
+
return _PackageJsonManager.PackageJsonManager.instance;
|
|
50
90
|
}
|
|
51
91
|
get configJson() {
|
|
52
|
-
if (!
|
|
53
|
-
|
|
92
|
+
if (!_ConfigJsonManager.ConfigJsonManager.instance) {
|
|
93
|
+
_ConfigJsonManager.ConfigJsonManager.load(this.destinationPath('config/config.json'), this.fs);
|
|
54
94
|
}
|
|
55
|
-
return
|
|
95
|
+
return _ConfigJsonManager.ConfigJsonManager.instance;
|
|
56
96
|
}
|
|
57
97
|
get serveJson() {
|
|
58
|
-
if (!
|
|
59
|
-
|
|
98
|
+
if (!_ServeJsonManager.ServeJsonManager.instance) {
|
|
99
|
+
_ServeJsonManager.ServeJsonManager.load(this.destinationPath('config/serve.json'), this.fs);
|
|
60
100
|
}
|
|
61
|
-
return
|
|
101
|
+
return _ServeJsonManager.ServeJsonManager.instance;
|
|
62
102
|
}
|
|
63
103
|
get packageSolutionJson() {
|
|
64
|
-
if (!
|
|
65
|
-
|
|
104
|
+
if (!_PackageSolutionJsonManager.PackageSolutionJsonManager.instance) {
|
|
105
|
+
_PackageSolutionJsonManager.PackageSolutionJsonManager.load(this.destinationPath('config/package-solution.json'), this.fs);
|
|
66
106
|
}
|
|
67
|
-
return
|
|
107
|
+
return _PackageSolutionJsonManager.PackageSolutionJsonManager.instance;
|
|
68
108
|
}
|
|
69
109
|
static _checkForUpdates() {
|
|
70
110
|
if (!BaseGenerator._hasCheckedForUpdates) {
|
|
71
|
-
const update = new
|
|
111
|
+
const update = new _updatenotifier.UpdateNotifier({
|
|
72
112
|
pkg: BaseGenerator.generatorPackageJson
|
|
73
113
|
});
|
|
74
114
|
update.notify({
|
|
@@ -77,8 +117,7 @@ class BaseGenerator extends yeoman_generator_1.default {
|
|
|
77
117
|
}
|
|
78
118
|
BaseGenerator._hasCheckedForUpdates = true;
|
|
79
119
|
}
|
|
80
|
-
/** Where you write the generator specific files (routes, controllers, etc) */
|
|
81
|
-
writing(shouldCopy = true) {
|
|
120
|
+
/** Where you write the generator specific files (routes, controllers, etc) */ writing(shouldCopy = true) {
|
|
82
121
|
// Update config to add the webpart entry.
|
|
83
122
|
this.configJson.save();
|
|
84
123
|
// Update package.json dependencies and trigger npm install if necessary.
|
|
@@ -91,43 +130,9 @@ class BaseGenerator extends yeoman_generator_1.default {
|
|
|
91
130
|
this.copyTemplate(this.sourceRoot(), this.destinationRoot());
|
|
92
131
|
}
|
|
93
132
|
}
|
|
94
|
-
constructor(args, options) {
|
|
95
|
-
// Always overwrite the conflict files, without any prompting.
|
|
96
|
-
super(args, !(options.force = true) || options);
|
|
97
|
-
this.allowEmptyPackageJson = false;
|
|
98
|
-
this.copyTemplate = (sourceDirectory, destinationDir) => {
|
|
99
|
-
Utils.filesIn(sourceDirectory).forEach(this._untokenizedCopier(sourceDirectory, destinationDir));
|
|
100
|
-
};
|
|
101
|
-
this.context = {};
|
|
102
|
-
// Register an error handler for uncaught exceptions:
|
|
103
|
-
this.addListener('error', (errorObject) => {
|
|
104
|
-
let errorMessage = '';
|
|
105
|
-
if (errorObject) {
|
|
106
|
-
if (typeof errorObject === 'string') {
|
|
107
|
-
errorMessage = errorObject || '';
|
|
108
|
-
}
|
|
109
|
-
else if (errorObject instanceof Error) {
|
|
110
|
-
errorMessage = errorObject.message || '';
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (!errorMessage.trim()) {
|
|
114
|
-
errorMessage = 'The operation was unsuccessful';
|
|
115
|
-
}
|
|
116
|
-
// eslint-disable-next-line no-console
|
|
117
|
-
console.error('\n' + colors_1.default.red('Error: ' + errorMessage));
|
|
118
|
-
process.exitCode = 1;
|
|
119
|
-
});
|
|
120
|
-
YeomanConfiguration_1.YeomanConfiguration.setStore(this.config);
|
|
121
|
-
BaseGenerator._checkForUpdates();
|
|
122
|
-
this.option('skip-install', {
|
|
123
|
-
type: Boolean,
|
|
124
|
-
description: 'Skip running package managers (NPM, etc) post scaffolding',
|
|
125
|
-
default: false
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
133
|
tryInstall() {
|
|
129
134
|
const shouldInstall = !this.options['skip-install'];
|
|
130
|
-
if (shouldInstall &&
|
|
135
|
+
if (shouldInstall && _YeomanConfiguration.YeomanConfiguration.packageManager === 'pnpm') {
|
|
131
136
|
this._doPnpmInstall();
|
|
132
137
|
}
|
|
133
138
|
return shouldInstall;
|
|
@@ -141,16 +146,18 @@ class BaseGenerator extends yeoman_generator_1.default {
|
|
|
141
146
|
const dependenciesByDependencyGroup = this._ensureDependenciesByDependencyGroup();
|
|
142
147
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
143
148
|
const dependencies = dependenciesByDependencyGroup.get(group);
|
|
144
|
-
for (const [name, version] of Object.entries(dependencies.dependencies))
|
|
149
|
+
for (const [name, version] of Object.entries(dependencies.dependencies)){
|
|
145
150
|
this.packageJsonManager.addDependency(name, version);
|
|
146
151
|
}
|
|
147
152
|
// before applying devDependencies, dedupe them
|
|
148
153
|
this._dedupeDependencies(dependencies.devDependencies);
|
|
149
|
-
for (const [name, version] of Object.entries(dependencies.devDependencies))
|
|
154
|
+
for (const [name, version] of Object.entries(dependencies.devDependencies)){
|
|
150
155
|
this.packageJsonManager.addDevDependency(name, version);
|
|
151
156
|
}
|
|
152
157
|
// if at any point we are adding some react typings, then ensure they are in the resolutions for Yarn
|
|
153
|
-
this._addResolutionsIfApplicable([
|
|
158
|
+
this._addResolutionsIfApplicable([
|
|
159
|
+
'@types/react'
|
|
160
|
+
]);
|
|
154
161
|
}
|
|
155
162
|
nameIsDependencyGroup(name) {
|
|
156
163
|
const dependenciesByDependencyGroup = this._ensureDependenciesByDependencyGroup();
|
|
@@ -158,16 +165,14 @@ class BaseGenerator extends yeoman_generator_1.default {
|
|
|
158
165
|
}
|
|
159
166
|
_ensureDependenciesByDependencyGroup() {
|
|
160
167
|
if (!this._dependenciesByDependencyGroup) {
|
|
161
|
-
const dependenciesFile =
|
|
168
|
+
const dependenciesFile = _nodecorelibrary.JsonFile.load(`${__dirname}/dependencies.json`);
|
|
162
169
|
const plusBeta = this.options.plusbeta;
|
|
163
170
|
const dependenciesByDependencyGroup = new Map();
|
|
164
171
|
this._dependenciesByDependencyGroup = dependenciesByDependencyGroup;
|
|
165
|
-
for (const [groupName, groupDependencies] of Object.entries(dependenciesFile))
|
|
172
|
+
for (const [groupName, groupDependencies] of Object.entries(dependenciesFile)){
|
|
166
173
|
const dependencyList = {
|
|
167
174
|
devDependencies: {},
|
|
168
|
-
...
|
|
169
|
-
? groupDependencies.plusBeta
|
|
170
|
-
: groupDependencies.standard)
|
|
175
|
+
...plusBeta && groupDependencies.plusBeta ? groupDependencies.plusBeta : groupDependencies.standard
|
|
171
176
|
};
|
|
172
177
|
dependenciesByDependencyGroup.set(groupName, dependencyList);
|
|
173
178
|
}
|
|
@@ -180,7 +185,7 @@ class BaseGenerator extends yeoman_generator_1.default {
|
|
|
180
185
|
return;
|
|
181
186
|
}
|
|
182
187
|
const { dependencies } = this.packageJsonManager.data;
|
|
183
|
-
Object.keys(devDependencies).forEach((packageName)
|
|
188
|
+
Object.keys(devDependencies).forEach((packageName)=>{
|
|
184
189
|
if (dependencies[packageName]) {
|
|
185
190
|
delete devDependencies[packageName];
|
|
186
191
|
}
|
|
@@ -188,9 +193,9 @@ class BaseGenerator extends yeoman_generator_1.default {
|
|
|
188
193
|
}
|
|
189
194
|
_addResolutionsIfApplicable(packages) {
|
|
190
195
|
if (this.packageJsonManager.data.dependencies) {
|
|
191
|
-
for (const packageName of packages)
|
|
196
|
+
for (const packageName of packages){
|
|
192
197
|
let packageVersion;
|
|
193
|
-
if (
|
|
198
|
+
if (packageVersion = this.packageJsonManager.data.dependencies[packageName]) {
|
|
194
199
|
this.packageJsonManager.addResolution(packageName, packageVersion);
|
|
195
200
|
}
|
|
196
201
|
}
|
|
@@ -199,37 +204,72 @@ class BaseGenerator extends yeoman_generator_1.default {
|
|
|
199
204
|
_doPnpmInstall() {
|
|
200
205
|
// Awaiting: https://github.com/yeoman/generator/pull/1067
|
|
201
206
|
const installer = 'pnpm';
|
|
202
|
-
const args = [
|
|
207
|
+
const args = [
|
|
208
|
+
'install'
|
|
209
|
+
];
|
|
203
210
|
// Follow the same pattern as runInstall(), which uses "once" to ensure only
|
|
204
211
|
// one install for both the solution and the component generators.
|
|
205
212
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
206
|
-
this.env.runLoop.add('install', (done)
|
|
213
|
+
this.env.runLoop.add('install', (done)=>{
|
|
207
214
|
this.emit(installer + 'Install');
|
|
208
|
-
this.spawnCommand(installer, args)
|
|
209
|
-
.on('error', (err) => {
|
|
215
|
+
this.spawnCommand(installer, args).on('error', (err)=>{
|
|
210
216
|
// eslint-disable-next-line no-console
|
|
211
|
-
console.log(
|
|
212
|
-
|
|
213
|
-
installer +
|
|
214
|
-
' with ' +
|
|
215
|
-
colors_1.default.yellow('npm install -g ' + installer) +
|
|
216
|
-
' and try again.');
|
|
217
|
-
})
|
|
218
|
-
.on('exit', (err) => {
|
|
217
|
+
console.log(_colors.default.red('Could not finish installation. \n') + 'Please install ' + installer + ' with ' + _colors.default.yellow('npm install -g ' + installer) + ' and try again.');
|
|
218
|
+
}).on('exit', (err)=>{
|
|
219
219
|
this.emit(installer + 'Install:end');
|
|
220
220
|
done();
|
|
221
221
|
});
|
|
222
|
-
}, {
|
|
222
|
+
}, {
|
|
223
|
+
once: installer + ' ' + args.join(' '),
|
|
224
|
+
run: false
|
|
225
|
+
});
|
|
223
226
|
}
|
|
224
227
|
_untokenizedCopier(directory, destination) {
|
|
225
|
-
return (filename)
|
|
226
|
-
const sourceFile =
|
|
227
|
-
const destinationFile =
|
|
228
|
+
return (filename)=>{
|
|
229
|
+
const sourceFile = _path.join(directory, filename);
|
|
230
|
+
const destinationFile = _path.join(destination, _utilities.untokenize(filename, this.context));
|
|
228
231
|
this.fs.copyTpl(sourceFile, destinationFile, this.context);
|
|
229
232
|
};
|
|
230
233
|
}
|
|
234
|
+
constructor(args, options){
|
|
235
|
+
// Always overwrite the conflict files, without any prompting.
|
|
236
|
+
super(args, !(options.force = true) || options);
|
|
237
|
+
/**
|
|
238
|
+
* The context property bag used by templates
|
|
239
|
+
*/ _define_property(this, "context", void 0);
|
|
240
|
+
_define_property(this, "allowEmptyPackageJson", false);
|
|
241
|
+
_define_property(this, "_dependenciesByDependencyGroup", void 0);
|
|
242
|
+
_define_property(this, "copyTemplate", (sourceDirectory, destinationDir)=>{
|
|
243
|
+
_utilities.filesIn(sourceDirectory).forEach(this._untokenizedCopier(sourceDirectory, destinationDir));
|
|
244
|
+
});
|
|
245
|
+
this.context = {};
|
|
246
|
+
// Register an error handler for uncaught exceptions:
|
|
247
|
+
this.addListener('error', (errorObject)=>{
|
|
248
|
+
let errorMessage = '';
|
|
249
|
+
if (errorObject) {
|
|
250
|
+
if (typeof errorObject === 'string') {
|
|
251
|
+
errorMessage = errorObject || '';
|
|
252
|
+
} else if (errorObject instanceof Error) {
|
|
253
|
+
errorMessage = errorObject.message || '';
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (!errorMessage.trim()) {
|
|
257
|
+
errorMessage = 'The operation was unsuccessful';
|
|
258
|
+
}
|
|
259
|
+
// eslint-disable-next-line no-console
|
|
260
|
+
console.error('\n' + _colors.default.red('Error: ' + errorMessage));
|
|
261
|
+
process.exitCode = 1;
|
|
262
|
+
});
|
|
263
|
+
_YeomanConfiguration.YeomanConfiguration.setStore(this.config);
|
|
264
|
+
BaseGenerator._checkForUpdates();
|
|
265
|
+
this.option('skip-install', {
|
|
266
|
+
type: Boolean,
|
|
267
|
+
description: 'Skip running package managers (NPM, etc) post scaffolding',
|
|
268
|
+
default: false
|
|
269
|
+
});
|
|
270
|
+
}
|
|
231
271
|
}
|
|
232
|
-
|
|
233
|
-
BaseGenerator
|
|
234
|
-
|
|
235
|
-
//#
|
|
272
|
+
_define_property(BaseGenerator, "generatorPackageJson", _nodecorelibrary.JsonFile.load(`${__dirname}/../../package.json`));
|
|
273
|
+
_define_property(BaseGenerator, "_hasCheckedForUpdates", false);
|
|
274
|
+
|
|
275
|
+
//#sourceMappingUrl=./BaseGenerator.js.map
|
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ConfigJsonManager", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return ConfigJsonManager;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _nodecorelibrary = require("@rushstack/node-core-library");
|
|
12
|
+
const _JsonManager = require("./JsonManager");
|
|
13
|
+
function _define_property(obj, key, value) {
|
|
14
|
+
if (key in obj) {
|
|
15
|
+
Object.defineProperty(obj, key, {
|
|
16
|
+
value: value,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
obj[key] = value;
|
|
23
|
+
}
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
class ConfigJsonManager extends _JsonManager.JsonManager {
|
|
7
27
|
static load(filepath, fs) {
|
|
8
28
|
if (this._instance) {
|
|
9
29
|
throw new Error(`Cannot create a second instance of ConfigJsonManager`);
|
|
@@ -12,10 +32,9 @@ class ConfigJsonManager extends JsonManager_1.JsonManager {
|
|
|
12
32
|
let configJsonIsV1 = false;
|
|
13
33
|
if (fs.exists(filepath)) {
|
|
14
34
|
try {
|
|
15
|
-
configJson =
|
|
35
|
+
configJson = _nodecorelibrary.JsonFile.load(filepath);
|
|
16
36
|
configJsonIsV1 = configJson.version === undefined;
|
|
17
|
-
}
|
|
18
|
-
catch (e) {
|
|
37
|
+
} catch (e) {
|
|
19
38
|
throw new Error(`Error reading config.json file: ${e}`);
|
|
20
39
|
}
|
|
21
40
|
}
|
|
@@ -30,25 +49,23 @@ class ConfigJsonManager extends JsonManager_1.JsonManager {
|
|
|
30
49
|
return this._instance;
|
|
31
50
|
}
|
|
32
51
|
addEntry(bundleEntry, name) {
|
|
33
|
-
var _a, _b;
|
|
34
52
|
if (this.configJsonIsV1) {
|
|
35
53
|
const v1Entry = this._translateV2BundleIntoV1(bundleEntry, name);
|
|
36
54
|
const existingConfig = this._data;
|
|
37
|
-
|
|
55
|
+
existingConfig.entries?.forEach((existingEntry)=>{
|
|
38
56
|
if (existingEntry.manifest === v1Entry.manifest) {
|
|
39
57
|
throw new Error('You cannot have two config entries for the same manifest.');
|
|
40
58
|
}
|
|
41
59
|
});
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
60
|
+
existingConfig.entries?.push(v1Entry);
|
|
61
|
+
} else {
|
|
45
62
|
const existingConfig = this._data;
|
|
46
63
|
if (existingConfig.bundles[name]) {
|
|
47
64
|
throw new Error('You cannot have two config bundles with the same output name.');
|
|
48
65
|
}
|
|
49
|
-
for (const configBundle of Object.values(existingConfig.bundles))
|
|
50
|
-
for (const component of configBundle.components)
|
|
51
|
-
for (const newComponent of bundleEntry.components)
|
|
66
|
+
for (const configBundle of Object.values(existingConfig.bundles)){
|
|
67
|
+
for (const component of configBundle.components){
|
|
68
|
+
for (const newComponent of bundleEntry.components){
|
|
52
69
|
if (component.manifest === newComponent.manifest) {
|
|
53
70
|
throw new Error('You cannot have two config entries for the same manifest.');
|
|
54
71
|
}
|
|
@@ -59,24 +76,17 @@ class ConfigJsonManager extends JsonManager_1.JsonManager {
|
|
|
59
76
|
}
|
|
60
77
|
}
|
|
61
78
|
addLocalizedResource(localizedResourceKey, localizedResourcePath) {
|
|
62
|
-
if (
|
|
63
|
-
(!localizedResourceKey && localizedResourcePath)) {
|
|
79
|
+
if (localizedResourceKey && !localizedResourcePath || !localizedResourceKey && localizedResourcePath) {
|
|
64
80
|
throw new Error(`When adding a localized resource, both localized resource key and path must be specified`);
|
|
65
81
|
}
|
|
66
|
-
if (
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
68
|
-
this._data.localizedResources[localizedResourceKey]
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
70
|
-
this._data.localizedResources[localizedResourceKey] !== localizedResourcePath) {
|
|
82
|
+
if (// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
83
|
+
this._data.localizedResources[localizedResourceKey] && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
84
|
+
this._data.localizedResources[localizedResourceKey] !== localizedResourcePath) {
|
|
71
85
|
throw new Error(`A localized resource with the key "${localizedResourceKey}" already exists in "config.json"`);
|
|
72
86
|
}
|
|
73
87
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
74
88
|
this._data.localizedResources[localizedResourceKey] = localizedResourcePath;
|
|
75
89
|
}
|
|
76
|
-
constructor(filepath, fs, data, configJsonIsV1) {
|
|
77
|
-
super(filepath, fs, data);
|
|
78
|
-
this.configJsonIsV1 = configJsonIsV1;
|
|
79
|
-
}
|
|
80
90
|
_translateV2BundleIntoV1(bundle, name) {
|
|
81
91
|
if (bundle.components.length !== 1) {
|
|
82
92
|
throw new Error('New bundle must have exactly one entry');
|
|
@@ -87,6 +97,12 @@ class ConfigJsonManager extends JsonManager_1.JsonManager {
|
|
|
87
97
|
outputPath: `./dist/${name}.js`
|
|
88
98
|
};
|
|
89
99
|
}
|
|
100
|
+
constructor(filepath, fs, data, configJsonIsV1){
|
|
101
|
+
super(filepath, fs, data);
|
|
102
|
+
_define_property(this, "configJsonIsV1", void 0);
|
|
103
|
+
this.configJsonIsV1 = configJsonIsV1;
|
|
104
|
+
}
|
|
90
105
|
}
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
_define_property(ConfigJsonManager, "_instance", void 0);
|
|
107
|
+
|
|
108
|
+
//#sourceMappingUrl=./ConfigJsonManager.js.map
|
|
@@ -1,30 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
17
4
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
Object.defineProperty(exports, "JsonManager", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return JsonManager;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _lodash = /*#__PURE__*/ _interop_require_wildcard(require("lodash"));
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
26
|
+
if (typeof WeakMap !== "function") return null;
|
|
27
|
+
var cacheBabelInterop = new WeakMap();
|
|
28
|
+
var cacheNodeInterop = new WeakMap();
|
|
29
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
30
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
31
|
+
})(nodeInterop);
|
|
32
|
+
}
|
|
33
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
34
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
35
|
+
return obj;
|
|
36
|
+
}
|
|
37
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
38
|
+
return {
|
|
39
|
+
default: obj
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
43
|
+
if (cache && cache.has(obj)) {
|
|
44
|
+
return cache.get(obj);
|
|
45
|
+
}
|
|
46
|
+
var newObj = {
|
|
47
|
+
__proto__: null
|
|
48
|
+
};
|
|
49
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
50
|
+
for(var key in obj){
|
|
51
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
52
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
53
|
+
if (desc && (desc.get || desc.set)) {
|
|
54
|
+
Object.defineProperty(newObj, key, desc);
|
|
55
|
+
} else {
|
|
56
|
+
newObj[key] = obj[key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
newObj.default = obj;
|
|
61
|
+
if (cache) {
|
|
62
|
+
cache.set(obj, newObj);
|
|
63
|
+
}
|
|
64
|
+
return newObj;
|
|
65
|
+
}
|
|
28
66
|
class JsonManager {
|
|
29
67
|
set(newData) {
|
|
30
68
|
if (!newData) {
|
|
@@ -34,7 +72,7 @@ class JsonManager {
|
|
|
34
72
|
return this._data;
|
|
35
73
|
}
|
|
36
74
|
merge(newData) {
|
|
37
|
-
|
|
75
|
+
_lodash.merge(this._data, newData);
|
|
38
76
|
return this._data;
|
|
39
77
|
}
|
|
40
78
|
get data() {
|
|
@@ -43,11 +81,14 @@ class JsonManager {
|
|
|
43
81
|
save() {
|
|
44
82
|
this._fs.writeJSON(this._filepath, this._data, /* replacer */ undefined, /* spacing */ 2);
|
|
45
83
|
}
|
|
46
|
-
constructor(filepath, fs, data)
|
|
84
|
+
constructor(filepath, fs, data){
|
|
85
|
+
_define_property(this, "_filepath", void 0);
|
|
86
|
+
_define_property(this, "_fs", void 0);
|
|
87
|
+
_define_property(this, "_data", void 0);
|
|
47
88
|
this._filepath = filepath;
|
|
48
89
|
this._fs = fs;
|
|
49
90
|
this._data = data;
|
|
50
91
|
}
|
|
51
92
|
}
|
|
52
|
-
|
|
53
|
-
//#
|
|
93
|
+
|
|
94
|
+
//#sourceMappingUrl=./JsonManager.js.map
|