diff --git a/README.md b/README.md index c77d4c5f5c..a2f63032bb 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,62 @@ We are also building out a number of starter projects, including the Ionic 2 sta [https://github.com/driftyco/ionic2-starter](https://github.com/driftyco/ionic2-starter) -### Distribution +## Distribution - [npm: ionic-framework](https://www.npmjs.com/package/ionic-framework) + +## Ionic Framework Package + The ionic-framework package comes with both frontend dependencies, located in 'dist', and a Node API, located in 'tooling'. + +### Bundles: + + - `css/` + - the Ionic CSS stylesheet + - `fonts/` + - Ionicons and Roboto fonts + - `js/` + - `ionic.js` the Ionic module, in System register format + - `ionic.bundle.js` the Ionic bundle, contains: + - es6-module-loader.js + - system.js + - angular2.dev.js + - router.dev.js (angular2 router) + - ionic.js + - web-animations.min.js + - `web-animations.min.js` web animations API polyfill + +### Source files: + + - `src/es5` - Ionic ES5 source files in both CommonJS and System module formats + - `src/es6` - Ionic ES6 source files + - `src/ts` - Ionic TypeScript source files (typings still missing) + - `scss` - Ionic Sass source files + +--------- + +### Tooling + + At the moment, ionic-framework exports one function, `generate`, that can be used to scaffold new pages in an Ionic app. It is used by the [Ionic CLI's](https://github.com/driftyco/ionic-cli) `generate` command. + +#### Methods + +`generate(config)` + +Creates the js, html, and scss file for a new page, based on the supplied [Generator](#generators). + +- **config** (Object) Config object, with the following options: + - `appDirectory` - root directory of the Ionic project + - `generator` - which [generator](#generators) to use, default is `page`. + - `name` - + +Example: + ``` + var ionic = require('ionic-framework'); + ionic.generate({ appDirectory: process.cwd(), generator: 'tabs', name: 'MyTabsPage' }) + ``` + +#### Generators +- `page`, a blank page +- `tabs`, a page with tab navigation +- `sidemenu` + diff --git a/gulpfile.js b/gulpfile.js index e730b36a16..c6d7143412 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -497,47 +497,3 @@ gulp.task('demos:docs', ['sass.demos:docs', 'bundle.demos:docs'], function() { gulp.task('demos', ['demos:all']); - -gulp.task('publish', function(done) { - var version = flags.version; - var ngVersion = flags.ngVersion; - var dryRun = flags['dry-run']; - - if (!version || !ngVersion) { - console.error("\nERR: You need to provide a version for Ionic as well as " + - "the version of Angular it depends on.\n\n" + - "gulp publish -v {version} -a {ngVersion}\n"); - return - } - if (version.indexOf("alpha") + version.indexOf("-") > -2 || - ngVersion.indexOf("alpha") + ngVersion.indexOf("-") > -2) - { - console.error("\n ERR: Just provide version number. Instead of 2.0.0-alpha.10, just enter 10\n"); - return - } - - var exec = require('child_process').exec; - var _ = require('lodash'); - var fs = require('fs'); - - runSequence( - 'clean', - ['bundle', 'sass', 'fonts', 'copy.ts', 'copy.scss', 'copy.web-animations'], - 'transpile.common', - function() { - var packageJSONTemplate = _.template(fs.readFileSync('scripts/npm/package.json')); - packageJSONContents = packageJSONTemplate({ 'version': version, 'ngVersion': ngVersion }); - fs.writeFileSync('dist/package.json', packageJSONContents); - fs.writeFileSync('dist/README.md', fs.readFileSync('scripts/npm/README.md')); - - // publish to npm - if (!dryRun) { - exec('cd dist && npm publish', function (err, stdout, stderr) { - console.log(stdout); - console.error(stderr); - done(); - }); - } - } - ) -}) diff --git a/index.js b/index.js deleted file mode 100644 index 4e52b93f40..0000000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - generate: require('./tooling/generate') -}; diff --git a/package.json b/package.json index 05b556514c..af31b1bad2 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "name": "ionic2", - "version": "2.0.0-alpha.2", + "name": "ionic-framework", + "version": "2.0.0-alpha.31", "license": "Apache-2.0", "repository": { "type": "git", "url": "https://github.com/driftyco/ionic2.git" }, - "main": "index.js", + "main": "tooling/index.js", "scripts": { "test": "gulp karma", "test:generators": "jasmine-node ./tooling/spec", diff --git a/scripts/npm/README.md b/scripts/npm/README.md deleted file mode 100644 index c83f327b9f..0000000000 --- a/scripts/npm/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Ionic Framework - -### Bundles: - - - `css/` - - the Ionic CSS stylesheet - - `fonts/` - - Ionicons and Roboto fonts - - `js/` - - `ionic.js` the Ionic module, in System register format - - `ionic.bundle.js` the Ionic bundle, contains: - - es6-module-loader.js - - system.js - - angular2.dev.js - - router.dev.js (angular2 router) - - ionic.js - - web-animations.min.js - - `web-animations.min.js` web animations API polyfill - -### Source files: - - - `src/es5` - Ionic ES5 source files in both CommonJS and System module formats - - `src/es6` - Ionic ES6 source files - - `src/ts` - Ionic TypeScript source files (typings still missing) - - `scss` - Ionic Sass source files diff --git a/scripts/npm/package.json b/scripts/npm/package.json deleted file mode 100644 index 42467ffe7c..0000000000 --- a/scripts/npm/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "ionic-framework", - "version": "2.0.0-alpha.<%= version %>", - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "https://github.com/driftyco/ionic2.git" - }, - "files": [ - "css", - "fonts", - "js", - "src" - ], - "dependencies": { - "angular2": "2.0.0-alpha.<%= ngVersion %>", - "es6-shim": "^0.33.6", - "@reactivex/rxjs": "5.0.0-alpha.4", - "reflect-metadata": "0.1.1", - "zone.js": "0.5.8" - } -} diff --git a/tooling/index.js b/tooling/index.js new file mode 100644 index 0000000000..f3a483486b --- /dev/null +++ b/tooling/index.js @@ -0,0 +1,3 @@ +module.exports = { + generate: require('./generate').generate +};