@intend-it/cli 1.1.1 → 1.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/dist/index.js +36 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -174,14 +174,45 @@ async function initCommand(args) {
|
|
|
174
174
|
text: warn(error2.message)
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
+
const typesPath = join2(directory, "src", "types.ts");
|
|
178
|
+
if (!existsSync2(typesPath)) {
|
|
179
|
+
const typesContent = `export interface User {
|
|
180
|
+
name: string;
|
|
181
|
+
id: number;
|
|
182
|
+
createdAt: Date;
|
|
183
|
+
}`;
|
|
184
|
+
writeFileSync2(typesPath, typesContent, "utf-8");
|
|
185
|
+
console.log(bullet(`${dim("src/types.ts")} ${dim("(typescript definition)")}`));
|
|
186
|
+
}
|
|
177
187
|
const examplePath = join2(srcDir, "example.intent");
|
|
178
188
|
if (!existsSync2(examplePath)) {
|
|
179
|
-
const exampleContent = `
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
189
|
+
const exampleContent = `import { User } from "../types";
|
|
190
|
+
|
|
191
|
+
export intent CreateUser(name: string) -> User {
|
|
192
|
+
step "Generate a random ID" => const id
|
|
193
|
+
step "Create a User object with name, id, and current date" => const user
|
|
194
|
+
return user
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export entry intent Main() -> void {
|
|
198
|
+
step "Call CreateUser with name 'Intender'" => const user
|
|
199
|
+
step "Log 'Created user:' and the user object to console"
|
|
200
|
+
}
|
|
201
|
+
`;
|
|
183
202
|
writeFileSync2(examplePath, exampleContent, "utf-8");
|
|
184
|
-
console.log(bullet(`${dim("src/intents/example.intent")} ${dim("(example)")}`));
|
|
203
|
+
console.log(bullet(`${dim("src/intents/example.intent")} ${dim("(example intent)")}`));
|
|
204
|
+
}
|
|
205
|
+
const gitignorePath = join2(directory, ".gitignore");
|
|
206
|
+
if (!existsSync2(gitignorePath)) {
|
|
207
|
+
const gitignoreContent = `node_modules/
|
|
208
|
+
dist/
|
|
209
|
+
out/
|
|
210
|
+
.intend/
|
|
211
|
+
.env
|
|
212
|
+
.DS_Store
|
|
213
|
+
`;
|
|
214
|
+
writeFileSync2(gitignorePath, gitignoreContent, "utf-8");
|
|
215
|
+
console.log(bullet(`${dim(".gitignore")} ${dim("(git config)")}`));
|
|
185
216
|
}
|
|
186
217
|
newline();
|
|
187
218
|
printSuccess("Project initialized");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intend-it/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "CLI for the Intend programming language",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@intend-it/parser": "^1.1.
|
|
33
|
-
"@intend-it/core": "^2.0.
|
|
32
|
+
"@intend-it/parser": "^1.1.2",
|
|
33
|
+
"@intend-it/core": "^2.0.2",
|
|
34
34
|
"picocolors": "^1.1.1",
|
|
35
35
|
"ora": "^8.1.1"
|
|
36
36
|
},
|