Skip to content

Commit

Permalink
fix version tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nealwp committed May 20, 2023
1 parent ff9f24e commit e9714e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"bin": {
"smodg": "./index.js"
},
"exports": {
"./package.json": "./package.json"
},
"scripts": {
"test": "jest",
"test:watch": "jest --watch",
Expand Down
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

import fs from 'node:fs'
import minimist from 'minimist';
import path from 'path';
import { generateModelInputs } from './parser';
import { modelTemplate, migrationTemplate } from './templates';
import { kebabCase } from './formatters';

const version = require('../package.json').version
let packageJsonPath: string;

if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
packageJsonPath = path.resolve(__dirname, '..', 'package.json');
} else {
packageJsonPath = path.resolve(__dirname, 'package.json');
}

const version = require(packageJsonPath).version

export const main = (args: minimist.ParsedArgs) => {

Expand Down

0 comments on commit e9714e7

Please sign in to comment.