This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup Rollup * Build with SWC * Minify * Update Package.json
- Loading branch information
Showing
5 changed files
with
1,174 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
{ | ||
"name": "sugarform", | ||
"version": "1.0.0", | ||
"version": "0.0.0", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"files": [ | ||
"package.json", | ||
"LICENSE", | ||
"dist" | ||
], | ||
"repository": "https://github.com/sugarform-dev/sugarform.git", | ||
"author": "aspulse <[email protected]>", | ||
"license": "MIT", | ||
"packageManager": "[email protected]", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-typescript": "^11.0.0", | ||
"@swc/core": "^1.3.37", | ||
"@types/react": "^18.0.28", | ||
"@typescript-eslint/eslint-plugin": "^5.54.0", | ||
"@typescript-eslint/parser": "^5.54.0", | ||
|
@@ -16,6 +25,10 @@ | |
"eslint-plugin-unused-imports": "^2.0.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rollup": "^3.18.0", | ||
"rollup-plugin-dts": "^5.2.0", | ||
"rollup-plugin-swc3": "^0.8.0", | ||
"tslib": "^2.5.0", | ||
"typescript": "^4.9.5" | ||
}, | ||
"peerDependencies": { | ||
|
@@ -27,5 +40,8 @@ | |
"@types/react": { | ||
"optional": true | ||
} | ||
}, | ||
"scripts": { | ||
"build": "rollup -c" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* eslint-disable no-restricted-exports */ | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import dts from 'rollup-plugin-dts'; | ||
import { swc, defineRollupSwcOption, minify, defineRollupSwcMinifyOption } from 'rollup-plugin-swc3'; | ||
import packageJson from './package.json' assert { type: 'json' }; | ||
|
||
export default [ | ||
{ | ||
input: 'src/index.ts', | ||
output: [ | ||
{ | ||
file: packageJson.main, | ||
format: 'cjs', | ||
sourcemap: false, | ||
}, | ||
{ | ||
file: packageJson.module, | ||
format: 'esm', | ||
sourcemap: false, | ||
}, | ||
], | ||
plugins: [ | ||
commonjs({ | ||
include: [ 'node_modules/**' ], | ||
}), | ||
swc(defineRollupSwcOption({ | ||
exclude: /__tests__/, | ||
})), | ||
minify(defineRollupSwcMinifyOption({ | ||
compress: true, | ||
mangle: true, | ||
})), | ||
], | ||
external: [ 'react', 'react-dom' ], | ||
}, | ||
{ | ||
input: 'dist/cjs/types/index.d.ts', | ||
output: [{ file: 'dist/cjs/index.d.ts', format: 'cjs' }], | ||
plugins: [ dts() ], | ||
}, | ||
{ | ||
input: 'dist/esm/types/index.d.ts', | ||
output: [{ file: 'dist/esm/index.d.ts', format: 'esm' }], | ||
plugins: [ dts() ], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export function helloSugarForm(): void { | ||
console.log('Hello, Sugar Form!'); | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.