create-unibest 3.0.9 → 3.0.11
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 +93 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -145,6 +145,7 @@ async function promptUser(projectName, argv = {}) {
|
|
|
145
145
|
|
|
146
146
|
// src/commands/create/generate.ts
|
|
147
147
|
import process3 from "process";
|
|
148
|
+
import { log } from "@clack/prompts";
|
|
148
149
|
|
|
149
150
|
// src/utils/cloneRepo.ts
|
|
150
151
|
import { exec } from "child_process";
|
|
@@ -424,8 +425,7 @@ ${importCode}`);
|
|
|
424
425
|
} else {
|
|
425
426
|
content = `${content}
|
|
426
427
|
<style lang="scss">
|
|
427
|
-
${importCode}
|
|
428
|
-
</style>`;
|
|
428
|
+
${importCode}</style>`;
|
|
429
429
|
}
|
|
430
430
|
writeFileSync2(appVuePath, content);
|
|
431
431
|
}
|
|
@@ -597,7 +597,7 @@ async function generateProject(options) {
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
try {
|
|
600
|
-
|
|
600
|
+
log.success(`\u9879\u76EE${projectName}\u521B\u5EFA\u6210\u529F\uFF01`);
|
|
601
601
|
logger.info("\u4E0B\u4E00\u6B65:");
|
|
602
602
|
logger.info(` cd ${projectName}`);
|
|
603
603
|
logger.info(" pnpm install");
|
|
@@ -611,10 +611,53 @@ async function generateProject(options) {
|
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
// package.json
|
|
614
|
-
var version = "3.0.
|
|
614
|
+
var version = "3.0.11";
|
|
615
|
+
var package_default = {
|
|
616
|
+
name: "create-unibest",
|
|
617
|
+
type: "module",
|
|
618
|
+
version,
|
|
619
|
+
packageManager: "pnpm@9.0.0",
|
|
620
|
+
description: "\u5FEB\u901F\u521B\u5EFAunibest\u9879\u76EE\u7684\u811A\u624B\u67B6\u5DE5\u5177",
|
|
621
|
+
author: "",
|
|
622
|
+
license: "ISC",
|
|
623
|
+
keywords: [],
|
|
624
|
+
main: "dist/index.js",
|
|
625
|
+
bin: {
|
|
626
|
+
best: "bin/index.js",
|
|
627
|
+
"create-unibest": "bin/index.js"
|
|
628
|
+
},
|
|
629
|
+
files: [
|
|
630
|
+
"bin",
|
|
631
|
+
"dist"
|
|
632
|
+
],
|
|
633
|
+
scripts: {
|
|
634
|
+
dev: "cross-env NODE_ENV=development tsup --watch",
|
|
635
|
+
build: "cross-env NODE_ENV=production tsup",
|
|
636
|
+
prepare: "cross-env NODE_ENV=production npm run build",
|
|
637
|
+
start: "cross-env NODE_ENV=development node bin/index.js"
|
|
638
|
+
},
|
|
639
|
+
dependencies: {
|
|
640
|
+
"@clack/prompts": "^0.11.0",
|
|
641
|
+
dayjs: "^1.11.18",
|
|
642
|
+
ejs: "^3.1.10",
|
|
643
|
+
"fs-extra": "^11.3.0",
|
|
644
|
+
kolorist: "^1.8.0",
|
|
645
|
+
minimist: "^1.2.8",
|
|
646
|
+
"node-fetch": "^3.3.2"
|
|
647
|
+
},
|
|
648
|
+
devDependencies: {
|
|
649
|
+
"@types/ejs": "^3.1.5",
|
|
650
|
+
"@types/fs-extra": "^11.0.4",
|
|
651
|
+
"@types/minimist": "^1.2.5",
|
|
652
|
+
"@types/node": "^24.5.0",
|
|
653
|
+
"cross-env": "^7.0.3",
|
|
654
|
+
tsup: "^8.5.0",
|
|
655
|
+
typescript: "^5.9.0"
|
|
656
|
+
}
|
|
657
|
+
};
|
|
615
658
|
|
|
616
659
|
// src/commands/create.ts
|
|
617
|
-
import { intro, log } from "@clack/prompts";
|
|
660
|
+
import { intro, log as log2 } from "@clack/prompts";
|
|
618
661
|
import { bold as bold3, yellow as yellow3, green as green3 } from "kolorist";
|
|
619
662
|
|
|
620
663
|
// src/utils/unibestVersion.ts
|
|
@@ -647,6 +690,48 @@ async function getUnibestVersion() {
|
|
|
647
690
|
}
|
|
648
691
|
var unibestVersion_default = getUnibestVersion;
|
|
649
692
|
|
|
693
|
+
// src/utils/beacon.ts
|
|
694
|
+
import fetch2 from "node-fetch";
|
|
695
|
+
import dayjs from "dayjs";
|
|
696
|
+
import os from "os";
|
|
697
|
+
import crypto from "crypto";
|
|
698
|
+
async function beacon(options) {
|
|
699
|
+
try {
|
|
700
|
+
const unibestVersion = await unibestVersion_default();
|
|
701
|
+
const deviceIdentifier = generateDeviceIdentifier();
|
|
702
|
+
await fetch2("https://ukw0y1.laf.run/create-unibest-v3/beacon", {
|
|
703
|
+
method: "POST",
|
|
704
|
+
headers: {
|
|
705
|
+
"Content-Type": "application/json"
|
|
706
|
+
},
|
|
707
|
+
body: JSON.stringify({
|
|
708
|
+
...options,
|
|
709
|
+
version: unibestVersion,
|
|
710
|
+
cbVersion: package_default.version,
|
|
711
|
+
createAt: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
|
712
|
+
nodeVersion: process.version,
|
|
713
|
+
osPlatform: process.platform,
|
|
714
|
+
cpuModel: os.cpus()[0]?.model || "unknown",
|
|
715
|
+
osRelease: os.release(),
|
|
716
|
+
totalMem: Math.round(os.totalmem() / (1024 * 1024 * 1024)),
|
|
717
|
+
// 四舍五入为整数 GB
|
|
718
|
+
cpuArch: process.arch,
|
|
719
|
+
uuid: deviceIdentifier
|
|
720
|
+
// 添加设备唯一标识符
|
|
721
|
+
})
|
|
722
|
+
});
|
|
723
|
+
debug("Beacon sent successfully");
|
|
724
|
+
} catch (error) {
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
function generateDeviceIdentifier() {
|
|
728
|
+
const deviceInfo = [os.cpus()[0]?.model || "", os.totalmem().toString(), os.platform(), os.userInfo().username].join(
|
|
729
|
+
"|"
|
|
730
|
+
);
|
|
731
|
+
const hash = crypto.createHash("sha256").update(deviceInfo).digest("hex");
|
|
732
|
+
return hash;
|
|
733
|
+
}
|
|
734
|
+
|
|
650
735
|
// src/commands/create.ts
|
|
651
736
|
async function createCommand(args) {
|
|
652
737
|
const projectName = args._[1];
|
|
@@ -655,16 +740,16 @@ async function createCommand(args) {
|
|
|
655
740
|
if (projectName) {
|
|
656
741
|
const errorMessage = checkProjectNameExistAndValidate(projectName);
|
|
657
742
|
if (errorMessage) {
|
|
658
|
-
|
|
743
|
+
log2.error(errorMessage);
|
|
659
744
|
process.exit(1);
|
|
660
745
|
}
|
|
661
746
|
}
|
|
662
747
|
try {
|
|
663
748
|
const projectOptions = await promptUser(projectName, args);
|
|
664
749
|
await generateProject(projectOptions);
|
|
665
|
-
|
|
750
|
+
beacon(projectOptions);
|
|
666
751
|
} catch (error) {
|
|
667
|
-
|
|
752
|
+
log2.error(`\u521B\u5EFA\u9879\u76EE\u5931\u8D25: ${error.message}`);
|
|
668
753
|
process.exit(1);
|
|
669
754
|
}
|
|
670
755
|
}
|