@svton/cli 1.0.4 → 1.0.5
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/index.js +10 -4
- package/dist/index.mjs +10 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -171,8 +171,14 @@ async function replacePackageNames(directory, config) {
|
|
|
171
171
|
for (const filePath of filesToUpdate) {
|
|
172
172
|
try {
|
|
173
173
|
let content = await import_fs_extra.default.readFile(filePath, "utf8");
|
|
174
|
-
content = content.replace(/@svton\//g, `${orgName}/`).replace(/community-next/g, projectName).replace(/community-helper/g, projectName).replace(/社区助手/g, projectName);
|
|
175
|
-
|
|
174
|
+
content = content.replace(/\{\{ORG_NAME\}\}/g, orgName).replace(/\{\{PROJECT_NAME\}\}/g, projectName).replace(/@svton\//g, `${orgName}/`).replace(/community-next/g, projectName).replace(/community-helper/g, projectName).replace(/社区助手/g, projectName);
|
|
175
|
+
if (filePath.endsWith(".tpl")) {
|
|
176
|
+
const newPath = filePath.replace(/\.tpl$/, "");
|
|
177
|
+
await import_fs_extra.default.writeFile(newPath, content);
|
|
178
|
+
await import_fs_extra.default.remove(filePath);
|
|
179
|
+
} else {
|
|
180
|
+
await import_fs_extra.default.writeFile(filePath, content);
|
|
181
|
+
}
|
|
176
182
|
} catch (error) {
|
|
177
183
|
logger.debug(`Failed to update file ${filePath}: ${error}`);
|
|
178
184
|
}
|
|
@@ -188,7 +194,7 @@ async function findFilesToUpdate(directory) {
|
|
|
188
194
|
await traverse(fullPath);
|
|
189
195
|
} else if (entry.isFile()) {
|
|
190
196
|
const ext = import_path.default.extname(entry.name);
|
|
191
|
-
const shouldUpdate = [".json", ".ts", ".tsx", ".js", ".jsx", ".md", ".yaml", ".yml", ".env.example"].includes(ext);
|
|
197
|
+
const shouldUpdate = [".json", ".ts", ".tsx", ".js", ".jsx", ".md", ".yaml", ".yml", ".env.example", ".tpl"].includes(ext) || entry.name.endsWith(".tpl");
|
|
192
198
|
if (shouldUpdate) {
|
|
193
199
|
files.push(fullPath);
|
|
194
200
|
}
|
|
@@ -748,7 +754,7 @@ async function createProjectFromTemplate(config) {
|
|
|
748
754
|
}
|
|
749
755
|
|
|
750
756
|
// package.json
|
|
751
|
-
var version = "1.0.
|
|
757
|
+
var version = "1.0.5";
|
|
752
758
|
|
|
753
759
|
// src/index.ts
|
|
754
760
|
async function cli() {
|
package/dist/index.mjs
CHANGED
|
@@ -144,8 +144,14 @@ async function replacePackageNames(directory, config) {
|
|
|
144
144
|
for (const filePath of filesToUpdate) {
|
|
145
145
|
try {
|
|
146
146
|
let content = await fs.readFile(filePath, "utf8");
|
|
147
|
-
content = content.replace(/@svton\//g, `${orgName}/`).replace(/community-next/g, projectName).replace(/community-helper/g, projectName).replace(/社区助手/g, projectName);
|
|
148
|
-
|
|
147
|
+
content = content.replace(/\{\{ORG_NAME\}\}/g, orgName).replace(/\{\{PROJECT_NAME\}\}/g, projectName).replace(/@svton\//g, `${orgName}/`).replace(/community-next/g, projectName).replace(/community-helper/g, projectName).replace(/社区助手/g, projectName);
|
|
148
|
+
if (filePath.endsWith(".tpl")) {
|
|
149
|
+
const newPath = filePath.replace(/\.tpl$/, "");
|
|
150
|
+
await fs.writeFile(newPath, content);
|
|
151
|
+
await fs.remove(filePath);
|
|
152
|
+
} else {
|
|
153
|
+
await fs.writeFile(filePath, content);
|
|
154
|
+
}
|
|
149
155
|
} catch (error) {
|
|
150
156
|
logger.debug(`Failed to update file ${filePath}: ${error}`);
|
|
151
157
|
}
|
|
@@ -161,7 +167,7 @@ async function findFilesToUpdate(directory) {
|
|
|
161
167
|
await traverse(fullPath);
|
|
162
168
|
} else if (entry.isFile()) {
|
|
163
169
|
const ext = path.extname(entry.name);
|
|
164
|
-
const shouldUpdate = [".json", ".ts", ".tsx", ".js", ".jsx", ".md", ".yaml", ".yml", ".env.example"].includes(ext);
|
|
170
|
+
const shouldUpdate = [".json", ".ts", ".tsx", ".js", ".jsx", ".md", ".yaml", ".yml", ".env.example", ".tpl"].includes(ext) || entry.name.endsWith(".tpl");
|
|
165
171
|
if (shouldUpdate) {
|
|
166
172
|
files.push(fullPath);
|
|
167
173
|
}
|
|
@@ -721,7 +727,7 @@ async function createProjectFromTemplate(config) {
|
|
|
721
727
|
}
|
|
722
728
|
|
|
723
729
|
// package.json
|
|
724
|
-
var version = "1.0.
|
|
730
|
+
var version = "1.0.5";
|
|
725
731
|
|
|
726
732
|
// src/index.ts
|
|
727
733
|
async function cli() {
|