mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
9e05af3aa4
Adds a tslint rule to enforce that the casing on our filenames is consistent. The tslint rule files are excluded, because their names have to be in camel case and end with `Rule`.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import {writeFileSync} from 'fs';
|
|
import {join} from 'path';
|
|
|
|
|
|
const Bundler = require('scss-bundle').Bundler;
|
|
const minimist = require('minimist');
|
|
|
|
/** The root of the bazel workspace (sandbox). */
|
|
const workspaceRoot = process.cwd();
|
|
|
|
/**
|
|
* Bundles sass partials into a single file using the `scss-bundle` package. This does not use the
|
|
* default CLI for `scss-bundle` to give us a place to introspect / debug values coming from
|
|
* bazel if necessary.
|
|
*/
|
|
export async function main(args: string[]): Promise<number> {
|
|
const parsedArgs: {srcs: string, output: string, entry: string} = minimist(args);
|
|
const inputFiles = parsedArgs.srcs.split(',');
|
|
|
|
return new Bundler().Bundle(join(workspaceRoot, parsedArgs.entry), inputFiles).then(result => {
|
|
writeFileSync(parsedArgs.output, result.bundledContent);
|
|
return 0;
|
|
}).catch(error => {
|
|
console.error('Sass bundling failed');
|
|
console.dir(error);
|
|
return 1;
|
|
});
|
|
}
|
|
|
|
if (require.main === module) {
|
|
const args = process.argv.slice(2);
|
|
main(args).then(exitCode => {
|
|
process.exitCode = exitCode;
|
|
});
|
|
}
|