Skip to content

Commit

Permalink
Merge branch 'v3' into remove-deprecated-hooks-and-co
Browse files Browse the repository at this point in the history
  • Loading branch information
juliencrn committed Feb 27, 2024
2 parents 3734324 + ebe1137 commit edd3814
Show file tree
Hide file tree
Showing 31 changed files with 51 additions and 37 deletions.
7 changes: 7 additions & 0 deletions .changeset/tame-news-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"eslint-config-custom": major
"usehooks-ts": major
"www": major
---

Move the full workspace into ES Module
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
![npm bundle size](https://img.shields.io/bundlephobia/minzip/usehooks-ts)
![npm](https://img.shields.io/npm/v/usehooks-ts)<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-234-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

<br />
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/www/next.config.mjs → apps/www/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './env.mjs'
import './env.js'

/** @type {import('next').NextConfig} */
const nextConfig = {}
Expand Down
3 changes: 2 additions & 1 deletion apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"name": "www",
"version": "0.2.2",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "pnpm generate && next build && pnpm generate-sitemap",
"generate-sitemap": "rimraf public/sitemap.xml public/robots.txt && next-sitemap --config ./next-sitemap.config.mjs",
"generate-sitemap": "rimraf public/sitemap.xml public/robots.txt && next-sitemap --config ./next-sitemap.config.js",
"start": "next start",
"lint": "next lint && tsc --noEmit",
"clean": "rimraf *.tsbuildinfo .next generated .turbo",
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions apps/www/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"**/*.js",
"**/*.mjs"
"**/*.js"
],
"exclude": ["node_modules"]
}
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"author": "Julien CARON <juliencaron@protonmail.com>",
"homepage": "https://usehooks-ts.com",
"module": "true",
"type": "module",
"keywords": [
"typescript",
"react",
Expand All @@ -19,10 +20,10 @@
"clean": "rimraf .turbo && turbo run clean",
"format": "prettier --write \"**/*.{json,md,mdx,css,scss,yaml,yml}\"",
"lint": "turbo run lint",
"update-testing-issue": "zx ./scripts/updateTestingIssue.mjs",
"update-readme": "zx ./scripts/updateReadme.mjs",
"copy-hooks": "rimraf -rf ./apps/www/generated && zx ./scripts/copyHooks.mjs",
"gen-hook": "turbo gen hook && pnpm format",
"update-testing-issue": "zx ./scripts/updateTestingIssue.js",
"update-readme": "zx ./scripts/updateReadme.js",
"copy-hooks": "rimraf ./apps/www/generated && zx ./scripts/copyHooks.js",
"gen-hook": "turbo gen hook --config \"turbo/generators/config.cts\" && pnpm format",
"changeset": "npx changeset",
"changeset-version": "npx changeset version",
"changeset-publish": "npx changeset publish"
Expand All @@ -32,7 +33,9 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@turbo/gen": "^1.12.4",
"all-contributors-cli": "^6.26.1",
"date-fns": "^3.3.1",
"eslint": "^8.56.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions packages/eslint-config-custom/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const eslintrc = require('./.eslintrc.cjs')

module.exports = eslintrc
3 changes: 0 additions & 3 deletions packages/eslint-config-custom/index.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"private": true,
"version": "1.2.0",
"description": "Base configuration for Eslint",
"main": "index.js",
"main": "index.cjs",
"author": "Julien CARON <juliencaron@protonmail.com>",
"license": "MIT",
"type": "module",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/usehooks-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
![npm bundle size](https://img.shields.io/bundlephobia/minzip/usehooks-ts)
![npm](https://img.shields.io/npm/v/usehooks-ts)<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-234-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

<br />
Expand Down
15 changes: 7 additions & 8 deletions packages/usehooks-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,33 @@
"hooks"
],
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"sideEffects": false,
"scripts": {
"build": "tsup && rm ./dist/index.d.mts",
"build": "tsup && rimraf ./dist/index.d.cts",
"dev": "tsup --watch",
"test": "vitest run",
"test:watch": "vitest",
"clean": "rimraf -rf ./dist .turbo *.tsbuildinfo",
"clean": "rimraf dist .turbo *.tsbuildinfo",
"lint": "eslint './src/**/*.{ts,tsx}' && tsc --noEmit"
},
"devDependencies": {
"@juggle/resize-observer": "^3.4.0",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@turbo/gen": "^1.12.4",
"@types/lodash.debounce": "^4.0.9",
"@types/node": "^20.11.19",
"@types/react": "18.2.57",
"date-fns": "^3.3.1",
"eslint-config-custom": "workspace:*",
"eslint-plugin-jsdoc": "^48.1.0",
"eslint-plugin-tree-shaking": "^1.12.1",
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/copyHooks.mjs → scripts/copyHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { path, fs } from 'zx'

import { isHookFile } from './utils.mjs'
import { isHookFile } from './utils.js'

const hooksDir = path.resolve('./packages/usehooks-ts/src')
const outputDir = path.resolve('./apps/www/generated')
Expand Down
2 changes: 1 addition & 1 deletion scripts/updateReadme.mjs → scripts/updateReadme.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { path, fs } from 'zx'

import { camelToKebabCase, isDemoFile, isHookFile } from './utils.mjs'
import { camelToKebabCase, isDemoFile, isHookFile } from './utils.js'

////////////////////////////////////////////////////////////////////////
// 1. Imperative script that updates the hook list in the README file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { path, fs, $ } from 'zx'

import { isHookFile, isTestFile } from './utils.mjs'
import { isHookFile, isTestFile } from './utils.js'

const GITHUB_REPO = `juliencrn/usehooks-ts`
const GITHUB_ISSUE_PATH = `${GITHUB_REPO}/issues/423`
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { PlopTypes } from '@turbo/gen'
import { format } from 'date-fns'
import path from 'path'

export default function generator(plop: PlopTypes.NodePlopAPI): void {
const usehooksSrcPath = path.resolve('packages/usehooks-ts/src')
plop.setGenerator('hook', {
description: 'Create a post',
prompts: [
Expand All @@ -15,14 +17,14 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
// Create the hook file itself
{
type: 'add',
path: 'src/{{camelCase name}}/{{camelCase name}}.ts',
path: usehooksSrcPath + '/{{camelCase name}}/{{camelCase name}}.ts',
templateFile: 'templates/hook/hook.ts.hbs',
},

// Create the test file
{
type: 'add',
path: 'src/{{camelCase name}}/{{camelCase name}}.test.ts',
path: usehooksSrcPath + '/{{camelCase name}}/{{camelCase name}}.test.ts',
templateFile: 'templates/hook/hook.test.ts.hbs',
},

Expand All @@ -32,28 +34,28 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
date: format(new Date(), 'yyyy-MM-dd'),
},
type: 'add',
path: 'src/{{camelCase name}}/{{camelCase name}}.md',
path: usehooksSrcPath + '/{{camelCase name}}/{{camelCase name}}.md',
templateFile: 'templates/hook/hook.mdx.hbs',
},

// Create the demo react component file
{
type: 'add',
path: 'src/{{camelCase name}}/{{camelCase name}}.demo.tsx',
path: usehooksSrcPath + '/{{camelCase name}}/{{camelCase name}}.demo.tsx',
templateFile: 'templates/hook/hook.demo.tsx.hbs',
},

// Create the hook's index file
{
type: 'add',
path: 'src/{{camelCase name}}/index.ts',
path: usehooksSrcPath + '/{{camelCase name}}/index.ts',
templateFile: 'templates/hook/index.ts.hbs',
},

// Update the global hooks index file
{
type: 'append',
path: 'src/index.ts',
path: usehooksSrcPath + '/index.ts',
templateFile: 'templates/index.ts.hbs',
},
],
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit edd3814

Please sign in to comment.