Skip to content

Commit d716d8c

Browse files
committed
feat(info): allow optional configure elements to be rendered
Closes #101 fix(build): move build assets to .pie directory fix(clean): simplify clean logic feat(support): Change how support modules work
1 parent b0cbe9d commit d716d8c

File tree

140 files changed

+2548
-4106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+2548
-4106
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,35 @@ This creates a new github release from the `develop` branch:
115115
npm run release
116116
```
117117

118+
119+
## Architecture Notes
120+
121+
When you run any of the commands that generate/serve js you are running one or more webpack builds via an `App`. For example `pie info` uses the `InfoApp` which has a `serve` function. This method will run an `install` then run a server that will make use of `webpack-dev-middleware`.
122+
123+
The high level flow is: `cmd` -> `install` -> `prepare webpack config(s)` -> `run webpack build` | `run webpack-dev-middleware`.
124+
125+
### .pie - build directory
126+
127+
When you install, you are installing the dependencies for your `pie` package.
128+
This happens in a directory called `.pie` that is relative to the `pie item` directory.
129+
130+
Inside the `.pie` directory is:
131+
* `package.json` - the install generated package.json that lists the pies that are dependencies
132+
* `.controllers` - the controllers install directory for controller related dependencies
133+
* `.configure` - the configure install directory for configure related dependencies.
134+
* `*.entry.js` - entry files for the given app type
135+
* `*.config.js` - webpack config js files (useful for debugging builds)
136+
137+
### build support
138+
139+
The webpack builds inside `.pie` make use of some pre-installed support directories that are located in `pie-cli/support`. They are npm packages that get installed along with `pie-cli`. Their `node_modules` directories are added to the webpack `resolve.modules` and `resolveLoader.modules` arrays.
140+
141+
They also contain `rules` that can be added to a webpack config. All the apps in `pie-cli` make use of any rules in the default support packages.
142+
143+
We do this to speed up intallation by only having to install these once. It gives greater control over supporting libs are added to the webpack build.
144+
145+
The support package is a standard npm package and we hope to enable the inclusion of external support packages via command line options for custom builds.
146+
118147
##### Credits
119148

120149
> Special thanks to Ken Pratt @kenpratt for the `pie` npm package name

TODO

Lines changed: 0 additions & 11 deletions
This file was deleted.

gulpfile.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const gulp = require('gulp'),
55
tsProject = ts.createProject('tsconfig.json'),
66
fsExtra = require('fs-extra'),
77
runSequence = require('run-sequence'),
8-
path = require('path');
8+
path = require('path'),
9+
spawn = require('child_process').spawn,
10+
{ join } = require('path');
911

1012
//Init custom release tasks
1113
releaseHelper.init(gulp);
@@ -52,3 +54,40 @@ gulp.task('build', done => runSequence('clean', ['md', 'ejs', 'pug', 'ts'], done
5254
gulp.task('dev', ['build', 'watch-md', 'watch-ejs', 'watch-pug', 'watch-ts']);
5355

5456
gulp.task('test', ['unit']);
57+
58+
59+
const dir = (d) => join(__dirname, 'support', d);
60+
61+
const install = (name) => {
62+
return (done) => {
63+
const p = spawn('npm', ['install'], { cwd: dir(name) });
64+
p.on('error', done);
65+
p.on('close', done.bind(null, null));
66+
}
67+
}
68+
69+
const rmDeps = (name) => (done) => fsExtra.remove(join(dir(name), 'node_modules'), done);
70+
71+
gulp.task('install-support-base', install('base'));
72+
gulp.task('install-support-less', install('less'));
73+
gulp.task('install-support-react', install('react'));
74+
gulp.task('install-support-corespring-legacy', install('corespring-legacy'));
75+
76+
gulp.task('rm-support-base', rmDeps('base'));
77+
gulp.task('rm-support-less', rmDeps('less'));
78+
gulp.task('rm-support-react', rmDeps('react'));
79+
gulp.task('rm-support-corespring-legacy', rmDeps('corespring-legacy'));
80+
81+
gulp.task('install-support-dependencies', [
82+
'install-support-base',
83+
'install-support-less',
84+
'install-support-react',
85+
'install-support-corespring-legacy'
86+
]);
87+
88+
gulp.task('rm-support-dependencies', done => runSequence(
89+
'rm-support-base',
90+
'rm-support-less',
91+
'rm-support-react',
92+
'rm-support-corespring-legacy',
93+
done));

package.json

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pie",
3-
"version": "5.5.0-prerelease",
3+
"version": "6.0.0-prerelease",
44
"description": "The Portable Interaction Elements framework CLI",
55
"preferGlobal": true,
66
"bin": {
@@ -13,7 +13,8 @@
1313
"it": "./node_modules/.bin/gulp it",
1414
"dev": "./node_modules/.bin/gulp dev",
1515
"release": "./node_modules/.bin/gulp release",
16-
"source-maps": "gulp build && ./node_modules/.bin/tsc"
16+
"source-maps": "gulp build && ./node_modules/.bin/tsc",
17+
"postinstall": "gulp install-support-dependencies"
1718
},
1819
"repository": {
1920
"type": "git",
@@ -35,29 +36,31 @@
3536
"homepage": "https://github.com/PieLabs/pie-cli#readme",
3637
"devDependencies": {
3738
"@types/acorn": "^4.0.0",
38-
"@types/ajv": "1.0.0",
3939
"@types/babel-core": "^6.7.14",
40+
"@types/bluebird": "^3.0.37",
4041
"@types/chokidar": "^1.4.31",
4142
"@types/ejs": "^2.3.33",
4243
"@types/express": "^4.0.35",
4344
"@types/fs-extra": "0.0.37",
4445
"@types/glob": "^5.0.30",
4546
"@types/jsesc": "^0.4.29",
4647
"@types/lodash": "^4.14.53",
48+
"@types/marked": "0.0.28",
4749
"@types/node": "^7.0.5",
4850
"@types/pug": "^2.0.4",
4951
"@types/resolve": "0.0.4",
5052
"@types/semver": "^5.3.30",
5153
"@types/source-map": "^0.5.0",
52-
"@types/stack-trace": "0.0.28",
5354
"@types/temp": "^0.8.29",
5455
"@types/touch": "0.0.1",
55-
"@types/uglify-js": "^2.6.28",
5656
"@types/webpack": "^2.2.7",
5757
"@types/winston": "2.2.0",
5858
"acorn": "^4.0.11",
5959
"babel-cli": "^6.23.0",
60+
"babel-core": "^6.23.1",
61+
"babel-loader": "^6.3.2",
6062
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0",
63+
"babel-register": "^6.23.0",
6164
"chai": "^3.5.0",
6265
"eslint": "^3.16.1",
6366
"eslint-plugin-react": "^6.10.0",
@@ -69,7 +72,6 @@
6972
"gulp-sourcemaps": "^2.4.1",
7073
"gulp-typescript": "^3.1.5",
7174
"gulp-util": "^3.0.8",
72-
"minimist": "^1.2.0",
7375
"mocha": "^3.2.0",
7476
"proxyquire": "^1.7.11",
7577
"release-helper": "PieLabs/release-helper#v1.3.0",
@@ -80,18 +82,11 @@
8082
"typescript": "^2.2.1"
8183
},
8284
"dependencies": {
83-
"@types/bluebird": "^3.0.37",
8485
"ajv": "^4.11.3",
8586
"archiver": "^1.3.0",
86-
"babel-core": "^6.23.1",
87-
"babel-loader": "^6.3.2",
88-
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0",
89-
"babel-register": "^6.23.0",
9087
"bluebird": "^3.4.7",
91-
"bower": "^1.8.0",
9288
"change-case": "^3.0.1",
9389
"chokidar": "^1.6.1",
94-
"commander": "^2.9.0",
9590
"ejs": "^2.5.6",
9691
"express": "^4.14.1",
9792
"fs-extra": "^2.0.0",
@@ -101,16 +96,13 @@
10196
"log-factory": "github:pielabs/log-factory#master",
10297
"marked": "^0.3.6",
10398
"marked-terminal": "^2.0.0",
99+
"minimist": "^1.2.0",
104100
"node-github": "0.0.3",
105101
"npm-registry-client": "^7.4.5",
106-
"pie-catalog-client": "PieLabs/pie-catalog-client#v0.2.0",
107102
"pug": "^2.0.0-beta9",
108-
"raw-loader": "^0.5.1",
109103
"resolve": "^1.3.2",
110104
"semver": "^5.3.0",
111-
"serve-index": "^1.8.0",
112105
"sockjs": "^0.3.18",
113-
"stack-trace": "0.0.9",
114106
"touch": "^1.0.0",
115107
"webpack": "2.2.1",
116108
"webpack-dev-middleware": "^1.10.1",

playground/bower-test.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

playground/package-info.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)