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

build(docs-infra): fixed broken stackblitz example of i18n module #42001

Conversation

iRealNirmal
Copy link
Contributor

This commit fixes the broken stackblitz example of animation.

Closes 41838.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

angular.io/guide/i18n live example is broken

Issue Number: #41838

What is the new behavior?

angular.io/guide/i18n live example issue if fixed

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@google-cla google-cla bot added the cla: yes label May 8, 2021
@pullapprove pullapprove bot requested a review from gkalpak May 8, 2021 08:55
@iRealNirmal iRealNirmal force-pushed the animation-stackblitz-dependency-issue branch from 2282516 to 6ce58f6 Compare May 8, 2021 08:57
@iRealNirmal
Copy link
Contributor Author

@petebacondarwin can you help in review this ? Also can you add air-preview label so it can be previewed as well.

@iRealNirmal iRealNirmal force-pushed the animation-stackblitz-dependency-issue branch from 6ce58f6 to bd1b653 Compare May 8, 2021 09:13
@iRealNirmal iRealNirmal changed the title docs(animation): fixed animation broken stackblitz example docs: fixed broken stackblitz example of animation module May 8, 2021
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer aio: preview comp: docs target: patch This PR is targeted for the next patch release labels May 8, 2021
@mary-poppins
Copy link

You can preview 6ce58f6 at https://pr42001-6ce58f6.ngbuilds.io/.
You can preview bd1b653 at https://pr42001-bd1b653.ngbuilds.io/.

@ngbot ngbot bot modified the milestone: Backlog May 8, 2021
Copy link
Member

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the fix was to add compiler-cli into the array here:

// Add unit test packages from devDependencies for unit test examples
const devDependencies = packageJson.devDependencies;
['jasmine-core', 'jasmine-marbles'].forEach(dep => exampleDependencies[dep] = devDependencies[dep]);

Did you try that?

@iRealNirmal
Copy link
Contributor Author

I thought the fix was to add compiler-cli into the array here:

// Add unit test packages from devDependencies for unit test examples
const devDependencies = packageJson.devDependencies;
['jasmine-core', 'jasmine-marbles'].forEach(dep => exampleDependencies[dep] = devDependencies[dep]);

Did you try that?

No let me try and update but fyi this is common place so it will add for all files, are you fine with that ?

@iRealNirmal
Copy link
Contributor Author

I thought the fix was to add compiler-cli into the array here:

// Add unit test packages from devDependencies for unit test examples
const devDependencies = packageJson.devDependencies;
['jasmine-core', 'jasmine-marbles'].forEach(dep => exampleDependencies[dep] = devDependencies[dep]);

Did you try that?

@petebacondarwin tried suggestion you provided but it's not working

@petebacondarwin
Copy link
Member

The 422 error message helps to solve the mystery:

"MISSING_PEERS\",\"data\":{\"typescript\":{\"@angular/compiler-cli@11.2.1}

So we need both @angular/compiler-cli and typescript.

@iRealNirmal
Copy link
Contributor Author

The 422 error message helps to solve the mystery:

"MISSING_PEERS\",\"data\":{\"typescript\":{\"@angular/compiler-cli@11.2.1}

So we need both @angular/compiler-cli and typescript.

Yes you want me to import both in builder.js and try, or keep current approach ?

@petebacondarwin
Copy link
Member

Rather than include these dependencies in every StackBlitz, I propose that we add a new property to the stackblitz.json config file that allows us to specify devDependencies to include in the dependencies of the StackBlitz.

So for the i18n example we would have:

{
    "description": "i18n",
    "files":[
      "!**/*.d.ts",
      "!**/*.js",
      "!**/*.[0-9].*",
      "!doc-files/**/*",	
      "**/*.xlf"
    ],
    "file": "src/app/app.component.ts", 
    "tags": ["Angular", "i18n", "internationalization"],
    "devDependencies": ["@angular/compiler-cli", "typescript"]
}

and then for the testing example we would have:

{
  "description": "Heroes Test App",
  "files":[
    "src/index.html",
    "src/main.ts",
    "src/styles.css",
    "src/test.css",

    "e2e/src/**/*.ts",

    "src/app/**/*.css",
    "src/app/**/*.html",
    "src/app/**/*.ts",

    "!src/**/*.spec.ts"
  ],
  "tags": ["testing"],
  "devDependencies": ["jasmine-core", "jasmine-marbles"]
}

And then we can remove the hard coded items from builder.js.

@iRealNirmal iRealNirmal force-pushed the animation-stackblitz-dependency-issue branch from bd1b653 to d0fcfd9 Compare May 9, 2021 03:18
@pullapprove pullapprove bot requested a review from IgorMinar May 9, 2021 03:18
@iRealNirmal iRealNirmal force-pushed the animation-stackblitz-dependency-issue branch 2 times, most recently from a8a3afe to ebc1e1a Compare May 9, 2021 03:22
@mary-poppins
Copy link

You can preview ebc1e1a at https://pr42001-ebc1e1a.ngbuilds.io/.

@iRealNirmal
Copy link
Contributor Author

Rather than include these dependencies in every StackBlitz, I propose that we add a new property to the stackblitz.json config file that allows us to specify devDependencies to include in the dependencies of the StackBlitz.

So for the i18n example we would have:

{
    "description": "i18n",
    "files":[
      "!**/*.d.ts",
      "!**/*.js",
      "!**/*.[0-9].*",
      "!doc-files/**/*",	
      "**/*.xlf"
    ],
    "file": "src/app/app.component.ts", 
    "tags": ["Angular", "i18n", "internationalization"],
    "devDependencies": ["@angular/compiler-cli", "typescript"]
}

and then for the testing example we would have:

{
  "description": "Heroes Test App",
  "files":[
    "src/index.html",
    "src/main.ts",
    "src/styles.css",
    "src/test.css",

    "e2e/src/**/*.ts",

    "src/app/**/*.css",
    "src/app/**/*.html",
    "src/app/**/*.ts",

    "!src/**/*.spec.ts"
  ],
  "tags": ["testing"],
  "devDependencies": ["jasmine-core", "jasmine-marbles"]
}

And then we can remove the hard coded items from builder.js.

@petebacondarwin it was good suggestion, I have done changes you suggested. can you re-review and also help to rerun test_ivy_aot_win ?

Copy link
Member

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I think it can be a lot simpler.

@@ -100,7 +121,7 @@ class StackblitzBuilder {
try {
const config = this._initConfigAndCollectFileNames(configFileName);
const postData = this._createPostData(config, configFileName);
this._addDependencies(config, postData);
this._addDependencies(config, postData, configFileName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add a new parameter here. The config parameter already contains the devDependencies that you need.

Comment on lines 47 to 49
const testStackblitzestPath = path.join(this.basePath, '/testing/stackblitz.json');
const stackblitzJsonDevDependencies = this._getDevDependencies(stackBlitzJson);
const stackblitzJsonTestDependencies = this._getDevDependencies(testStackblitzestPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this code is here, and why it is hard-coded to the /testing/ path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petebacondarwin this seems required change because if I remove this it will not import
"jasmine-core", "jasmine-marbles" from test file.

If we don't want to add this line of code then other alternative would be to add
"jasmine-core", "jasmine-marbles" it each and every stackblitz.json

For now I have done changes as you suggested and you can see difference in live example between
https://pr42001-ebc1e1a.ngbuilds.io/guide/i18n
https://pr42001-335a4ca.ngbuilds.io/guide/i18n

aio/tools/stackblitz-builder/builder.js Outdated Show resolved Hide resolved
@iRealNirmal iRealNirmal force-pushed the animation-stackblitz-dependency-issue branch from ebc1e1a to 335a4ca Compare May 10, 2021 02:24
@mary-poppins
Copy link

You can preview 335a4ca at https://pr42001-335a4ca.ngbuilds.io/.

@iRealNirmal iRealNirmal force-pushed the animation-stackblitz-dependency-issue branch from 335a4ca to a9cc93e Compare May 10, 2021 07:20
@iRealNirmal iRealNirmal force-pushed the animation-stackblitz-dependency-issue branch from a9cc93e to b251ee8 Compare May 10, 2021 07:21
@iRealNirmal iRealNirmal changed the title docs: fixed broken stackblitz example of animation module build(docs-infra): fixed broken stackblitz example of i18n module May 10, 2021
This commit fixes the broken stackblitz example of i18n.

Closes angular#41838.
@iRealNirmal iRealNirmal force-pushed the animation-stackblitz-dependency-issue branch from b251ee8 to 7d7abc9 Compare May 10, 2021 07:23
@mary-poppins
Copy link

You can preview 7d7abc9 at https://pr42001-7d7abc9.ngbuilds.io/.

@petebacondarwin petebacondarwin removed the action: review The PR is still awaiting reviews from at least one requested reviewer label May 10, 2021
Copy link
Member

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @iRealNirmal

@petebacondarwin petebacondarwin requested review from AndrewKushnir and removed request for gkalpak May 10, 2021 07:52
@petebacondarwin petebacondarwin added the action: review The PR is still awaiting reviews from at least one requested reviewer label May 10, 2021
@petebacondarwin petebacondarwin removed the request for review from IgorMinar May 10, 2021 15:50
@petebacondarwin petebacondarwin added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 10, 2021
@alxhub alxhub closed this in e071e3b May 10, 2021
alxhub pushed a commit that referenced this pull request May 10, 2021
This commit fixes the broken stackblitz example of i18n.

Closes #41838.

PR Close #42001
alxhub pushed a commit that referenced this pull request May 10, 2021
This commit fixes the broken stackblitz example of i18n.

Closes #41838.

PR Close #42001
@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 Jun 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker aio: preview cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants