Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added legacy wrapper package #1290

Merged
merged 9 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"filesize",
"iife",
"Initialising",
"javascripts",
"logcapture",
"Loggable",
"sarif",
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Iframe Resizer Version 5

This JavaScript library is Copyright © 2013-2024 David J. Bradshaw and is distributed under the GPL V3 for non-commercial use. A commercial license is available upon request.

For more information on commercial licensing contact dave@bradshaw.net
For more information on commercial licensing see https://iframe-resizer.com/pricing/

--

Expand Down
3 changes: 2 additions & 1 deletion bin/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ cd ../react
npm publish --tag $1
cd ../vue
npm publish --tag $1
cd ../legacy
npm publish --tag $1

if [ $1 != "latest" ]
then
Expand All @@ -55,7 +57,6 @@ zip iframe-resizer.zip js/**
cp -v js/** js-dist

git add .

git commit -am "Release v$VERSION"
git tag "v$VERSION"
git pull
Expand Down
26 changes: 19 additions & 7 deletions build/pkgJson.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
const main = 'index.cjs.js'
const module = 'index.esm.js'

const customConfig = (file) => {
const entryPoints = {
main: `index.cjs.js`,
module: `index.esm.js`,
main,
module,
browser: `index.umd.js`,
}

switch (file) {
case 'react':
return {
main: 'index.cjs.js',
module: 'index.esm.js',
main,
module,
types: `iframe-resizer.${file}.d.ts`,
peerDependencies: {
react: '^16.8.0 || ^17.0.0 || ^18.0.0',
'react-dom': '^16.8.0 || ^17.0.0 || ^18.0.0',
react: '^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0',
'react-dom': '^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0',
},
}

case 'legacy':
return {
name: 'iframe-resizer',
description:
"This project has now been split into two separate packages. Please use '@iframe-resizer/parent' and '@iframe-resizer/child'. See https://iframe-resizer.com/upgrade for more details.",
main,
module,
}

case 'vue':
return {
main: 'index.umd.js',
module: 'index.esm.js',
module,
browser: {
'./sfc': 'iframe-resizer.vue',
},
Expand Down
10 changes: 9 additions & 1 deletion build/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ export const pluginsBase = (stripLog) => (file) => {
const fixVersion = (file) =>
file in { core: 1, child: 1 }
? {}
: { additionalDependencies: { '@iframe-resizer/core': pkg.version } }
: file !== 'legacy'
? { additionalDependencies: { '@iframe-resizer/core': pkg.version } }
: {
additionalDependencies: {
'@iframe-resizer/child': pkg.version,
'@iframe-resizer/jquery': pkg.version,
'@iframe-resizer/parent': pkg.version,
},
}

const today = new Date().toISOString().split('T').join(' - ')

Expand Down
4 changes: 4 additions & 0 deletions example/child/frame.content.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
type="text/javascript"
src="../../js/iframe-resizer.child.js"
></script>
<!-- <script
type="text/javascript"
src="../../dist/legacy/js/iframeResizer.contentWindow.js"
></script> -->
<script>
function toggle() {
const { style } = document.getElementsByTagName('p')[1]
Expand Down
12 changes: 8 additions & 4 deletions example/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
border-width: 0;
} */
</style>
<script
type="text/javascript"
src="../../js/iframe-resizer.parent.js"
></script>
<!-- <script
type="text/javascript"
src="../../dist/legacy/js/iframeResizer.js"
></script> -->
</head>

<body>
Expand All @@ -40,10 +48,6 @@ <h2>Automagically resizing iFrame</h2>
<a href="https://iframe-resizer.com">https://frame-resizer.com</a>.
</div>

<script
type="text/javascript"
src="../../js/iframe-resizer.parent.js"
></script>
<script type="text/javascript">
/*
* If you do not understand what the code below does, then please just use the
Expand Down
2 changes: 2 additions & 0 deletions karma.conf.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ module.exports = function (config) {
{ pattern: 'dist/parent/*.js', included: false },
{ pattern: 'dist/child/*.js', included: false },
{ pattern: 'dist/jquery/*.js', included: false },
{ pattern: 'dist/legacy/*.js', included: false },
{ pattern: 'dist/legacy/js/*.js', included: false },
// { pattern: 'packages/*.js', included: false },
{ pattern: 'example/html/*.html', included: false },
{ pattern: 'example/child/*.html', included: false },
Expand Down
Loading
Loading