generated from thothom/base-project-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efa64ab
commit 4cfa12d
Showing
15 changed files
with
1,199 additions
and
1,820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ yarn-debug.log* | |
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Jest | ||
/jest.config.cjs | ||
|
||
# OS | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"*{ts,js}": [ | ||
"*{ts,js,cjs}": [ | ||
"yarn format" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
import { getRootPath } from "@techmmunity/utils"; | ||
import { ThothError } from "@thothom/core"; | ||
import { readFileSync, existsSync } from "fs"; | ||
|
||
export const getThothVersion = () => { | ||
const { dependencies } = require(getRootPath("package.json")); | ||
const packageJsonPath = getRootPath("package.json"); | ||
|
||
const version = dependencies["@thothom/core"].replace("^", ""); | ||
if (!existsSync(packageJsonPath)) { | ||
throw new ThothError({ | ||
message: "package.json was not found", | ||
code: "AUTOMATION_FAILED", | ||
origin: "THOTHOM", | ||
details: [`Path: ${packageJsonPath}`], | ||
}); | ||
} | ||
|
||
const { dependencies } = JSON.parse(readFileSync(packageJsonPath, "utf8")); | ||
|
||
const version = dependencies?.["@thothom/core"]?.replace("^", ""); | ||
|
||
if (!version) { | ||
throw new ThothError({ | ||
message: "@thothom/cli version was not found on the dependencies", | ||
code: "AUTOMATION_FAILED", | ||
origin: "THOTHOM", | ||
details: [`Path: ${packageJsonPath}`], | ||
}); | ||
} | ||
|
||
return version; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
/* eslint-disable @typescript-eslint/no-require-imports */ | ||
|
||
import { getRootPath } from "@techmmunity/utils"; | ||
import type { Command } from "commander"; | ||
|
||
export const loadLocalBinCommandLoader = (program: Command) => { | ||
const { loadCommands } = require(getRootPath( | ||
"node_modules/@thothom/cli/cli/commands", | ||
)); | ||
export const loadLocalBinCommandLoader = async (program: Command) => { | ||
const { loadCommands } = await import( | ||
getRootPath("node_modules/@thothom/cli/cli/commands") | ||
); | ||
|
||
return loadCommands(program); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.