mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 09:34:19 +08:00

Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> CSS is not copied from the `core/` package when running each respective framework package in watch mode. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Copies the global styles from the `core/` package to each respective framework package when running the build in watch mode. Note: This does not register a file watcher to copy CSS updates after the initial command is ran. This just avoids a scenario of the global styles being updated and the developer _not_ running a `pnpm build` prior to running `pnpm build.watch` and the global styles not being reflected in the framework package. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
const fs = require('fs-extra');
|
|
const path = require('path');
|
|
const spawn = require('child_process').spawn;
|
|
|
|
const typescriptPath = path.join(__dirname, '..', 'node_modules', '.bin');
|
|
|
|
/**
|
|
* Copy the CSS from the core package to the angular package.
|
|
*
|
|
* This allows developers to import the global stylesheets
|
|
* from the @ionic/angular package instead of @ionic/core.
|
|
*/
|
|
function copyCSS() {
|
|
const src = path.join(__dirname, '..', '..', '..', 'core', 'css');
|
|
const dst = path.join(__dirname, '..','dist', 'css');
|
|
|
|
fs.removeSync(dst);
|
|
fs.copySync(src, dst);
|
|
}
|
|
|
|
function buildSchematics(){
|
|
return new Promise((resolve, reject) => {
|
|
const cmd = 'tsc';
|
|
const args = [
|
|
'--project',
|
|
path.join(__dirname, '..', 'tsconfig.schematics.json'),
|
|
];
|
|
|
|
const p = spawn(cmd, args, { cwd: typescriptPath, stdio: 'inherit', shell: true });
|
|
p.on('close', (code) => {
|
|
if (code > 0) {
|
|
console.log(`ng-add build exited with ${code}`);
|
|
reject();
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
function copySchematicsJson(){
|
|
const src = path.join(__dirname, '..', 'src', 'schematics', 'collection.json');
|
|
const fileSrc = path.join(__dirname, '..', 'src', 'schematics', 'add', 'files');
|
|
const dst = path.join(__dirname, '..', 'dist','schematics', 'collection.json');
|
|
const fileDst = path.join(__dirname, '..', 'dist', 'schematics', 'add', 'files');
|
|
const schemaSrc = path.join(__dirname, '..', 'src', 'schematics', 'add', 'schema.json');
|
|
const schemaDst = path.join(__dirname, '..', 'dist', 'schematics', 'add', 'schema.json');
|
|
|
|
fs.removeSync(dst);
|
|
fs.removeSync(fileDst);
|
|
fs.copySync(src, dst);
|
|
fs.copySync(fileSrc,fileDst);
|
|
fs.copySync(schemaSrc, schemaDst);
|
|
|
|
}
|
|
|
|
copyCSS();
|
|
buildSchematics();
|
|
copySchematicsJson()
|