Giter Club home page Giter Club logo

tsed-cli's People

Contributors

antonio-piha avatar changjoo-park avatar classical-bit avatar csprance avatar davidlutta avatar dependabot[bot] avatar flexwie avatar from-nibly avatar jonasschatz avatar jsaady avatar kat-lc avatar loic5 avatar nidble avatar romakita avatar semantic-release-bot avatar sidharthv96 avatar stefanvanherwijnen avatar tim-hoffmann avatar tlfbrito avatar tripodsgames avatar vedranjukic avatar xcryzed avatar youssefsalameh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tsed-cli's Issues

[BUG] Title - Tsed init failing while bootstrapping a new project

Information

  • Version: 3.26.1
  • Packages: all required in tsed init
    A few sentences describing the overall goals of the issue.
    tsed init not working with the latest version and latest stable node version (16.17.0)

Example

badals-MacBook-Pro-2:web-bff bads$ tsed init .
? Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Swagger, Testing, Linter
? Choose unit framework Jest
? Choose linter tools framework EsLint
? Choose extra linter tools Prettier, Lint on commit
? Choose the package manager: NPM
↓ Write RC files [SKIPPED]
βœ” Install plugins
↓ Write RC files [SKIPPED]
βœ” Install plugins
βœ” Load plugins
βœ” Install plugins dependencies
βœ” Generate project files
βœ” Generate files for eslint
βœ” Add dependencies
βœ” Generate files for jest
βœ” Install dependencies
βœ” Add husky prepare task
βœ” Generate barrels files
/usr/local/lib/node_modules/@tsed/cli/node_modules/execa/lib/error.js:60
		error = new Error(message);
		        ^

Error: Command failed with exit code 1: npm run barrels
node:fs:1442
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, scandir '/Users/bads/workspace/webstack/web-bff/src/resolvers'
    at Object.readdirSync (node:fs:1442:3)
    at buildTree (/Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/fileTree.js:13:32)
    at /Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:46:51
    at Generator.next (<anonymous>)
    at /Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:9:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:5:12)
    at /Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:43:60
    at Array.forEach (<anonymous>)
    at Barrelsby (/Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:43:25) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/bads/workspace/webstack/web-bff/src/resolvers'
}

> web-bff@1.0.0 barrels
> barrelsby --config .barrelsby.json

    at makeError (/usr/local/lib/node_modules/@tsed/cli/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/usr/local/lib/node_modules/@tsed/cli/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  shortMessage: 'Command failed with exit code 1: npm run barrels',
  command: 'npm run barrels',
  escapedCommand: 'npm run barrels',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '\n> [email protected] barrels\n> barrelsby --config .barrelsby.json\n',
  stderr: 'node:fs:1442\n' +
    '  handleErrorFromBinding(ctx);\n' +
    '  ^\n' +
    '\n' +
    "Error: ENOENT: no such file or directory, scandir '/Users/bads/workspace/webstack/web-bff/src/resolvers'\n" +
    '    at Object.readdirSync (node:fs:1442:3)\n' +
    '    at buildTree (/Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/fileTree.js:13:32)\n' +
    '    at /Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:46:51\n' +
    '    at Generator.next (<anonymous>)\n' +
    '    at /Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:9:71\n' +
    '    at new Promise (<anonymous>)\n' +
    '    at __awaiter (/Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:5:12)\n' +
    '    at /Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:43:60\n' +
    '    at Array.forEach (<anonymous>)\n' +
    '    at Barrelsby (/Users/bads/workspace/webstack/web-bff/node_modules/barrelsby/bin/index.js:43:25) {\n' +
    '  errno: -2,\n' +
    "  syscall: 'scandir',\n" +
    "  code: 'ENOENT',\n" +
    "  path: '/Users/bads/workspace/webstack/web-bff/src/resolvers'\n" +
    '}',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Acceptance criteria

  • tsed init works fine

"init" has quite a number of bugs...

version of tsed - 3.20.12

  • selecting pnpm will fail many setups due to peer-dependancies. Use npm or yarn.
  • selecting "linter + lint on commit" will fail as the project does not do a "git init" or similar
  • selecting graphql generates wrong code in "src/config/index.ts" - no comma
  • the generated "package.json" file has bad "script" definitions for other than yarn. "npm run tsc" fails, should be just "tsc"
  • selecting all (besides "lint on commit" - see above) will fail to "build" with missing typescript declarations. Specifically: @types/inquirer, @types/fs-extra, @types/oidc-provider
  • When the above is fixed there are a number of errors that suggest incompatible libs/modules have been installed. I stopped here.

Hope this is not too terse, tried to keep it simple to reproduce.

[Feature request] Generate multiple things at once

First of all, I wanna thank you guys for creating and maintaining tsed.

When we try to generate something using tsed g, it only allows us to generate one thing at a time.
Screenshot (151)

it would've been even more awesome, if we could generate multiple things at once like the screenshot below using the tsed g command:
Screenshot (152)

Thanks a million

[Plugin] Add eslint plugin to replace deprecated TsLint

Tslint will be deprecated soon, https://medium.com/palantir/tslint-in-2019-1a144c2317a9
I would be nice to have an eslint integration

Here you have my generic eslint file

module.exports = {
  root: true,
  extends: ['eslint:recommended', 'plugin:sonarjs/recommended'],
  plugins: ['sonarjs'],
  parserOptions: {
    ecmaVersion: 2019,
    sourceType: 'module',
    project: './tsconfig.json'
  },
  env: {
    browser: true,
    node: true,
    es6: true
  },
  overrides: [
    {
      files: ['**/*.ts'],
      parser: '@typescript-eslint/parser',
      plugins: ['@typescript-eslint'],
      extends: [
        'plugin:prettier/recommended',
        'plugin:@typescript-eslint/eslint-recommended',
        'plugin:@typescript-eslint/recommended',
        'plugin:@typescript-eslint/recommended-requiring-type-checking',
        'prettier/@typescript-eslint'
      ],
      rules: {
        // Resets
        '@typescript-eslint/camelcase': 0,
        // '@typescript-eslint/explicit-function-return-type': 0,
        '@typescript-eslint/ban-ts-ignore': 0,
        '@typescript-eslint/no-this-alias': 0,
        '@typescript-eslint/no-non-null-assertion': 0,
        // '@typescript-eslint/no-unused-vars': 0,
        '@typescript-eslint/no-empty-interface': 0,
        '@typescript-eslint/no-use-before-define': 0,
        // '@typescript-eslint/no-explicit-any': 0,
        'no-constant-condition': 0,

        // General formatting
        '@typescript-eslint/semi': 2,
        '@typescript-eslint/brace-style': 2,
        '@typescript-eslint/func-call-spacing': 2,

        // tslint
        '@typescript-eslint/class-name-casing': 2,
        '@typescript-eslint/explicit-member-accessibility': [
          0,
          {
            overrides: {
              constructors: 0
            }
          }
        ],
        // '@typescript-eslint/no-empty-interface': 2,
        '@typescript-eslint/no-inferrable-types': 2,
        '@typescript-eslint/no-misused-new': 2,
        // '@typescript-eslint/no-non-null-assertion': 2,
        // '@typescript-eslint/no-use-before-define': 2,
        '@typescript-eslint/prefer-function-type': 2,
        // '@typescript-eslint/type-annotation-spacing': 2,
        '@typescript-eslint/unified-signatures': 2,
        '@typescript-eslint/no-shadow': 0,
        '@typescript-eslint/array-type': 2,
        // tsrules
        'require-await': 0,
        '@typescript-eslint/require-await': 0,
        '@typescript-eslint/no-unused-vars': [
          2,
          {
            vars: 'all',
            args: 'after-used',
            ignoreRestSiblings: false,
            varsIgnorePattern: 'h|Host',
            caughtErrors: 'all',
            caughtErrorsIgnorePattern: '^_'
          }
        ],
        '@typescript-eslint/explicit-function-return-type': 0,
        '@typescript-eslint/no-explicit-any': 0,
        '@typescript-eslint/interface-name-prefix': 0,
        '@typescript-eslint/unbound-method': [
          2,
          {
            ignoreStatic: true
          }
        ],
        'no-empty-function': 0,
        '@typescript-eslint/no-empty-function': 2,
        '@typescript-eslint/no-unnecessary-type-assertion': 2
      }
    },
    // Spec files
    {
      files: ['**/*.spec.ts'],
      rules: {
        '@typescript-eslint/unbound-method': 0
      }
    },
    // Test Files
    {
      files: ['**/*.e2e.ts', '**/*.spec.ts'],
      rules: {
        'sonarjs/no-duplicate-string': 0
      },
      env: {
        jest: true
      }
    }
  ],
  rules: {
    // Best practices
    'no-shadow': 2,
    'require-atomic-updates': 2,
    'no-var': 2,
    'prefer-object-spread': 2,
    'no-nested-ternary': 2,
    'no-duplicate-imports': 2,
    // General formatting
    indent: [2, 2, { SwitchCase: 1 }],
    'no-trailing-spaces': 2,
    curly: [2, 'all'],
    'comma-spacing': 2,
    'comma-style': 2,
    'computed-property-spacing': 2,
    // 'func-style': [2, 'expression', { 'allowArrowFunctions': true }],
    'multiline-ternary': [2, 'always-multiline'],
    'operator-linebreak': [2, 'after', { overrides: { '?': 'before', ':': 'before' } }],
    // 'linebreak-style': 2,
    'space-in-parens': 2,

    // 'arrow-body-style': [2, 'as-needed', { 'requireReturnForObjectLiteral': true }],
    'constructor-super': 2,
    'dot-notation': 0,
    // 'eol-last': 2,
    'guard-for-in': 2,
    'no-bitwise': 0,
    'no-caller': 2,
    'no-console': [1],
    'no-debugger': 2,
    'no-empty': 0,
    'no-empty-function': 2,
    'no-fallthrough': 2,
    'no-new-wrappers': 2,
    'no-throw-literal': 2,
    'no-undef-init': 2,
    'no-unused-labels': 2,
    'prefer-const': 2,
    radix: 2,
    'no-shadowed-variable': 0,
    'max-params': [2, 4]
  },
  settings: {
    'import/parsers': {
      '@typescript-eslint/parser': ['.ts']
    },
    'import/resolver': {
      typescript: {}
    }
  }
};

and dependencies to install:

    "@typescript-eslint/eslint-plugin": "2.31.0",
    "@typescript-eslint/parser": "2.31.0",
    "eslint": "6.8.0",
    "eslint-config-prettier": "6.11.0",
    "eslint-plugin-prettier": "3.1.3",
    "eslint-plugin-sonarjs": "0.5.0",

TypeError: Cannot read property 'get' of undefined

Hello everyone,

I try to use the cli, I installed it with :
yarn global add @tsed/cli
(but tried with npm too, same result)

And when I want to use tsed -h or tsed init ., I have the error :

TypeError: Cannot read property 'get' of undefined
    at Provider.get (C:\Users\Iosis\AppData\Local\Yarn\Data\global\node_modules\@tsed\di\lib\index.js:187:23)
    at Provider.get configuration [as configuration] (C:\Users\Iosis\AppData\Local\Yarn\Data\global\node_modules\@tsed\di\lib\index.js:179:17)
    at C:\Users\Iosis\AppData\Local\Yarn\Data\global\node_modules\@tsed\di\lib\index.js:1792:20
    at Map.forEach (<anonymous>)
    at Map.resolveConfiguration (C:\Users\Iosis\AppData\Local\Yarn\Data\global\node_modules\@tsed\di\lib\index.js:1791:11)
    at Map.bootstrap (C:\Users\Iosis\AppData\Local\Yarn\Data\global\node_modules\@tsed\di\lib\index.js:1755:10)
    at Map.load (C:\Users\Iosis\AppData\Local\Yarn\Data\global\node_modules\@tsed\di\lib\index.js:1767:10)
    at Function.loadInjector (C:\Users\Iosis\AppData\Local\Yarn\Data\global\node_modules\@tsed\cli-core\lib\index.js:3593:20)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Function.bootstrap (C:\Users\Iosis\AppData\Local\Yarn\Data\global\node_modules\@tsed\cli-core\lib\index.js:3574:5)

Can you help / check please ?

Environment:

  • Windows 10
  • Node 14.17.6 (through nvm)
  • Using GitBash

[TECH] Remove the Swagger 2 code configuration example

Information

When a new project is initialized with tsed init, the swagger can be selected to generate swagger-ui.
Currently, the init command generate the configuration for Swagger 2 and Open spec 3 as followings:

https://github.com/tsedio/tsed-cli/blob/master/packages/cli/templates/generate/server.hbs#L41

{
swagger: [
    {
      path: "/v2/docs",
      specVersion: "2.0"
    },
    {
      path: "/v3/docs",
      specVersion: "3.0.1"
    }
]
}

The goals is to remove the v2. Ts.ED in v7 will not support any longer the Swagger v2. To prepare this enhancement, we need to remove the swagger 2 in our template.

The expected result will be this configuration:

swagger: [
    {
      path: "/docs",
      specVersion: "3.0.1"
    }
]

Acceptance criteria

  • yarn test is OK, all integration test must be validated. The CI will confirm it!
  • The configuration is correctly generated with the correct indentation !

Documentation regarding extend Cli for custom command

Is it possible to use tsed-cli to create CLI command for an existing tsed project?
From the documentation that doesn't seem obvious, I think it would be good if that could be clarified, because it might be useful for people that want to use the Framework with CLI commands.

Thanks

Namespace is not a fuction

Getting a fatal error when installing 3.4.4

TypeError: UpdateNotifier__namespace is not a function
    at Function.updateNotifier (/Users/***/.nvm/versions/node/v14.16.1/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/index.js:3488:5)
    at Function.bootstrap (/Users/***/.nvm/versions/node/v14.16.1/lib/node_modules/@tsed/cli/lib/Cli.js:32:14)
    at Object.<anonymous> (/Users/***/.nvm/versions/node/v14.16.1/lib/node_modules/@tsed/cli/lib/bin/tsed.js:8:11)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47

Downgrading to 3.4.3 solved the problem.

OS: Mac 10.15.7
node: 14.16.1

[FEAT] Add Exception Filter template generation

Information

As developer I want to generate an Exception Filter file with is unit test via the command tsed g.

The goal is to implement the template file to generate the Exception Filter.

Template

import {Catch, PlatformContext, ExceptionFilterMethods} from "@tsed/common";

@Catch(Error)
export class HttpExceptionFilter implements ExceptionFilterMethods {
   catch(exception: Exception, ctx: PlatformContext) {
      
  Β }
}

How to implement

Edit the ProviderTypes file here: https://github.com/TypedProject/tsed-cli/blob/master/packages/cli/src/commands/generate/ProviderTypes.ts and add the new type:

{
    name: "Exception Filter",
    value: "exception-filter",
    baseDir: "filters",
    model: "{{symbolName}}.exception-filter"
}

This file add a new choice for the tsed g

Create a new exception-filter.hbs file here: https://github.com/TypedProject/tsed-cli/tree/master/packages/cli/templates/generate . Look on another file in the same directory to implement the expected template !

Finally, implement the integration test. Add a new spec file generate.exception-filter.integration.spec.ts:

import {CliService, ProjectPackageJson} from "@tsed/cli-core";
import {CliPlatformTest, FakeCliFs} from "@tsed/cli-testing";
import {readFileSync} from "fs";
import {resolve} from "path";
import {GenerateCmd} from "../../../src";

const TEMPLATE_DIR = resolve(__dirname, "..", "..", "..", "templates");

function readFile(file: string) {
  return readFileSync(`${__dirname}/${file}`, {encoding: "utf8"});
}

describe("Generate Exception Filter", () => {
  beforeEach(() =>
    CliPlatformTest.bootstrap({
      templateDir: TEMPLATE_DIR,
      commands: [GenerateCmd]
    })
  );
  afterEach(() => CliPlatformTest.reset());

  it("should generate a template with the right options", async () => {
    const cliService = CliPlatformTest.get<CliService>(CliService);
    const projectPackageJson = CliPlatformTest.get<ProjectPackageJson>(ProjectPackageJson);
    // @ts-ignore
    projectPackageJson.raw = {
      name: "",
      version: "1.0.0",
      description: "",
      scripts: {},
      dependencies: {},
      devDependencies: {}
    };

    await cliService.exec("generate", {
      rootDir: "./project-data",
      type: "exception-filter",
      name: "Http"
    });

    expect(FakeCliFs.getKeys()).toEqual([
      "project-name/src/filters",
      "project-name/src/filters/HttpExceptionFilter.ts"
    ]);

    const result = FakeCliFs.entries.get("project-name/src/filters/HttpExceptionFilter.ts");

    expect(result).toContain("import {Catch, PlatformContext, ExceptionFilterMethods} from \"@tsed/common\";");
    expect(result).toContain("@Catch(Error)");
    expect(result).toContain("export class HttpExceptionFilter implements ExceptionFilterMethods");
    expect(result).toContain("catch(exception: Exception, ctx: PlatformContext) {");
  });
});

Run yarn test to validate your integration test :)

Acceptance criteria

  • The template generate the ExceptionFilter in filters directory
  • The unit test and integration are OK

[FEAT] Create a DIContext like is doing in @tsed/common

Information

Is your feature request related to a problem? Please describe.

Create context will allow to use @InjectContext in CLI context. The CLI logger will be attached to the DIContext and an ID will be generated to trace the log in a logger management. Also the cli arguments can be retrieved through the DIContext.

Acceptance criteria

  • DIContext is consumable in any services

EBADF: bad file descriptor

I encounter error like this: Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Database, Passport.js,
Testing
? Choose a ORM manager Prisma
? Choose unit framework Jest
? Choose the package manager: NPM
↓ Write RC files [SKIPPED]
βœ– EBADF: bad file descriptor, write
β—Ό Install plugins
β—Ό Load plugins
β—Ό Install plugins dependencies
Error: EBADF: bad file descriptor, write
at Object.writeFileSync (node:fs:2352:20)
at CliFs.writeFileSync (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/CliFs.js:35:25)
at ProjectPackageJson.write (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:231:17)
at ProjectPackageJson.init (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:253:14)
at Task.task (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/lib/cjs/commands/init/InitCmd.js:115:44)
at Task.run (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/listr2/dist/index.cjs:978:35)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
name: 'CLI_ERROR',
cli: Cli { injector: [Getter], cliService: [Getter] },
origin: Error: EBADF: bad file descriptor, write
at Object.writeFileSync (node:fs:2352:20)
at CliFs.writeFileSync (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/CliFs.js:35:25)
at ProjectPackageJson.write (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:231:17)
at ProjectPackageJson.init (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/cjs/services/ProjectPackageJson.js:253:14)
at Task.task (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/lib/cjs/commands/init/InitCmd.js:115:44)
at Task.run (/Users/supyaesone/.npm-global/lib/node_modules/@tsed/cli/node_modules/listr2/dist/index.cjs:978:35)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -9,
code: 'EBADF',
syscall: 'write'
}
} `

I try to reinstall node.js but it didn't solved. Also after I command this npm install -g @tsed/cli tsed init .didn't found every time.

TypeORM default connection template

The default connection template that is generated when using tsed init with typorm should use a different templating string for entities, migrations and subscribers.

Instead of

"entities": ["${rootDir}/entity/**/*.ts"],  
"migrations": ["${rootDir}/migration/**/*.ts"],  
"subscribers": ["${rootDir}/subscriber/**/*.ts"]

it should be

"entities": ["${rootDir}/entity/**/*.{js,ts}"],  
"migrations": ["${rootDir}/migration/**/*.{js,ts}"],  
"subscribers": ["${rootDir}/subscriber/**/*.{js,ts}"]

Otherwise it will fail when running compiled in a Docker container because it can't find the entities and therefore does not have metadata for them.

[Feat] Add cli passport plugins

Passport is not managed in the core project. So we will manage this feature with a cli-plugin.

Passport plugins will be able to generate a new protocole by extending the tsed generate command.

Missing modules at install for passport and jest

Hi,

first thanks for your awesome work on the TS.ED project. I really appreciate it.

I wanted to try the CLI today but experienced some problems while doing so.
I checked JEST as testing tool and passport.js.

While installing the modules via Yarn, I got errors that thje modules @tsed/cli-plugin-passport and @tsed/cli-plugin-jest were not found.

Is this intended? The modules do exist in the main npm registry.

Please tell me if you need any additional info.

image

image

Kind Regards

[Bugs] Cli issue on init command

Description

Issue 1

When using CLI to generate new project on linux, getting multiple nested folders of the project name.

tsed init bandApp => band-app/band-app/band-app

node_modules are in the correct place in the root folder.

Issue 2

When moving the files to the correct place and running the project i get this error

import { $log } from "@tsed/common";
SyntaxError: Cannot use import statement outside a module

Issue 3

Issue on babel generation. Some dependencies require babel v7 or v6.

Can't install from npm

I got the error when running npm i @tsed/cli

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@tsed%2fcli - Not found
npm ERR! 404 
npm ERR! 404  '@tsed/cli@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No Slack web-hook defined.

A Slack Webhook must be created and set in the SLACK_WEBHOOK environment variable on your CI environment.

Please make sure to create a Slack Webhook and to set it in the SLACK_WEBHOOK environment variable on your CI environment. Alternatively, provide slackWebhook as a configuration option.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Init command fails on version 2.4.2

Hi there! πŸ‘‹

I am just starting to try out TsED and I am getting the following error when running the init command (using latest version, 2.4.2):

> npx @tsed/cli@ init .
npx: installed 534 in 26.011s
(node:45266) UnhandledPromiseRejectionWarning: Error: option 'version' clashes with existing property 'version' on Command
- call storeOptionsAsProperties(false) to store option values safely,
- or call storeOptionsAsProperties(true) to suppress this check,
- or change option name

Read more on https://git.io/JJc0W
    at Command._checkForOptionNameClash (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/commander/index.js:472:13)
    at Command._optionEx (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/commander/index.js:499:10)
    at Command.option (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/commander/index.js:622:17)
    at /Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:131:30
    at Array.reduce (<anonymous>)
    at CliService.buildOption (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:123:33)
    at CliService.build (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:174:22)
    at /Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:38:104
    at Array.forEach (<anonymous>)
    at CliService.load (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:38:77)
    at CliService.parseArgs (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:34:14)
    at Cli.parseArgs (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/Cli.js:81:25)
    at /Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/lib/bin/tsed.js:18:13
    at Generator.next (<anonymous>)
    at fulfilled (/Users/matheus/.npm/_npx/45266/lib/node_modules/@tsed/cli/node_modules/tslib/tslib.js:111:62)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:45266) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:45266) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

This looks like an issue introduced in the latest version of the CLI.
The previous version, 2.4.1 works just fine:

> npx @tsed/[email protected] init .
npx: installed 527 in 11.78s
? Choose the target platform: (Use arrow keys)
❯ Express.js 
  Koa.js 

I tried it out on Node 15, 14 and 12, with the same outcome: v2.4.1 works, v2.4.2 has the exception.

[BUG] init including oidc imports wrong version

Information

  • Version: 4.2.6
  • Packages: oicd-provider

Initializing a project and including open id connect provider installs oicd-provider version 8.0.0 which is incompatible with the node version set. The error says I need to use node version 18 but when upgrading node to 18 the packages all install correctly however I get errors in that package when trying to yarn start. Errors that are in my node modules folder, and out of my control, because the new version is a breaking version for this project.

After some digging in the code I found the oicd-provider is set to ^7.11.1 in the tsed repo but looking for the "latest" in here

forcing the "oidc-provider": "^7.11.1", and "@types/oidc-provider": "^7.11.1", in my yarn file fixed this.

I believe setting the version instead of using latest in CliPluginOidcProviderModule.js will help. I can open up a PR but wasn't sure how you wanted to handle this considering that upgrading

Example

yarn install -g @tsed/cli
tsed init .

cli inputs

? Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Database, Passport.js, Swagger, OpenID Connect provider, Linter, 
Bundler
? Choose a ORM manager Mongoose
? Choose linter tools framework EsLint
? Choose extra linter tools Prettier, Lint on commit
? Choose your bundler Babel
? Choose the OIDC base path server /oidc
? Choose the package manager: Yarn

yarn

  ❯ Install
    βœ” Write package.json
    βœ” Installing dependencies using Yarn
    βœ– Command failed with exit code 1: yarn add @react-native-community/masked-view@^0.1.11 @react-navigation/bot…
      error [email protected]: The engine "node" is incompatible with this module. Expected version "18". Got "…
      error Found incompatible module.
      yarn add v1.22.19
      [1/4] Resolving packages...
      [2/4] Fetching packages...
      info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
    β—Ό Add devDependencies using Yarn
    β—Ό Clean
Error: Command failed with exit code 1: yarn add @react-native-community/masked-view@^0.1.11 @react-navigation/bottom-tabs@^5.11.15 @react-navigation/native@^5.9.8 @reduxjs/toolkit@^1.7.1 @tsed/ajv@^7.8.2 @tsed/common@^7.8.2 @tsed/core@^7.8.2 @tsed/di@^7.8.2 @tsed/engines@^7.8.2 @tsed/exceptions@^7.8.2 @tsed/json-mapper@^7.8.2 @tsed/logger@^6.3.3 @tsed/logger-file@^6.3.3 @tsed/openspec@^7.8.2 @tsed/platform-cache@^7.8.2 @tsed/platform-exceptions@^7.8.2 @tsed/platform-express@^7.8.2 @tsed/platform-log-middleware@^7.8.2 @tsed/platform-middlewares@^7.8.2 @tsed/platform-params@^7.8.2 @tsed/platform-response-filter@^7.8.2 @tsed/platform-views@^7.8.2 @tsed/schema@^7.8.2 @tsed/swagger@^7.8.2 ajv@^8.11.2 barrelsby@^2.5.1 body-parser@^1.20.1 compression@^1.7.4 cookie-parser@^1.4.6 cors@^2.8.5 cross-env@^7.0.3 dotenv@^16.0.3 dotenv-expand@^9.0.0 dotenv-flow@^3.2.0 expo@~44.0.0 expo-status-bar@~1.2.0 express@^4.18.2 method-override@^3.0.0 native-base@^3.3.7 react-native-animated-nav-tab-bar@^3.1.7 react-native-gesture-handler@~2.1.0 react-native-reanimated@~2.3.1 react-native-screens@~3.10.1 react-redux@^7.2.6 @tsed/passport@^7.8.2 passport oidc-provider @tsed/oidc-provider @tsed/jwks @tsed/adapters bcrypt @tsed/mongoose@^7.8.2 mongoose
error [email protected]: The engine "node" is incompatible with this module. Expected version "18". Got "16.15.1"
error Found incompatible module.

Acceptance criteria

  • Setting the oicd-provider version to 7.11.1 or some other solution that's more stable (upgrading oicd-provider would mean also upgrading here which would be an easy miss and cause this bug to continue)

[BUG] Title Docker file generated with yarn config even when using npm package maneger

Information

  • Version: 3.26.2
  • Packages: Dockerfile

A few sentences describing the overall goals of the issue.

Example

badals-MacBook-Pro-2:web-bff bads$ tsed init .
? Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Swagger, Testing, Linter
? Choose unit framework Jest
? Choose linter tools framework EsLint
? Choose extra linter tools Prettier, Lint on commit
? Choose the package manager: NPM
↓ Write RC files [SKIPPED]
βœ” Install plugins
↓ Write RC files [SKIPPED]
βœ” Install plugins
βœ” Load plugins
βœ” Install plugins dependencies
βœ” Generate project files
βœ” Generate files for eslint
βœ” Add dependencies
βœ” Generate files for jest
βœ” Install dependencies
βœ” Add husky prepare task
βœ” Generate barrels files

GENERATED Dockerfile


###############################################################################
###############################################################################
##                      _______ _____ ______ _____                           ##
##                     |__   __/ ____|  ____|  __ \                          ##
##                        | | | (___ | |__  | |  | |                         ##
##                        | |  \___ \|  __| | |  | |                         ##
##                        | |  ____) | |____| |__| |                         ##
##                        |_| |_____/|______|_____/                          ##
##                                                                           ##
## description     : Dockerfile for TsED Application                         ##
## author          : TsED team                                               ##
## date            : 2022-03-05                                              ##
## version         : 2.0                                                     ##
##                                                                           ##
###############################################################################
###############################################################################
ARG NODE_VERSION=16.13.1

FROM node:${NODE_VERSION}-alpine as build
WORKDIR /opt

COPY package.json yarn.lock tsconfig.json tsconfig.compile.json .barrelsby.json ./

RUN yarn install --pure-lockfile

COPY ./src ./src

RUN yarn build

FROM node:${NODE_VERSION}-alpine as runtime
ENV WORKDIR /opt
WORKDIR $WORKDIR

RUN apk update && apk add build-base git curl
RUN npm install -g pm2

COPY --from=build /opt .

RUN yarn install --pure-lockfile --production

COPY ./views ./views
COPY processes.config.js .

EXPOSE 8081
ENV PORT 8081
ENV NODE_ENV production

CMD ["pm2-runtime", "start", "processes.config.js", "--env", "production"]

Building image therefore fails:

 => ERROR [build 3/6] COPY package.json yarn.lock tsconfig.json tsconfig.compile.json .barrelsby.json ./                     0.0s
------
 > [build 3/6] COPY package.json yarn.lock tsconfig.json tsconfig.compile.json .barrelsby.json ./:
------
failed to compute cache key: "/yarn.lock" not found: not found

 *  The terminal process "/bin/bash '-c', 'docker build --pull --rm -f "web-bff/Dockerfile" -t webstack:latest "web-bff"'" terminated with exit code: 1. 

Acceptance criteria

  • The generated Dockerfile should use npm package manager

[FEAT] Add MikroOrm plugin

Information

MikroORM is now supported by Ts.ED framework. It could be interesting to have a CLI plugin to simplify Mikro ORM integration to a Ts.ED project.

Features

  • The user is able to select a database to create the first connection and the correct configuration
  • The required modules will be installed
  • The user is able to generate a new connection with tsed init g

We can take as example the @tsed/cli-typeorm module.

Acceptance criteria

  • The tsed init command provide a new option in ORM section
  • The tsed g command provide a recipe to generate a new mikro orm connection

[BUG] TypeGraphQL Installation fails

Information

I've had some trouble with tsed init where 'barrelsby --config .barrelsby.json' would fail due to the error:
Error: ENOENT: no such file or directory, scandir '/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/src/datasources'\n
I've managed to narrow this down to the TypeGraphQL feature.

I'm using an M1 Mac, Node.js v18.4.0. I asked someone who was using a non-M1 mac to test this out and it fails with the same message.

  • **Version: 3.21.2
  • Logs:

tsed init .                      
feature/basic-express-server  ✱
? Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project TypeGraphQL
? Choose the package manager: NPM
↓ Write RC files [SKIPPED]
↓ Write RC files [SKIPPED]
βœ” Install plugins
βœ” Load plugins
βœ” Install plugins dependencies
βœ” Generate project files
/Users/frederiquelemieux/.nvm/versions/node/v18.4.0/lib/node_modules/@tsed/cli/node_modules/execa/lib/error.js:60
                error = new Error(message);
                        ^

Error: Command failed with exit code 1: npm run barrels
node:fs:1450
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, scandir '/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/src/datasources'
    at Object.readdirSync (node:fs:1450:3)
    at buildTree (/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/fileTree.js:13:32)
    at /Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:46:51
    at Generator.next (<anonymous>)
    at /Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:9:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:5:12)
    at /Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:43:60
    at Array.forEach (<anonymous>)
    at Barrelsby (/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:43:25) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/src/datasources'
}

Node.js v18.4.0

> [email protected] barrels
> barrelsby --config .barrelsby.json

    at makeError (/Users/frederiquelemieux/.nvm/versions/node/v18.4.0/lib/node_modules/@tsed/cli/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/frederiquelemieux/.nvm/versions/node/v18.4.0/lib/node_modules/@tsed/cli/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  shortMessage: 'Command failed with exit code 1: npm run barrels',
  command: 'npm run barrels',
  escapedCommand: 'npm run barrels',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '\n> [email protected] barrels\n> barrelsby --config .barrelsby.json\n',
  stderr: 'node:fs:1450\n' +
    '  handleErrorFromBinding(ctx);\n' +
    '  ^\n' +
    '\n' +
    "Error: ENOENT: no such file or directory, scandir '/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/src/datasources'\n" +
    '    at Object.readdirSync (node:fs:1450:3)\n' +
    '    at buildTree (/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/fileTree.js:13:32)\n' +
    '    at /Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:46:51\n' +
    '    at Generator.next (<anonymous>)\n' +
    '    at /Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:9:71\n' +
    '    at new Promise (<anonymous>)\n' +
    '    at __awaiter (/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:5:12)\n' +
    '    at /Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:43:60\n' +
    '    at Array.forEach (<anonymous>)\n' +
    '    at Barrelsby (/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/node_modules/barrelsby/bin/index.js:43:25) {\n' +
    '  errno: -2,\n' +
    "  syscall: 'scandir',\n" +
    "  code: 'ENOENT',\n" +
    "  path: '/Users/frederiquelemieux/dev/hoarelea/LivingLabAPI_v2/app/src/datasources'\n" +
    '}\n' +
    '\n' +
    'Node.js v18.4.0',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Node.js v18.4.0

UPDATE: if I run tsed command on it's own it says:
[15:15:05][WARN] βœ– Fail to load plugin @tsed/cli-plugin-typegraphql

UPDATE-2:
I've cloned this repo and run the yarn start:init:run command and generated a tsed project with typegraphql and it worked fine?! I'm a little unsure how to debug and diagnose the problem, but please let me know how I can help?

UPDATE-3: Tried installing all features used above but using the cloned Repo and got the same error:

yarn start:init:run                                                                                                                                       master 
yarn run v1.22.17
$ cross-env NODE_ENV=development cross-env CI=true ts-node -r tsconfig-paths/register src/bin/tsed.ts init -r ./.tmp/init/default
? Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project TypeGraphQL, Database, Passport.js, Testing, Linter
? Choose a ORM manager Prisma
? Choose unit framework Jest
? Choose linter tools framework EsLint
? Choose extra linter tools Prettier, Lint on commit
? Choose the package manager: NPM
[15:34:35] [START] Write RC files
[15:34:35] [SKIP] Write RC files
[15:34:35] [START] Install plugins
[15:34:35] [START] Write package.json
[15:34:35] [SUCCESS] Write package.json
[15:34:35] [START] Installing dependencies using npm
[15:34:35] [DATA] npm WARN config production Use `--omit=dev` instead.
[15:34:59] [DATA] npm WARN deprecated [email protected]: The `apollo-tracing` package is no longer part of Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#tracing for details
[15:34:59] [DATA] npm WARN deprecated [email protected]: The `graphql-extensions` API has been removed from Apollo Server 3. Use the plugin API instead: https://www.apollographql.com/docs/apollo-server/integrations/plugins/
[15:34:59] [DATA] npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[15:34:59] [DATA] npm WARN deprecated [email protected]: The functionality provided by the `apollo-cache-control` package is built in to `apollo-server-core` starting with Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#cachecontrol for details.
[15:34:59] [DATA] npm WARN deprecated [email protected]: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
[15:34:59] [DATA] npm WARN deprecated [email protected]: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead
[15:35:00] [DATA] added 214 packages, and audited 215 packages in 25s
[15:35:00] [DATA] 38 packages are looking for funding
[15:35:00] [DATA]   run `npm fund` for details
[15:35:00] [DATA] 5 high severity vulnerabilities
[15:35:00] [DATA] To address all issues (including breaking changes), run:
[15:35:00] [DATA]   npm audit fix --force
[15:35:00] [DATA] Run `npm audit` for details.
[15:35:00] [SUCCESS] Installing dependencies using npm
[15:35:00] [START] Add dependencies using npm
[15:35:31] [DATA] added 187 packages, and audited 402 packages in 31s
[15:35:31] [DATA] 47 packages are looking for funding
[15:35:31] [DATA]   run `npm fund` for details
[15:35:31] [DATA] 5 high severity vulnerabilities
[15:35:31] [DATA] To address all issues (including breaking changes), run:
[15:35:31] [DATA]   npm audit fix --force
[15:35:31] [DATA] Run `npm audit` for details.
[15:35:31] [SUCCESS] Add dependencies using npm
[15:35:31] [START] Add devDependencies using npm
[15:35:42] [DATA] added 80 packages, removed 20 packages, changed 2 packages, and audited 462 packages in 10s
[15:35:42] [DATA] 54 packages are looking for funding
[15:35:42] [DATA]   run `npm fund` for details
[15:35:42] [DATA] 5 high severity vulnerabilities
[15:35:42] [DATA] To address all issues (including breaking changes), run:
[15:35:42] [DATA]   npm audit fix --force
[15:35:42] [DATA] Run `npm audit` for details.
[15:35:42] [SUCCESS] Add devDependencies using npm
[15:35:42] [START] Clean
[15:35:42] [SUCCESS] Clean
[15:35:42] [SUCCESS] Install plugins
[15:35:42] [START] Load plugins
[15:35:43] βœ” @tsed/cli-plugin-eslint module loaded
[15:35:43] βœ” @tsed/cli-plugin-jest module loaded
[15:35:43] βœ” @tsed/cli-plugin-passport module loaded
[15:35:43] βœ” @tsed/cli-plugin-prisma module loaded
[15:35:43] βœ” @tsed/cli-plugin-typegraphql module loaded
[15:35:43] [SUCCESS] Load plugins
[15:35:43] [START] Install plugins dependencies
[15:35:43] [START] Run plugin '@tsed/cli-plugin-typegraphql'
[15:35:43] [SUCCESS] Run plugin '@tsed/cli-plugin-typegraphql'
[15:35:43] [START] Run plugin '@tsed/cli-plugin-passport'
[15:35:43] [SUCCESS] Run plugin '@tsed/cli-plugin-passport'
[15:35:43] [START] Run plugin '@tsed/cli-plugin-prisma'
[15:35:43] [SUCCESS] Run plugin '@tsed/cli-plugin-prisma'
[15:35:43] [START] Run plugin '@tsed/cli-plugin-jest'
[15:35:43] [SUCCESS] Run plugin '@tsed/cli-plugin-jest'
[15:35:43] [START] Run plugin '@tsed/cli-plugin-eslint'
[15:35:43] [SUCCESS] Run plugin '@tsed/cli-plugin-eslint'
[15:35:43] [START] Install
[15:35:43] [START] Write package.json
[15:35:43] [SUCCESS] Write package.json
[15:35:43] [START] Installing dependencies using npm
[15:35:43] [DATA] npm WARN config production Use `--omit=dev` instead.
[15:35:44] [DATA] up to date, audited 462 packages in 668ms
[15:35:44] [DATA] 54 packages are looking for funding
[15:35:44] [DATA]   run `npm fund` for details
[15:35:44] [DATA] 5 high severity vulnerabilities
[15:35:44] [DATA] To address all issues (including breaking changes), run:
[15:35:44] [DATA]   npm audit fix --force
[15:35:44] [DATA] Run `npm audit` for details.
[15:35:44] [SUCCESS] Installing dependencies using npm
[15:35:44] [START] Add dependencies using npm
[15:35:53] [DATA] added 47 packages, changed 4 packages, and audited 509 packages in 9s
[15:35:53] [DATA] 56 packages are looking for funding
[15:35:53] [DATA]   run `npm fund` for details
[15:35:53] [DATA] 5 high severity vulnerabilities
[15:35:53] [DATA] To address all issues (including breaking changes), run:
[15:35:53] [DATA]   npm audit fix --force
[15:35:53] [DATA] Run `npm audit` for details.
[15:35:53] [SUCCESS] Add dependencies using npm
[15:35:53] [START] Add devDependencies using npm
[15:36:16] [DATA] added 234 packages, and audited 743 packages in 23s
[15:36:16] [DATA] 77 packages are looking for funding
[15:36:16] [DATA]   run `npm fund` for details
[15:36:16] [DATA] 6 high severity vulnerabilities
[15:36:16] [DATA] To address issues that do not require attention, run:
[15:36:16] [DATA]   npm audit fix
[15:36:16] [DATA] To address all issues (including breaking changes), run:
[15:36:16] [DATA]   npm audit fix --force
[15:36:16] [DATA] Run `npm audit` for details.
[15:36:16] [SUCCESS] Add devDependencies using npm
[15:36:16] [START] Clean
[15:36:16] [SUCCESS] Clean
[15:36:16] [SUCCESS] Install
[15:36:16] [SUCCESS] Install plugins dependencies
[15:36:16] [START] Generate project files
[15:36:16] [START] Root files
[15:36:16] [DATA] [0/13] Rendering files...
[15:36:17] [DATA] [1/13] Rendering files...
[15:36:17] [DATA] [2/13] Rendering files...
[15:36:17] [DATA] [3/13] Rendering files...
[15:36:17] [DATA] [4/13] Rendering files...
[15:36:17] [DATA] [5/13] Rendering files...
[15:36:17] [DATA] [6/13] Rendering files...
[15:36:17] [DATA] [7/13] Rendering files...
[15:36:17] [DATA] [8/13] Rendering files...
[15:36:17] [DATA] [9/13] Rendering files...
[15:36:17] [DATA] [10/13] Rendering files...
[15:36:17] [DATA] [11/13] Rendering files...
[15:36:17] [DATA] [12/13] Rendering files...
[15:36:17] [DATA] [13/13] Rendering files...
[15:36:17] [DATA] [13/13] Rendering files...
[15:36:17] [SUCCESS] Root files
[15:36:17] [START] Generate server file to 'Server.ts'
[15:36:17] [SUCCESS] Generate server file to 'Server.ts'
[15:36:17] [START] Update bin/index
[15:36:17] [SKIP] Update bin/index
[15:36:17] [START] Generate server integration file 'Server.integration.spec.ts'
[15:36:17] [SUCCESS] Generate server integration file 'Server.integration.spec.ts'
[15:36:17] [START] Generate controller file to 'controllers/rest/HelloWorldController.ts'
[15:36:17] [SUCCESS] Generate controller file to 'controllers/rest/HelloWorldController.ts'
[15:36:17] [START] Update bin/index
[15:36:17] [SKIP] Update bin/index
[15:36:17] [START] Generate controller spec file to 'controllers/rest/HelloWorldController.spec.ts'
[15:36:17] [SUCCESS] Generate controller spec file to 'controllers/rest/HelloWorldController.spec.ts'
[15:36:17] [START] Generate controller integration file 'controllers/rest/HelloWorldController.integration.spec.ts'
[15:36:17] [SUCCESS] Generate controller integration file 'controllers/rest/HelloWorldController.integration.spec.ts'
[15:36:17] [SUCCESS] Generate project files
[15:36:17] [START] Generate files for eslint
[15:36:17] [DATA] [0/10] Rendering files...
[15:36:17] [DATA] [1/10] Rendering files...
[15:36:17] [DATA] [2/10] Rendering files...
[15:36:17] [DATA] [3/10] Rendering files...
[15:36:17] [DATA] [4/10] Rendering files...
[15:36:17] [DATA] [5/10] Rendering files...
[15:36:17] [DATA] [6/10] Rendering files...
[15:36:17] [DATA] [7/10] Rendering files...
[15:36:17] [DATA] [8/10] Rendering files...
[15:36:17] [DATA] [9/10] Rendering files...
[15:36:17] [DATA] [10/10] Rendering files...
[15:36:17] [DATA] [10/10] Rendering files...
[15:36:17] [SUCCESS] Generate files for eslint
[15:36:17] [START] Add dependencies
[15:36:17] [SUCCESS] Add dependencies
[15:36:17] [START] Generate files for jest
[15:36:17] [DATA] [0/1] Rendering files...
[15:36:17] [DATA] [1/1] Rendering files...
[15:36:17] [DATA] [1/1] Rendering files...
[15:36:17] [SUCCESS] Generate files for jest
[15:36:17] [START] Generate Prisma schema
Error: Command failed with exit code 1: npm run barrels
node:fs:1390
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, scandir '/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/src/datasources'
    at Object.readdirSync (node:fs:1390:3)
    at buildTree (/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/fileTree.js:13:32)
    at /Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:46:51
    at Generator.next (<anonymous>)
    at /Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:9:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:5:12)
    at /Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:43:60
    at Array.forEach (<anonymous>)
    at Barrelsby (/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:43:25) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/src/datasources'
}

> [email protected] barrels
> barrelsby --config .barrelsby.json

    at makeError (/Users/frederiquelemieux/dev/contributions/tsed-cli/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/frederiquelemieux/dev/contributions/tsed-cli/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  shortMessage: 'Command failed with exit code 1: npm run barrels',
  command: 'npm run barrels',
  escapedCommand: 'npm run barrels',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '\n> [email protected] barrels\n> barrelsby --config .barrelsby.json\n',
  stderr: 'node:fs:1390\n' +
    '  handleErrorFromBinding(ctx);\n' +
    '  ^\n' +
    '\n' +
    "Error: ENOENT: no such file or directory, scandir '/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/src/datasources'\n" +
    '    at Object.readdirSync (node:fs:1390:3)\n' +
    '    at buildTree (/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/fileTree.js:13:32)\n' +
    '    at /Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:46:51\n' +
    '    at Generator.next (<anonymous>)\n' +
    '    at /Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:9:71\n' +
    '    at new Promise (<anonymous>)\n' +
    '    at __awaiter (/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:5:12)\n' +
    '    at /Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:43:60\n' +
    '    at Array.forEach (<anonymous>)\n' +
    '    at Barrelsby (/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/node_modules/barrelsby/bin/index.js:43:25) {\n' +
    '  errno: -2,\n' +
    "  syscall: 'scandir',\n" +
    "  code: 'ENOENT',\n" +
    "  path: '/Users/frederiquelemieux/dev/contributions/tsed-cli/packages/cli/.tmp/init/default/src/datasources'\n" +
    '}',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
error Command failed with exit code 1.

Acceptance criteria

  • Including TypeGraphQL doesn't fail tsed init.

[BUG] "./MysqlDatasource" has no exported member named 'MysqlDatasource'

Information

  • Version: v4.6.4
  • Packages:

Steps to reproduce

  1. Create new project using this following options
tsed init .
 Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Database, Swagger, Testing, Linter
? Choose a ORM manager TypeORM
? Which TypeORM you want to install? MySQL
? Choose unit framework Jest
? Choose linter tools framework EsLint
? Choose extra linter tools Prettier, Lint on commit
? Choose the package manager: Yarn Berry
↓ Write RC files [SKIPPED]
βœ” Initialize package.json
βœ” Install plugins
↓ Write RC files [SKIPPED]
βœ” Initialize package.json
βœ” Install plugins
βœ” Load plugins
βœ” Install plugins dependencies
βœ” Generate project files
βœ” Generate files for eslint
βœ” Add dependencies
βœ” Generate files for jest
βœ” Generate typeorm:datasource spec file to 'datasources/MysqlDatasource.spec.ts'
βœ” Generate TypeORM datasource file to 'datasources/MysqlDatasource.ts'
βœ” Generate docker-compose configuration
βœ” Install dependencies
βœ” Add husky prepare task
βœ” Generate barrels files
  1. run build
yarn build
  1. You should see
src/datasources/MysqlDatasource.spec.ts:2:10 - error TS2724: '"./MysqlDatasource"' has no exported member named 'MysqlDatasource'. Did you mean 'MysqlDataSource'?

image

Possible Solution

Replace export const MysqlDataSource with export const MysqlDatasource in here ? (not sure if this is the correct file)

Bugs with the proxy configuration

I stumble on these bugs :

  1. When varenv are defined, the proxyUrl is never set :
    https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliProxyAgent.ts#L58
    Suggested :
this.proxyUrl = HTTP_PROXY || HTTPS_PROXY;
return this.proxyUrl;
  1. The expected protocol of an URL ends with ':'. so it should be 'http:' and 'https:
    https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliProxyAgent.ts#L30
    https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliProxyAgent.ts#L34
    https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliProxyAgent.ts#L38
    https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliProxyAgent.ts#L42

https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliHttpClient.ts#L29
https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliHttpClient.ts#L33

  1. Tunnel expects as host the following value : 'localhost' , for http://localhost:8000
    URL.host = localhost:8000
    URL.hostname = localhost
    https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliProxyAgent.ts#L25

Username and password are also expected.
Suggested :

proxy: {
          host: url.hostname,
          port: (url.port ? +url.port : undefined) as any,
          proxyAuth:`${url.username}:${url.password}`
        }
  1. Tunnel seems to be undefined . But no idea why.
 TypeError: Cannot read property 'httpsOverHttp' of undefined

https://github.com/TypedProject/tsed-cli/blob/88e0139f54d998dee4fc05d37879a3499be1ae1a/packages/cli-core/src/services/CliProxyAgent.ts#L31

Unable to create project

Been having issues creating a new project with the cli. It's always stuck on

Capture 1

And this, sometimes

Capture 2

Any ideas why this is happening and how I can get past this.

[BUG] Receipe resolve imports Receipe service that doesn't exist

Information

  • **Version:3.21.3
  • Mac M1

After running the tsed init with the feature TypeGraphQL, the install works, however there is a missing service:

In the file src/resolvers/recipes/RecipeResolver.ts there is an import of a "../../services/RecipeService that doesn't exist.

import {ResolverService} from "@tsed/typegraphql";
import {Arg, Query} from "type-graphql";
import {RecipeService} from "../../services/RecipeService";
import {Recipe} from "./Recipe";
import {RecipeNotFoundError} from "./RecipeNotFoundError";

@ResolverService(Recipe)
export class RecipeResolver {
  constructor(private recipeService: RecipeService) {}

  @Query((returns) => Recipe)
  async recipe(@Arg("id") id: string) {
    const recipe = await this.recipeService.findById(id);

    if (recipe === undefined) {
      throw new RecipeNotFoundError(id);
    }

    return recipe;
  }

  @Query((returns) => [Recipe], {description: "Get all the recipes from around the world "})
  async recipes(): Promise<Recipe[]> {
    return this.recipeService.findAll({});
  }
}

Example

Acceptance criteria

  • No typescript error
  • yarn start, results in working app

Check for yarn & install

Hi just a quick tip I suppose. Upon running tsed init . without yarn installed the installer will crash as yarn isn't installed. I suppose it would be smoother to install yarn if it is not installed already to mitigate this.

Stuck in the "resolve versions" step when GraphQL feature is selected

When I create a project and select the feature "GraphQL", the packages resolution never ends.

Example of configuration :

  • Choose the target platform: Koa.js
  • Check the features needed for your project:
    • βœ… GraphQL ← Seems to be the culprit πŸ‘¨β€βš–οΈ
    • βœ… Database
    • βœ… Passport.js
    • βœ… Socket.io
    • πŸ”² Swagger
    • βœ… Testing
    • βœ… Linter
  • Choose a ORM manager: Mongoose
  • Choose unit framework: Jest
  • Choose linter tools framework: EsLint
  • Choose extra linter tools:
    • βœ… Prettier
    • βœ… Lint on commit

image

TypeError: Cannot read property 'owner' of undefined

Thanks for amazing project Tsed. Having cli is also very useful. πŸ‘

Continuing discussion on this issue because it's still not fixed:
#15

tsed-cli help is still showing providers with first letter uppercase:

$tsed --version
2.10.1

$tsed generate --help

Usage: tsed generate|g [options] [type] [name]

Generate a new provider class

Arguments:

  type                   Type of the provider (Injectable, Controller, Pipe, etc...)
...

Also when run with something else as a provider it breaks with same error:

$tsed generate Schema MyModel
(node:2544) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'owner' of undefined
    at ProvidersInfoService.isMyProvider (/path/node_modules/@tsed/cli/lib/services/ProvidersInfoService.js:23:35)
    at GenerateCmd.<anonymous> (/path/node_modules/@tsed/cli/lib/commands/generate/GenerateCmd.js:122:36)
    at Generator.next (<anonymous>)
    at /path/node_modules/@tsed/cli/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/path/node_modules/@tsed/cli/node_modules/tslib/tslib.js:113:16)
    at GenerateCmd.$exec (/path/node_modules/@tsed/cli/lib/commands/generate/GenerateCmd.js:120:24)
    at CliService.<anonymous> (/path/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:99:40)
    at Generator.next (<anonymous>)
    at /path/node_modules/@tsed/cli/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/path/node_modules/@tsed/cli/node_modules/tslib/tslib.js:113:16)
    at CliService.getTasks (/path/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:92:24)
    at CliService.<anonymous> (/path/node_modules/@tsed/cli/node_modules/@tsed/cli-core/lib/services/CliService.js:52:32)
    at Generator.next (<anonymous>)
    at /path/node_modules/@tsed/cli/node_modules/tslib/tslib.js:117:75

Thank you.

Regression in [email protected]: Cannot read property 'install' of undefined (cli-plugin-mocha)

Information

  • Version: 3.3.2
  • Install Method: sudo yarn global add @tsed/cli

I've found a regression in 3.3.2 that was not in 3.3.1.

On version 3.3.2, this happens, while on 3.3.1 it finishes correctly.

? Choose the target platform: Express.js
? Choose the convention file styling: Ts.ED
? Check the features needed for your project GraphQL, Database, Passport.js, Socket.io, Testing, Commands
? Choose a ORM manager TypeORM
? Which TypeORM you want to install? MariaDB
? Choose unit framework Mocha + Chai + Sinon
? Choose the package manager: Yarn
  ↓ Write RC files [skipped]
  βœ” Install plugins
  βœ” Load plugins
  ❯ Install plugins dependencies
    βœ– Run plugin '@tsed/cli-plugin-mocha'
      β†’ Cannot read property 'install' of undefined
      Run plugin '@tsed/cli-plugin-passport'
      Run plugin '@tsed/cli-plugin-typeorm'
      Install
TypeError: Cannot read property 'install' of undefined
    at CliHooks.emit (/usr/local/share/.config/yarn/global/node_modules/@tsed/cli-core/lib/services/CliHooks.js:17:68)
    at Task.task (/usr/local/share/.config/yarn/global/node_modules/@tsed/cli-core/lib/services/CliPlugins.js:33:43)
    at /usr/local/share/.config/yarn/global/node_modules/listr/lib/task.js:167:30
    at processTicksAndRejections (node:internal/process/task_queues:94:5) {
  context: {
    root: '.',
    tsedVersion: 'latest',
    production: false,
    rawArgs: [],
    platform: 'express',
    convention: 'default',
    packageManager: 'yarn',
    projectName: 'tsed',
    graphql: true,
    db: true,
    passportjs: true,
    socketio: true,
    testing: true,
    commands: true,
    typeorm: true,
    mariadb: true,
    mocha: true,
    features: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object]
    ],
    srcDir: 'src',
    npm: false,
    yarn: true,
    express: true,
    koa: false,
    platformSymbol: 'PlatformExpress',
    verbose: undefined
  }
}

Passport generator not working

When I run tsed init . and choose Passport, it wasn't generate any passport files or endpoints, only includes dependencies

[BUG] Minor issues with generated code

Information

  • Version: 5.0.2
  • Packages:
> tsed init .
? Choose the target platform: Express.js
? Choose the architecture for your project: Ts.ED     
? Choose the convention file styling: Ts.ED
? Check the features needed for your project Database, Swagger, Testing, Linter
? Choose a ORM manager TypeORM
? Which TypeORM you want to install? Postgres
? Choose unit framework Jest
? Choose linter tools framework EsLint
? Choose extra linter tools Prettier, Lint on commit
? Choose the runtime: Node.js + Babel
? Choose the package manager: NPM

Following compile erros occur:

> npm run build

> [email protected] build
> npm run barrels && tsc && babel src --out-dir dist --extensions ".ts,.tsx" --source-maps inline

> [email protected] barrels
> barrelsby --config .barrelsby.json

src/config/index.ts:2:9 - error TS2305: Module '"./envs/index"' has no exported member 'envs'.

2 import {envs} from "./envs/index";
          ~~~~

src/datasources/PostgresDatasource.spec.ts:9:39 - error TS2749: 'PostgresDatasource' refers to a value, but is being used as a type here. Did you mean 'typeof PostgresDatasource'?

9     const instance = PlatformTest.get<PostgresDatasource>(PostgresDatasource);
                                        ~~~~~~~~~~~~~~~~~~

src/Server.integration.spec.ts:10:5 - error TS2322: Type 'TestAgent<Test>' is not assignable to type 'SuperTest<Test>'.
  Type 'TestAgent<Test>' is missing the following properties from type 'Stream': pipe, compose, addListener, removeListener, and 11 more.

10     request = SuperTest(PlatformTest.callback());
       ~~~~~~~

./envs/index only exports config and isProduction. I guess config should be imported in src/config/index.ts but that would also clash with the file defining export const config by itself. Maybe import like import {config as envConfig} from "./envs/index"; should be considered.

PostgresDatasource is actually the name from the exported DataSource. I guess it should be const instance = PlatformTest.get<DataSource>(PostgresDatasource); where DataSource is the type from typeorm package.

Never used SuperTest but the type seems to be just let request: SuperTest.Agent; instead of let request: SuperTest.SuperTest<SuperTest.Test>;

After fixing this, I get: Error: Cannot find package '@babel/plugin-proposal-object-rest-spread' [...]. Should be installed by the CLI.

Also the CLI page doesn't work: https://cli.tsed.io/

Example

Just follow the posted interaction with tsed cli.

Acceptance criteria

  • Criteria 1

Unable to find module '../envs' in a new project

I can't run a brand new project created by tsed-cli. The error message is:

[ERROR] 17:34:59 Error: Cannot find module '../envs'
Require stack:
- /Users/xxx/project/abc/src/config/logger/index.ts
- /Users/xxx/project/abc/src/config/index.ts
- /Users/xxx/project/abc/src/Server.ts
- /Users/xxx/project/abc/src/index.ts

So I checked file src/config/logger/index.ts. I see it imports an non-exist module

import {isProduction} from "../envs";

Probably it's a typo because I see there is a file src/config/env/index.js which contains constant isProduction.

Additionally, module envs is used by src/index.ts but it is not imported.

Please let me know if this bug report makes sense. Happy to create a PR if needed.

[FEAT] Add ResponseFilter template

TsLib is used as a phantom dependency

TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.

tslib is used by the framework (with the annotations @) but is not defined as devDependency.
This problem is highlighted when choosing pnpm over npm.

Steps to reproduce the issue

  1. tsed init .
  2. Choose the package manager: PNPM
  3. Check the HelloWorldController
  4. TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.

Probable Solution
Add tslib: "latest", to src/commands/init/InitCmd.ts:314

Note: Sorry, I do not have the time to add that as a PR right now, but I might do it over this week-end

invalid run commands in generated README.md

OS: windows 10
node -v: v14.16.1
tsed --version: 3.0.3

running command

> tsed init .
? Choose the target platform: Express.js
? Choose the convention file styling: Ts.ED
? Check the features needed for your project
? Choose the package manager: NPM
test-tsed
  √ Install plugins
  √ Load plugins
  √ Install plugins dependencies
  √ Generate project files

generated README.md

# install dependencies
$  install

# serve
$  start

# build for production
$  build
$  start:prod

[TECH] Replace Jest by VitePress

Information

Vitetest can be used to run test since the unplugin-swc is released and support TS legacy decorator.

Here is an example of vitest.config.ts required to run test correctly:

import swc from "unplugin-swc";
import {defineConfig} from "vitest/config";

export default defineConfig({
  test: {
    globals: true,
    root: "./"
  },
  plugins: [
    // This is required to build the test files with SWC
    swc.vite({
      // Explicitly set the module type to avoid inheriting this value from a `.swcrc` config file
      module: {type: "es6"}
    })
  ]
});

Note: Vitest support workspace https://vitest.dev/guide/workspace.html . It can be interesting to use it on this project to run all test.

Acceptance criteria

  • All tests run
  • Coverage are updated correctly

TypeError: Cannot read property 'owner' of undefined

This happened when I run the command tsed generate -r . Pipe CustomPipe

The same error is occurring for every generate command. I am using Windows 10 and Node 12.18.3

(node:7328) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'owner' of undefined
    at ProvidersInfoService.isMyProvider (C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\lib\services\ProvidersInfoService.js:23:35)
    at GenerateCmd.<anonymous> (C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\lib\commands\generate\GenerateCmd.js:99:36)
    at Generator.next (<anonymous>)
    at C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\node_modules\tslib\tslib.js:113:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\node_modules\tslib\tslib.js:109:16)
    at GenerateCmd.$exec (C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\lib\commands\generate\GenerateCmd.js:97:24)
    at CliService.<anonymous> (C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\node_modules\@tsed\cli-core\lib\services\CliService.js:101:40)
    at Generator.next (<anonymous>)
    at C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\node_modules\tslib\tslib.js:113:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\node_modules\tslib\tslib.js:109:16)
    at CliService.getTasks (C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\node_modules\@tsed\cli-core\lib\services\CliService.js:94:24)
    at CliService.<anonymous> (C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\node_modules\@tsed\cli-core\lib\services\CliService.js:54:32)
    at Generator.next (<anonymous>)
    at C:\Users\anvar\AppData\Roaming\npm\node_modules\@tsed\cli\node_modules\tslib\tslib.js:113:75
(node:7328) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:7328) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

[EPIC] Generate command

Here is the list of the different provider would be available for the v1:

  • Controller (assigned to @Romakita) - merged
  • Middleware (assigned to ...)
  • Injectable (assigned to ...)
  • Model (assigned to ...)
  • Decorator (assigned to ...)
  • Module (assigned to ...)
  • Pipe (assigned to ...)
  • Interceptor (assigned to ...)
  • Server (assigned to @Romakita) - merged

Note: Add you name on the line

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.