Skip to content

The CLI adds the imports and declarations 3 characters too early #9712

@dushkostanoeski

Description

@dushkostanoeski

Versions

Angular CLI: 1.7.0
Node: 9.5.0
OS: win32 x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

angular/cdk: 5.2.2
angular/cli: 1.7.0
angular/material: 5.2.2
angular-devkit/build-optimizer: 0.3.1
angular-devkit/core: 0.3.1
angular-devkit/schematics: 0.3.1
ngtools/json-schema: 1.2.0
ngtools/webpack: 1.10.0
schematics/angular: 0.3.1
schematics/package-update: 0.3.1
typescript: 2.6.2
webpack: 3.11.0

Repro steps

I am writing an app in a Cyrillic language, and the encoding of the files that the CLI generates don't support the Cyrillic characters (I am getting ��� �� ������ in the browser) so I found this powershell script:

$files = Get-ChildItem 'PATH_TO_APP_FOLDER' -Recurse | ? {Test-Path $_.FullName -PathType Leaf}
                           foreach($file in $files)
{
    $content = Get-Content $file.FullName
    $content | Out-File $file.FullName -Encoding utf8
}

that converts all the files to UTF 8 and that way I can get Cyrillic in the browser. To reproduce the issue simply create a new project, run the script (make sure that the path points to the app folder) and then add a new component to the project. Imports in the module would look something like this:

import { ChangePasswordComponent } from './dialogs/change-password/change-password.componen;
import { TestComponent } from './test/test.component't';

and the same happens with the declarations:

    ChangePasswordCompone,
    TestComponentnt

I don't know if this is connected to #2077, but never the less, changing the encoding of the module file shouldn't break the functionality of the CLI.

Desired behavior

The module shouldn't have any errors after a component is generated.

Mention any other details that might be useful (optional)

I thought it had something to do with the script, so I used Notepad++ to convert the module file to UTF8 and again I got the same result.

EDIT:
I just noticed that the import is added 3 characters too early, but the declaration only 2.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions