Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chain steps seem to be repeated multiple times #11267

Closed
sebawita opened this issue Jun 15, 2018 · 2 comments
Closed

Chain steps seem to be repeated multiple times #11267

sebawita opened this issue Jun 15, 2018 · 2 comments

Comments

@sebawita
Copy link

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x] devkit
- [ ] schematics

Versions

@angular/cli@6.1.0.rc.0

Repro steps

When I run a schematic like:

let x = 1;

export default function(_options: any): Rule {
  return chain([
    () => {
      console.log(`Say it #${x++}`);
    },
    addSebastian,
    addCharles,
    addHans
  ]);
}

const addSebastian = () => {
  const templateOptions = {
    name: 'sebastian'
  };
  const templateSource = apply(url('./_files'), [
      template(templateOptions)
  ]);
  return mergeWith(templateSource);
}

const addCharles = () => {
  const templateOptions = {
    name: 'charles'
  };
  const templateSource = apply(url('./_files'), [
      template(templateOptions)
  ]);
  return mergeWith(templateSource);
}

const addHans = () => {
  const templateOptions = {
    name: 'hans'
  };
  const templateSource = apply(url('./_files'), [
      template(templateOptions)
  ]);
  return mergeWith(templateSource);
}

I get a message printed in the first step 8 times. Which suggests that the step runs 8 times.
I would expect it to be executed only once.

You can easily reproduce the issue with this project.
https://github.com/sebawita/sample

The log given by the failure

screen shot 2018-06-15 at 16 20 32

Desired functionality

I only expect Say it #1 to be displayed, but not the other 7

@sebawita
Copy link
Author

Also here is package.json from my demo project:

{
  "name": "cli610rc0",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.3",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.3",
    "@angular/http": "^6.0.3",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/router": "^6.0.3",
    "core-js": "^2.5.4",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26",
    "nativescript-angular": "6.0.0",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "~0.1.8",
    "tns-core-modules": "~4.1.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.7.0-beta.2",
    "@angular/cli": "6.1.0-rc.0",
    "@angular/compiler-cli": "^6.0.3",
    "@angular/language-service": "^6.0.3",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "2.7.2",
    "nativescript-dev-typescript": "~0.7.0",
    "nativescript-dev-webpack": "0.13.0",
    "@angular-devkit/core": "0.7.0-beta.2"
  }
}

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants