Skip to content

Commit

Permalink
feat(build): rename --ignore-resources to --copy-resources
Browse files Browse the repository at this point in the history
Rework `lb-tsc` to NOT copy resources by default.

Drop `--ignore-resources` flag (which implied that resources are
copied by default).

Add a new flag `--copy-resources` to allow old projects to request
the old behavior.
  • Loading branch information
bajtos committed Oct 8, 2018
1 parent 1a8c8c1 commit 2958ace
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ Now you run the scripts, such as:

- The following un-official compiler options are available:

| Option | Description |
| -------------------- | ----------------------------------- |
| `--ignore-resources` | Do not copy any resources to outDir |
| Option | Description |
| ------------------ | ------------------------------------------------------------------------------------------------- |
| `--copy-resources` | Copy all non-typescript files from `src` and `test` to `outDir`, preserving their relative paths. |

- lb-tslint

Expand Down
14 changes: 7 additions & 7 deletions packages/build/bin/compile-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ function run(argv, options) {
const isTargetSet = utils.isOptionSet(compilerOpts, '--target');
const isOutDirSet = utils.isOptionSet(compilerOpts, '--outDir');
const isProjectSet = utils.isOptionSet(compilerOpts, '-p', '--project');
const isIgnoreResourcesSet = utils.isOptionSet(
const isCopyResourcesSet = utils.isOptionSet(
compilerOpts,
'--ignore-resources',
'--copy-resources',
);

var target;

// --ignore-resources is not a TS Compiler option so we remove it from the
// --copy-resources is not a TS Compiler option so we remove it from the
// list of compiler options to avoid compiler errors.
if (isIgnoreResourcesSet) {
compilerOpts.splice(compilerOpts.indexOf('--ignore-resources'), 1);
if (isCopyResourcesSet) {
compilerOpts.splice(compilerOpts.indexOf('--copy-resources'), 1);
}

if (!isTargetSet) {
Expand Down Expand Up @@ -128,9 +128,9 @@ function run(argv, options) {
args.push('--outDir', path.relative(cwd, outDir));

// Since outDir is set, ts files are compiled into that directory.
// If ignore-resources flag is not passed, copy resources (non-ts files)
// If copy-resources flag is passed, copy resources (non-ts files)
// to the same outDir as well.
if (rootDir && tsConfigFile && !isIgnoreResourcesSet) {
if (rootDir && tsConfigFile && isCopyResourcesSet) {
const tsConfig = require(tsConfigFile);
const dirs = tsConfig.include
? tsConfig.include.join('|')
Expand Down

0 comments on commit 2958ace

Please sign in to comment.