Skip to content

Commit

Permalink
feat(web): add standalone umd / embeddable version (#413)
Browse files Browse the repository at this point in the history
* fixed bug in packages/web/src/ui/viewer/jscad-viewer-lightgl.js, cut/paste issue
fixed bug in packages/web/postInstall.js that prevented installing @jscad/web,
when the examples were not loaded.
Adds a umd build target based on opt.js.  umd.js and processor-bare.js
are usable by different bundlers like webpack.
* update @jscad/openscad-openjscad-translator to 0.0.11
* fix 'main' typo, add 'module'
* closes #402 
* closes #343
  • Loading branch information
johnwebbcole authored and kaosat-dev committed Jan 3, 2019
1 parent a96076e commit f25d8c0
Show file tree
Hide file tree
Showing 7 changed files with 821 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@jscad/csg": "0.7.0",
"@jscad/examples": "^1.7.2",
"@jscad/io": "0.4.7",
"@jscad/openscad-openjscad-translator": "0.0.10"
"@jscad/openscad-openjscad-translator": "0.0.11"
},
"devDependencies": {
"ava": "^0.23.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"@jscad/csg": "0.7.0",
"@jscad/io": "0.4.7",
"@jscad/openscad-openjscad-translator": "0.0.10",
"@jscad/openscad-openjscad-translator": "0.0.11",
"astring": "^1.3.1",
"esprima": "^3.1.3",
"estraverse": "^4.2.0",
Expand Down
7 changes: 5 additions & 2 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build-web": "browserify src/ui/index.js -o dist/index.js -t [babelify browserify minifyify]",
"build-min": "browserify src/ui/min.js -o dist/min.js -t [babelify browserify minifyify]",
"build-opt": "browserify src/ui/opt.js -o dist/opt.js -t [babelify browserify minifyify]",
"build-all": "npm run build-web && npm run build-min && npm run build-opt",
"build-umd": "browserify --standalone openjscad src/ui/umd.js -o dist/openjscad.umd.js -t [babelify browserify minifyify]",
"build-all": "npm run build-web && npm run build-min && npm run build-opt && npm run build-umd",
"start-dev": "budo src/ui/index.js:dist/index.js --port=8080 --live -- -b -t babelify",
"preversion": "npm test",
"version": "npm run build-all && git add -A ",
Expand All @@ -32,12 +33,14 @@
}
],
"license": "MIT",
"main": "dist/openjscad.umd.js",
"module": "dist/openjscad.umd.js",
"dependencies": {
"@jscad/core": "^0.3.0",
"@jscad/csg": "0.7.0",
"@jscad/examples": "^1.7.2",
"@jscad/io": "0.4.7",
"@jscad/openscad-openjscad-translator": "0.0.10",
"@jscad/openscad-openjscad-translator": "0.0.11",
"astring": "^1.3.1",
"brace": "0.10.0",
"esprima": "^3.1.3",
Expand Down
3 changes: 2 additions & 1 deletion packages/web/postInstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
const path = require('path')
const examplesPath = path.resolve('./node_modules/@jscad/examples')
const copydir = require('copy-dir')
copydir.sync(examplesPath, 'examples')
const fs = require('fs')
if (fs.existsSync(examplesPath)) copydir.sync(examplesPath, 'examples')
Loading

0 comments on commit f25d8c0

Please sign in to comment.