chore(build): update build scripts

This commit is contained in:
Adam Bradley
2018-03-03 16:16:02 -06:00
parent 06abbf069f
commit 239b0aa1bb
7 changed files with 126 additions and 69 deletions

View File

@@ -1,12 +1,19 @@
# @ionic/angular
Ionic Angular specific building blocks on top of [@ionic/core](https://www.npmjs.com/package/@ionic/core) components/services.
Ionic Angular specific building blocks on top of [@ionic/core](https://www.npmjs.com/package/@ionic/core) components.
## Related
* [Ionic Components](https://www.npmjs.com/package/@ionic/core)
* [Ionicons](http://ionicons.com/)
* [Ionic Core Components](https://www.npmjs.com/package/@ionic/core)
* [Ionic Documentation](https://ionicframework.com/docs/)
* [Ionic Worldwide Slack](http://ionicworldwide.herokuapp.com/)
* [Ionic Forum](https://forum.ionicframework.com/)
* [Ionicons](http://ionicons.com/)
* [Stencil](https://stenciljs.com/)
* [Stencil Worldwide Slack](https://stencil-worldwide.slack.com)
## License
* [MIT](https://raw.githubusercontent.com/ionic-team/ionic/master/LICENSE)

View File

@@ -5,10 +5,11 @@
"keywords": [
"ionic",
"framework",
"angular",
"mobile",
"app",
"hybrid",
"webapp",
"capacitor",
"cordova",
"progressive web app",
"pwa"
@@ -20,7 +21,6 @@
},
"scripts": {
"build": "npm run clean && npm run compile && npm run clean-generated",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"clean": "node scripts/clean.js",
"clean-generated": "node ./scripts/clean-generated.js",
"compile": "./node_modules/.bin/ngc",
@@ -47,7 +47,6 @@
"@angular/router": "latest",
"@ionic/core": "^0.1.3",
"chalk": "^2.3.2",
"conventional-changelog-cli": "^1.3.16",
"execa": "^0.9.0",
"fs-extra": "^5.0.0",
"glob": "7.1.2",

View File

@@ -149,10 +149,6 @@ function runTasks(opts) {
{
title: 'Set package.json version',
task: () => execa('npm', ['run', 'set.version', opts.version], { cwd: rootDir }),
},
{
title: 'Generate CHANGELOG',
task: () => execa('npm', ['run', 'changelog'], { cwd: rootDir }),
}
);
}
@@ -165,7 +161,7 @@ function runTasks(opts) {
},
{
title: 'Tagging the latest commit',
task: () => execa('git', ['tag', `v${opts.version}`], { cwd: rootDir })
task: () => execa('git', ['tag', `${pkg.name}-v${opts.version}`], { cwd: rootDir })
},
{
title: 'Pushing to Github',

View File

@@ -1,54 +1,47 @@
# @ionic/core
This contains the core stencil components for ionic based applications.
## Let's get started
### 1. Install global dependencies
- stencil
- np
- jest
- tsc
- tslint
```
npm i -g stencil np jest tsc tslint
```
### 2. Clone your ionic fork
```
git@github.com:ionic-team/ionic.git
cd ionic
```
### 3. Run `npm install`
```
npm install
cd packages/core
npm install
````
Notice that ionic-core lives in `packages/core`.
### 4. Run `npm run dev`
Make sure you are inside `packages/core`
[Ionic](https://ionicframework.com/) is the open-source app development framework that makes it easy to build top quality native and progressive web apps with web technologies. Ionic Core is able to provide the collection by using Web Components at the lowest-level, so they work in any framework or with no framework at all.
## How to contribute
## Features
1. `npm run dev` allows you to modify the components and have live reloading, just like another ionic app.
3. When everything looks good, run `npm run validate` to verify the tests linter and production build passes.
* Tiny, highly optimized components built with [Stencil](https://stenciljs.com/)
* Styling for both iOS and Material Design
* No build or compiling required
* Simply add the static files to any project
* Lazy-loaded components without configuration
* Asynchronous rendering
* Theming through CSS Variables
## More commands
## How to use
- `npm run build`: build ionic-core for production.
- `npm run dev`: live reloading server for ionic developement,
- `npm run test`: runs unit tests.
- `npm run clean`: cleans dist folder.
- `npm run lint`: runs typescript linter.
- `npm run lint-fix`: tries to auto-fix linter issues.
- `npm run validate`: runs tests, linter and production build.
- `npm run deploy`: publishes a new version to NPM.
Easiest way to start using Ionic Core is by adding a script tag to the CDN:
<script src="https://unpkg.com/@ionic/core@0.1.2/dist/ionic.js"></script>
Any Ionic component added to the webpage will automatically load. This includes writing the component tag directly in HTML, or using JavaScript such as `document.createElement('ion-toggle')`.
Additionally, within this package is a `dist/ionic.js` file and accompanying `dist/ionic/` directory. These are the same files which are used by the CDN, and they're available in this package so they can be apart of an app's local development.
## Framework Bindings
The `@ionic/core` package can by used in simple HTML, or by vanilla JavaScript without any framework at all. Ionic also has packages that make it easiesr to integrate Ionic into a framework's traditional ecosystem and patterns. (However, at the lowest-level framework bindings are still just using Ionic Core and Web Components).
* [@ionic/angular](https://www.npmjs.com/package/@ionic/angular)
## Related
* [Ionic Documentation](https://ionicframework.com/docs/)
* [Ionic Worldwide Slack](http://ionicworldwide.herokuapp.com/)
* [Ionic Forum](https://forum.ionicframework.com/)
* [Ionicons](http://ionicons.com/)
* [Stencil](https://stenciljs.com/)
* [Stencil Worldwide Slack](https://stencil-worldwide.slack.com)
## License
* [MIT](https://raw.githubusercontent.com/ionic-team/ionic/master/LICENSE)

View File

@@ -2,6 +2,18 @@
"name": "@ionic/core",
"version": "0.1.3",
"description": "Base components for Ionic",
"keywords": [
"ionic",
"framework",
"stencil",
"mobile",
"app",
"webapp",
"capacitor",
"cordova",
"progressive web app",
"pwa"
],
"main": "dist/ionic.js",
"types": "dist/types/index.d.ts",
"collection": "dist/collection/collection-manifest.json",

View File

@@ -1,7 +1,44 @@
## Build
### 1. Clone ionic
git@github.com:ionic-team/ionic.git
cd ionic
### 2. Run `npm install`
cd packages/core
npm install
Notice that `@ionic/core` lives in `packages/core`.
### 3. Run `npm run dev`
Make sure you are inside the `packages/core` directory.
npm run dev
With the `dev` command, Ionic components will be built with [Stencil](https://stenciljs.com/), changes to source files are warched, a local http server will startup, and http://localhost:3333/ will open in a browser.
### 4. Preview
Navigate to http://localhost:3333/src/components/. Each component has small e2e apps found in the `test` directory, for example: http://localhost:3333/src/components/button/test/basic
As changes are made in an editor to source files, the e2e app will live-reload.
## How to contribute
1. `npm run dev` allows you to modify the components and have live reloading, just like another ionic app.
2. When everything looks good, run `npm run validate` to verify the tests linter and production build passes.
# Deploy
1. `npm run prepare.deploy`
2. Review/update changelog
3. Commit updates using the package name and version number as the commit message.
4. `npm run deploy`
5. :tada:
5. :tada:

View File

@@ -1,19 +1,32 @@
const fs = require('fs');
const path = require('path');
const semver = require('semver')
const packageJsonPath = path.join(__dirname, '../package.json');
const packageLockPath = path.join(__dirname, '../package-lock.json');
const pkgJsonPath = path.join(__dirname, '../package.json');
const pkgLockPath = path.join(__dirname, '../package-lock.json');
const readmePath = path.join(__dirname, '../README.md');
function getVersion() {
return process.argv[process.argv.length - 1];
// get the version number from the last arg
const newVersion = process.argv[2];
semver.valid(newVersion);
if (!newVersion) {
throw new Error('invalid version number: ' + newVersion);
}
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
packageJson.version = getVersion();
// update the package.json
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
pkgJson.version = newVersion;
const packageLock = JSON.parse(fs.readFileSync(packageLockPath, 'utf-8'));
packageLock.version = packageJson.version;
// update the package-lock.json
const pkgLock = JSON.parse(fs.readFileSync(pkgLockPath, 'utf-8'));
pkgLock.version = pkgJson.version;
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
fs.writeFileSync(packageLockPath, JSON.stringify(packageLock, null, 2) + '\n');
// update the readme script tag
let readme = fs.readFileSync(readmePath, 'utf-8');
const cdnUrl = 'https://unpkg.com/' + pkgJson.name + '@' + pkgJson.version + '/dist/ionic.js'
readme = readme.replace(/https:\/\/unpkg.com(.*)ionic.js/, cdnUrl);
// save our changes
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + '\n');
fs.writeFileSync(pkgLockPath, JSON.stringify(pkgLock, null, 2) + '\n');
fs.writeFileSync(readmePath, readme);