Skip to content

Commit

Permalink
feat: module overhaul (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianGlowala authored Apr 16, 2024
1 parent 1130799 commit 65f3b7d
Show file tree
Hide file tree
Showing 29 changed files with 10,228 additions and 8,148 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test-fixtures:
runs-on: ${{ matrix.os }}
timeout-minutes: 10

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [18]

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- run: corepack enable
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Install Playwright
run: pnpm playwright-core install chromium

- name: Build (stub)
run: pnpm dev:prepare

- name: Test (fixtures)
run: pnpm test
22 changes: 0 additions & 22 deletions .github/workflows/test.yaml

This file was deleted.

55 changes: 45 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,49 @@
# Dependencies
node_modules
*.iml
.idea
*.log*
jspm_packages

# Logs
*.log

# Temp directories
.temp
.tmp
.cache

# Generated dirs
dist
.nuxt
.vscode
.DS_STORE
coverage
.output
dist

# Yarn
**/.yarn/cache
**/.yarn/*state*
# VSCode
.vscode

# Intellij idea
*.iml
.idea

# OSX
.DS_Store
.AppleDouble
.LSOverride

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

.env

.pnpm-store
.eslintcache
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

13 changes: 0 additions & 13 deletions DEVELOPER.md

This file was deleted.

17 changes: 17 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'

export default createConfigForNuxt({
features: {
tooling: true,
stylistic: true,
},
dirs: {
src: [
'./playground',
],
},
})
.append(
// your custom flat config here...
)
55 changes: 33 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@
"name": "@nuxtjs/device",
"version": "3.1.1",
"description": "Device detection module for Nuxt",
"repository": "nuxt-modules/device",
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt-modules/device"
},
"license": "MIT",
"author": "Shinji Yamada <dotneet@gmail.com>",
"type": "module",
"exports": {
".": {
"types": "./dist/types.d.ts",
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
},
"./runtime/*": {
"types": "./dist/runtime/*.d.ts",
"import": "./dist/runtime/*.mjs",
"require": "./dist/runtime/*.cjs",
"types": "./dist/runtime/*.d.ts"
"require": "./dist/runtime/*.cjs"
}
},
"main": "./dist/module.cjs",
Expand All @@ -23,31 +27,38 @@
"dist"
],
"scripts": {
"prepack": "nuxt-module-build",
"prepack": "nuxt-module-build build",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
"new-version": "standard-version",
"release": "git push --follow-tags && npm publish",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
"bot-regex": "node scripts/create-bots-regex.js",
"test": "cross-env NUXT_TELEMETRY_DISABLED=1 yarn nuxi prepare test/fixtures && cross-env JITI_ESM_RESOLVE=1 vitest run --dir test"
"lint": "eslint . --cache",
"lint:fix": "eslint . --cache --fix",
"test": "vitest run",
"test:watch": "vitest watch"
},
"dependencies": {
"@nuxt/kit": "^3.7.3",
"defu": "^6.1.2"
"@nuxt/kit": "^3.11.2",
"defu": "^6.1.4"
},
"devDependencies": {
"@nuxt/module-builder": "latest",
"@nuxt/test-utils": "^3.7.3",
"@nuxtjs/eslint-config-typescript": "latest",
"@nuxt/devtools": "^1.1.5",
"@nuxt/eslint-config": "^0.3.6",
"@nuxt/module-builder": "^0.5.5",
"@nuxt/test-utils": "^3.12.0",
"changelogen": "^0.5.5",
"cross-env": "^7.0.3",
"eslint": "latest",
"jsdom": "^20.0.2",
"node-fetch": "^3.3.0",
"nuxt": "^3.7.3",
"playwright": "^1.27.1",
"standard-version": "^9.5.0",
"typescript": "^4.8.3",
"vitest": "^0.34.0"
}
"eslint": "^9.0.0",
"happy-dom": "^14.7.1",
"node-fetch": "^3.3.2",
"nuxt": "^3.11.2",
"playwright": "^1.43.1",
"typescript": "^5.4.5",
"vitest": "^1.5.0"
},
"resolutions": {
"@nuxtjs/device": "workspace:*"
},
"packageManager": "pnpm@9.0.0"
}
7 changes: 3 additions & 4 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import device from '../src/module'

export default defineNuxtConfig({
devtools: { enabled: true },
modules: [
device
'@nuxtjs/device',
],
device: {
// enabled: true,
// defaultUserAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.39 Safari/537.36',
// refreshOnResize: false
}
},
})
11 changes: 10 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"private": true,
"name": "device-module-playground"
"name": "nuxt-device-playground",
"type": "module",
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate"
},
"dependencies": {
"@nuxtjs/device": "workspace:*"
}
}
Loading

0 comments on commit 65f3b7d

Please sign in to comment.