@microsoft/sp-build-web 1.20.2 → 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-commonjs/BuildRigConstants.js +23 -0
- package/lib-commonjs/SPBuildRig.js +286 -0
- package/lib-commonjs/SPWebBuildRig.js +250 -0
- package/lib-commonjs/WebBuildRigConstants.js +25 -0
- package/lib-commonjs/index.js +56 -0
- package/{lib → lib-esm}/BuildRigConstants.js +3 -5
- package/lib-esm/SPBuildRig.js +227 -0
- package/lib-esm/SPWebBuildRig.js +186 -0
- package/{lib → lib-esm}/WebBuildRigConstants.js +3 -5
- package/lib-esm/index.js +19 -0
- package/package.json +31 -11
- package/lib/BuildRigConstants.d.ts.map +0 -1
- package/lib/SPBuildRig.d.ts.map +0 -1
- package/lib/SPBuildRig.js +0 -250
- package/lib/SPWebBuildRig.d.ts.map +0 -1
- package/lib/SPWebBuildRig.js +0 -212
- package/lib/WebBuildRigConstants.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -39
- /package/{lib → lib-dts}/BuildRigConstants.d.ts +0 -0
- /package/{lib → lib-dts}/SPBuildRig.d.ts +0 -0
- /package/{lib → lib-dts}/SPWebBuildRig.d.ts +0 -0
- /package/{lib → lib-dts}/WebBuildRigConstants.d.ts +0 -0
- /package/{lib → lib-dts}/index.d.ts +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/typedef
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BuildRigConstants", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return BuildRigConstants;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const BuildRigConstants = {
|
|
13
|
+
tasks: {
|
|
14
|
+
build: 'build',
|
|
15
|
+
default: 'default'
|
|
16
|
+
},
|
|
17
|
+
flavors: {
|
|
18
|
+
debug: 'debug',
|
|
19
|
+
ship: 'ship'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//#sourceMappingUrl=./BuildRigConstants.js.map
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
SPBuildRig: function() {
|
|
13
|
+
return SPBuildRig;
|
|
14
|
+
},
|
|
15
|
+
postCopy: function() {
|
|
16
|
+
return postCopy;
|
|
17
|
+
},
|
|
18
|
+
preCopy: function() {
|
|
19
|
+
return preCopy;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
|
|
23
|
+
const _yargs = /*#__PURE__*/ _interop_require_wildcard(require("yargs"));
|
|
24
|
+
const _semver = /*#__PURE__*/ _interop_require_wildcard(require("semver"));
|
|
25
|
+
const _gulpcorebuild = /*#__PURE__*/ _interop_require_wildcard(require("@microsoft/gulp-core-build"));
|
|
26
|
+
const _gulpcorebuildtypescript = require("@microsoft/gulp-core-build-typescript");
|
|
27
|
+
const _BuildRigConstants = require("./BuildRigConstants");
|
|
28
|
+
function _define_property(obj, key, value) {
|
|
29
|
+
if (key in obj) {
|
|
30
|
+
Object.defineProperty(obj, key, {
|
|
31
|
+
value: value,
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
obj[key] = value;
|
|
38
|
+
}
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
42
|
+
if (typeof WeakMap !== "function") return null;
|
|
43
|
+
var cacheBabelInterop = new WeakMap();
|
|
44
|
+
var cacheNodeInterop = new WeakMap();
|
|
45
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
46
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
47
|
+
})(nodeInterop);
|
|
48
|
+
}
|
|
49
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
50
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
51
|
+
return obj;
|
|
52
|
+
}
|
|
53
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
54
|
+
return {
|
|
55
|
+
default: obj
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
59
|
+
if (cache && cache.has(obj)) {
|
|
60
|
+
return cache.get(obj);
|
|
61
|
+
}
|
|
62
|
+
var newObj = {
|
|
63
|
+
__proto__: null
|
|
64
|
+
};
|
|
65
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
66
|
+
for(var key in obj){
|
|
67
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
68
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
69
|
+
if (desc && (desc.get || desc.set)) {
|
|
70
|
+
Object.defineProperty(newObj, key, desc);
|
|
71
|
+
} else {
|
|
72
|
+
newObj[key] = obj[key];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
newObj.default = obj;
|
|
77
|
+
if (cache) {
|
|
78
|
+
cache.set(obj, newObj);
|
|
79
|
+
}
|
|
80
|
+
return newObj;
|
|
81
|
+
}
|
|
82
|
+
const preCopy = new _gulpcorebuild.CopyTask();
|
|
83
|
+
const postCopy = new _gulpcorebuild.CopyTask();
|
|
84
|
+
class SPBuildRig {
|
|
85
|
+
initialize(gulp) {
|
|
86
|
+
if (!_semver.satisfies(process.version, this.nodeSupportedVersionRange)) {
|
|
87
|
+
const nodeVersionMessage = `Your dev environment is running NodeJS version ${process.version} which does` + ' not meet the requirements for running this tool. This tool requires a version of NodeJS' + ` that matches "${this.nodeSupportedVersionRange}".`;
|
|
88
|
+
if (process.env.SPFX_OVERRIDE_NODE_VERSION_CHECK === 'true') {
|
|
89
|
+
// This environment variable is when testing new versions of NodeJS for compatibility.
|
|
90
|
+
// eslint-disable-next-line no-console
|
|
91
|
+
console.warn(nodeVersionMessage + ' Proceeding with execution due to override.');
|
|
92
|
+
} else {
|
|
93
|
+
throw new Error(nodeVersionMessage);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Initialize yargs & figure out which command we are running
|
|
97
|
+
const yargsArgs = this.getYargs();
|
|
98
|
+
const command = yargsArgs.argv._[0];
|
|
99
|
+
this.args = yargsArgs.argv;
|
|
100
|
+
// Collect the tasks which need to be registered
|
|
101
|
+
const tasks = this.getTasks();
|
|
102
|
+
// Reset the args and reconfigure based on the selected command
|
|
103
|
+
yargsArgs.reset();
|
|
104
|
+
if (tasks.has(command)) {
|
|
105
|
+
const task = tasks.get(command);
|
|
106
|
+
if (task && task.arguments) {
|
|
107
|
+
task.arguments(yargsArgs);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Note this overrides the getters for ship and production on args
|
|
111
|
+
this.args.ship = this.args.production = this.args.production || this.args.ship;
|
|
112
|
+
// Since gulp-core-build doesn't recognize the --ship flag, ensure it gets the right state
|
|
113
|
+
_gulpcorebuild.mergeConfig({
|
|
114
|
+
production: this.args.ship,
|
|
115
|
+
shouldWarningsFailBuild: this.args.ship
|
|
116
|
+
});
|
|
117
|
+
// Register all the tasks with gulp-core-build
|
|
118
|
+
tasks.forEach((definition, name)=>{
|
|
119
|
+
_gulpcorebuild.task(name, definition.executable);
|
|
120
|
+
});
|
|
121
|
+
// If they are just looking for the task list, save time by not reading config files
|
|
122
|
+
if (!this.args.tasks) {
|
|
123
|
+
// Configure tasks for a normal build
|
|
124
|
+
// eslint-disable-next-line no-console
|
|
125
|
+
console.log('Build target: ' + (this.args.ship ? _BuildRigConstants.BuildRigConstants.flavors.ship.toUpperCase() : _BuildRigConstants.BuildRigConstants.flavors.debug.toUpperCase()));
|
|
126
|
+
this.setupSharedConfig();
|
|
127
|
+
}
|
|
128
|
+
_gulpcorebuild.initialize(gulp);
|
|
129
|
+
// Try to ensure the casing of the rootPath is correct
|
|
130
|
+
try {
|
|
131
|
+
const originalRootPath = _gulpcorebuild.getConfig().rootPath;
|
|
132
|
+
const normalizedRootPath = _fs.realpathSync.native(originalRootPath);
|
|
133
|
+
if (normalizedRootPath !== originalRootPath) {
|
|
134
|
+
_gulpcorebuild.mergeConfig({
|
|
135
|
+
rootPath: normalizedRootPath
|
|
136
|
+
});
|
|
137
|
+
// eslint-disable-next-line no-console
|
|
138
|
+
console.log(`Normalized project rootPath from "${originalRootPath}" to ${normalizedRootPath}`);
|
|
139
|
+
}
|
|
140
|
+
} catch (e) {
|
|
141
|
+
// eslint-disable-next-line no-console
|
|
142
|
+
console.error(`An error occurred when normalizing the project root path: ${e}`);
|
|
143
|
+
}
|
|
144
|
+
// If they are just looking for the task list, save time by not reading config files
|
|
145
|
+
if (!this.args.tasks) {
|
|
146
|
+
this.finalizeSharedConfig();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Register additional telemetry sub-tasks to run at the end of the sequence
|
|
151
|
+
*/ addPostTelemetryTask(tasks) {
|
|
152
|
+
this.addTaskOrListOfTasks(tasks, this._postTelemetryTask);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Register additional telemetry sub-tasks to run at the beginning of the sequence
|
|
156
|
+
*/ addPreTelemetryTask(tasks) {
|
|
157
|
+
this.addTaskOrListOfTasks(tasks, this._preTelemetryTask);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Register additional sub-tasks to run before the typescript subtask.
|
|
161
|
+
* Note, this is meant to be used in a gulpfile.js to inject one-off subtasks
|
|
162
|
+
*/ addPreBuildTask(tasks) {
|
|
163
|
+
this.addTaskOrListOfTasks(tasks, this._preBuildTasks);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Register additional sub-tasks to run after the typescript subtask.
|
|
167
|
+
* Note, this is meant to be used in a gulpfile.js to inject one-off subtasks
|
|
168
|
+
*/ addPostTypescriptTask(tasks) {
|
|
169
|
+
this.addTaskOrListOfTasks(tasks, this._postTypescriptTasks);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Register additional sub-tasks to run after the typescript subtask.
|
|
173
|
+
* @deprecated - Use {@link addPostTypescriptTask} instead
|
|
174
|
+
*/ addBuildTasks(tasks) {
|
|
175
|
+
this.addTaskOrListOfTasks(tasks, this._postTypescriptTasks);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Register additional sub-tasks to run after the entire build.
|
|
179
|
+
* Note, this is meant to be used in a gulpfile.js to inject one-off subtasks
|
|
180
|
+
*/ addPostBuildTask(tasks) {
|
|
181
|
+
this.addTaskOrListOfTasks(tasks, this._postBuildTasks);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Override this function to register more top-level command line arguments (i.e. not task-specific).
|
|
185
|
+
* Ideally, extend the ICoreBuildArgs when hooking into this function
|
|
186
|
+
*
|
|
187
|
+
* Registers the command line arguments which are available for this rig
|
|
188
|
+
*/ getYargs() {
|
|
189
|
+
return _yargs.usage().option('production', {
|
|
190
|
+
alias: 'p',
|
|
191
|
+
describe: 'build in ship mode with full localization and minimization',
|
|
192
|
+
boolean: true
|
|
193
|
+
}).option('ship', {
|
|
194
|
+
alias: 'p',
|
|
195
|
+
describe: 'build in ship mode with full localization and minimization',
|
|
196
|
+
boolean: true
|
|
197
|
+
}).option('verbose', {
|
|
198
|
+
describe: 'run the build with verbose logging'
|
|
199
|
+
}).option('tasks', {
|
|
200
|
+
alias: [
|
|
201
|
+
'T',
|
|
202
|
+
'tasks-simple'
|
|
203
|
+
],
|
|
204
|
+
describe: 'shows the list of tasks which can be run'
|
|
205
|
+
}).help('h').global([
|
|
206
|
+
'production',
|
|
207
|
+
'verbose',
|
|
208
|
+
'h'
|
|
209
|
+
]).option('locale', {
|
|
210
|
+
describe: 'override the default culture (e.g. "fr-fr")',
|
|
211
|
+
type: 'string'
|
|
212
|
+
}).option('lite', {
|
|
213
|
+
alias: 'l',
|
|
214
|
+
describe: 'Speeds up the build by running the minimal set of tasks required to produce an executable output',
|
|
215
|
+
type: 'boolean'
|
|
216
|
+
}).command(_BuildRigConstants.BuildRigConstants.tasks.build, 'build the project').command(_BuildRigConstants.BuildRigConstants.tasks.default, 'equivalent to bundle');
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Override this function to create new top-level tasks which can be executed via the command line
|
|
220
|
+
*
|
|
221
|
+
* Register 2 tasks, build and default, which simply copy files, then run typescript and tslint
|
|
222
|
+
*/ getTasks() {
|
|
223
|
+
const result = new Map();
|
|
224
|
+
result.set(_BuildRigConstants.BuildRigConstants.tasks.build, {
|
|
225
|
+
executable: this.getBuildTask()
|
|
226
|
+
});
|
|
227
|
+
result.set(_BuildRigConstants.BuildRigConstants.tasks.default, {
|
|
228
|
+
executable: this.getBuildTask()
|
|
229
|
+
});
|
|
230
|
+
return result;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Override this function to overwrite the "build" task
|
|
234
|
+
*/ getBuildTask() {
|
|
235
|
+
return _gulpcorebuild.serial(preCopy, _gulpcorebuild.serial(this._preBuildTasks), this.getCoreBuildTask(), _gulpcorebuild.serial(this._postBuildTasks), postCopy);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Override this function to redefine the core build loop
|
|
239
|
+
*/ getCoreBuildTask() {
|
|
240
|
+
return _gulpcorebuild.parallel(_gulpcorebuildtypescript.lintCmd, _gulpcorebuild.serial(_gulpcorebuild.serial(_gulpcorebuildtypescript.tscCmd, _gulpcorebuildtypescript.apiExtractor), _gulpcorebuild.serial(...this._postTypescriptTasks)));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Override this function to do configuration before the configuration .json files have been loaded
|
|
244
|
+
*/ setupSharedConfig() {
|
|
245
|
+
preCopy.name = 'pre-copy';
|
|
246
|
+
postCopy.name = 'post-copy';
|
|
247
|
+
// adding release folder to the list of folders to be removed during the clean task run
|
|
248
|
+
_gulpcorebuild.clean.getCleanMatch = ()=>[
|
|
249
|
+
'release'
|
|
250
|
+
];
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Override this function to do configuration after the configuration .json files have been loaded
|
|
254
|
+
*
|
|
255
|
+
* This function cleans up the shared config by populating task config properties that depend on other tasks'
|
|
256
|
+
* user-defined properties.
|
|
257
|
+
*/ finalizeSharedConfig() {
|
|
258
|
+
if (this.args.lite) {
|
|
259
|
+
this._disableTasks(_gulpcorebuildtypescript.lintCmd);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
addTaskOrListOfTasks(tasks, array) {
|
|
263
|
+
if (tasks.length) {
|
|
264
|
+
array.push(...tasks);
|
|
265
|
+
} else {
|
|
266
|
+
array.push(tasks);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
_disableTasks(...tasks) {
|
|
270
|
+
tasks.forEach((task)=>{
|
|
271
|
+
task.isEnabled = ()=>false;
|
|
272
|
+
_gulpcorebuild.verbose(`Disabling task: ${task.name}`);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
constructor(){
|
|
276
|
+
_define_property(this, "_preBuildTasks", []);
|
|
277
|
+
_define_property(this, "_postTypescriptTasks", []);
|
|
278
|
+
_define_property(this, "_postBuildTasks", []);
|
|
279
|
+
_define_property(this, "_postTelemetryTask", []);
|
|
280
|
+
_define_property(this, "_preTelemetryTask", []);
|
|
281
|
+
_define_property(this, "args", void 0);
|
|
282
|
+
_define_property(this, "nodeSupportedVersionRange", '>=18.17.1 <19.0.0 || >=20.11.0 <21.0.0 || >=22.14.0 <23.0.0');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
//#sourceMappingUrl=./SPBuildRig.js.map
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
SPWebBuildRig: function() {
|
|
13
|
+
return SPWebBuildRig;
|
|
14
|
+
},
|
|
15
|
+
serveWatchFilter: function() {
|
|
16
|
+
return serveWatchFilter;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _gulpcorebuildsass = /*#__PURE__*/ _interop_require_default(require("@microsoft/gulp-core-build-sass"));
|
|
20
|
+
const _gulpcorebuildserve = require("@microsoft/gulp-core-build-serve");
|
|
21
|
+
const _gulpcorebuild = require("@microsoft/gulp-core-build");
|
|
22
|
+
const _gulpcorebuildwebpack = require("@microsoft/gulp-core-build-webpack");
|
|
23
|
+
const _spbuildcoretasks = /*#__PURE__*/ _interop_require_wildcard(require("@microsoft/sp-build-core-tasks"));
|
|
24
|
+
const _ConfigureWebpackTask = require("@microsoft/sp-build-core-tasks/lib/webpack/ConfigureWebpackTask");
|
|
25
|
+
const _gulpcorebuildtypescript = require("@microsoft/gulp-core-build-typescript");
|
|
26
|
+
const _WebBuildRigConstants = require("./WebBuildRigConstants");
|
|
27
|
+
const _SPBuildRig = require("./SPBuildRig");
|
|
28
|
+
const _BuildRigConstants = require("./BuildRigConstants");
|
|
29
|
+
function _define_property(obj, key, value) {
|
|
30
|
+
if (key in obj) {
|
|
31
|
+
Object.defineProperty(obj, key, {
|
|
32
|
+
value: value,
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true
|
|
36
|
+
});
|
|
37
|
+
} else {
|
|
38
|
+
obj[key] = value;
|
|
39
|
+
}
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
function _interop_require_default(obj) {
|
|
43
|
+
return obj && obj.__esModule ? obj : {
|
|
44
|
+
default: obj
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
48
|
+
if (typeof WeakMap !== "function") return null;
|
|
49
|
+
var cacheBabelInterop = new WeakMap();
|
|
50
|
+
var cacheNodeInterop = new WeakMap();
|
|
51
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
52
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
53
|
+
})(nodeInterop);
|
|
54
|
+
}
|
|
55
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
56
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
57
|
+
return obj;
|
|
58
|
+
}
|
|
59
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
60
|
+
return {
|
|
61
|
+
default: obj
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
65
|
+
if (cache && cache.has(obj)) {
|
|
66
|
+
return cache.get(obj);
|
|
67
|
+
}
|
|
68
|
+
var newObj = {
|
|
69
|
+
__proto__: null
|
|
70
|
+
};
|
|
71
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
72
|
+
for(var key in obj){
|
|
73
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
74
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
75
|
+
if (desc && (desc.get || desc.set)) {
|
|
76
|
+
Object.defineProperty(newObj, key, desc);
|
|
77
|
+
} else {
|
|
78
|
+
newObj[key] = obj[key];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
newObj.default = obj;
|
|
83
|
+
if (cache) {
|
|
84
|
+
cache.set(obj, newObj);
|
|
85
|
+
}
|
|
86
|
+
return newObj;
|
|
87
|
+
}
|
|
88
|
+
const serveWatchFilter = [
|
|
89
|
+
'src/**/*.{ts,tsx,scss,resx,js,json,html}',
|
|
90
|
+
'!src/**/*.{scss.ts,resx.ts}',
|
|
91
|
+
'node_modules/*/*/dist/*.manifest.json'
|
|
92
|
+
];
|
|
93
|
+
class SPWebBuildRig extends _SPBuildRig.SPBuildRig {
|
|
94
|
+
addPostBundleTask(tasks) {
|
|
95
|
+
this.addTaskOrListOfTasks(tasks, this._postBundleTasks);
|
|
96
|
+
}
|
|
97
|
+
getYargs() {
|
|
98
|
+
return super.getYargs().option('debug', {
|
|
99
|
+
describe: 'runs tests in unit mode'
|
|
100
|
+
}).option('upgrade', {
|
|
101
|
+
describe: 'upgrades outdated files in the project'
|
|
102
|
+
}).command(_WebBuildRigConstants.WebBuildRigConstants.tasks.bundle, 'build, localize, and bundle the project').command(_WebBuildRigConstants.WebBuildRigConstants.tasks.deployAzureStorage, 'upload the assets to a development CDN').command(_WebBuildRigConstants.WebBuildRigConstants.tasks.packageSolution, 'package the project into a SPPKG').command(_WebBuildRigConstants.WebBuildRigConstants.tasks.test, 'build, localize, and bundle the project and run tests, and verify the coverage').command(_WebBuildRigConstants.WebBuildRigConstants.tasks.testOnly, 'run the tests without running the build').command(_WebBuildRigConstants.WebBuildRigConstants.tasks.serve, 'build and bundle the project and run the development server').command(_WebBuildRigConstants.WebBuildRigConstants.tasks.trustDevCert, "generates and trusts a development certificate if one isn't already present").command(_WebBuildRigConstants.WebBuildRigConstants.tasks.untrustDevCert, 'untrusts and deletes the development certificate if it exists').command('default', 'equivalent to bundle and test').option('entry', {
|
|
103
|
+
describe: 'Select which entries should be bundled. This can match the GUID or the alias of the entry.',
|
|
104
|
+
string: true
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
setupSharedConfig() {
|
|
108
|
+
super.setupSharedConfig();
|
|
109
|
+
_gulpcorebuildwebpack.webpack.taskConfig.webpack = require('webpack');
|
|
110
|
+
_gulpcorebuildsass.default.mergeConfig({
|
|
111
|
+
preamble: '',
|
|
112
|
+
postamble: '',
|
|
113
|
+
sassMatch: [
|
|
114
|
+
'src/**/*.scss',
|
|
115
|
+
'src/**/*.sass'
|
|
116
|
+
],
|
|
117
|
+
useCSSModules: false,
|
|
118
|
+
warnOnCssInvalidPropertyName: true,
|
|
119
|
+
dropCssFiles: true,
|
|
120
|
+
warnOnNonCSSModules: true,
|
|
121
|
+
// Cast is needed due to autoprefixer types mismatch due to workspace install in odsp-web
|
|
122
|
+
autoprefixerOptions: {
|
|
123
|
+
overrideBrowserslist: [
|
|
124
|
+
'> 1%',
|
|
125
|
+
'ie >= 11'
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
_spbuildcoretasks.configureWebpack.mergeConfig({
|
|
130
|
+
webpack: _gulpcorebuildwebpack.webpack,
|
|
131
|
+
singleLocale: this.args.locale,
|
|
132
|
+
useLegacyExternals: true
|
|
133
|
+
});
|
|
134
|
+
_gulpcorebuild.copyStaticAssets.setConfig({
|
|
135
|
+
includeExtensions: [
|
|
136
|
+
..._ConfigureWebpackTask.FILE_LOADER_EXTENSIONS,
|
|
137
|
+
'resx'
|
|
138
|
+
]
|
|
139
|
+
});
|
|
140
|
+
_gulpcorebuildtypescript.tscCmd.mergeConfig({
|
|
141
|
+
allowBuiltinCompiler: true
|
|
142
|
+
});
|
|
143
|
+
_gulpcorebuildtypescript.lintCmd.mergeConfig({
|
|
144
|
+
allowBuiltinCompiler: true
|
|
145
|
+
});
|
|
146
|
+
_gulpcorebuildtypescript.apiExtractor.mergeConfig({
|
|
147
|
+
allowBuiltinCompiler: true
|
|
148
|
+
});
|
|
149
|
+
_gulpcorebuild.jest.mergeConfig({
|
|
150
|
+
writeNUnitResults: this.args.writeNUnitResults
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
finalizeSharedConfig() {
|
|
154
|
+
super.finalizeSharedConfig();
|
|
155
|
+
if (this.args.lite || this.args.notest) {
|
|
156
|
+
this._disableTasks(_gulpcorebuild.jest);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
getTasks() {
|
|
160
|
+
const result = super.getTasks();
|
|
161
|
+
result.set(_BuildRigConstants.BuildRigConstants.tasks.build, {
|
|
162
|
+
executable: this.getBuildTask()
|
|
163
|
+
});
|
|
164
|
+
result.set(_WebBuildRigConstants.WebBuildRigConstants.tasks.bundle, {
|
|
165
|
+
executable: this.getBundleTask()
|
|
166
|
+
});
|
|
167
|
+
result.set(_WebBuildRigConstants.WebBuildRigConstants.tasks.deployAzureStorage, {
|
|
168
|
+
executable: _spbuildcoretasks.deployAzureStorage
|
|
169
|
+
});
|
|
170
|
+
result.set(_WebBuildRigConstants.WebBuildRigConstants.tasks.packageSolution, {
|
|
171
|
+
executable: _spbuildcoretasks.packageSolution
|
|
172
|
+
});
|
|
173
|
+
// @todo VSO #167343
|
|
174
|
+
result.set(_WebBuildRigConstants.WebBuildRigConstants.tasks.test, {
|
|
175
|
+
executable: this.getTestTask(),
|
|
176
|
+
arguments: (yargs)=>{
|
|
177
|
+
return yargs.option('debug', {
|
|
178
|
+
describe: 'run tests in debug mode'
|
|
179
|
+
}).option('match', {
|
|
180
|
+
describe: 'regular expression. Only run tests that match',
|
|
181
|
+
string: true
|
|
182
|
+
}).option('notest', {
|
|
183
|
+
describe: 'run the build without running the test'
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
result.set(_WebBuildRigConstants.WebBuildRigConstants.tasks.serve, {
|
|
188
|
+
executable: (0, _gulpcorebuild.serial)(_spbuildcoretasks.serve, (0, _gulpcorebuild.watch)(serveWatchFilter, (0, _gulpcorebuild.serial)(this._preTelemetryTask, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
189
|
+
result.get(_WebBuildRigConstants.WebBuildRigConstants.tasks.bundle).executable, _gulpcorebuildserve.reload, this._postTelemetryTask))),
|
|
190
|
+
arguments: (yargs)=>{
|
|
191
|
+
return yargs.option('port', {
|
|
192
|
+
description: 'the port to serve on should be the next argument (e.g. "--port 80")'
|
|
193
|
+
}).option('nobrowser', {
|
|
194
|
+
description: "don't open a browser after initial bundle"
|
|
195
|
+
}).option('config', {
|
|
196
|
+
description: 'use this option to specify which configuration to use in the serve.json file'
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
result.set(_WebBuildRigConstants.WebBuildRigConstants.tasks.trustDevCert, {
|
|
201
|
+
executable: _gulpcorebuildserve.trustDevCert
|
|
202
|
+
});
|
|
203
|
+
result.set(_WebBuildRigConstants.WebBuildRigConstants.tasks.untrustDevCert, {
|
|
204
|
+
executable: _gulpcorebuildserve.untrustDevCert
|
|
205
|
+
});
|
|
206
|
+
result.set(_WebBuildRigConstants.WebBuildRigConstants.tasks.testOnly, {
|
|
207
|
+
executable: this.getTestOnlyTask(),
|
|
208
|
+
arguments: (yargs)=>{
|
|
209
|
+
return yargs.option('writeNUnitResults', {
|
|
210
|
+
description: 'write the jest results to an nunit test results file',
|
|
211
|
+
boolean: true
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
result.forEach((taskDefinition, name)=>{
|
|
216
|
+
result.set(name, {
|
|
217
|
+
executable: (0, _gulpcorebuild.serial)((0, _gulpcorebuild.serial)(this._preTelemetryTask), taskDefinition.executable, (0, _gulpcorebuild.serial)(this._postTelemetryTask)),
|
|
218
|
+
arguments: taskDefinition.arguments
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
222
|
+
result.set(_BuildRigConstants.BuildRigConstants.tasks.default, result.get(_WebBuildRigConstants.WebBuildRigConstants.tasks.bundle));
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
getTestTask() {
|
|
226
|
+
return (0, _gulpcorebuild.serial)(this.getBundleTask(), _gulpcorebuild.jest);
|
|
227
|
+
}
|
|
228
|
+
getTestOnlyTask() {
|
|
229
|
+
return (0, _gulpcorebuild.serial)(_gulpcorebuild.jest);
|
|
230
|
+
}
|
|
231
|
+
getCoreBuildTask() {
|
|
232
|
+
return (0, _gulpcorebuild.parallel)((0, _gulpcorebuild.serial)(_gulpcorebuildsass.default, super.getCoreBuildTask()), _gulpcorebuild.copyStaticAssets);
|
|
233
|
+
}
|
|
234
|
+
getBundleTask() {
|
|
235
|
+
return (0, _gulpcorebuild.serial)(this.getBuildTask(), this.getPreWebpackTasks(), _spbuildcoretasks.configureWebpack, _gulpcorebuildwebpack.webpack, this.getPreCopyAssetsTasks(), (0, _gulpcorebuild.parallel)(this._postBundleTasks));
|
|
236
|
+
}
|
|
237
|
+
getPreWebpackTasks() {
|
|
238
|
+
return (0, _gulpcorebuild.serial)();
|
|
239
|
+
}
|
|
240
|
+
getPreCopyAssetsTasks() {
|
|
241
|
+
return (0, _gulpcorebuild.serial)();
|
|
242
|
+
}
|
|
243
|
+
constructor(...args){
|
|
244
|
+
super(...args);
|
|
245
|
+
_define_property(this, "args", void 0);
|
|
246
|
+
_define_property(this, "_postBundleTasks", []);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
//#sourceMappingUrl=./SPWebBuildRig.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/typedef
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "WebBuildRigConstants", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return WebBuildRigConstants;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
const WebBuildRigConstants = {
|
|
13
|
+
tasks: {
|
|
14
|
+
test: 'test',
|
|
15
|
+
testOnly: 'test-only',
|
|
16
|
+
bundle: 'bundle',
|
|
17
|
+
deployAzureStorage: 'deploy-azure-storage',
|
|
18
|
+
packageSolution: 'package-solution',
|
|
19
|
+
serve: 'serve-deprecated',
|
|
20
|
+
trustDevCert: 'trust-dev-cert',
|
|
21
|
+
untrustDevCert: 'untrust-dev-cert'
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#sourceMappingUrl=./WebBuildRigConstants.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
initialize: function() {
|
|
13
|
+
return initialize;
|
|
14
|
+
},
|
|
15
|
+
reload: function() {
|
|
16
|
+
return _gulpcorebuildserve.reload;
|
|
17
|
+
},
|
|
18
|
+
rig: function() {
|
|
19
|
+
return rig;
|
|
20
|
+
},
|
|
21
|
+
trustDevCert: function() {
|
|
22
|
+
return _gulpcorebuildserve.trustDevCert;
|
|
23
|
+
},
|
|
24
|
+
untrustDevCert: function() {
|
|
25
|
+
return _gulpcorebuildserve.untrustDevCert;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
_export_star(require("@microsoft/gulp-core-build-sass"), exports);
|
|
29
|
+
_export_star(require("@microsoft/gulp-core-build-typescript"), exports);
|
|
30
|
+
const _gulpcorebuildserve = require("@microsoft/gulp-core-build-serve");
|
|
31
|
+
_export_star(require("@microsoft/gulp-core-build-webpack"), exports);
|
|
32
|
+
_export_star(require("@microsoft/sp-build-core-tasks/lib/index"), exports);
|
|
33
|
+
_export_star(require("@microsoft/gulp-core-build"), exports);
|
|
34
|
+
const _SPWebBuildRig = _export_star(require("./SPWebBuildRig"), exports);
|
|
35
|
+
_export_star(require("./WebBuildRigConstants"), exports);
|
|
36
|
+
_export_star(require("./SPBuildRig"), exports);
|
|
37
|
+
function _export_star(from, to) {
|
|
38
|
+
Object.keys(from).forEach(function(k) {
|
|
39
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
40
|
+
Object.defineProperty(to, k, {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function() {
|
|
43
|
+
return from[k];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return from;
|
|
49
|
+
}
|
|
50
|
+
const rig = new _SPWebBuildRig.SPWebBuildRig();
|
|
51
|
+
const initialize = (gulp)=>{
|
|
52
|
+
rig.initialize(gulp);
|
|
53
|
+
return rig;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//#sourceMappingUrl=./index.js.map
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuildRigConstants = void 0;
|
|
4
1
|
// eslint-disable-next-line @typescript-eslint/typedef
|
|
5
|
-
|
|
2
|
+
export const BuildRigConstants = {
|
|
6
3
|
tasks: {
|
|
7
4
|
build: 'build',
|
|
8
5
|
default: 'default'
|
|
@@ -12,4 +9,5 @@ exports.BuildRigConstants = {
|
|
|
12
9
|
ship: 'ship'
|
|
13
10
|
}
|
|
14
11
|
};
|
|
15
|
-
|
|
12
|
+
|
|
13
|
+
//#sourceMappingUrl=./BuildRigConstants.js.map
|