Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"ethers": "^6.13.4",
"fs-extra": "^11.3.0",
"genlayer-js": "^0.16.0",
"giget": "^2.0.0",
"inquirer": "^12.0.0",
"keytar": "^7.9.0",
"node-fetch": "^3.0.0",
Expand Down
19 changes: 9 additions & 10 deletions src/commands/scaffold/new.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import fs from "fs-extra";
import path from "path";
import { fileURLToPath } from "url";
import { downloadTemplate } from "giget";
import { BaseAction } from "../../lib/actions/BaseAction";

export class NewAction extends BaseAction {
private templatePath: string;

constructor() {
super();
const __filename = fileURLToPath(import.meta.url);
const basePath = path.resolve(path.dirname(__filename), "..");
this.templatePath = path.join(basePath, "templates", "default");
}
private readonly templateSource = "github:genlayerlabs/genlayer-project-boilerplate";

async createProject(projectName: string, options: { path: string; overwrite: boolean }) {
const targetPath = path.resolve(options.path, projectName);
Expand All @@ -25,7 +18,13 @@ export class NewAction extends BaseAction {
this.startSpinner(`Creating new GenLayer project: ${projectName}`);

try {
fs.copySync(this.templatePath, targetPath);
await downloadTemplate(this.templateSource, {
dir: targetPath,
force: options.overwrite,
offline: false,
install: false,
});
Comment on lines +21 to +26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Reconsider the hardcoded offline: false setting.

The PR description mentions "built-in caching for faster subsequent scaffolds" as a key benefit, but offline: false explicitly disables offline mode. This means:

  • Users cannot scaffold projects without internet access
  • Cached templates won't be used, contradicting the claimed caching benefit
  • Network failures will always cause the operation to fail

Consider allowing giget to use its default offline behavior or make it configurable:

-      await downloadTemplate(this.templateSource, {
-        dir: targetPath,
-        force: options.overwrite,
-        offline: false,
-        install: false,
-      });
+      await downloadTemplate(this.templateSource, {
+        dir: targetPath,
+        force: options.overwrite,
+        // Let giget handle caching and offline fallback automatically
+        install: false,
+      });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await downloadTemplate(this.templateSource, {
dir: targetPath,
force: options.overwrite,
offline: false,
install: false,
});
await downloadTemplate(this.templateSource, {
dir: targetPath,
force: options.overwrite,
install: false,
});
🤖 Prompt for AI Agents
In src/commands/scaffold/new.ts around lines 21 to 26 the call to
downloadTemplate hardcodes offline: false which disables giget's offline/caching
behavior and prevents scaffolding without network access; change this to respect
a passed-in option or omit the offline property so giget uses its default
behavior—either wire a new CLI flag (e.g., options.offline) and pass that value,
or remove the offline key entirely to allow giget to use its built-in
cache/offline mode, and update any docs/CLI help accordingly.


this.succeedSpinner(`Project "${projectName}" created successfully at ${targetPath}`);
} catch (error) {
this.failSpinner(`Error creating project "${projectName}"`, error);
Expand Down
21 changes: 0 additions & 21 deletions templates/default/LICENSE

This file was deleted.

101 changes: 0 additions & 101 deletions templates/default/README.md

This file was deleted.

Empty file removed templates/default/__init__.py
Empty file.
2 changes: 0 additions & 2 deletions templates/default/app/.env.example

This file was deleted.

24 changes: 0 additions & 24 deletions templates/default/app/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions templates/default/app/.vscode/extensions.json

This file was deleted.

5 changes: 0 additions & 5 deletions templates/default/app/README.md

This file was deleted.

17 changes: 0 additions & 17 deletions templates/default/app/index.html

This file was deleted.

23 changes: 0 additions & 23 deletions templates/default/app/package.json

This file was deleted.

6 changes: 0 additions & 6 deletions templates/default/app/postcss.config.js

This file was deleted.

Binary file removed templates/default/app/public/favicon.png
Binary file not shown.
16 changes: 0 additions & 16 deletions templates/default/app/src/App.vue

This file was deleted.

38 changes: 0 additions & 38 deletions templates/default/app/src/components/Address.vue

This file was deleted.

Loading