@doyuli/kits-core 0.1.1 → 0.1.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/LICENSE +20 -20
- package/README.md +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -12
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 doyuli
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 doyuli
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
### Kits-Core
|
|
2
|
-
|
|
3
|
-
Provides basic capabilities for creating templates
|
|
1
|
+
### Kits-Core
|
|
2
|
+
|
|
3
|
+
Provides basic capabilities for creating templates
|
package/dist/index.d.ts
CHANGED
|
@@ -49,4 +49,4 @@ declare function unwrapPrompt<T>(maybeCancelPromise: Promise<T | symbol>): Promi
|
|
|
49
49
|
declare function renderTemplate(src: string, dest: string): void;
|
|
50
50
|
declare function renderFile(root: string, fileName: string, content: string): void;
|
|
51
51
|
//#endregion
|
|
52
|
-
export { PromptResult, canSkipEmptying, dotGitDirectoryState, emptyDir, getCommand, getPackageManager, postOrderDirectoryTraverse, preOrderDirectoryTraverse, renderFile, renderTemplate, setupProject, setupPrompts, unwrapPrompt };
|
|
52
|
+
export { type PromptResult, canSkipEmptying, dotGitDirectoryState, emptyDir, getCommand, getPackageManager, postOrderDirectoryTraverse, preOrderDirectoryTraverse, renderFile, renderTemplate, setupProject, setupPrompts, unwrapPrompt };
|
package/dist/index.js
CHANGED
|
@@ -91,13 +91,12 @@ function deepMerge(target, source) {
|
|
|
91
91
|
}
|
|
92
92
|
function sortDependencies(packageJson) {
|
|
93
93
|
const sorted = {};
|
|
94
|
-
const
|
|
94
|
+
for (const depType of [
|
|
95
95
|
"dependencies",
|
|
96
96
|
"devDependencies",
|
|
97
97
|
"peerDependencies",
|
|
98
98
|
"optionalDependencies"
|
|
99
|
-
]
|
|
100
|
-
for (const depType of depTypes) if (packageJson[depType]) {
|
|
99
|
+
]) if (packageJson[depType]) {
|
|
101
100
|
sorted[depType] = {};
|
|
102
101
|
Object.keys(packageJson[depType]).sort().forEach((name) => {
|
|
103
102
|
sorted[depType][name] = packageJson[depType][name];
|
|
@@ -131,23 +130,17 @@ function renderTemplate(src, dest) {
|
|
|
131
130
|
}
|
|
132
131
|
const filename = path.basename(src);
|
|
133
132
|
if (filename === "package.json" && fs.existsSync(dest)) {
|
|
134
|
-
const
|
|
135
|
-
const newPackage = JSON.parse(fs.readFileSync(src, "utf8"));
|
|
136
|
-
const pkg = sortDependencies(deepMerge(existing, newPackage));
|
|
133
|
+
const pkg = sortDependencies(deepMerge(JSON.parse(fs.readFileSync(dest, "utf8")), JSON.parse(fs.readFileSync(src, "utf8"))));
|
|
137
134
|
fs.writeFileSync(dest, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
138
135
|
return;
|
|
139
136
|
}
|
|
140
137
|
if (filename === "extensions.json" && fs.existsSync(dest)) {
|
|
141
|
-
const
|
|
142
|
-
const newExtensions = JSON.parse(fs.readFileSync(src, "utf8"));
|
|
143
|
-
const extensions = deepMerge(existing, newExtensions);
|
|
138
|
+
const extensions = deepMerge(JSON.parse(fs.readFileSync(dest, "utf8")), JSON.parse(fs.readFileSync(src, "utf8")));
|
|
144
139
|
fs.writeFileSync(dest, `${JSON.stringify(extensions, null, 2)}\n`);
|
|
145
140
|
return;
|
|
146
141
|
}
|
|
147
142
|
if (filename === "settings.json" && fs.existsSync(dest)) {
|
|
148
|
-
const
|
|
149
|
-
const newSettings = JSON.parse(fs.readFileSync(src, "utf8"));
|
|
150
|
-
const settings = deepMerge(existing, newSettings);
|
|
143
|
+
const settings = deepMerge(JSON.parse(fs.readFileSync(dest, "utf8")), JSON.parse(fs.readFileSync(src, "utf8")));
|
|
151
144
|
fs.writeFileSync(dest, `${JSON.stringify(settings, null, 2)}\n`);
|
|
152
145
|
return;
|
|
153
146
|
}
|