@git.zone/cli 1.16.6 → 1.16.8
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/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.gitzoneconfig.js +1 -1
- package/dist_ts/gitzone.cli.js +1 -1
- package/dist_ts/gitzone.logging.js +1 -1
- package/dist_ts/mod_commit/index.js +3 -2
- package/dist_ts/mod_deprecate/index.js +1 -1
- package/dist_ts/mod_format/classes.baseformatter.d.ts +0 -2
- package/dist_ts/mod_format/classes.baseformatter.js +3 -22
- package/dist_ts/mod_format/classes.changecache.js +14 -29
- package/dist_ts/mod_format/classes.dependency-analyzer.js +24 -18
- package/dist_ts/mod_format/classes.diffreporter.js +4 -4
- package/dist_ts/mod_format/classes.formatcontext.d.ts +0 -13
- package/dist_ts/mod_format/classes.formatcontext.js +1 -41
- package/dist_ts/mod_format/classes.formatplanner.js +25 -45
- package/dist_ts/mod_format/classes.formatstats.js +22 -20
- package/dist_ts/mod_format/classes.rollbackmanager.d.ts +1 -0
- package/dist_ts/mod_format/classes.rollbackmanager.js +79 -16
- package/dist_ts/mod_format/format.cleanup.js +7 -2
- package/dist_ts/mod_format/format.copy.d.ts +1 -1
- package/dist_ts/mod_format/format.copy.js +3 -3
- package/dist_ts/mod_format/format.gitignore.js +1 -1
- package/dist_ts/mod_format/format.license.js +1 -1
- package/dist_ts/mod_format/format.npmextra.js +1 -1
- package/dist_ts/mod_format/format.packagejson.js +5 -3
- package/dist_ts/mod_format/format.prettier.js +7 -2
- package/dist_ts/mod_format/format.readme.js +1 -1
- package/dist_ts/mod_format/format.templates.js +1 -1
- package/dist_ts/mod_format/format.tsconfig.js +4 -2
- package/dist_ts/mod_format/formatters/cleanup.formatter.js +8 -3
- package/dist_ts/mod_format/formatters/legacy.formatter.js +6 -4
- package/dist_ts/mod_format/formatters/prettier.formatter.js +9 -16
- package/dist_ts/mod_format/formatters/readme.formatter.js +6 -4
- package/dist_ts/mod_format/index.js +13 -71
- package/dist_ts/mod_meta/meta.classes.meta.js +1 -1
- package/dist_ts/mod_standard/index.js +1 -1
- package/dist_ts/mod_start/index.js +1 -1
- package/dist_ts/mod_template/index.js +1 -1
- package/package.json +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.gitzoneconfig.ts +3 -1
- package/ts/gitzone.cli.ts +5 -5
- package/ts/gitzone.logging.ts +2 -1
- package/ts/mod_commit/index.ts +36 -11
- package/ts/mod_deprecate/index.ts +4 -1
- package/ts/mod_format/classes.baseformatter.ts +15 -38
- package/ts/mod_format/classes.changecache.ts +74 -80
- package/ts/mod_format/classes.dependency-analyzer.ts +46 -36
- package/ts/mod_format/classes.diffreporter.ts +44 -28
- package/ts/mod_format/classes.formatcontext.ts +3 -54
- package/ts/mod_format/classes.formatplanner.ts +56 -70
- package/ts/mod_format/classes.formatstats.ts +69 -49
- package/ts/mod_format/classes.rollbackmanager.ts +170 -70
- package/ts/mod_format/format.cleanup.ts +9 -2
- package/ts/mod_format/format.copy.ts +17 -14
- package/ts/mod_format/format.gitignore.ts +2 -1
- package/ts/mod_format/format.license.ts +3 -1
- package/ts/mod_format/format.npmextra.ts +9 -2
- package/ts/mod_format/format.packagejson.ts +47 -12
- package/ts/mod_format/format.prettier.ts +10 -2
- package/ts/mod_format/format.readme.ts +2 -1
- package/ts/mod_format/format.templates.ts +15 -7
- package/ts/mod_format/format.tsconfig.ts +6 -2
- package/ts/mod_format/formatters/cleanup.formatter.ts +13 -8
- package/ts/mod_format/formatters/copy.formatter.ts +1 -1
- package/ts/mod_format/formatters/gitignore.formatter.ts +1 -1
- package/ts/mod_format/formatters/legacy.formatter.ts +19 -12
- package/ts/mod_format/formatters/license.formatter.ts +1 -1
- package/ts/mod_format/formatters/npmextra.formatter.ts +1 -1
- package/ts/mod_format/formatters/packagejson.formatter.ts +1 -1
- package/ts/mod_format/formatters/prettier.formatter.ts +50 -47
- package/ts/mod_format/formatters/readme.formatter.ts +11 -9
- package/ts/mod_format/formatters/templates.formatter.ts +1 -1
- package/ts/mod_format/formatters/tsconfig.formatter.ts +1 -1
- package/ts/mod_format/index.ts +54 -113
- package/ts/mod_format/interfaces.format.ts +3 -3
- package/ts/mod_meta/meta.classes.meta.ts +57 -19
- package/ts/mod_standard/index.ts +3 -1
- package/ts/mod_start/index.ts +3 -1
- package/ts/mod_template/index.ts +5 -2
|
@@ -4,56 +4,59 @@ import { logger } from '../gitzone.logging.js';
|
|
|
4
4
|
|
|
5
5
|
export const run = async (projectArg: Project) => {
|
|
6
6
|
const gitzoneConfig = await projectArg.gitzoneConfig;
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
// Get copy configuration from npmextra.json
|
|
9
9
|
const npmextraConfig = new plugins.npmextra.Npmextra();
|
|
10
10
|
const copyConfig = npmextraConfig.dataFor<any>('gitzone.format.copy', {
|
|
11
|
-
patterns: []
|
|
11
|
+
patterns: [],
|
|
12
12
|
});
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
if (!copyConfig.patterns || copyConfig.patterns.length === 0) {
|
|
15
15
|
logger.log('info', 'No copy patterns configured in npmextra.json');
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
for (const pattern of copyConfig.patterns) {
|
|
20
20
|
if (!pattern.from || !pattern.to) {
|
|
21
21
|
logger.log('warn', 'Invalid copy pattern - missing "from" or "to" field');
|
|
22
22
|
continue;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
try {
|
|
26
26
|
// Handle glob patterns
|
|
27
27
|
const files = await plugins.smartfile.fs.listFileTree('.', pattern.from);
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
for (const file of files) {
|
|
30
30
|
const sourcePath = file;
|
|
31
31
|
let destPath = pattern.to;
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
// If destination is a directory, preserve filename
|
|
34
34
|
if (pattern.to.endsWith('/')) {
|
|
35
35
|
const filename = plugins.path.basename(file);
|
|
36
36
|
destPath = plugins.path.join(pattern.to, filename);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
// Handle template variables in destination path
|
|
40
40
|
if (pattern.preservePath) {
|
|
41
41
|
const relativePath = plugins.path.relative(
|
|
42
|
-
plugins.path.dirname(pattern.from.replace(/\*/g, '')),
|
|
43
|
-
file
|
|
42
|
+
plugins.path.dirname(pattern.from.replace(/\*/g, '')),
|
|
43
|
+
file,
|
|
44
44
|
);
|
|
45
45
|
destPath = plugins.path.join(pattern.to, relativePath);
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
// Ensure destination directory exists
|
|
49
49
|
await plugins.smartfile.fs.ensureDir(plugins.path.dirname(destPath));
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
// Copy file
|
|
52
52
|
await plugins.smartfile.fs.copy(sourcePath, destPath);
|
|
53
53
|
logger.log('info', `Copied ${sourcePath} to ${destPath}`);
|
|
54
54
|
}
|
|
55
55
|
} catch (error) {
|
|
56
|
-
logger.log(
|
|
56
|
+
logger.log(
|
|
57
|
+
'error',
|
|
58
|
+
`Failed to copy pattern ${pattern.from}: ${error.message}`,
|
|
59
|
+
);
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
};
|
|
@@ -79,4 +82,4 @@ export const run = async (projectArg: Project) => {
|
|
|
79
82
|
* }
|
|
80
83
|
* }
|
|
81
84
|
* }
|
|
82
|
-
*/
|
|
85
|
+
*/
|
|
@@ -12,7 +12,8 @@ export const run = async (projectArg: Project) => {
|
|
|
12
12
|
const ciTemplate = await templateModule.getTemplate('gitignore');
|
|
13
13
|
if (gitignoreExists) {
|
|
14
14
|
// lets get the existing gitignore file
|
|
15
|
-
const existingGitIgnoreString =
|
|
15
|
+
const existingGitIgnoreString =
|
|
16
|
+
plugins.smartfile.fs.toStringSync(gitignorePath);
|
|
16
17
|
let customPart = existingGitIgnoreString.split('# custom\n')[1];
|
|
17
18
|
customPart ? null : (customPart = '');
|
|
18
19
|
}
|
|
@@ -24,7 +24,9 @@ export const run = async (projectArg: Project) => {
|
|
|
24
24
|
} else {
|
|
25
25
|
logger.log('error', 'Error -> licenses failed. Here is why:');
|
|
26
26
|
for (const failedModule of licenseCheckResult.failingModules) {
|
|
27
|
-
console.log(
|
|
27
|
+
console.log(
|
|
28
|
+
`${failedModule.name} fails with license ${failedModule.license}`,
|
|
29
|
+
);
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
};
|
|
@@ -29,7 +29,12 @@ export const run = async (projectArg: Project) => {
|
|
|
29
29
|
|
|
30
30
|
const interactInstance = new plugins.smartinteract.SmartInteract();
|
|
31
31
|
for (const expectedRepoInformationItem of expectedRepoInformation) {
|
|
32
|
-
if (
|
|
32
|
+
if (
|
|
33
|
+
!plugins.smartobject.smartGet(
|
|
34
|
+
npmextraJson.gitzone,
|
|
35
|
+
expectedRepoInformationItem,
|
|
36
|
+
)
|
|
37
|
+
) {
|
|
33
38
|
interactInstance.addQuestions([
|
|
34
39
|
{
|
|
35
40
|
message: `What is the value of ${expectedRepoInformationItem}`,
|
|
@@ -43,7 +48,9 @@ export const run = async (projectArg: Project) => {
|
|
|
43
48
|
|
|
44
49
|
const answerbucket = await interactInstance.runQueue();
|
|
45
50
|
for (const expectedRepoInformationItem of expectedRepoInformation) {
|
|
46
|
-
const cliProvidedValue = answerbucket.getAnswerFor(
|
|
51
|
+
const cliProvidedValue = answerbucket.getAnswerFor(
|
|
52
|
+
expectedRepoInformationItem,
|
|
53
|
+
);
|
|
47
54
|
if (cliProvidedValue) {
|
|
48
55
|
plugins.smartobject.smartAdd(
|
|
49
56
|
npmextraJson.gitzone,
|
|
@@ -19,7 +19,7 @@ const ensureDependency = async (
|
|
|
19
19
|
: [dependencyArg, 'latest'];
|
|
20
20
|
|
|
21
21
|
const targetSections: string[] = [];
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
switch (position) {
|
|
24
24
|
case 'dep':
|
|
25
25
|
targetSections.push('dependencies');
|
|
@@ -43,7 +43,8 @@ const ensureDependency = async (
|
|
|
43
43
|
break;
|
|
44
44
|
case 'include':
|
|
45
45
|
if (!packageJsonObjectArg[section][packageName]) {
|
|
46
|
-
packageJsonObjectArg[section][packageName] =
|
|
46
|
+
packageJsonObjectArg[section][packageName] =
|
|
47
|
+
version === 'latest' ? '^1.0.0' : version;
|
|
47
48
|
}
|
|
48
49
|
break;
|
|
49
50
|
case 'latest':
|
|
@@ -54,9 +55,13 @@ const ensureDependency = async (
|
|
|
54
55
|
const latestVersion = packageInfo['dist-tags'].latest;
|
|
55
56
|
packageJsonObjectArg[section][packageName] = `^${latestVersion}`;
|
|
56
57
|
} catch (error) {
|
|
57
|
-
logger.log(
|
|
58
|
+
logger.log(
|
|
59
|
+
'warn',
|
|
60
|
+
`Could not fetch latest version for ${packageName}, using existing or default`,
|
|
61
|
+
);
|
|
58
62
|
if (!packageJsonObjectArg[section][packageName]) {
|
|
59
|
-
packageJsonObjectArg[section][packageName] =
|
|
63
|
+
packageJsonObjectArg[section][packageName] =
|
|
64
|
+
version === 'latest' ? '^1.0.0' : version;
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
break;
|
|
@@ -91,9 +96,15 @@ export const run = async (projectArg: Project) => {
|
|
|
91
96
|
|
|
92
97
|
// Check for private or public
|
|
93
98
|
if (packageJson.private !== undefined) {
|
|
94
|
-
logger.log(
|
|
99
|
+
logger.log(
|
|
100
|
+
'info',
|
|
101
|
+
'Success -> found private/public info in package.json!',
|
|
102
|
+
);
|
|
95
103
|
} else {
|
|
96
|
-
logger.log(
|
|
104
|
+
logger.log(
|
|
105
|
+
'error',
|
|
106
|
+
'found no private boolean! Setting it to private for now!',
|
|
107
|
+
);
|
|
97
108
|
packageJson.private = true;
|
|
98
109
|
}
|
|
99
110
|
|
|
@@ -101,7 +112,10 @@ export const run = async (projectArg: Project) => {
|
|
|
101
112
|
if (packageJson.license) {
|
|
102
113
|
logger.log('info', 'Success -> found license in package.json!');
|
|
103
114
|
} else {
|
|
104
|
-
logger.log(
|
|
115
|
+
logger.log(
|
|
116
|
+
'error',
|
|
117
|
+
'found no license! Setting it to UNLICENSED for now!',
|
|
118
|
+
);
|
|
105
119
|
packageJson.license = 'UNLICENSED';
|
|
106
120
|
}
|
|
107
121
|
|
|
@@ -109,13 +123,19 @@ export const run = async (projectArg: Project) => {
|
|
|
109
123
|
if (packageJson.scripts.build) {
|
|
110
124
|
logger.log('info', 'Success -> found build script in package.json!');
|
|
111
125
|
} else {
|
|
112
|
-
logger.log(
|
|
126
|
+
logger.log(
|
|
127
|
+
'error',
|
|
128
|
+
'found no build script! Putting a placeholder there for now!',
|
|
129
|
+
);
|
|
113
130
|
packageJson.scripts.build = `echo "Not needed for now"`;
|
|
114
131
|
}
|
|
115
132
|
|
|
116
133
|
// Check for buildDocs script
|
|
117
134
|
if (!packageJson.scripts.buildDocs) {
|
|
118
|
-
logger.log(
|
|
135
|
+
logger.log(
|
|
136
|
+
'info',
|
|
137
|
+
'found no buildDocs script! Putting tsdoc script there now.',
|
|
138
|
+
);
|
|
119
139
|
packageJson.scripts.buildDocs = `tsdoc`;
|
|
120
140
|
}
|
|
121
141
|
|
|
@@ -134,9 +154,24 @@ export const run = async (projectArg: Project) => {
|
|
|
134
154
|
];
|
|
135
155
|
|
|
136
156
|
// check for dependencies
|
|
137
|
-
await ensureDependency(
|
|
138
|
-
|
|
139
|
-
|
|
157
|
+
await ensureDependency(
|
|
158
|
+
packageJson,
|
|
159
|
+
'devDep',
|
|
160
|
+
'latest',
|
|
161
|
+
'@push.rocks/tapbundle',
|
|
162
|
+
);
|
|
163
|
+
await ensureDependency(
|
|
164
|
+
packageJson,
|
|
165
|
+
'devDep',
|
|
166
|
+
'latest',
|
|
167
|
+
'@git.zone/tstest',
|
|
168
|
+
);
|
|
169
|
+
await ensureDependency(
|
|
170
|
+
packageJson,
|
|
171
|
+
'devDep',
|
|
172
|
+
'latest',
|
|
173
|
+
'@git.zone/tsbuild',
|
|
174
|
+
);
|
|
140
175
|
|
|
141
176
|
// set overrides
|
|
142
177
|
const overrides = plugins.smartfile.fs.toObjectSync(
|
|
@@ -16,7 +16,12 @@ const prettierDefaultMarkdownConfig: prettier.Options = {
|
|
|
16
16
|
parser: 'markdown',
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const filesToFormat = [
|
|
19
|
+
const filesToFormat = [
|
|
20
|
+
`ts/**/*.ts`,
|
|
21
|
+
`test/**/*.ts`,
|
|
22
|
+
`readme.md`,
|
|
23
|
+
`docs/**/*.md`,
|
|
24
|
+
];
|
|
20
25
|
|
|
21
26
|
const choosePrettierConfig = (fileArg: plugins.smartfile.SmartFile) => {
|
|
22
27
|
switch (fileArg.parsedPath.ext) {
|
|
@@ -39,7 +44,10 @@ const prettierTypeScriptPipestop = plugins.through2.obj(
|
|
|
39
44
|
cb(null);
|
|
40
45
|
} else {
|
|
41
46
|
logger.log('info', `${fileArg.path} is being reformated!`);
|
|
42
|
-
const formatedFileString = await prettier.format(
|
|
47
|
+
const formatedFileString = await prettier.format(
|
|
48
|
+
fileString,
|
|
49
|
+
chosenConfig,
|
|
50
|
+
);
|
|
43
51
|
fileArg.setContentsFromString(formatedFileString);
|
|
44
52
|
cb(null, fileArg);
|
|
45
53
|
}
|
|
@@ -18,7 +18,8 @@ export const run = async () => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// Check and initialize readme.hints.md if it doesn't exist
|
|
21
|
-
const readmeHintsExists =
|
|
21
|
+
const readmeHintsExists =
|
|
22
|
+
await plugins.smartfile.fs.fileExists(readmeHintsPath);
|
|
22
23
|
if (!readmeHintsExists) {
|
|
23
24
|
await plugins.smartfile.fs.toFs(
|
|
24
25
|
'# Project Readme Hints\n\nThis is the initial readme hints file.',
|
|
@@ -26,10 +26,12 @@ export const run = async (project: Project) => {
|
|
|
26
26
|
case 'npm':
|
|
27
27
|
case 'wcc':
|
|
28
28
|
if (project.gitzoneConfig.data.npmciOptions.npmAccessLevel === 'public') {
|
|
29
|
-
const ciTemplateDefault =
|
|
29
|
+
const ciTemplateDefault =
|
|
30
|
+
await templateModule.getTemplate('ci_default');
|
|
30
31
|
ciTemplateDefault.writeToDisk(paths.cwd);
|
|
31
32
|
} else {
|
|
32
|
-
const ciTemplateDefault =
|
|
33
|
+
const ciTemplateDefault =
|
|
34
|
+
await templateModule.getTemplate('ci_default_private');
|
|
33
35
|
ciTemplateDefault.writeToDisk(paths.cwd);
|
|
34
36
|
}
|
|
35
37
|
logger.log('info', 'Updated .gitlabci.yml!');
|
|
@@ -41,7 +43,8 @@ export const run = async (project: Project) => {
|
|
|
41
43
|
logger.log('info', 'Updated CI/CD config files!');
|
|
42
44
|
|
|
43
45
|
// lets care about docker
|
|
44
|
-
const dockerTemplate =
|
|
46
|
+
const dockerTemplate =
|
|
47
|
+
await templateModule.getTemplate('dockerfile_service');
|
|
45
48
|
dockerTemplate.writeToDisk(paths.cwd);
|
|
46
49
|
logger.log('info', 'Updated Dockerfile!');
|
|
47
50
|
|
|
@@ -56,17 +59,22 @@ export const run = async (project: Project) => {
|
|
|
56
59
|
|
|
57
60
|
// update html
|
|
58
61
|
if (project.gitzoneConfig.data.projectType === 'website') {
|
|
59
|
-
const websiteUpdateTemplate =
|
|
60
|
-
|
|
62
|
+
const websiteUpdateTemplate =
|
|
63
|
+
await templateModule.getTemplate('website_update');
|
|
64
|
+
const variables = {
|
|
61
65
|
assetbrokerUrl: project.gitzoneConfig.data.module.assetbrokerUrl,
|
|
62
66
|
legalUrl: project.gitzoneConfig.data.module.legalUrl,
|
|
63
67
|
};
|
|
64
|
-
console.log(
|
|
68
|
+
console.log(
|
|
69
|
+
'updating website template with variables\n',
|
|
70
|
+
JSON.stringify(variables, null, 2),
|
|
71
|
+
);
|
|
65
72
|
websiteUpdateTemplate.supplyVariables(variables);
|
|
66
73
|
await websiteUpdateTemplate.writeToDisk(paths.cwd);
|
|
67
74
|
logger.log('info', `Updated html for website!`);
|
|
68
75
|
} else if (project.gitzoneConfig.data.projectType === 'service') {
|
|
69
|
-
const websiteUpdateTemplate =
|
|
76
|
+
const websiteUpdateTemplate =
|
|
77
|
+
await templateModule.getTemplate('service_update');
|
|
70
78
|
await websiteUpdateTemplate.writeToDisk(paths.cwd);
|
|
71
79
|
logger.log('info', `Updated html for element template!`);
|
|
72
80
|
} else if (project.gitzoneConfig.data.projectType === 'wcc') {
|
|
@@ -19,8 +19,12 @@ export const run = async (projectArg: Project) => {
|
|
|
19
19
|
const publishModules = await tsPublishInstance.getModuleSubDirs(paths.cwd);
|
|
20
20
|
for (const publishModule of Object.keys(publishModules)) {
|
|
21
21
|
const publishConfig = publishModules[publishModule];
|
|
22
|
-
tsconfigObject.compilerOptions.paths[`${publishConfig.name}`] = [
|
|
22
|
+
tsconfigObject.compilerOptions.paths[`${publishConfig.name}`] = [
|
|
23
|
+
`./${publishModule}/index.js`,
|
|
24
|
+
];
|
|
23
25
|
}
|
|
24
|
-
tsconfigSmartfile.setContentsFromString(
|
|
26
|
+
tsconfigSmartfile.setContentsFromString(
|
|
27
|
+
JSON.stringify(tsconfigObject, null, 2),
|
|
28
|
+
);
|
|
25
29
|
await tsconfigSmartfile.write();
|
|
26
30
|
};
|
|
@@ -7,13 +7,18 @@ export class CleanupFormatter extends BaseFormatter {
|
|
|
7
7
|
get name(): string {
|
|
8
8
|
return 'cleanup';
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
async analyze(): Promise<IPlannedChange[]> {
|
|
12
12
|
const changes: IPlannedChange[] = [];
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
// List of files to remove
|
|
15
|
-
const filesToRemove = [
|
|
16
|
-
|
|
15
|
+
const filesToRemove = [
|
|
16
|
+
'yarn.lock',
|
|
17
|
+
'package-lock.json',
|
|
18
|
+
'tslint.json',
|
|
19
|
+
'defaults.yml',
|
|
20
|
+
];
|
|
21
|
+
|
|
17
22
|
for (const file of filesToRemove) {
|
|
18
23
|
const exists = await plugins.smartfile.fs.fileExists(file);
|
|
19
24
|
if (exists) {
|
|
@@ -21,14 +26,14 @@ export class CleanupFormatter extends BaseFormatter {
|
|
|
21
26
|
type: 'delete',
|
|
22
27
|
path: file,
|
|
23
28
|
module: this.name,
|
|
24
|
-
description: `Remove obsolete file
|
|
29
|
+
description: `Remove obsolete file`,
|
|
25
30
|
});
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
|
-
|
|
33
|
+
|
|
29
34
|
return changes;
|
|
30
35
|
}
|
|
31
|
-
|
|
36
|
+
|
|
32
37
|
async applyChange(change: IPlannedChange): Promise<void> {
|
|
33
38
|
switch (change.type) {
|
|
34
39
|
case 'delete':
|
|
@@ -36,4 +41,4 @@ export class CleanupFormatter extends BaseFormatter {
|
|
|
36
41
|
break;
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
|
-
}
|
|
44
|
+
}
|
|
@@ -7,30 +7,37 @@ import * as plugins from '../mod.plugins.js';
|
|
|
7
7
|
export class LegacyFormatter extends BaseFormatter {
|
|
8
8
|
private moduleName: string;
|
|
9
9
|
private formatModule: any;
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
10
|
+
|
|
11
|
+
constructor(
|
|
12
|
+
context: any,
|
|
13
|
+
project: Project,
|
|
14
|
+
moduleName: string,
|
|
15
|
+
formatModule: any,
|
|
16
|
+
) {
|
|
12
17
|
super(context, project);
|
|
13
18
|
this.moduleName = moduleName;
|
|
14
19
|
this.formatModule = formatModule;
|
|
15
20
|
}
|
|
16
|
-
|
|
21
|
+
|
|
17
22
|
get name(): string {
|
|
18
23
|
return this.moduleName;
|
|
19
24
|
}
|
|
20
|
-
|
|
25
|
+
|
|
21
26
|
async analyze(): Promise<IPlannedChange[]> {
|
|
22
27
|
// For legacy modules, we can't easily predict changes
|
|
23
28
|
// So we'll return a generic change that indicates the module will run
|
|
24
|
-
return [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
type: 'modify',
|
|
32
|
+
path: '<various files>',
|
|
33
|
+
module: this.name,
|
|
34
|
+
description: `Run ${this.name} formatter`,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
30
37
|
}
|
|
31
|
-
|
|
38
|
+
|
|
32
39
|
async applyChange(change: IPlannedChange): Promise<void> {
|
|
33
40
|
// Run the legacy format module
|
|
34
41
|
await this.formatModule.run(this.project);
|
|
35
42
|
}
|
|
36
|
-
}
|
|
43
|
+
}
|