secptrum-ui
Advanced tools
Comparing version 1.1.56 to 1.1.57
{ | ||
"name": "secptrum-ui", | ||
"version": "1.1.56", | ||
"version": "1.1.57", | ||
"description": "**SecptrumUI** A comprehensive React component library", | ||
@@ -36,2 +36,5 @@ "homepage": "https://secptrumui.vercel.app", | ||
}, | ||
"bin": { | ||
"init": "./scripts/next-setup.js" | ||
}, | ||
"keywords": [ | ||
@@ -38,0 +41,0 @@ "react", |
#!/usr/bin/env node | ||
const { Command } = require("commander"); | ||
const { existsSync, mkdirSync, writeFileSync } = require("fs-extra"); | ||
const { join } = require("path"); | ||
const { Command } = require('commander'); | ||
const { existsSync, mkdirSync, writeFileSync } = require('fs-extra'); | ||
const { join } = require('path'); | ||
const program = new Command(); | ||
program.version("1.0.0").description("Setup SecptrumUI for Next.js"); | ||
program.version('1.0.0').description('Setup SecptrumUI for Next.js'); | ||
program | ||
.command("setup") | ||
.description("Setup Next.js configuration for SecptrumUI") | ||
.command('setup') | ||
.description('Setup Next.js configuration for SecptrumUI') | ||
.action(() => { | ||
const isTypeScript = existsSync(join(process.cwd(), "tsconfig.json")); | ||
const isTypeScript = existsSync(join(process.cwd(), 'tsconfig.json')); | ||
const registryContentJs = `'use client'; | ||
import React, { useState } from 'react'; | ||
import { useServerInsertedHTML } from 'next/navigation'; | ||
import { ServerStyleSheet, StyleSheetManager } from 'styled-components'; | ||
import { useServerInsertedHTML } from "next/navigation"; | ||
import { renderStyles, StyleSheetManager } from "styled-chroma"; | ||
export default function StyledComponentsRegistry({ children }) { | ||
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet()); | ||
const SecptrumUIRegistry = ({ children }) => { | ||
useServerInsertedHTML(() => { | ||
const styles = styledComponentsStyleSheet.getStyleElement(); | ||
styledComponentsStyleSheet.instance.clearTag(); | ||
return <>{styles}</>; | ||
const styles = renderStyles(); | ||
StyleSheetManager.clearStyles(); | ||
return <style dangerouslySetInnerHTML={{ __html: styles }} />; | ||
}); | ||
if (typeof window !== 'undefined') return <>{children}</>; | ||
if (typeof window !== "undefined") return <>{children}</>; | ||
return ( | ||
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}> | ||
{children} | ||
</StyleSheetManager> | ||
); | ||
} | ||
return <>{children}</>; | ||
}; | ||
export default SecptrumUIRegistry; | ||
SecptrumUIRegistry.displayName = "SecptrumUIRegistry"; | ||
`; | ||
@@ -44,37 +40,29 @@ | ||
import React, { useState } from 'react'; | ||
import { useServerInsertedHTML } from 'next/navigation'; | ||
import { ServerStyleSheet, StyleSheetManager } from 'styled-components'; | ||
import { useServerInsertedHTML } from "next/navigation"; | ||
import { renderStyles, StyleSheetManager } from "styled-chroma"; | ||
export default function StyledComponentsRegistry({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
const [styledComponentsStyleSheet] = useState(() => new ServerStyleSheet()); | ||
const SecptrumUIRegistry = ({ children }: { children: React.ReactNode }) => { | ||
useServerInsertedHTML(() => { | ||
const styles = styledComponentsStyleSheet.getStyleElement(); | ||
styledComponentsStyleSheet.instance.clearTag(); | ||
return <>{styles}</>; | ||
const styles = renderStyles(); | ||
StyleSheetManager.clearStyles(); | ||
return <style dangerouslySetInnerHTML={{ __html: styles }} />; | ||
}); | ||
if (typeof window !== 'undefined') return <>{children}</>; | ||
if (typeof window !== "undefined") return <>{children}</>; | ||
return ( | ||
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}> | ||
{children} | ||
</StyleSheetManager> | ||
); | ||
} | ||
return <>{children}</>; | ||
}; | ||
export default SecptrumUIRegistry; | ||
SecptrumUIRegistry.displayName = "SecptrumUIRegistry"; | ||
`; | ||
// Determine paths | ||
const srcPath = join(process.cwd(), "src"); | ||
const srcPath = join(process.cwd(), 'src'); | ||
const libPath = existsSync(srcPath) | ||
? join(srcPath, "lib") | ||
: join(process.cwd(), "lib"); | ||
? join(srcPath, 'lib') | ||
: join(process.cwd(), 'lib'); | ||
const registryPath = join( | ||
libPath, | ||
isTypeScript ? "registry.tsx" : "registry.js" | ||
isTypeScript ? 'registry.tsx' : 'registry.js' | ||
); | ||
@@ -95,7 +83,11 @@ | ||
console.log( | ||
`Created ${isTypeScript ? "registry.tsx" : "registry.js"} in ${libPath}.` | ||
`Created ${ | ||
isTypeScript ? 'registry.tsx' : 'registry.js' | ||
} in ${libPath}.` | ||
); | ||
} else { | ||
console.log( | ||
`${isTypeScript ? "registry.tsx" : "registry.js"} already exists in ${libPath}, skipping.` | ||
`${ | ||
isTypeScript ? 'registry.tsx' : 'registry.js' | ||
} already exists in ${libPath}, skipping.` | ||
); | ||
@@ -102,0 +94,0 @@ } |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1007563
6973