Skip to content

feat: NPM registry package for garden #5087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Prev Previous commit
Next Next commit
improvement: set node options; ensure static dir
The `garden` CLI requires a `static` dir to be in proximate location to
its run path. It also requires some Node options set for performance
reasons. We can do both of these within the `garden` CLI shell script.

By hiding these options behind an environment flag, the Pkg `garden` we
currently vend is unaffected.
  • Loading branch information
worldofgeese committed Sep 13, 2023
commit edce41d5ac44cd08a63e3383fc655cb240cc36be
19 changes: 19 additions & 0 deletions cli/bin/garden
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
#!/usr/bin/env node
const path = require('path');

process.env.NODE_OPTIONS = "max-old-space-size=4096 max-semi-space-size=64";
process.env.STATIC_DIR = path.join(__dirname, '..', 'static');

const fs = require('fs');
const exec = require('child_process').exec;

const gitDir = path.join(process.env.STATIC_DIR, '.git');

if (!fs.existsSync(gitDir)) {
exec(`git init ${process.env.STATIC_DIR}`, (error, stdout, stderr) => {
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a little early in the code to call git init; Also if we generally call git init on the static directory if it isn't a git repository yet (until we fixed #4477) we also fix a windows issue (#5030 and #2614)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stefreak, where would you move this call?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should finalize and merge #5120 before merging this, so we don't have to call it at all.

if (error) {
console.error(`Error: ${error.message}`);
}
if (stderr) {
console.error(`Stderr: ${stderr}`);
}
});
}

if (process.env.GARDEN_ENABLE_PROFILING === "1" || process.env.GARDEN_ENABLE_PROFILING === "true") {
// Patch require to profile module loading
Expand Down
2 changes: 1 addition & 1 deletion core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const defaultGitScanMode: GitScanMode = "subtree"

export const GARDEN_CORE_ROOT = isPkg ? resolve(process.execPath, "..") : resolve(__dirname, "..", "..")
export const GARDEN_CLI_ROOT = isPkg ? resolve(process.execPath, "..") : resolve(GARDEN_CORE_ROOT, "..", "cli")
export const STATIC_DIR = isPkg ? resolve(process.execPath, "..", "static") : resolve(GARDEN_CORE_ROOT, "..", "static")
export const STATIC_DIR = process.env.STATIC_DIR || (isPkg ? resolve(process.execPath, "..", "static") : resolve(GARDEN_CORE_ROOT, "..", "static"));
export const DEFAULT_GARDEN_DIR_NAME = ".garden"
export const MUTAGEN_DIR_NAME = "mutagen"
export const LOGS_DIR_NAME = "logs"
Expand Down
1 change: 0 additions & 1 deletion plugins/jib/.prettierrc.json

This file was deleted.

8 changes: 8 additions & 0 deletions plugins/jib/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arrowParens": "always",
"printWidth": 120,
"quoteProps": "consistent",
"semi": false,
"trailingComma": "es5",
"tabWidth": 2
}
1 change: 0 additions & 1 deletion sdk/.prettierrc.json

This file was deleted.

8 changes: 8 additions & 0 deletions sdk/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"arrowParens": "always",
"printWidth": 120,
"quoteProps": "consistent",
"semi": false,
"trailingComma": "es5",
"tabWidth": 2
}