create-message-kit 1.1.7-beta.19 → 1.1.7-beta.20
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +25 -16
- package/package.json +1 -1
package/index.js
CHANGED
@@ -32,7 +32,9 @@ Powered by XMTP`;
|
|
32
32
|
|
33
33
|
const { templateType, displayName, destDir } = await gatherProjectInfo();
|
34
34
|
|
35
|
+
// Add package.json
|
35
36
|
addPackagejson(destDir, displayName);
|
37
|
+
|
36
38
|
// Create .gitignore
|
37
39
|
createGitignore(destDir);
|
38
40
|
|
@@ -42,9 +44,6 @@ Powered by XMTP`;
|
|
42
44
|
// Create tsconfig.json file
|
43
45
|
createTsconfig(destDir);
|
44
46
|
|
45
|
-
// Replace package.json properties
|
46
|
-
updatePackageJson(destDir, displayName);
|
47
|
-
|
48
47
|
// Wrap up
|
49
48
|
log.success(`Project launched in ${pc.red(destDir)}!`);
|
50
49
|
|
@@ -60,15 +59,32 @@ Powered by XMTP`;
|
|
60
59
|
});
|
61
60
|
|
62
61
|
program.parse(process.argv);
|
62
|
+
|
63
63
|
async function addPackagejson(destDir, name) {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
// Create package.json based on the template
|
65
|
+
const packageTemplate = {
|
66
|
+
name: name,
|
67
|
+
private: true,
|
68
|
+
type: "module",
|
69
|
+
scripts: {
|
70
|
+
build: "tsc",
|
71
|
+
dev: "tsc -w & sleep 1 && node --watch dist/index.js",
|
72
|
+
start: "node dist/index.js",
|
73
|
+
postinstall: "tsc",
|
69
74
|
},
|
70
|
-
|
75
|
+
dependencies: {
|
76
|
+
"@xmtp/message-kit": "workspace:*",
|
77
|
+
},
|
78
|
+
engines: {
|
79
|
+
node: ">=20",
|
80
|
+
},
|
81
|
+
};
|
82
|
+
|
83
|
+
fs.writeJsonSync(resolve(destDir, "package.json"), packageTemplate, {
|
84
|
+
spaces: 2,
|
85
|
+
});
|
71
86
|
}
|
87
|
+
|
72
88
|
async function gatherProjectInfo() {
|
73
89
|
const templateOptions = [
|
74
90
|
{ value: "gm", label: "GM" },
|
@@ -158,13 +174,6 @@ function createTsconfig(destDir) {
|
|
158
174
|
});
|
159
175
|
}
|
160
176
|
|
161
|
-
function updatePackageJson(destDir, name) {
|
162
|
-
const pkgJson = fs.readJsonSync(resolve(destDir, "package.json"));
|
163
|
-
pkgJson.name = name;
|
164
|
-
updateDependenciesToLatest(pkgJson);
|
165
|
-
fs.writeJsonSync(resolve(destDir, "package.json"), pkgJson, { spaces: 2 });
|
166
|
-
}
|
167
|
-
|
168
177
|
function logNextSteps(name) {
|
169
178
|
log.message("Next steps:");
|
170
179
|
log.step(`1. ${pc.red(`cd ./${name}`)} - Navigate to project`);
|