Skip to content
This repository has been archived by the owner on Sep 9, 2019. It is now read-only.

Commit

Permalink
fix: use absolute path to copy
Browse files Browse the repository at this point in the history
  • Loading branch information
weareoutman committed Feb 28, 2019
1 parent ed66afc commit 98a2f61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 0 additions & 2 deletions __tests__/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,6 @@ describe('generator-console-package:app:@console-plugin', () => {
it('should run `lerna exec yarn link` and `yarn`', () => {
expect(mockSpawn.calledWithExactly('lerna', ['exec', 'yarn', 'link', `--scope=@console-plugin/${packageName}`])).toBe(true);

expect(mockSpawn.calledWithExactly('yarn', [], { cwd: `packages/${packageName}` })).toBe(true);

expect(mockSpawn.callCount).toBe(2);
});
});
Expand Down
9 changes: 5 additions & 4 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ module.exports = class extends Generator {

writing() {
const { packageName, componentName, scope, subPackagePath, isLibrary, projectNamePrefix, tsconfigPath, needPluginsConfig, needDeployConfig } = this.props;
const destPath = `${subPackagePath}/${packageName}`;
const destRoot = this.destinationRoot();
const destPath = `${destRoot}/${subPackagePath}/${packageName}`;
const srcPath = `${this.sourceRoot()}/${isLibrary ? 'library' : 'plugin'}`;

let srcPairs, tplPairs;
Expand Down Expand Up @@ -174,7 +175,7 @@ module.exports = class extends Generator {

if (tsconfigPath) {
const tsconfigJson = 'tsconfig.json';
this.fs.copy(tsconfigJson, tsconfigJson, {
this.fs.copy(`${this.destinationRoot()}/${tsconfigJson}`, `${destRoot}/${tsconfigJson}`, {
process: content => {
const tsconfig = JSON.parse(content);
tsconfig.compilerOptions.paths[`${scope}/${packageName}`] = [`${subPackagePath}/${packageName}/public_api.ts`];
Expand All @@ -185,7 +186,7 @@ module.exports = class extends Generator {

const angularPath = 'angular.json';
const projectName = (projectNamePrefix === undefined ? '' : projectNamePrefix) + packageName;
this.fs.copy(angularPath, angularPath, {
this.fs.copy(`${this.destinationRoot()}/${angularPath}`, `${destRoot}/${angularPath}`, {
process: content => {
const angular = JSON.parse(content);
angular.projects[projectName] = {
Expand Down Expand Up @@ -222,7 +223,7 @@ module.exports = class extends Generator {
install() {
const done = this.async();
const { subPackagePath, scope, packageName, isLibrary } = this.props;
const distPath = `${subPackagePath}/${packageName}`;
const distPath = `${this.destinationRoot()}/${subPackagePath}/${packageName}`;
const childOfYarnLink = this.spawnCommand('lerna', ['exec', 'yarn', 'link', `--scope=${scope}/${packageName}`]);
childOfYarnLink.on("close", () => {
if (isLibrary) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"pretest": "eslint .",
"precommit": "lint-staged",
"prepublish": "cross-env NODE_ENV=testing yarn test",
"test": "cross-env NODE_ENV=testing jest",
"test": "cross-env NODE_ENV=testing jest --runInBand",
"coveralls": "cat ./coverage/lcov.info | coveralls"
},
"license": "MIT"
Expand Down

0 comments on commit 98a2f61

Please sign in to comment.