Skip to content

Commit

Permalink
pack dependences in dist
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeskydev committed Apr 3, 2021
1 parent 5e7bb4e commit 7040b58
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 67 deletions.
16 changes: 3 additions & 13 deletions examples/gltf-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,14 @@
margin: 0;
}
</style>
<script defer src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
<script type="importmap-shim">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/examples/jsm/" : "https://unpkg.com/[email protected]/examples/jsm/",
"camera-controls" : "https://unpkg.com/[email protected]/dist/camera-controls.module.js",
"hold-event" : "https://unpkg.com/[email protected]/dist/hold-event.module.js"
}
}
</script>
</head>
<body>
<script type="module-shim">
import { Viewer } from "../../dist/icosa-viewer.module.js";
<script type="module">
import { Viewer } from "../dist/icosa-viewer.module.js";

var viewer = new Viewer();
viewer.loadGLTF("test.glb");

</script>
<div id="icosa-viewer"></div>
</body>
Expand Down
15 changes: 2 additions & 13 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,11 @@
margin: 0;
}
</style>
<script defer src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
<script type="importmap-shim">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/examples/jsm/" : "https://unpkg.com/[email protected]/examples/jsm/",
"camera-controls" : "https://unpkg.com/[email protected]/dist/camera-controls.module.js",
"hold-event" : "https://unpkg.com/[email protected]/dist/hold-event.module.js"
}
}
</script>
</head>
<body>
<script type="module-shim">
<script type="module">
import { Viewer } from "../dist/icosa-viewer.module.js";
import { GUI } from 'three/examples/jsm/libs/dat.gui.module.js';
import { GUI } from "https://unpkg.com/three@0.125.0/examples/jsm/libs/dat.gui.module.js";

const viewer = new Viewer();
viewer.loadPolyUrl("https://poly.google.com/view/c_l71DaVU_3");
Expand Down
15 changes: 2 additions & 13 deletions examples/poly-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,10 @@
margin: 0;
}
</style>
<script defer src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
<script type="importmap-shim">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/examples/jsm/" : "https://unpkg.com/[email protected]/examples/jsm/",
"camera-controls" : "https://unpkg.com/[email protected]/dist/camera-controls.module.js",
"hold-event" : "https://unpkg.com/[email protected]/dist/hold-event.module.js"
}
}
</script>
</head>
<body>
<script type="module-shim">
import { Viewer } from "../../dist/icosa-viewer.module.js";
<script type="module">
import { Viewer } from "../dist/icosa-viewer.module.js";

var viewer = new Viewer();
viewer.loadPolyUrl("https://poly.google.com/view/c_l71DaVU_3");
Expand Down
78 changes: 72 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,34 @@
},
"homepage": "https://github.com/icosa-gallery/icosa-viewer#readme",
"devDependencies": {
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/dat.gui": "^0.7.6",
"@types/three": "^0.125.3",
"node-sass": "^5.0.0",
"postcss": "^8.2.6",
"postcss-url": "^10.1.3",
"rollup": "^2.40.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-typescript2": "^0.30.0",
"rollup-plugin-glslify": "^1.2.0",
"terser": "^5.6.0",
"typescript": "^4.1.3"
},
"peerDependencies": {
"dependencies": {
"three": "^0.125.0",
"camera-controls": "^1.25.3",
"hold-event": "0.0.1"
},
"dependencies": {
"camera-controls": "^1.25.3",
"hold-event": "0.0.1",
"rollup-plugin-glslify": "^1.2.0",
"three": "^0.125.0"
},
"files": [
"dist/icosa-viewer.js",
"dist/icosa-viewer.min.js",
"dsit/icosa-viewer.module.js",
"examples",
"LICENSE",
"package.json",
"README.md",
"src"
],
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/icosa"
Expand Down
16 changes: 2 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import typescript from 'rollup-plugin-typescript2';
import postcss from 'rollup-plugin-postcss'
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import glslify from 'rollup-plugin-glslify';
import url from 'postcss-url';

Expand All @@ -11,37 +11,25 @@ const license = `/*!
* Released under the Apache 2.0 Licence.
*/`;

const globals = {
'three': 'THREE',
'three/examples/jsm/webxr/VRButton': 'VRButton',
'three/examples/jsm/loaders/TiltLoader': 'TiltLoader',
'three/examples/jsm/loaders/GLTFLoader': 'GLTFLoader',
'camera-controls': 'CameraControls',
'hold-event': 'holdEvent'
}

export default {
input: 'src/index.ts',
external: ['three', 'camera-controls', 'hold-event'],
output: [
{
format: 'umd',
name: 'IcosaViewer',
file: 'dist/icosa-viewer.js',
banner: license,
indent: '\t',
globals: globals
},
{
format: 'es',
file: 'dist/icosa-viewer.module.js',
banner: license,
indent: '\t',
globals: globals
},
],
plugins: [
peerDepsExternal(),
nodeResolve(),
typescript( { typescript: require( 'typescript' ) } ),
glslify(),
postcss( {
Expand Down

0 comments on commit 7040b58

Please sign in to comment.