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: enable importHelpers in tsconfig and add tslib to dependencies #4676

Closed
2 tasks
bajtos opened this issue Feb 18, 2020 · 0 comments · Fixed by #4680
Closed
2 tasks

build: enable importHelpers in tsconfig and add tslib to dependencies #4676

bajtos opened this issue Feb 18, 2020 · 0 comments · Fixed by #4680
Assignees
Labels
breaking-change feature good first issue Internal Tooling Issues related to our tooling and monorepo infrastructore

Comments

@bajtos
Copy link
Member

bajtos commented Feb 18, 2020

TypeScript has quite few helper functions that are by default emitted in every code produced by the compiler. For example, the Todo controller from our examples/todo application contains the following header in the transpiled output:

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};

Let's avoid this extra boilerplate by adding tslib package to project dependencies and telling the compiler to load helpers from there (--import-helpers).

See also nestjs/nest#3748 and https://www.npmjs.com/package/tslib

Acceptance criteria

  • Modify our shared tsconfig, enable importHelpers compiler option. This is a breaking change, see Describe incompatibilites for release notes.
  • Add tslib to dependencies of all packages in our monorepo, with the exception of packages written in vanilla JavaScript (I think that's only packages/cli, maybe docs too?). By packages I mean also examples/*, extensions/* and anything else that has a compilation step (test fixtures in tsdocs?). This should be fully backwards-compatible, therefore it should be committed in a commit different from the breaking change enabling importHelpers flag.
@bajtos bajtos added feature breaking-change good first issue Internal Tooling Issues related to our tooling and monorepo infrastructore labels Feb 18, 2020
@bajtos bajtos changed the title tsc: enable importHelpers and add tslib to dependencies build: enable importHelpers in tsconfig and add tslib to dependencies Feb 18, 2020
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 19, 2020
BREAKING CHANGE: enable importHelpers on a shared configuration file which requires `tslib` to be
installed on the dependent packages.

To migrate, run `npm i tslib` on the dependent package before updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 19, 2020
re loopbackio#4676

add tslib to allow upgrading to the next major semver of
`@loopback/build`.

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 19, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 19, 2020
BREAKING CHANGE: enable importHelpers on a shared configuration file which requires `tslib` to be
installed on the dependent packages.

To migrate, run `npm i tslib` on the dependent package before updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 19, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 19, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>

chore: update package-lock.json

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
@dhmlau dhmlau assigned dhmlau and achrinza and unassigned dhmlau Feb 19, 2020
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
BREAKING CHANGE: enable importHelpers on the shared Typescript
configuration file which requires `tslib` to be installed on the
dependent packages

To migrate, run `npm install tslib` on the dependent package before
updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
BREAKING CHANGE: enable importHelpers on the shared Typescript
configuration file which requires `tslib` to be installed on the
dependent packages

To migrate, run `npm install tslib` on the dependent package before
updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
BREAKING CHANGE: enable importHelpers on the shared Typescript
configuration file which requires `tslib` to be installed on the
dependent packages

To migrate, run `npm install tslib` on the dependent package before
updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
BREAKING CHANGE: enable importHelpers on the shared Typescript
configuration file which requires `tslib` to be installed on the
dependent packages

To migrate, run `npm install tslib` on the dependent package before
updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 20, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
BREAKING CHANGE: enable importHelpers on the shared Typescript
configuration file which requires `tslib` to be installed on the
dependent packages

To migrate, run `npm install tslib` on the dependent package before
updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
BREAKING CHANGE: enable importHelpers on the shared Typescript
configuration file which requires `tslib` to be installed on dependent
packages if the shared Typescript configuration is used.

To migrate, run `npm install tslib` on the dependent package before
updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
BREAKING CHANGE: enable importHelpers on the shared Typescript
configuration file which requires `tslib` to be installed on dependent
packages if the shared Typescript configuration is used.

To migrate, run `npm install tslib` on the dependent package before
updating to this version.

see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit to achrinzafork/loopback-next that referenced this issue Feb 21, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
raymondfeng pushed a commit that referenced this issue Feb 21, 2020
see #4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
raymondfeng pushed a commit that referenced this issue Feb 21, 2020
BREAKING CHANGE: enable importHelpers on the shared Typescript
configuration file which requires `tslib` to be installed on dependent
packages if the shared Typescript configuration is used.

To migrate, run `npm install tslib` on the dependent package before
updating to this version.

see #4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
raymondfeng pushed a commit that referenced this issue Feb 21, 2020
see #4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
alep007 pushed a commit to alep007/loopback-next that referenced this issue Oct 21, 2020
see loopbackio#4676

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change feature good first issue Internal Tooling Issues related to our tooling and monorepo infrastructore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants