Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
9fa948ea81
16
.github/actions/setup/action.yml
vendored
Normal file
16
.github/actions/setup/action.yml
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
name: Setup
|
||||
description: Installs Node, Enables Corepack and caches pnpm.
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Enable corepack
|
||||
run: corepack enable
|
||||
shell: bash
|
||||
|
||||
- name: Setup node & pnpm
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: pnpm
|
||||
28
.github/workflows/publish.yaml
vendored
28
.github/workflows/publish.yaml
vendored
|
|
@ -48,32 +48,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Run a build step here
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.1.2
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
- name: Setup (Install Node & pnpm)
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm i --frozen-lockfile
|
||||
|
|
|
|||
9
.github/workflows/release.yaml
vendored
9
.github/workflows/release.yaml
vendored
|
|
@ -14,14 +14,13 @@ jobs:
|
|||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.x
|
||||
- name: Setup (Install Node & pnpm)
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- run: npx changelogithub
|
||||
- run: pnpm dlx changelogithub
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
|
|
|
|||
27
.github/workflows/test.yaml
vendored
27
.github/workflows/test.yaml
vendored
|
|
@ -19,31 +19,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 9.0.5
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
- name: Setup (Install Node & pnpm)
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm i --frozen-lockfile
|
||||
|
|
|
|||
|
|
@ -66,8 +66,10 @@
|
|||
"ofetch": "^1.3.4",
|
||||
"ora": "^8.0.1",
|
||||
"pathe": "^1.1.2",
|
||||
"pkg-types": "^1.1.0",
|
||||
"prompts": "^2.4.2",
|
||||
"radix-vue": "^1.7.3",
|
||||
"semver": "^7.6.0",
|
||||
"ts-morph": "^22.0.0",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"zod": "^3.23.3"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import { z } from 'zod'
|
|||
import { addDependency, addDevDependency } from 'nypm'
|
||||
import { consola } from 'consola'
|
||||
import { colors } from 'consola/utils'
|
||||
import { gte } from 'semver'
|
||||
import { getProjectInfo } from '../utils/get-project-info'
|
||||
import * as templates from '../utils/templates'
|
||||
import {
|
||||
getRegistryBaseColor,
|
||||
|
|
@ -239,6 +241,15 @@ export async function promptForConfig(
|
|||
export async function runInit(cwd: string, config: Config) {
|
||||
const spinner = ora('Initializing project...')?.start()
|
||||
|
||||
// Check in in a Nuxt project.
|
||||
const { isNuxt, shadcnNuxt } = await getProjectInfo()
|
||||
if (isNuxt) {
|
||||
consola.log('')
|
||||
shadcnNuxt
|
||||
? consola.info(`Detected a Nuxt project with 'shadcn-nuxt' v${shadcnNuxt.version}...`)
|
||||
: consola.warn(`Detected a Nuxt project without 'shadcn-nuxt' module. It's recommended to install it.`)
|
||||
}
|
||||
|
||||
// Ensure all resolved paths directories exist.
|
||||
for (const [key, resolvedPath] of Object.entries(config.resolvedPaths)) {
|
||||
// Determine if the path is a file or directory.
|
||||
|
|
@ -299,9 +310,10 @@ export async function runInit(cwd: string, config: Config) {
|
|||
// Install dependencies.
|
||||
const dependenciesSpinner = ora('Installing dependencies...')?.start()
|
||||
|
||||
const deps = PROJECT_DEPENDENCIES.base.concat(
|
||||
config.style === 'new-york' ? ['@radix-icons/vue'] : ['lucide-vue-next'],
|
||||
).filter(Boolean)
|
||||
// Starting from `shadcn-nuxt` version 0.10.4, Base dependencies are handled by the module so no need to re-add them by the CLI
|
||||
const baseDeps = gte(shadcnNuxt?.version || '0.0.0', '0.10.4') ? [] : PROJECT_DEPENDENCIES.base
|
||||
const iconsDep = config.style === 'new-york' ? ['@radix-icons/vue'] : ['lucide-vue-next']
|
||||
const deps = baseDeps.concat(iconsDep).filter(Boolean)
|
||||
|
||||
await Promise.allSettled(
|
||||
[
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
import { existsSync } from 'node:fs'
|
||||
import path from 'pathe'
|
||||
import fs from 'fs-extra'
|
||||
import { readPackageJSON } from 'pkg-types'
|
||||
import type { PackageJson } from 'pkg-types'
|
||||
|
||||
export async function getProjectInfo() {
|
||||
const info = {
|
||||
tsconfig: null,
|
||||
isNuxt: false,
|
||||
shadcnNuxt: undefined,
|
||||
isVueVite: false,
|
||||
srcDir: false,
|
||||
componentsUiDir: false,
|
||||
|
|
@ -15,9 +18,13 @@ export async function getProjectInfo() {
|
|||
try {
|
||||
const tsconfig = await getTsConfig()
|
||||
|
||||
const isNuxt = existsSync(path.resolve('./nuxt.config.js')) || existsSync(path.resolve('./nuxt.config.ts'))
|
||||
const shadcnNuxt = isNuxt ? await getShadcnNuxtInfo() : undefined
|
||||
|
||||
return {
|
||||
tsconfig,
|
||||
isNuxt: existsSync(path.resolve('./nuxt.config.js')) || existsSync(path.resolve('./nuxt.config.ts')),
|
||||
isNuxt,
|
||||
shadcnNuxt,
|
||||
isVueVite: existsSync(path.resolve('./vite.config.js')) || existsSync(path.resolve('./vite.config.ts')),
|
||||
srcDir: existsSync(path.resolve('./src')),
|
||||
srcComponentsUiDir: existsSync(path.resolve('./src/components/ui')),
|
||||
|
|
@ -29,6 +36,18 @@ export async function getProjectInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
async function getShadcnNuxtInfo() {
|
||||
let nuxtModule: PackageJson | undefined
|
||||
try {
|
||||
nuxtModule = await readPackageJSON('shadcn-nuxt')
|
||||
}
|
||||
catch (error) {
|
||||
nuxtModule = undefined
|
||||
}
|
||||
|
||||
return nuxtModule
|
||||
}
|
||||
|
||||
export async function getTsConfig() {
|
||||
try {
|
||||
const tsconfigPath = path.join('tsconfig.json')
|
||||
|
|
|
|||
|
|
@ -36,7 +36,10 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@nuxt/kit": "^3.11.2",
|
||||
"@oxc-parser/wasm": "^0.1.0"
|
||||
"@oxc-parser/wasm": "^0.1.0",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"tailwind-merge": "^2.3.0",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/eslint-config": "^0.3.10",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export default defineNuxtConfig({
|
||||
modules: ['@nuxtjs/tailwindcss', '../src/module'],
|
||||
modules: ['@nuxtjs/tailwindcss', 'shadcn-nuxt'],
|
||||
shadcn: {
|
||||
prefix: 'Ui',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,17 +8,13 @@
|
|||
"generate": "nuxi generate"
|
||||
},
|
||||
"dependencies": {
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.1.1",
|
||||
"embla-carousel": "8.0.0-rc19",
|
||||
"@nuxtjs/tailwindcss": "^6.10.1",
|
||||
"embla-carousel-vue": "8.0.0-rc19",
|
||||
"lucide-vue-next": "^0.276.0",
|
||||
"radix-vue": "^1.7.2",
|
||||
"tailwind-merge": "^2.3.0",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
"lucide-vue-next": "^0.276.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxtjs/tailwindcss": "^6.12.0",
|
||||
"nuxt": "latest"
|
||||
"nuxt": "latest",
|
||||
"shadcn-nuxt": "file:.."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { UTILS } from '../../cli/src/utils/templates'
|
|||
// Module options TypeScript interface definition
|
||||
export interface ModuleOptions {
|
||||
/**
|
||||
* Prefix for all the imported component
|
||||
* Prefix for all the imported component.
|
||||
*/
|
||||
prefix?: string
|
||||
/**
|
||||
|
|
|
|||
2703
pnpm-lock.yaml
2703
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user