Skip to content

Commit

Permalink
feat: compile both esm and cjs format of @repo/utils
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Dec 2, 2024
1 parent 0adaa07 commit 6de8b7d
Show file tree
Hide file tree
Showing 12 changed files with 9,852 additions and 14,244 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ All services for Blog Environment Group. The monorepo system is powered by [Turb

## Ecosystem

| Project | Version | Build Status | Description |
| ------------------------- | ---------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------- |
| [cms] | ![cms-version] | ![cms-build-status] | The CMS for Yancey blog with React, Apollo Client, Material-UI and GraphQL. |
| [frontend] | ![frontend-version] | ![frontend-build-status] | The website app for Yancey blog with React, Next.js, styled-components, Apollo Client and GraphQL. |
| [backend] | ![backend-version] | ![backend-build-status] | The backend platform for Yancey Official Blog with Node.js, NestJS, MongoDB, GraphQL, JWT and more. |
| [uploader] | ![uploader-version] | ![uploader-build-status] | The Uploader backend powered by Azure Blob. |
| [@repo/utils] | ![@repo/utils-version] | | Common utils library. |
| [@repo/eslint-config] | ![@repo/eslint-config-version] | | Common Eslint Config library. |
| [@repo/typescript-config] | ![@repo/typescript-config-version] | | Common TypeScript Config library. |
| [@repo/graphql-types] | ![@repo/graphql-types-version] | | Graphql types of backend. |
| Project | Version | Build Status | Description |
| ------------------------- | ---------------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------- |
| [cms] | ![cms-version] | ![cms-build-status] | The CMS for Yancey blog with React, Apollo Client, Material-UI and GraphQL. |
| [frontend] | ![frontend-version] | ![frontend-build-status] | The website app for Yancey blog with React, Next.js, styled-components, Apollo Client and GraphQL. |
| [backend] | ![backend-version] | ![backend-build-status] | The backend platform for Yancey Official Blog with Node.js, NestJS, MongoDB, GraphQL, JWT and more. |
| [uploader] | ![uploader-version] | ![uploader-build-status] | The Uploader backend powered by Azure Blob. |
| [@repo/utils] | ![@repo/utils-version] | | Common utils library. |
| [@repo/eslint-config] | ![@repo/eslint-config-version] | | Common Eslint Config library. |
| [@repo/typescript-config] | ![@repo/typescript-config-version] | | Common TypeScript Config library. |
| [@repo/graphql-types] | ![@repo/graphql-types-version] | | Graphql types of backend. |

[cms]: ./apps/cms
[frontend]: ./apps/frontend
Expand All @@ -37,7 +37,7 @@ All services for Blog Environment Group. The monorepo system is powered by [Turb
[frontend-version]: https://img.shields.io/badge/Version-v5.2.0-brightgreen
[backend-version]: https://img.shields.io/badge/Version-v3.1.1-brightgreen
[uploader-version]: https://img.shields.io/badge/Version-v2.0.1-brightgreen
[@repo/utils-version]: https://img.shields.io/badge/Version-v2.0.0-brightgreen
[@repo/utils-version]: https://img.shields.io/badge/Version-v3.0.0-brightgreen
[@repo/eslint-config-version]: https://img.shields.io/badge/Version-v1.0.0-brightgreen
[@repo/typescript-config-version]: https://img.shields.io/badge/Version-v1.0.0-brightgreen
[@repo/graphql-types-version]: https://img.shields.io/badge/Version-v1.0.0-brightgreen
Expand Down
7 changes: 7 additions & 0 deletions apps/backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 3.1.2

### Patch Changes

- Updated dependencies []:
- @repo/utils@3.0.0

## 3.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend",
"version": "3.1.1",
"version": "3.1.2",
"description": "The backend platform for Yancey blog.",
"repository": "git@github.com:Yancey-Blog/blog-be-next.git",
"author": "YanceyOfficial <yanceyofficial@gmail.com>",
Expand Down
7 changes: 7 additions & 0 deletions apps/uploader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log - uploader-service

## 2.0.2

### Patch Changes

- Updated dependencies []:
- @repo/utils@3.0.0

## 2.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/uploader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uploader",
"version": "2.0.1",
"version": "2.0.2",
"description": "",
"author": "Yancey Leo",
"license": "MIT",
Expand Down
15 changes: 0 additions & 15 deletions packages/utils/.eslintrc.js

This file was deleted.

14 changes: 14 additions & 0 deletions packages/utils/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint/eslint-plugin"],
"extends": ["plugin:@typescript-eslint/recommended"],
"root": true,
"env": {
"node": true,
"jest": true
}
}
6 changes: 6 additions & 0 deletions packages/utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log - @shared/utils

## 3.0.0

### Major Changes

- compile both esm and cjs

## 2.0.0

### Major Changes
Expand Down
13 changes: 9 additions & 4 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
{
"name": "@repo/utils",
"version": "2.0.0",
"version": "3.0.0",
"description": "",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"type": "module",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"main": "dist/index.cjs",
"scripts": {
"clear": "rimraf dist",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup --config rollup.config.js",
"build": "pnpm run clear && rollup --config rollup.config.js",
"lint": "eslint src --ext .ts --fix"
},
"author": "Yancey Leo",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^22.10.1",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"eslint": "^8",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"rimraf": "^6.0.1",
"rollup": "^4.27.4",
"ts-node": "^10.9.2",
"tslib": "^2.8.1",
Expand Down
60 changes: 42 additions & 18 deletions packages/utils/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,47 @@
// eslint-disable-next-line @typescript-eslint/no-require-imports
const typescript = require('@rollup/plugin-typescript')
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'
import { defineConfig } from 'rollup'

/**
* @type {import('rollup').RollupOptions}
*/
module.exports = {
input: 'src/index.ts',
output: {
file: 'dist/index.js',
format: 'commonjs',
sourcemap: true
export default defineConfig([
{
input: 'src/index.ts',
output: [
{
file: 'dist/index.cjs',
format: 'cjs'
}
],
plugins: [
/**
* @type {import('@rollup/plugin-typescript').RollupTypescriptOptions}
*/
typescript(),
/**
* @type {import('@rollup/plugin-terser').Options}
*/
terser()
]
},
plugins: [
/**
* @type {import('@rollup/plugin-typescript').RollupTypescriptOptions}
*/
typescript({
outputToFilesystem: true,
tsconfig: './tsconfig.json'
})
]
}
{
input: 'src/index.ts',
output: [
{
file: 'dist/index.js',
format: 'esm'
}
],
plugins: [
/**
* @type {import('@rollup/plugin-typescript').RollupTypescriptOptions}
*/
typescript(),
/**
* @type {import('@rollup/plugin-terser').Options}
*/
terser()
]
}
])
Loading

0 comments on commit 6de8b7d

Please sign in to comment.