mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-12-19 05:19:42 +08:00
chore(build): improve angular build scripts
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
# Local @ionic/angular test app development
|
||||
# Local @ionic/angular test/testapp development
|
||||
|
||||
1. `npm install` at the root of `angular`
|
||||
2. `npm run build` to build local `@ionic/angular`
|
||||
3. `npm link` to locally link `@ionic/angular`
|
||||
4. `cd` to the test app, such as `angular/test/nav`
|
||||
5. `npm install` in the test app directory
|
||||
6. `npm link @ionic/angular` in the test app directory
|
||||
7. `ng serve` in the test app directory
|
||||
8. [http://localhost:4200/](http://localhost:4200/)
|
||||
2. `npm run build.dev` to build local `@ionic/angular` and `@ionic/core`
|
||||
3. `cd test/testapp` to the test app
|
||||
4. `npm install` in the test app directory
|
||||
5. `npm run serve` copies packages and serve the app (see package.json for more options)
|
||||
6. [http://localhost:4200/](http://localhost:4200/)
|
||||
|
||||
|
||||
# npm link local development
|
||||
|
||||
74
angular/scripts/build-core.js
vendored
Normal file
74
angular/scripts/build-core.js
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
const stencilPath = path.join(__dirname, '..', '..', 'core', 'node_modules', '.bin');
|
||||
|
||||
|
||||
function buildIonicAngular() {
|
||||
const cmd = 'stencil';
|
||||
const args = [
|
||||
'build',
|
||||
'--config',
|
||||
path.join(__dirname, '..', 'stencil.config.js'),
|
||||
...process.argv.slice(2)
|
||||
];
|
||||
|
||||
console.log(cmd, args.join(' '));
|
||||
|
||||
const p = spawn('stencil', args, { cwd: stencilPath, stdio: 'inherit' });
|
||||
p.on('close', (code) => {
|
||||
if (code > 0) {
|
||||
console.log(`@ionic/angular build exited with ${code}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buildIonicCore() {
|
||||
const cmd = 'stencil';
|
||||
const args = [
|
||||
'build',
|
||||
'--config',
|
||||
path.join(__dirname, '..', '..', 'core', 'stencil.config.js'),
|
||||
...process.argv.slice(2)
|
||||
];
|
||||
|
||||
console.log(cmd, args.join(' '));
|
||||
|
||||
const p = spawn('stencil', args, { cwd: stencilPath, stdio: 'inherit' });
|
||||
p.on('close', (code) => {
|
||||
if (code > 0) {
|
||||
console.log(`@ionic/core build exited with ${code}`);
|
||||
} else {
|
||||
copyIonicCore();
|
||||
copyIonicons();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function copyIonicons() {
|
||||
const src = path.join(__dirname, '..', '..', 'core', 'node_modules', 'ionicons');
|
||||
const dst = path.join(__dirname, '..', 'node_modules', 'ionicons');
|
||||
|
||||
fs.emptyDirSync(dst);
|
||||
fs.copySync(src, dst);
|
||||
}
|
||||
|
||||
function copyIonicCore() {
|
||||
const srcDir = path.join(__dirname, '..', '..', 'core');
|
||||
const dstDir = path.join(__dirname, '..', 'node_modules', '@ionic', 'core');
|
||||
|
||||
fs.emptyDirSync(dstDir);
|
||||
|
||||
const srcPkg = path.join(srcDir, 'package.json');
|
||||
const dstPkg = path.join(dstDir, 'package.json');
|
||||
fs.copySync(srcPkg, dstPkg);
|
||||
|
||||
const srcDist = path.join(srcDir, 'dist');
|
||||
const dstDist = path.join(dstDir, 'dist');
|
||||
fs.emptyDirSync(dstDist);
|
||||
fs.copySync(srcDist, dstDist);
|
||||
}
|
||||
|
||||
buildIonicCore();
|
||||
buildIonicAngular();
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -rf ./node_modules/ionicons
|
||||
cp -a ../core/node_modules/ionicons ./node_modules/ionicons
|
||||
../core/node_modules/.bin/stencil build
|
||||
Reference in New Issue
Block a user