@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
|
@@ -35,7 +35,10 @@ export class Meta {
|
|
|
35
35
|
* sorts the metaRepoData
|
|
36
36
|
*/
|
|
37
37
|
public async sortMetaRepoData() {
|
|
38
|
-
const stringifiedMetadata = plugins.smartjson.stringify(
|
|
38
|
+
const stringifiedMetadata = plugins.smartjson.stringify(
|
|
39
|
+
this.metaRepoData,
|
|
40
|
+
[],
|
|
41
|
+
);
|
|
39
42
|
this.metaRepoData = plugins.smartjson.parse(stringifiedMetadata);
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -45,11 +48,15 @@ export class Meta {
|
|
|
45
48
|
public async readDirectory() {
|
|
46
49
|
await this.syncToRemote(true);
|
|
47
50
|
logger.log('info', `reading directory`);
|
|
48
|
-
const metaFileExists = plugins.smartfile.fs.fileExistsSync(
|
|
51
|
+
const metaFileExists = plugins.smartfile.fs.fileExistsSync(
|
|
52
|
+
this.filePaths.metaJson,
|
|
53
|
+
);
|
|
49
54
|
if (!metaFileExists) {
|
|
50
55
|
throw new Error(`meta file does not exist at ${this.filePaths.metaJson}`);
|
|
51
56
|
}
|
|
52
|
-
this.metaRepoData = plugins.smartfile.fs.toObjectSync(
|
|
57
|
+
this.metaRepoData = plugins.smartfile.fs.toObjectSync(
|
|
58
|
+
this.filePaths.metaJson,
|
|
59
|
+
);
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
/**
|
|
@@ -76,7 +83,10 @@ export class Meta {
|
|
|
76
83
|
this.filePaths.metaJson,
|
|
77
84
|
);
|
|
78
85
|
// write .gitignore to disk
|
|
79
|
-
plugins.smartfile.memory.toFsSync(
|
|
86
|
+
plugins.smartfile.memory.toFsSync(
|
|
87
|
+
await this.generateGitignore(),
|
|
88
|
+
this.filePaths.gitIgnore,
|
|
89
|
+
);
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
/**
|
|
@@ -84,13 +94,17 @@ export class Meta {
|
|
|
84
94
|
*/
|
|
85
95
|
public async syncToRemote(gitCleanArg = false) {
|
|
86
96
|
logger.log('info', `syncing from origin master`);
|
|
87
|
-
await this.smartshellInstance.exec(
|
|
97
|
+
await this.smartshellInstance.exec(
|
|
98
|
+
`cd ${this.cwd} && git pull origin master`,
|
|
99
|
+
);
|
|
88
100
|
if (gitCleanArg) {
|
|
89
101
|
logger.log('info', `cleaning the repository from old directories`);
|
|
90
102
|
await this.smartshellInstance.exec(`cd ${this.cwd} && git clean -fd`);
|
|
91
103
|
}
|
|
92
104
|
logger.log('info', `syncing to remote origin master`);
|
|
93
|
-
await this.smartshellInstance.exec(
|
|
105
|
+
await this.smartshellInstance.exec(
|
|
106
|
+
`cd ${this.cwd} && git push origin master`,
|
|
107
|
+
);
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
/**
|
|
@@ -98,7 +112,9 @@ export class Meta {
|
|
|
98
112
|
*/
|
|
99
113
|
public async updateLocalRepos() {
|
|
100
114
|
await this.syncToRemote();
|
|
101
|
-
const projects = plugins.smartfile.fs.toObjectSync(
|
|
115
|
+
const projects = plugins.smartfile.fs.toObjectSync(
|
|
116
|
+
this.filePaths.metaJson,
|
|
117
|
+
).projects;
|
|
102
118
|
const preExistingFolders = plugins.smartfile.fs.listFoldersSync(this.cwd);
|
|
103
119
|
for (const preExistingFolderArg of preExistingFolders) {
|
|
104
120
|
if (
|
|
@@ -107,14 +123,18 @@ export class Meta {
|
|
|
107
123
|
projectFolder.startsWith(preExistingFolderArg),
|
|
108
124
|
)
|
|
109
125
|
) {
|
|
110
|
-
const response =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
126
|
+
const response =
|
|
127
|
+
await plugins.smartinteraction.SmartInteract.getCliConfirmation(
|
|
128
|
+
`Do you want to delete superfluous directory >>${preExistingFolderArg}<< ?`,
|
|
129
|
+
true,
|
|
130
|
+
);
|
|
114
131
|
if (response) {
|
|
115
132
|
logger.log('warn', `Deleting >>${preExistingFolderArg}<<!`);
|
|
116
133
|
} else {
|
|
117
|
-
logger.log(
|
|
134
|
+
logger.log(
|
|
135
|
+
'warn',
|
|
136
|
+
`Not deleting ${preExistingFolderArg} by request!`,
|
|
137
|
+
);
|
|
118
138
|
}
|
|
119
139
|
}
|
|
120
140
|
}
|
|
@@ -160,7 +180,9 @@ export class Meta {
|
|
|
160
180
|
*/
|
|
161
181
|
public async initProject() {
|
|
162
182
|
await this.syncToRemote(true);
|
|
163
|
-
const fileExists = await plugins.smartfile.fs.fileExists(
|
|
183
|
+
const fileExists = await plugins.smartfile.fs.fileExists(
|
|
184
|
+
this.filePaths.metaJson,
|
|
185
|
+
);
|
|
164
186
|
if (!fileExists) {
|
|
165
187
|
await plugins.smartfile.memory.toFs(
|
|
166
188
|
JSON.stringify({
|
|
@@ -168,7 +190,10 @@ export class Meta {
|
|
|
168
190
|
}),
|
|
169
191
|
this.filePaths.metaJson,
|
|
170
192
|
);
|
|
171
|
-
logger.log(
|
|
193
|
+
logger.log(
|
|
194
|
+
`success`,
|
|
195
|
+
`created a new .meta.json in directory ${this.cwd}`,
|
|
196
|
+
);
|
|
172
197
|
await plugins.smartfile.memory.toFs(
|
|
173
198
|
JSON.stringify({
|
|
174
199
|
name: this.dirName,
|
|
@@ -176,9 +201,15 @@ export class Meta {
|
|
|
176
201
|
}),
|
|
177
202
|
this.filePaths.packageJson,
|
|
178
203
|
);
|
|
179
|
-
logger.log(
|
|
204
|
+
logger.log(
|
|
205
|
+
`success`,
|
|
206
|
+
`created a new package.json in directory ${this.cwd}`,
|
|
207
|
+
);
|
|
180
208
|
} else {
|
|
181
|
-
logger.log(
|
|
209
|
+
logger.log(
|
|
210
|
+
`error`,
|
|
211
|
+
`directory ${this.cwd} already has a .metaJson file. Doing nothing.`,
|
|
212
|
+
);
|
|
182
213
|
}
|
|
183
214
|
await this.smartshellInstance.exec(
|
|
184
215
|
`cd ${this.cwd} && git add -A && git commit -m "feat(project): init meta project for ${this.dirName}"`,
|
|
@@ -195,7 +226,9 @@ export class Meta {
|
|
|
195
226
|
const existingProject = this.metaRepoData.projects[projectNameArg];
|
|
196
227
|
|
|
197
228
|
if (existingProject) {
|
|
198
|
-
throw new Error(
|
|
229
|
+
throw new Error(
|
|
230
|
+
'Project already exists! Please remove it first before adding it again.',
|
|
231
|
+
);
|
|
199
232
|
}
|
|
200
233
|
|
|
201
234
|
this.metaRepoData.projects[projectNameArg] = gitUrlArg;
|
|
@@ -217,7 +250,10 @@ export class Meta {
|
|
|
217
250
|
const existingProject = this.metaRepoData.projects[projectNameArg];
|
|
218
251
|
|
|
219
252
|
if (!existingProject) {
|
|
220
|
-
logger.log(
|
|
253
|
+
logger.log(
|
|
254
|
+
'error',
|
|
255
|
+
`Project ${projectNameArg} does not exist! So it cannot be removed`,
|
|
256
|
+
);
|
|
221
257
|
return;
|
|
222
258
|
}
|
|
223
259
|
|
|
@@ -228,7 +264,9 @@ export class Meta {
|
|
|
228
264
|
await this.writeToDisk();
|
|
229
265
|
|
|
230
266
|
logger.log('info', 'removing directory from cwd');
|
|
231
|
-
await plugins.smartfile.fs.remove(
|
|
267
|
+
await plugins.smartfile.fs.remove(
|
|
268
|
+
plugins.path.join(paths.cwd, projectNameArg),
|
|
269
|
+
);
|
|
232
270
|
await this.updateLocalRepos();
|
|
233
271
|
}
|
|
234
272
|
}
|
package/ts/mod_standard/index.ts
CHANGED
|
@@ -16,7 +16,9 @@ export let run = () => {
|
|
|
16
16
|
* create a new project with 'gitzone template [template]'
|
|
17
17
|
the following templates exist: ${(() => {
|
|
18
18
|
let projects = `\n`;
|
|
19
|
-
for (const template of plugins.smartfile.fs.listFoldersSync(
|
|
19
|
+
for (const template of plugins.smartfile.fs.listFoldersSync(
|
|
20
|
+
paths.templatesDir,
|
|
21
|
+
)) {
|
|
20
22
|
projects += ` - ${template}\n`;
|
|
21
23
|
}
|
|
22
24
|
return projects;
|
package/ts/mod_start/index.ts
CHANGED
|
@@ -15,7 +15,9 @@ export const run = async (argvArg: any) => {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
await smartshellInstance.execStrict(`cd ${paths.cwd} && git checkout master`);
|
|
18
|
-
await smartshellInstance.execStrict(
|
|
18
|
+
await smartshellInstance.execStrict(
|
|
19
|
+
`cd ${paths.cwd} && git pull origin master`,
|
|
20
|
+
);
|
|
19
21
|
await smartshellInstance.execStrict(`cd ${paths.cwd} && npm ci`);
|
|
20
22
|
|
|
21
23
|
await provideNoGitFiles();
|
package/ts/mod_template/index.ts
CHANGED
|
@@ -16,7 +16,9 @@ export const isTemplate = async (templateNameArg: string) => {
|
|
|
16
16
|
|
|
17
17
|
export const getTemplate = async (templateNameArg: string) => {
|
|
18
18
|
if (isTemplate(templateNameArg)) {
|
|
19
|
-
const localScafTemplate = new plugins.smartscaf.ScafTemplate(
|
|
19
|
+
const localScafTemplate = new plugins.smartscaf.ScafTemplate(
|
|
20
|
+
getTemplatePath(templateNameArg),
|
|
21
|
+
);
|
|
20
22
|
await localScafTemplate.readTemplateFromDir();
|
|
21
23
|
return localScafTemplate;
|
|
22
24
|
} else {
|
|
@@ -32,7 +34,8 @@ export const run = async (argvArg: any) => {
|
|
|
32
34
|
const answerBucket = await smartinteract.askQuestion({
|
|
33
35
|
type: 'list',
|
|
34
36
|
default: 'npm',
|
|
35
|
-
message:
|
|
37
|
+
message:
|
|
38
|
+
'What template do you want to scaffold? (Only showing mpost common options)',
|
|
36
39
|
name: 'templateName',
|
|
37
40
|
choices: ['npm', 'service', 'wcc', 'website'],
|
|
38
41
|
});
|