New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

next-list

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-list - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

28

index.js

@@ -7,3 +7,5 @@ #!/usr/bin/env node

const appDirectory = path.join(process.cwd(), 'src/app');
const appDirectory = fs.existsSync(path.join(process.cwd(), 'app'))
? path.join(process.cwd(), 'app')
: path.join(process.cwd(), 'src/app');

@@ -74,3 +76,3 @@ function listRoutes(dir, baseRoute = '') {

default:
return method; // Sin color si no es uno de los anteriores
return method;
}

@@ -85,3 +87,3 @@ }

style: {
head: [], // Personaliza los estilos de la cabecera si lo deseas
head: [],
border: []

@@ -96,3 +98,4 @@ }

.replace(/\((\w+)\)/g, chalk.blue('($1)'));
const fullUrl = `https://localhost:3000${row[2]}`;
const baseUrl = process.env.BASE_URL || process.env.APP_URL || 'https://localhost:3000';
const fullUrl = `${baseUrl}${row[2]}`;
table.push([methodColored, row[1], routeColored, fullUrl]);

@@ -104,8 +107,13 @@ });

console.log('Listing page routes in src/app:');
const routesTable = listRoutes(appDirectory);
renderTable(routesTable);
console.log('Listing routes in src/app:');
const arg = process.argv[2];
console.log('Listing API routes in src/app:');
const apiRoutesTable = listApiRoutes(appDirectory);
renderTable(apiRoutesTable);
if (!arg || arg === 'pages') {
const routesTable = listRoutes(appDirectory);
renderTable(routesTable);
}
if (!arg || arg === 'api') {
const apiRoutesTable = listApiRoutes(appDirectory);
renderTable(apiRoutesTable);
}
{
"name": "next-list",
"version": "1.0.9",
"version": "1.0.10",
"description": "A package to render tables in CLI",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,3 +15,3 @@ # next-list for Next.js 🗺️

![next-list CLI output](https://raw.githubusercontent.com/pablolizardo/next-list/main/main/screenshot.png)
![next-list CLI output](https://imgur.com/a/3ZzqjUl)

@@ -26,6 +26,6 @@ ## Installation 📦

To use `next-list`, you can run the provided npm script from your project root:
To use `next-list`, you can run the provided npm script from your project root with optional arguments to specify what routes to list:
```bash
npm run list
npm run list [pages|api]
```

@@ -41,7 +41,9 @@

If no argument is provided, `next-list` will list both page and API routes. You can specify `pages` to list only page routes or `api` to list only API routes.
### Output Example 📄
The utility will generate two tables:
The utility will generate tables based on the specified argument:
1. **Page Routes:**
1. **Page Routes (if `pages` is specified or no argument is provided):**

@@ -56,3 +58,3 @@ ```

2. **API Routes:**
2. **API Routes (if `api` is specified or no argument is provided):**

@@ -59,0 +61,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc