forgive me for the noob question. I have no experience with TypeScript. Appologies in advanced that I need to replace my repo names, and project names in any example code.

I am trying to create a fork of sequlize-auto so that I can modify the generated models header output. Also want to adapt it to generate Vuex ORM models at the same time.

I have forked the repo from sequelize/sequlize-auto to my own repo ( my repo name/sequelize-auto), and I have tried install with npm using:

npm install https://github.com/<my repo name>/sequelize-auto/tarball/master

Also:

npm install <my repo name>/sequelize-auto

When I try to run the command in PowerShell:

node_modules\.bin\sequelize-auto -o "./api/models/new" .......

I get the following error:

node:internal/modules/cjs/loader:928
  throw err;
  ^

Error: Cannot find module './lib/auto'
Require stack:
- D:\projects\<my project name>\node_modules\sequelize-auto\index.js
- D:\projects\<my project name>\node_modules\sequelize-auto\bin\sequelize-auto
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (D:\projects\<my project name>\node_modules\sequelize-auto\index.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\projects\\<my project name>\\node_modules\\sequelize-auto\\index.js',
    'D:\\projects\\<my project name>\\node_modules\\sequelize-auto\\bin\\sequelize-auto'
  ]
}

However, if I npm install sequelize/sequelize-auto and run the command the models are generated without any problems.

I've also tried to npm run build and npm run prepack using scripts in package.json:

"scripts": {
    "tsc": "tsc",
    "clean": "rimraf lib && rimraf types && rimraf **/models && rimraf *.tgz",
    "build": "npm run clean && tsc",
    "prepack": "crlf --set=LF bin/sequelize-auto",
    "test": "npm run test-mssql && npm run test-mysql && npm run test-postgres && npm run test-sqlite",
    "test-postgres": "cross-env DEBUG='sequelize-auto:*' DIALECT=postgres nyc mocha",
    "test-postgres-native": "cross-env DEBUG='sequelize-auto:*' DIALECT=postgres-native nyc mocha",
    "test-mysql": "cross-env DEBUG='sequelize-auto:*' DIALECT=mysql nyc mocha",
    "test-sqlite": "cross-env DEBUG='sequelize-auto:*' DIALECT=sqlite nyc mocha",
    "test-mssql": "cross-env DEBUG='sequelize-auto:*' DIALECT=mssql nyc mocha",
    "coveralls": "nyc report --reporter=text-lcov | coveralls"
  },

I've also tried deleting the node_modules folder, and package-lock.json, and then npm install without success.

Am I missing any build steps, pushing it to github repo incorrectly, or using npm install incorrectly? Or any other problems I am missing?

Any help would be greatly appreciated. Thank you in advance.

1

There are 1 best solutions below

0
thrasher On

I've found the solution. Just needed to remove lib from .gitignore so the transpiled JavaScript is pushed to my repo.