-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
67 lines (62 loc) · 2.16 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const fs = require('fs');
const webpack = require('webpack');
const DEBUGGING = false;
const COURSE_PLAN = 'src/Inventory/CoursePlans/CoursePlan.ts';
const STUDENT_FOLDER = 'src/Inventory/StudentFolders/StudentFolder.ts';
const ADVISOR_FOLDER = 'src/Inventory/AdvisorFolders/AdvisorFolder.ts';
const DOCUMENTATION = 'src/Workflow/Documentation.ts';
const files = {};
function stepCount(filePaths, hash) {
let count = 0;
for (const filePath of filePaths) {
if (!files[filePath]) {
files[filePath] = fs.readFileSync(filePath).toString();
}
count += files[filePath].match(new RegExp(`//.*${hash}`, 'g'))?.length || 0;
}
console.log(`${hash}: ${count} steps`);
return JSON.stringify(count);
}
module.exports = require('@battis/gas-lighter/webpack.config')({
root: __dirname,
plugins: [
new webpack.DefinePlugin({
APP_VERSION: JSON.stringify(
JSON.parse(fs.readFileSync('package.json')).version
),
CREATE_STEPS: stepCount([COURSE_PLAN, STUDENT_FOLDER], '#create'),
UPDATE_ENROLLMENT_HISTORY_STEPS: stepCount(
[COURSE_PLAN],
'#update-enrollment-history'
),
UPDATE_COURSE_LIST_STEPS: stepCount([COURSE_PLAN], '#update-course-list'),
DELETE_STUDENT_STEPS: stepCount(
[COURSE_PLAN, STUDENT_FOLDER],
'#delete-student'
),
DELETE_ADVISOR_STEPS: stepCount([ADVISOR_FOLDER], '#delete-advisor'),
ASSIGN_TO_CURRENT_ADVISOR_STEPS: stepCount(
[COURSE_PLAN, STUDENT_FOLDER],
'#assign-to-current-advisor'
),
DEACTIVATE_STEPS: stepCount([COURSE_PLAN, STUDENT_FOLDER], '#deactivate'),
RESET_COURSE_PLAN_PERMISSIONS_STEPS: stepCount(
[COURSE_PLAN, STUDENT_FOLDER],
'#reset-course-plan-permissions'
),
RESET_STUDENT_FOLDER_PERMISSIONS_STEPS: stepCount(
[STUDENT_FOLDER],
'#reset-student-folder-permissions'
),
RESET_ADVISOR_FOLDER_PERMISSIONS_STEPS: stepCount(
[ADVISOR_FOLDER],
'#reset-advisor-folder-permissions'
),
DOCUMENTATION_COURSE_PLAN_DATA_STEPS: stepCount(
[DOCUMENTATION],
'#doc-course-plan-data'
)
})
],
production: !DEBUGGING
});