Skip to content

Commit

Permalink
feat(build): add support for dryRun to --copy-resources
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
  • Loading branch information
bajtos committed Jun 10, 2019
1 parent 4f947a3 commit f8f078f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ Now you run the scripts, such as:
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "@loopback/build/config/tsconfig.common.json",
"compilerOptions": {
"rootDir": "."
"outDir": "dist",
"rootDir": "src"
},
"include": ["src", "test"]
"include": ["src"]
}
```

Expand Down
9 changes: 8 additions & 1 deletion packages/build/bin/compile-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Where <target> is one of es2015, es2017 or es2018.

'use strict';

const debug = require('debug')('loopback:build');
const utils = require('./utils');
const path = require('path');
const fs = require('fs');
Expand Down Expand Up @@ -195,6 +196,12 @@ function copyResources(rootDir, packageDir, tsConfigFile, outDir, options) {
if (compilerRootDir && file.startsWith(compilerRootDir + '/')) {
targetFile = file.substring(compilerRootDir.length + 1);
}
fse.copySync(path.join(packageDir, file), path.join(outDir, targetFile));

const copyFrom = path.join(packageDir, file);
const copyTo = path.join(outDir, targetFile);
debug(' copy %j to %j', copyFrom, copyTo);
if (!options.dryRun) {
fse.copySync(copyFrom, copyTo);
}
}
}

0 comments on commit f8f078f

Please sign in to comment.