@git.zone/tsdoc 1.1.41 → 1.3.0
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 +2 -2
- package/dist_ts/aidocs_classes/commit.d.ts +1 -0
- package/dist_ts/aidocs_classes/commit.js +30 -21
- package/dist_ts/logging.js +3 -12
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +3 -2
- package/package.json +2 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aidocs_classes/commit.ts +42 -22
- package/ts/logging.ts +2 -11
- package/ts/plugins.ts +2 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@git.zone/tsdoc',
|
|
6
|
-
version: '1.
|
|
6
|
+
version: '1.3.0',
|
|
7
7
|
description: 'An advanced TypeScript documentation tool using AI to generate and enhance documentation for TypeScript projects.'
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxpQkFBaUI7SUFDdkIsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLG1IQUFtSDtDQUNqSSxDQUFBIn0=
|
|
@@ -3,6 +3,7 @@ export interface INextCommitObject {
|
|
|
3
3
|
recommendedNextVersionLevel: 'fix' | 'feat' | 'BREAKING CHANGE';
|
|
4
4
|
recommendedNextVersionScope: string;
|
|
5
5
|
recommendedNextVersionMessage: string;
|
|
6
|
+
recommendedNextVersionDetauls: string[];
|
|
6
7
|
recommendedNextVersion: string;
|
|
7
8
|
changelog?: string;
|
|
8
9
|
}
|
|
@@ -32,10 +32,12 @@ Important: Answer only in valid JSON.
|
|
|
32
32
|
Your answer should be parseable with JSON.parse() without modifying anything.
|
|
33
33
|
|
|
34
34
|
Here is the structure of the JSON you should return:
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
interface {
|
|
36
37
|
recommendedNextVersionLevel: 'fix' | 'feat' | 'BREAKING CHANGE'; // the recommended next version level of the project
|
|
37
38
|
recommendedNextVersionScope: string; // the recommended scope name of the next version, like "core" or "cli", or specific class names.
|
|
38
39
|
recommendedNextVersionMessage: string; // the commit message. Don't put fix() feat() or BREAKING CHANGE in the message. Please just the message itself.
|
|
40
|
+
recommendedNextVersionDetails: string[]; // detailed bullet points for the changelog
|
|
39
41
|
recommendedNextVersion: string; // the recommended next version of the project, x.x.x
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -55,32 +57,39 @@ Also you are given a diff
|
|
|
55
57
|
if (await plugins.smartfile.fs.fileExists(previousChangelogPath)) {
|
|
56
58
|
previousChangelog = await plugins.smartfile.SmartFile.fromFilePath(previousChangelogPath);
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if (!previousChangelog) {
|
|
61
|
+
let result2 = await this.aiDocsRef.openaiInstance.chat({
|
|
62
|
+
messageHistory: [],
|
|
63
|
+
systemMessage: `
|
|
64
|
+
You are building a changelog.md file for the project.
|
|
62
65
|
Omit commits and versions that lack relevant changes.
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
* the previous changelog file (if available)
|
|
66
|
-
* the commit messages of the project
|
|
67
|
+
A changelog entry should look like this:
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
## yyyy-mm-dd - x.x.x - scope here
|
|
70
|
+
main descriptiom here
|
|
71
|
+
- detailed bullet points follow
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
`,
|
|
73
|
-
userMessage: `
|
|
74
|
-
The previous changelog file is:
|
|
75
|
-
${(!previousChangelog) ? 'No previous changelog file found' : previousChangelog.contents.toString()}
|
|
73
|
+
You are given:
|
|
74
|
+
* the commit messages of the project
|
|
76
75
|
|
|
77
|
-
|
|
76
|
+
Only return the changelog file, so it can be written directly to changelog.md`,
|
|
77
|
+
userMessage: `
|
|
78
|
+
Here are the commit messages:
|
|
78
79
|
|
|
79
|
-
${commitMessages.join('\n
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
${commitMessages.join('\n')}
|
|
81
|
+
`,
|
|
82
|
+
});
|
|
83
|
+
previousChangelog = await plugins.smartfile.SmartFile.fromString(previousChangelogPath, result2.message, 'utf8');
|
|
84
|
+
}
|
|
85
|
+
let oldChangelog = previousChangelog.contents.toString().replace('# Changelog\n\n', '');
|
|
86
|
+
let newDateString = new plugins.smarttime.ExtendedDate().exportToEuropeanDate();
|
|
87
|
+
let newChangelog = `# Changelog\n\n${`## ${newDateString} - {{nextVersion}} - {{nextVersionScope}}
|
|
88
|
+
{{nextVersionMessage}}
|
|
89
|
+
{{nextVersionDetails}}
|
|
90
|
+
`}\n\n${oldChangelog}\n`;
|
|
91
|
+
resultObject.changelog = newChangelog;
|
|
83
92
|
return resultObject;
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
95
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvYWlkb2NzX2NsYXNzZXMvY29tbWl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxxQkF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csTUFBTSxPQUFPLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxVQUFVLENBQUMscUJBQXFCLEVBQUUsT0FBTyxDQUFDLE9BQU8sRUFBRSxNQUFNLENBQUMsQ0FBQztRQUNuSCxDQUFDO1FBRUQsSUFBSSxZQUFZLEdBQUcsaUJBQWlCLENBQUMsUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDLE9BQU8sQ0FBQyxpQkFBaUIsRUFBRSxFQUFFLENBQUMsQ0FBQztRQUN4RixJQUFJLGFBQWEsR0FBRyxJQUFJLE9BQU8sQ0FBQyxTQUFTLENBQUMsWUFBWSxFQUFFLENBQUMsb0JBQW9CLEVBQUUsQ0FBQztRQUNoRixJQUFJLFlBQVksR0FBRyxrQkFDdkIsTUFBTSxhQUFhOzs7Q0FHbEIsT0FBTyxZQUFZLElBQUksQ0FBQztRQUNyQixZQUFZLENBQUMsU0FBUyxHQUFHLFlBQVksQ0FBQztRQUV0QyxPQUFPLFlBQVksQ0FBQztJQUN0QixDQUFDO0NBQ0YifQ==
|
package/dist_ts/logging.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
+
import { commitinfo } from './00_commitinfo_data.js';
|
|
1
2
|
import * as plugins from './plugins.js';
|
|
2
|
-
export const logger =
|
|
3
|
-
logContext: {
|
|
4
|
-
company: 'Some Company',
|
|
5
|
-
companyunit: 'Some CompanyUnit',
|
|
6
|
-
containerName: 'Some Containername',
|
|
7
|
-
environment: 'local',
|
|
8
|
-
runtime: 'node',
|
|
9
|
-
zone: 'gitzone',
|
|
10
|
-
},
|
|
11
|
-
minimumLogLevel: 'silly',
|
|
12
|
-
});
|
|
3
|
+
export const logger = plugins.smartlog.Smartlog.createForCommitinfo(commitinfo);
|
|
13
4
|
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2luZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xvZ2dpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3JELE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBRXhDLE1BQU0sQ0FBQyxNQUFNLE1BQU0sR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBQyxtQkFBbUIsQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUVoRixNQUFNLENBQUMsaUJBQWlCLENBQUMsSUFBSSxPQUFPLENBQUMsd0JBQXdCLENBQUMsZ0JBQWdCLEVBQUUsQ0FBQyxDQUFDIn0=
|
package/dist_ts/plugins.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import * as smartlog from '@push.rocks/smartlog';
|
|
|
13
13
|
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
|
14
14
|
import * as smartpath from '@push.rocks/smartpath';
|
|
15
15
|
import * as smartshell from '@push.rocks/smartshell';
|
|
16
|
-
|
|
16
|
+
import * as smarttime from '@push.rocks/smarttime';
|
|
17
|
+
export { npmextra, qenv, smartai, smartcli, smartdelay, smartfile, smartgit, smartinteract, smartlog, smartlogDestinationLocal, smartpath, smartshell, smarttime, };
|
|
17
18
|
import * as typedoc from 'typedoc';
|
|
18
19
|
export { typedoc };
|
package/dist_ts/plugins.js
CHANGED
|
@@ -14,8 +14,9 @@ import * as smartlog from '@push.rocks/smartlog';
|
|
|
14
14
|
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
|
15
15
|
import * as smartpath from '@push.rocks/smartpath';
|
|
16
16
|
import * as smartshell from '@push.rocks/smartshell';
|
|
17
|
-
|
|
17
|
+
import * as smarttime from '@push.rocks/smarttime';
|
|
18
|
+
export { npmextra, qenv, smartai, smartcli, smartdelay, smartfile, smartgit, smartinteract, smartlog, smartlogDestinationLocal, smartpath, smartshell, smarttime, };
|
|
18
19
|
// third party scope
|
|
19
20
|
import * as typedoc from 'typedoc';
|
|
20
21
|
export { typedoc };
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3BsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYztBQUNkLE9BQU8sS0FBSyxJQUFJLE1BQU0sTUFBTSxDQUFDO0FBRTdCLE9BQU8sRUFBRSxJQUFJLEVBQUUsQ0FBQztBQUVoQixrQkFBa0I7QUFDbEIsT0FBTyxLQUFLLFFBQVEsTUFBTSxzQkFBc0IsQ0FBQztBQUNqRCxPQUFPLEtBQUssSUFBSSxNQUFNLGtCQUFrQixDQUFDO0FBQ3pDLE9BQU8sS0FBSyxPQUFPLE1BQU0scUJBQXFCLENBQUM7QUFDL0MsT0FBTyxLQUFLLFFBQVEsTUFBTSxzQkFBc0IsQ0FBQztBQUNqRCxPQUFPLEtBQUssVUFBVSxNQUFNLHdCQUF3QixDQUFDO0FBQ3JELE9BQU8sS0FBSyxTQUFTLE1BQU0sdUJBQXVCLENBQUM7QUFDbkQsT0FBTyxLQUFLLFFBQVEsTUFBTSxzQkFBc0IsQ0FBQztBQUNqRCxPQUFPLEtBQUssYUFBYSxNQUFNLDJCQUEyQixDQUFDO0FBQzNELE9BQU8sS0FBSyxRQUFRLE1BQU0sc0JBQXNCLENBQUM7QUFDakQsT0FBTyxLQUFLLHdCQUF3QixNQUFNLHdDQUF3QyxDQUFDO0FBQ25GLE9BQU8sS0FBSyxTQUFTLE1BQU0sdUJBQXVCLENBQUM7QUFDbkQsT0FBTyxLQUFLLFVBQVUsTUFBTSx3QkFBd0IsQ0FBQztBQUNyRCxPQUFPLEtBQUssU0FBUyxNQUFNLHVCQUF1QixDQUFDO0FBRW5ELE9BQU8sRUFDTCxRQUFRLEVBQ1IsSUFBSSxFQUNKLE9BQU8sRUFDUCxRQUFRLEVBQ1IsVUFBVSxFQUNWLFNBQVMsRUFDVCxRQUFRLEVBQ1IsYUFBYSxFQUNiLFFBQVEsRUFDUix3QkFBd0IsRUFDeEIsU0FBUyxFQUNULFVBQVUsRUFDVixTQUFTLEdBQ1YsQ0FBQztBQUVGLG9CQUFvQjtBQUNwQixPQUFPLEtBQUssT0FBTyxNQUFNLFNBQVMsQ0FBQztBQUVuQyxPQUFPLEVBQUUsT0FBTyxFQUFFLENBQUMifQ==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@git.zone/tsdoc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An advanced TypeScript documentation tool using AI to generate and enhance documentation for TypeScript projects.",
|
|
6
6
|
"type": "module",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@push.rocks/smartlog-destination-local": "^9.0.2",
|
|
34
34
|
"@push.rocks/smartpath": "^5.0.18",
|
|
35
35
|
"@push.rocks/smartshell": "^3.0.5",
|
|
36
|
+
"@push.rocks/smarttime": "^4.0.6",
|
|
36
37
|
"typedoc": "^0.26.0",
|
|
37
38
|
"typescript": "^5.5.2"
|
|
38
39
|
},
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface INextCommitObject {
|
|
|
6
6
|
recommendedNextVersionLevel: 'fix' | 'feat' | 'BREAKING CHANGE'; // the recommended next version level of the project
|
|
7
7
|
recommendedNextVersionScope: string; // the recommended scope name of the next version, like "core" or "cli", or specific class names.
|
|
8
8
|
recommendedNextVersionMessage: string; // the commit message. Don't put fix() feat() or BREAKING CHANGE in the message. Please just the message itself.
|
|
9
|
+
recommendedNextVersionDetauls: string[]; // detailed bullet points for the changelog
|
|
9
10
|
recommendedNextVersion: string; // the recommended next version of the project, x.x.x
|
|
10
11
|
changelog?: string; // the changelog for the next version
|
|
11
12
|
}
|
|
@@ -22,7 +23,10 @@ export class Commit {
|
|
|
22
23
|
public async buildNextCommitObject(): Promise<INextCommitObject> {
|
|
23
24
|
const smartgitInstance = new plugins.smartgit.Smartgit();
|
|
24
25
|
await smartgitInstance.init();
|
|
25
|
-
const gitRepo = await plugins.smartgit.GitRepo.fromOpeningRepoDir(
|
|
26
|
+
const gitRepo = await plugins.smartgit.GitRepo.fromOpeningRepoDir(
|
|
27
|
+
smartgitInstance,
|
|
28
|
+
this.projectDir
|
|
29
|
+
);
|
|
26
30
|
const diffString = await gitRepo.getUncommittedDiff();
|
|
27
31
|
const projectContext = new ProjectContext(this.projectDir);
|
|
28
32
|
let contextString = await projectContext.update();
|
|
@@ -32,7 +36,7 @@ ${contextString}
|
|
|
32
36
|
Below is the diff of the uncommitted changes. If nothing is changed, there are no changes:
|
|
33
37
|
|
|
34
38
|
${diffString || 'No changes.'}
|
|
35
|
-
|
|
39
|
+
`;
|
|
36
40
|
|
|
37
41
|
let result = await this.aiDocsRef.openaiInstance.chat({
|
|
38
42
|
systemMessage: `
|
|
@@ -46,10 +50,12 @@ Important: Answer only in valid JSON.
|
|
|
46
50
|
Your answer should be parseable with JSON.parse() without modifying anything.
|
|
47
51
|
|
|
48
52
|
Here is the structure of the JSON you should return:
|
|
49
|
-
|
|
53
|
+
|
|
54
|
+
interface {
|
|
50
55
|
recommendedNextVersionLevel: 'fix' | 'feat' | 'BREAKING CHANGE'; // the recommended next version level of the project
|
|
51
56
|
recommendedNextVersionScope: string; // the recommended scope name of the next version, like "core" or "cli", or specific class names.
|
|
52
57
|
recommendedNextVersionMessage: string; // the commit message. Don't put fix() feat() or BREAKING CHANGE in the message. Please just the message itself.
|
|
58
|
+
recommendedNextVersionDetails: string[]; // detailed bullet points for the changelog
|
|
53
59
|
recommendedNextVersion: string; // the recommended next version of the project, x.x.x
|
|
54
60
|
}
|
|
55
61
|
|
|
@@ -62,7 +68,9 @@ Also you are given a diff
|
|
|
62
68
|
});
|
|
63
69
|
|
|
64
70
|
// console.log(result.message);
|
|
65
|
-
const resultObject: INextCommitObject = JSON.parse(
|
|
71
|
+
const resultObject: INextCommitObject = JSON.parse(
|
|
72
|
+
result.message.replace('```json', '').replace('```', '')
|
|
73
|
+
);
|
|
66
74
|
|
|
67
75
|
// lets build the changelog based on that
|
|
68
76
|
const commitMessages = await gitRepo.getAllCommitMessages();
|
|
@@ -71,31 +79,43 @@ Also you are given a diff
|
|
|
71
79
|
if (await plugins.smartfile.fs.fileExists(previousChangelogPath)) {
|
|
72
80
|
previousChangelog = await plugins.smartfile.SmartFile.fromFilePath(previousChangelogPath);
|
|
73
81
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
|
|
83
|
+
if (!previousChangelog) {
|
|
84
|
+
let result2 = await this.aiDocsRef.openaiInstance.chat({
|
|
85
|
+
messageHistory: [],
|
|
86
|
+
systemMessage: `
|
|
87
|
+
You are building a changelog.md file for the project.
|
|
78
88
|
Omit commits and versions that lack relevant changes.
|
|
79
89
|
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
A changelog entry should look like this:
|
|
91
|
+
|
|
92
|
+
## yyyy-mm-dd - x.x.x - scope here
|
|
93
|
+
main descriptiom here
|
|
94
|
+
- detailed bullet points follow
|
|
95
|
+
|
|
96
|
+
You are given:
|
|
82
97
|
* the commit messages of the project
|
|
83
98
|
|
|
84
|
-
Only return the changelog file, so it can be written directly to changelog.md
|
|
99
|
+
Only return the changelog file, so it can be written directly to changelog.md`,
|
|
100
|
+
userMessage: `
|
|
101
|
+
Here are the commit messages:
|
|
85
102
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
103
|
+
${commitMessages.join('\n')}
|
|
104
|
+
`,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
previousChangelog = await plugins.smartfile.SmartFile.fromString(previousChangelogPath, result2.message, 'utf8');
|
|
108
|
+
}
|
|
92
109
|
|
|
93
|
-
|
|
110
|
+
let oldChangelog = previousChangelog.contents.toString().replace('# Changelog\n\n', '');
|
|
111
|
+
let newDateString = new plugins.smarttime.ExtendedDate().exportToEuropeanDate();
|
|
112
|
+
let newChangelog = `# Changelog\n\n${
|
|
113
|
+
`## ${newDateString} - {{nextVersion}} - {{nextVersionScope}}
|
|
114
|
+
{{nextVersionMessage}}
|
|
115
|
+
{{nextVersionDetails}}
|
|
116
|
+
`}\n\n${oldChangelog}\n`;
|
|
117
|
+
resultObject.changelog = newChangelog;
|
|
94
118
|
|
|
95
|
-
${commitMessages.join('\n\n')}
|
|
96
|
-
`
|
|
97
|
-
})
|
|
98
|
-
resultObject.changelog = result2.message;
|
|
99
119
|
return resultObject;
|
|
100
120
|
}
|
|
101
121
|
}
|
package/ts/logging.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
+
import { commitinfo } from './00_commitinfo_data.js';
|
|
1
2
|
import * as plugins from './plugins.js';
|
|
2
3
|
|
|
3
|
-
export const logger =
|
|
4
|
-
logContext: {
|
|
5
|
-
company: 'Some Company',
|
|
6
|
-
companyunit: 'Some CompanyUnit',
|
|
7
|
-
containerName: 'Some Containername',
|
|
8
|
-
environment: 'local',
|
|
9
|
-
runtime: 'node',
|
|
10
|
-
zone: 'gitzone',
|
|
11
|
-
},
|
|
12
|
-
minimumLogLevel: 'silly',
|
|
13
|
-
});
|
|
4
|
+
export const logger = plugins.smartlog.Smartlog.createForCommitinfo(commitinfo);
|
|
14
5
|
|
|
15
6
|
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
package/ts/plugins.ts
CHANGED
|
@@ -16,6 +16,7 @@ import * as smartlog from '@push.rocks/smartlog';
|
|
|
16
16
|
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
|
|
17
17
|
import * as smartpath from '@push.rocks/smartpath';
|
|
18
18
|
import * as smartshell from '@push.rocks/smartshell';
|
|
19
|
+
import * as smarttime from '@push.rocks/smarttime';
|
|
19
20
|
|
|
20
21
|
export {
|
|
21
22
|
npmextra,
|
|
@@ -30,6 +31,7 @@ export {
|
|
|
30
31
|
smartlogDestinationLocal,
|
|
31
32
|
smartpath,
|
|
32
33
|
smartshell,
|
|
34
|
+
smarttime,
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
// third party scope
|