Skip to content

Commit

Permalink
Apply babel as a prepublish step.
Browse files Browse the repository at this point in the history
This way users of openCPQ need not care about applying babel to openCPQ.

Adapted the directory structure accordingly.  Also prepared "npm publish".
  • Loading branch information
hcschuetz committed Aug 10, 2015
1 parent e5c8853 commit fe00296
Show file tree
Hide file tree
Showing 35 changed files with 149 additions and 59 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
*~
node_modules
/dst
10 changes: 10 additions & 0 deletions .npmignore
@@ -0,0 +1,10 @@
.editorconfig
.git
.gitignore
.npmignore
doc
examples
gulpfile.js
node_modules
README.md
src
55 changes: 0 additions & 55 deletions README.md
Expand Up @@ -8,58 +8,3 @@ A browser-based product-configuration framework
pre-defined in openCPQ and some application-specific components
- [Presentations](doc/presentations/README.md)
- [Documentation](http://webxcerpt.github.io/openCPQ/) (work in progress)


## A Note on Installation

npm dependencies can be tricky. And peer dependencies are particularly
tricky.

All the packages openCPQ depends on might also be used directly by your
openCPQ application. (For `react` it is actually important that only a
single copy is being used.) Thus we declared them as peer dependencies
and actually expect them to be satisfied in some node_modules directory
further up the directory hierarchy. If I understand correctly, npm
version 3.x will not install peer dependencies locally, but will only
check them, which is exactly what we want. But for now npm 2.x does
install peer dependencies if they are not yet satisfied.

If you are working on the openCPQ framework and openCPQ applications in
parallel then you typically don't want to install a snapshot of the
opencpq module. Instead, you want to access a working copy of openCPQ's
git repository (i.e. this directory) from the application. One way to
achieve this is something like the following directory structure:

```
+- some_common_ancestor_directory
+- node_modules
| +- opencpq (this directory)
| +- (openCPQ's peer dependencies)
+- path
+- to
+- some_application
+- another_application
```

So in `some_common_ancestor_directory` you run

```
npm install babel-core babel-loader browser-filesaver react react-bootstrap
```

or you just run

```
npm install
```

after creating a small `package.json` with the dependencies and possibly
version ranges.

In the current directory
(`some_common_ancestor_directory/node_modules/opencpq`) you don't run
`npm install`.

And in your applications you don't install `opencpq` and its
dependencies. (Remove them from package.json before running `npm
install`.)
27 changes: 27 additions & 0 deletions gulpfile.js
@@ -0,0 +1,27 @@
var gulp = require('gulp');
var gulpif = require('gulp-if');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var chain = require('gulp-chain');
var rimraf = require('rimraf');

var outDir = "dst";

gulp.task('clean', function(cb) {
rimraf(outDir, cb);
});

gulp.task('default', ['clean'], function () {
return gulp
.src('src/**/*')
.pipe(gulpif(
function(file) { return file.path.endsWith(".js"); },
chain(function(stream) {
return stream
.pipe(sourcemaps.init())
.pipe(babel({stage: 0}))
.pipe(sourcemaps.write('maps'));
})()
))
.pipe(gulp.dest(outDir));
});
92 changes: 92 additions & 0 deletions npm-debug.log
@@ -0,0 +1,92 @@
0 info it worked if it ends with ok
1 verbose cli [ '/home/hs/sw/iojs-v2.0.0-linux-x64/bin/iojs',
1 verbose cli '/home/hs/sw/npm/bin/npm',
1 verbose cli 'version',
1 verbose cli 'minor' ]
2 info using npm@2.7.5
3 info using node@v2.0.0
4 info git [ 'status', '--porcelain' ]
5 verbose stack Error: Git working directory not clean.
5 verbose stack M .gitignore
5 verbose stack M README.md
5 verbose stack M package.json
5 verbose stack R index.js -> src/index.js
5 verbose stack R lib/accordion.js -> src/lib/accordion.js
5 verbose stack R lib/base.js -> src/lib/base.js
5 verbose stack R lib/bom.js -> src/lib/bom.js
5 verbose stack R lib/confirm-retract.js -> src/lib/confirm-retract.js
5 verbose stack R lib/display.js -> src/lib/display.js
5 verbose stack R lib/fixed-table.js -> src/lib/fixed-table.js
5 verbose stack R lib/group.js -> src/lib/group.js
5 verbose stack R lib/html.js -> src/lib/html.js
5 verbose stack R lib/label.js -> src/lib/label.js
5 verbose stack R lib/linear-aggregation.js -> src/lib/linear-aggregation.js
5 verbose stack R lib/names.js -> src/lib/names.js
5 verbose stack R lib/op.js -> src/lib/op.js
5 verbose stack R lib/panel.js -> src/lib/panel.js
5 verbose stack R lib/path.js -> src/lib/path.js
5 verbose stack R lib/primitives.js -> src/lib/primitives.js
5 verbose stack R lib/problems.js -> src/lib/problems.js
5 verbose stack R lib/quantification.js -> src/lib/quantification.js
5 verbose stack R lib/root.js -> src/lib/root.js
5 verbose stack R lib/select.js -> src/lib/select.js
5 verbose stack R lib/tabbed-area.js -> src/lib/tabbed-area.js
5 verbose stack R lib/table.js -> src/lib/table.js
5 verbose stack R lib/toc.js -> src/lib/toc.js
5 verbose stack R lib/util.js -> src/lib/util.js
5 verbose stack R lib/validation.js -> src/lib/validation.js
5 verbose stack R lib/visualization.js -> src/lib/visualization.js
5 verbose stack R lib/workbench.js -> src/lib/workbench.js
5 verbose stack R openCPQ-logo-black-100x41.png -> src/openCPQ-logo-black-100x41.png
5 verbose stack R style.css -> src/style.css
5 verbose stack at /home/hs/sw/npm/lib/node_modules/npm/lib/version.js:138:37
5 verbose stack at /home/hs/sw/npm/lib/node_modules/npm/lib/utils/git.js:26:8
5 verbose stack at ChildProcess.exithandler (child_process.js:676:7)
5 verbose stack at emitTwo (events.js:87:13)
5 verbose stack at ChildProcess.emit (events.js:169:7)
5 verbose stack at maybeClose (child_process.js:953:16)
5 verbose stack at Socket.<anonymous> (child_process.js:1114:11)
5 verbose stack at emitOne (events.js:77:13)
5 verbose stack at Socket.emit (events.js:166:7)
5 verbose stack at Pipe._onclose (net.js:456:12)
6 verbose cwd /home/hs/openCPQ/node_modules/opencpq
7 error Linux 3.13.0-36-generic
8 error argv "/home/hs/sw/iojs-v2.0.0-linux-x64/bin/iojs" "/home/hs/sw/npm/bin/npm" "version" "minor"
9 error node v2.0.0
10 error npm v2.7.5
11 error Git working directory not clean.
11 error M .gitignore
11 error M README.md
11 error M package.json
11 error R index.js -> src/index.js
11 error R lib/accordion.js -> src/lib/accordion.js
11 error R lib/base.js -> src/lib/base.js
11 error R lib/bom.js -> src/lib/bom.js
11 error R lib/confirm-retract.js -> src/lib/confirm-retract.js
11 error R lib/display.js -> src/lib/display.js
11 error R lib/fixed-table.js -> src/lib/fixed-table.js
11 error R lib/group.js -> src/lib/group.js
11 error R lib/html.js -> src/lib/html.js
11 error R lib/label.js -> src/lib/label.js
11 error R lib/linear-aggregation.js -> src/lib/linear-aggregation.js
11 error R lib/names.js -> src/lib/names.js
11 error R lib/op.js -> src/lib/op.js
11 error R lib/panel.js -> src/lib/panel.js
11 error R lib/path.js -> src/lib/path.js
11 error R lib/primitives.js -> src/lib/primitives.js
11 error R lib/problems.js -> src/lib/problems.js
11 error R lib/quantification.js -> src/lib/quantification.js
11 error R lib/root.js -> src/lib/root.js
11 error R lib/select.js -> src/lib/select.js
11 error R lib/tabbed-area.js -> src/lib/tabbed-area.js
11 error R lib/table.js -> src/lib/table.js
11 error R lib/toc.js -> src/lib/toc.js
11 error R lib/util.js -> src/lib/util.js
11 error R lib/validation.js -> src/lib/validation.js
11 error R lib/visualization.js -> src/lib/visualization.js
11 error R lib/workbench.js -> src/lib/workbench.js
11 error R openCPQ-logo-black-100x41.png -> src/openCPQ-logo-black-100x41.png
11 error R style.css -> src/style.css
12 error If you need help, you may report this error at:
12 error <https://github.com/npm/npm/issues>
13 verbose exit [ 1, true ]
23 changes: 19 additions & 4 deletions package.json
@@ -1,11 +1,13 @@
{
"name": "opencpq",
"description": "A React.js-based product-configuration framework",
"description": "A library for in-browser product-configuration",
"version": "0.0.1",
"keywords": [
"configuration",
"product configuration",
"CPQ",
"react"
"react",
"react-component"
],
"repository": {
"type": "git",
Expand All @@ -14,12 +16,25 @@
"homepage": "http://opencpq.org/",
"bugs": "https://github.com/webXcerpt/openCPQ/issues",
"license": "MIT",
"scripts": {
"compile": "./node_modules/.bin/gulp",
"prepublish": "npm run compile"
},
"main": "dst/index.js",
"peerDependencies": {
"babel-core": "^5.0.8",
"babel-loader": "^5.0.0",
"browser-filesaver": "^1.0.0",
"react": "^0.13.1",
"react-bootstrap": "^0.20.1",
"react-widgets": "^2.4.1"
},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-babel": "^5.2.0",
"gulp-chain": "^1.0.3",
"gulp-if": "^1.2.5",
"gulp-json-editor": "^2.2.1",
"gulp-sourcemaps": "^1.5.2",
"lazypipe": "^1.0.1",
"rimraf": "^2.4.2"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.

0 comments on commit fe00296

Please sign in to comment.