-
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.
- Loading branch information
1 parent
01f576e
commit c1c1eb2
Showing
5 changed files
with
159 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Cypress Tests | ||
|
||
on: [push] | ||
|
||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# Install NPM dependencies, cache them correctly | ||
# and run all Cypress tests | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v4 | ||
with: | ||
build: npm run build | ||
start: npm start |
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,11 @@ | ||
/** | ||
* | ||
* Author: Allan Nava ([email protected]) | ||
* ----- | ||
* Last Modified: | ||
* Modified By: Allan Nava ([email protected]>) | ||
* ----- | ||
* Copyright 2023 - 2023 © | ||
* | ||
* | ||
*/ |
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,35 @@ | ||
{ | ||
"name": "compress-nodejs", | ||
"private": true, | ||
"version": "0.1.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"browser": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"scripts": { | ||
"build": "rimraf dist && rollup --config --bundleConfigAsCjs", | ||
"tsc": "tsc", | ||
"prepublishOnly": "npm run build", | ||
"prepare": "npm run build" | ||
}, | ||
"peerDependencies": { | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"moment": "^2.29.4", | ||
"next": ">=13.0.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@types/react": "18.0.9", | ||
"rollup": "^3.2.5", | ||
"babel-loader": "^8.2.2", | ||
"rimraf": "^3.0.2", | ||
"rollup-plugin-peer-deps-external": "^2.2.4", | ||
"rollup-plugin-typescript2": "^0.31.1", | ||
"tslib": "^2.4.1" | ||
} | ||
} | ||
|
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,61 @@ | ||
import resolve from "@rollup/plugin-node-resolve"; | ||
import peerDepsExternal from 'rollup-plugin-peer-deps-external'; | ||
import pkg from "./package.json"; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
|
||
const commonOutputOptions = { | ||
dir: "dist", | ||
preserveModules: true, | ||
preserveModulesRoot: "lib", | ||
}; | ||
|
||
function getOutputOptions(options) { | ||
return { | ||
...commonOutputOptions, | ||
...options, | ||
}; | ||
} | ||
|
||
function withSourceMapOutputOptions(options) { | ||
return { | ||
...options, | ||
sourcemap: true, | ||
}; | ||
} | ||
|
||
function getCJSOutputOptions(options) { | ||
return { | ||
...getOutputOptions(options), | ||
format: "cjs", | ||
exports: "named", | ||
}; | ||
} | ||
|
||
function getESMOutputOptions(options) { | ||
return { | ||
...getOutputOptions(options), | ||
format: "esm", | ||
}; | ||
} | ||
|
||
export default { | ||
input: ["lib/index.ts"], | ||
output: [ | ||
// ESM | ||
getESMOutputOptions( | ||
withSourceMapOutputOptions({ | ||
entryFileNames: "[name].esm.js", | ||
}) | ||
), | ||
// CommonJS | ||
getCJSOutputOptions( | ||
withSourceMapOutputOptions({}) | ||
) | ||
], | ||
plugins: [ | ||
peerDepsExternal(), | ||
resolve(), | ||
typescript(), | ||
], | ||
external: Object.keys(pkg.peerDependencies), | ||
}; |
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,35 @@ | ||
{ | ||
"include": [ | ||
"lib/**/*.ts", | ||
"lib/**/*.tsx" | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
"dist", | ||
], | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "esnext", | ||
"lib": [ | ||
"dom.iterable", | ||
"dom", | ||
"esnext" | ||
], | ||
"allowJs": false, | ||
"jsx": "react", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"outDir": "dist", | ||
"rootDir": "lib", | ||
"baseUrl": "lib", | ||
"removeComments": true, | ||
"strict": false, | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true | ||
} | ||
} | ||
|