Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remix-flat-routes

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-flat-routes - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

dist/cli.js

12

package.json
{
"name": "remix-flat-routes",
"version": "0.1.1",
"version": "0.2.0",
"description": "Package for generating routes using flat convention",
"main": "dist/src/index.js",
"main": "dist/cli.js",
"bin": {
"migrate-flat-routes": "dist/cli.js"
},
"files": [

@@ -14,7 +17,8 @@ "dist",

"clean": "rimraf dist",
"build": "npm run clean && tsc --project tsconfig.json --module CommonJS --outDir ./dist",
"build": "npm run clean && esbuild --format=cjs --outdir=./dist ./src/*.ts",
"test": "jest",
"contributors:add": "all-contributors add",
"contributors:generate": "all-contributors generate",
"prepublish": "npm run build"
"prepublish": "npm run build",
"migrate": "rm -rf ./app/flat-files ./app/flat-folders && npm run build && node ./dist/cli.js"
},

@@ -21,0 +25,0 @@ "keywords": [

@@ -36,2 +36,17 @@ # Remix Flat Routes

## 🚚 Migrating Existing Routes
You can now migrate your existing routes to the new flat-routes convention. Simply run:
```bash
npx migrate-flat-routes <sourceDir> <targetDir> [options]
Options:
--convention=<convention>
The convention to use when migrating.
flat-files - Migrates all files to a flat directory structure.
flat-folders - Migrates all files to a flat directory structure, but
creates folders for each route.
```
## 🔨 Flat Routes Convention

@@ -38,0 +53,0 @@

@@ -1,3 +0,3 @@

import * as fs from 'fs'
import * as path from 'path'
import { visitFiles } from './util'

@@ -23,3 +23,3 @@ export default function flatRoutes(

// setup parent map
for (let [name, route] of routeMap) {
for (let [_name, route] of routeMap) {
let parentRoute = route.parent

@@ -190,19 +190,2 @@ if (parentRoute) {

function visitFiles(
dir: string,
visitor: (file: string) => void,
baseDir = dir,
) {
for (let filename of fs.readdirSync(dir)) {
let file = path.resolve(dir, filename)
let stat = fs.lstatSync(file)
if (stat.isDirectory()) {
visitFiles(file, visitor, baseDir)
} else if (stat.isFile()) {
visitor(path.relative(baseDir, file))
}
}
}
export { flatRoutes }
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