Skip to content
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

feat: add detect-framework command #401

Merged
merged 3 commits into from
Mar 22, 2025
Merged

feat: add detect-framework command #401

merged 3 commits into from
Mar 22, 2025

Conversation

rmarescu
Copy link
Member

@rmarescu rmarescu commented Mar 21, 2025

Note

Experimental feature

Ref: #375 (comment)

New commad npx shortest detect-framework

Generates .shortest/project.json with framework information about the project/repo.

data is generated via @netlify/framework-info. Future work can improve/simplify if this solution stays.

Sample

{
  "metadata": {
    "timestamp": 1742593873821,
    "version": 1,
    "git": {
      "branch": "rmarescu/framework",
      "commit": "995e002ed7ff7e5375ccd4a3258df06a5dced845"
    }
  },
  "data": [
    {
      "id": "next",
      "name": "Next.js",
      "package": {
        "name": "next",
        "version": "15.0.0-canary.152"
      },
      "category": "static_site_generator",
      "dev": {
        "commands": [
          "npm run dev",
          "npm run start",
          "npm run build"
        ],
        "port": 3000,
        "pollingStrategies": [
          {
            "name": "TCP"
          }
        ]
      },
      "build": {
        "commands": [
          "next build"
        ],
        "directory": ".next"
      },
      "env": {},
      "logo": {
        "default": "https://framework-info.netlify.app/logos/nextjs/light.svg",
        "light": "https://framework-info.netlify.app/logos/nextjs/light.svg",
        "dark": "https://framework-info.netlify.app/logos/nextjs/dark.svg"
      },
      "plugins": [
        "@netlify/plugin-nextjs"
      ]
    }
  ]
}

@rmarescu rmarescu self-assigned this Mar 21, 2025
Copy link

vercel bot commented Mar 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
shortest ⬜️ Ignored (Inspect) Visit Preview Mar 22, 2025 5:51am

@rmarescu rmarescu marked this pull request as ready for review March 22, 2025 05:53
metadata: {
timestamp: Date.now(),
version: VERSION,
git: await getGitInfo(),
Copy link
Member Author

Choose a reason for hiding this comment

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

This could be used to invalidate cache in the future, with a simple check against current branch / last commit.

}

try {
const VERSION = 1;
Copy link
Member Author

Choose a reason for hiding this comment

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

Useful if the entire structure changes, can be used to invalidate cache.

@rmarescu rmarescu merged commit 9a34a17 into main Mar 22, 2025
6 checks passed
@rmarescu rmarescu deleted the rmarescu/framework branch March 22, 2025 05:57
@rmarescu rmarescu added this to the v0.4.8 milestone Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant