Skip to content

Commit

Permalink
test using tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
anicioalexandre committed Sep 30, 2024
1 parent e530331 commit 5fef370
Show file tree
Hide file tree
Showing 18 changed files with 413 additions and 81 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A modularized package system for TSL's frontend baseapp.",
"private": true,
"scripts": {
"build": "turbo run build --filter=./packages/authentication",
"build": "turbo run build --filter=./packages/utils",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"test": "turbo run test",
Expand Down
6 changes: 0 additions & 6 deletions packages/authentication/.parcelrc

This file was deleted.

4 changes: 2 additions & 2 deletions packages/authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"types": "dist/types.d.ts",
"sideEffects": false,
"scripts": {
"build": "parcel build",
"dev": "parcel watch",
"build": "tsup",
"test": "jest --config ./jest.config.ts",
"lint": "eslint . --ext .tsx --ext .ts && tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
Expand Down Expand Up @@ -50,6 +49,7 @@
"parcel": "^2.12.0",
"ts-jest": "^29.1.4",
"ts-node": "^10.9.2",
"tsup": "^8.3.0",
"typescript": "^5.4.5"
},
"license": "MIT",
Expand Down
20 changes: 0 additions & 20 deletions packages/authentication/parcel-optimizer-use-client.mjs

This file was deleted.

14 changes: 14 additions & 0 deletions packages/authentication/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from 'tsup'

export default defineConfig({
name: '@baseapp-frontend/authentication',
entry: ['index.ts'],
format: ['esm', 'cjs'],
treeshake: false,
splitting: true,
dts: false,
clean: true,
minify: true,
external: ['react', 'react-dom'],
})
6 changes: 0 additions & 6 deletions packages/utils/.parcelrc

This file was deleted.

11 changes: 11 additions & 0 deletions packages/utils/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use client'

export { default as withController } from './functions/form/withController'
export type * from './functions/form/withController/types'
export { default as useDebounce } from './hooks/useDebounce'
export { default as useDjangoOrderBy } from './hooks/useDjangoOrderBy'
export { default as useEventSubscription } from './hooks/useEventSubscription'
export { default as useNotification } from './hooks/useNotification'
export { NotificationProvider } from './hooks/useNotification'
export { default as useSSR } from './hooks/useSSR'
export { default as useBoolean } from './hooks/useBoolean'
3 changes: 0 additions & 3 deletions packages/utils/functions/form/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
export { default as withController } from './withController'
export type * from './withController/types'

export * from './filterDirtyValues'
export * from './getInitialValues'
export * from './setFormApiErrors'
2 changes: 0 additions & 2 deletions packages/utils/functions/form/withController/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import type { ChangeEventHandler, FC, FocusEventHandler } from 'react'

import { Controller } from 'react-hook-form'
Expand Down
2 changes: 0 additions & 2 deletions packages/utils/hooks/useDebounce/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import { useEffect, useRef } from 'react'

import debounce from 'lodash/debounce'
Expand Down
2 changes: 0 additions & 2 deletions packages/utils/hooks/useDjangoOrderBy/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import { useState } from 'react'

import { decamelize } from 'humps'
Expand Down
2 changes: 0 additions & 2 deletions packages/utils/hooks/useNotification/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client'

import React, { type FC, type PropsWithChildren, createContext, useContext, useRef } from 'react'

import { createStore, useStore } from 'zustand'
Expand Down
8 changes: 0 additions & 8 deletions packages/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ export * from './functions/form'
export * from './functions/string'
export * from './functions/token'

export { default as useDebounce } from './hooks/useDebounce'
export { default as useDjangoOrderBy } from './hooks/useDjangoOrderBy'
export { default as useEventSubscription } from './hooks/useEventSubscription'
export { default as useNotification } from './hooks/useNotification'
export { NotificationProvider } from './hooks/useNotification'
export { default as useSSR } from './hooks/useSSR'
export { default as useBoolean } from './hooks/useBoolean'

export type * from './types/cookie'
export type * from './types/date'
export type * from './types/django'
Expand Down
15 changes: 13 additions & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
"name": "@baseapp-frontend/utils",
"description": "Util functions, constants and types.",
"version": "2.5.6",
"source": "index.ts",
"main": "dist/main.js",
"module": "dist/module.js",
"types": "dist/types.d.ts",
"sideEffects": false,
"scripts": {
"build": "parcel build",
"build": "tsup",
"dev": "parcel watch",
"test": "jest --config ./jest.config.ts",
"lint": "eslint . --ext .tsx --ext .ts && tsc --noEmit",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"prepare": "pnpm build"
},
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.mts"
},
"./client": {
"import": "./dist/client.mjs",
"require": "./dist/client.cjs",
"types": "./dist/client.d.mts"
}
},
"dependencies": {
"axios": "^1.7.2",
"humps": "^2.0.1",
Expand Down
20 changes: 0 additions & 20 deletions packages/utils/parcel-optimizer-use-client.mjs

This file was deleted.

12 changes: 11 additions & 1 deletion packages/utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"extends": "@baseapp-frontend/tsconfig/lib.json",
"include": ["**/*.ts", "**/*.tsx", "**/*.d.ts", ".eslintrc.js", "*.js", "*.jsx", "index.d.ts"],
"include": [
"**/*.ts",
"**/*.tsx",
"**/*.d.ts",
".eslintrc.js",
"*.js",
"*.jsx",
"index.d.ts",
"index.ts",
"client.ts"
],
"exclude": ["node_modules"]
}
14 changes: 14 additions & 0 deletions packages/utils/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { defineConfig } from 'tsup'

export default defineConfig({
name: '@baseapp-frontend/utils',
entry: ['index.ts', 'client.ts'],
format: ['esm', 'cjs'],
treeshake: false,
splitting: true,
dts: false,
clean: true,
minify: false,
external: ['react', 'react-dom'],
})
Loading

0 comments on commit 5fef370

Please sign in to comment.