Skip to content

Commit

Permalink
chore: update bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
ZipingL committed May 2, 2024
1 parent dd032dc commit 0a8627d
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 190 deletions.
14 changes: 8 additions & 6 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.
### Utilizling Linkedin's methods instead with this Com ponent
Version 4.0 or lower utilizes LinkedIn's [script](https://platform.linkedin.com/badges/js/profile.js) to render the badge. I recommend using version 4 or lower in case you require rendering via LinkedIn's method by any means. Version 4 by the means is a version that has issues or functionality flaws, and is a stable legacy version of the component. Version 5.0 given that it fully integrates rendering within the component and thus utilizes full adherence toward React's lifecycle methods and state management system, provides even fuller abilities in allowing the badge to properly render and animate utilizing any other React components or libraries within your project.

| Version | Supported |
| ------- | ------------------ |
Expand All @@ -13,9 +13,11 @@ currently being supported with security updates.
| < 4.0 | :x: |

## Reporting a Vulnerability
For all issues, including security vulnerabilities, please open an issue on the repository, and is an encouraged practice at least in all projects I maintain given that it:
- Provides a public record of the issue such that that others can avoid or even fix the issue themselves.
- Provides a means of tracking the issue and its resolution.
Hence, in the worst case where the issue is never resolved there at least exists a form of notice to prevent others in becoming vulnerable to such and hence allowing issues encountered to become an issue that is more widely recognized and possibly addressed by the broader community. Publicly documenting the issues not only increases transparency but also builds a community responsibility where multiple contributors can collaborate on solving problems.



Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-linkedinbadge",
"version": "5.1.2026",
"version": "5.1.2027",
"description": "The LinkedIn Badge Rendering React Component is a powerful tool for displaying LinkedIn badges on websites. With customizable options and support for both profile and entity badges, this component offers improved features over LinkedIn's basic implementation. It enhances code organization by separating badge container rendering from dynamic content rendering and efficiently handles asynchronous loading of content from LinkedIn servers. This component also allows for easy management of multiple badges on a page and provides a callback function for tracking badge rendering completion. Make sure to review the licensing information for proper usage.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -83,7 +83,7 @@
],
"files": [
"lib",
"LINKEDINLIU.LICENSE.md",
"LICENSE.md",
"types",
"README.md",
"package.json",
Expand Down Expand Up @@ -118,7 +118,7 @@
"clean": "rimraf -rf lib && rm -rf types"
},
"author": "Ziping Liu <ziping@linkedinliu.com>",
"license": "SEE LICENSE IN LINKEDINLIU.LICENSE.md",
"license": "SEE LICENSE IN LICENSE.md",
"devDependencies": {
"@babel/cli": "^7.18.10",
"@babel/core": "^7.19.1",
Expand Down
163 changes: 75 additions & 88 deletions rollup.config.all.js
Original file line number Diff line number Diff line change
@@ -1,100 +1,87 @@
import {babel} from '@rollup/plugin-babel';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
import localResolve from '@haensl/rollup-plugin-local-resolve';
import { babel } from "@rollup/plugin-babel";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import filesize from "rollup-plugin-filesize";
import localResolve from "@haensl/rollup-plugin-local-resolve";
import replace from "@rollup/plugin-replace";

import typescript from "rollup-plugin-typescript2";

import terser from "@rollup/plugin-terser";
import{ dts} from "rollup-plugin-dts";

import packageJson from './package.json';

import { dts } from "rollup-plugin-dts";
import packageJson from "./package.json";
const outputCommonConf = {
sourcemap: 'inline',
exports: 'named',
sourcemap: "inline",
exports: "named",
globals: {
react: 'React',
'react-dom/client': 'ReactDOM'
}
react: "React",
"react-dom/client": "ReactDOM",
},
};



export default [
{
input: "./src/index.tsx",
output: [
{
file: packageJson['umd:main'],
format: 'umd',
name: 'ReactScriptTag',
...outputCommonConf
},
{
file: packageJson.main,
format: 'cjs',
...outputCommonConf
},
{
file: packageJson.module,
format: 'es',
...outputCommonConf
},
{
input: "./src/index.tsx",
output: [
{
file: packageJson["umd:main"],
format: "umd",
name: "ReactScriptTag",
...outputCommonConf,
},
{
file: packageJson.main,
format: "cjs",
...outputCommonConf,
},
{
file: packageJson.module,
format: "es",
...outputCommonConf,
},
],
plugins: [
peerDepsExternal(),
localResolve(),
babel({
exclude: "node_modules/**, src/tests/**",

babelHelpers: "external",
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
plugins: [
peerDepsExternal(),
localResolve(),
babel({ exclude: 'node_modules/**, src/tests/**' ,

babelHelpers: 'external',
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
}),

}),
replace({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
preventAssignment: true,
}),



replace({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
}),
resolve(),
commonjs(),
typescript({
tsconfig: "./tsconfig.json",
sourceMap: true,
tsconfigOverride: {
include: ["src/index.tsx"],
outDir: "lib",
},
}),


resolve(),
commonjs(),
typescript({ tsconfig: "./tsconfig.json",
"sourceMap": true,

"tsconfigOverride": {
"include": [
"src/index.tsx",
],
"outDir": "lib",

},

}),

terser( {
format:{
comments: "some",
preamble: "/* react-linkedinbadge */"
}
}),
terser({
format: {
comments: "some",
preamble: "/* react-linkedinbadge */",
},
}),

filesize(),
],
external: ["react", "react-dom", "styled-components"]
},
{
input: "types/index.d.ts",
output: [{ file: "lib/bundle.esm.d.ts", format: "esm" }],
plugins: [dts()],
},
];
filesize(),
],
external: ["react", "react-dom", "styled-components"],
},
{
input: "types/index.d.ts",
output: [{ file: "lib/bundle.esm.d.ts", format: "esm" }],
plugins: [dts()],
},
];
105 changes: 45 additions & 60 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,52 @@
import babel from "@rollup/plugin-babel";
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import resolve from '@rollup/plugin-node-resolve';


import babel from "@rollup/plugin-babel";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import resolve from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import typescript from 'rollup-plugin-typescript2';

import typescript from "rollup-plugin-typescript2";
import terser from "@rollup/plugin-terser";

const config = {
input: 'src/main/index.tsx',

output: [
{

file: 'lib/linkedinbadge.js',
// cdn format
format: 'umd',
name: 'LinkedInBadge',

globals: {
react: 'React',
'react-dom/client': 'ReactDOM'

},
sourcemap:'inline'

}
],
plugins: [


typescript({ useTsconfigDeclarationDir: true ,
sourceMap: true,
}),
peerDepsExternal(),
babel({
exclude: 'node_modules/**',
babelHelpers: 'external',
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
}),
resolve(),

replace({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
}),


terser( {
format:{
comments: "all",
preamble: `${process.env.CDN_PREAMBLE_COMMENTARY_NOTICE || "/* LinkedInBadge */"}`
}
}),

],


external: ['react', 'react-dom/client', 'react-dom'],
input: "src/main/index.tsx",
output: [
{
file: "lib/linkedinbadge.js",
format: "umd",
name: "LinkedInBadge",
globals: {
react: "React",
"react-dom/client": "ReactDOM",
},
sourcemap: "inline",
},
],
plugins: [
typescript({
useTsconfigDeclarationDir: true,
sourceMap: true,
}),
peerDepsExternal(),
babel({
exclude: "node_modules/**",
babelHelpers: "external",
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
}),
resolve(),
replace({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
preventAssignment: true,
}),
terser({
format: {
comments: "all",
preamble: `${process.env.CDN_PREAMBLE_COMMENTARY_NOTICE || "/* LinkedInBadge */"}`,
},
}),
],
external: ["react", "react-dom/client", "react-dom"],
};

export default config;
4 changes: 3 additions & 1 deletion src/LIRenderAll/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ export const LIRenderAll = (props: Partial<LIRenderAllProps>) => {

// Gets all incoming responses

return <></>;
return <>

</>;
};

export function isCNDomain() {
Expand Down
Loading

0 comments on commit 0a8627d

Please sign in to comment.