Skip to content

Commit

Permalink
Fix CLI build
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeGinnivan committed Oct 30, 2023
1 parent 8aba940 commit 4959701
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 27 deletions.
4 changes: 2 additions & 2 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@featureboard/cli",
"version": "0.2.1",
"types": "module",
"license": "MIT",
"dependencies": {
"devDependencies": {
"@commander-js/extra-typings": "^11.1.0",
"@featureboard/code-generator": "workspace:*",
"ejs": "^3.1.9",
"figlet": "^1.7.0",
"prompts": "^2.4.2"
},
"type": "module",
Expand Down
41 changes: 31 additions & 10 deletions apps/cli/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,42 @@
"sourceRoot": "apps/cli/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"platform": "node",
"outputPath": "apps/cli/dist",
"assets": [],
"format": ["esm"],
"bundle": true,
"skipTypeCheck": true,

"main": "apps/cli/src/main.ts",
"tsConfig": "apps/cli/tsconfig.json",
"esbuildOptions": {
"sourcemap": true,
"outExtension": {
".js": ".js"
},
"banner": {
"js": "const require = (await import('node:module')).createRequire(import.meta.url);const __filename = (await import('node:url')).fileURLToPath(import.meta.url);const __dirname = (await import('node:path')).dirname(__filename);"
}
},
"thirdParty": true
},
"configurations": {
"development": {},
"production": {}
}
},
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "cli:build",

"args": [
"code-gen",
"--output-path",
Expand All @@ -24,16 +55,6 @@
}
}
},
"package": {
"executor": "nx:run-commands",
"options": {
"commands": [
"tsup src/main.ts -d dist --sourcemap --format esm --external @featureboard/code-generator"
],
"cwd": "apps/cli",
"parallel": false
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
Expand Down
9 changes: 7 additions & 2 deletions apps/cli/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
flushChanges,
printChanges,
} from '@featureboard/code-generator'
import figlet from 'figlet'
import fs from 'fs'
import fsAsync from 'fs/promises'
import path from 'path'
Expand All @@ -20,7 +19,13 @@ import prompts from 'prompts'
const packageJson: { version: string } = JSON.parse(
fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8'),
)
const titleText = figlet.textSync(`FeatureBoard CLI V${packageJson.version}`)

// https://manytools.org/hacker-tools/ascii-banner/
const titleText = ` ___ _ ___ _ ___ _ ___
| __|__ __ _| |_ _ _ _ _ ___| _ ) ___ __ _ _ _ __| | / __| | |_ _|
| _/ -_) _\` | _| || | '_/ -_) _ \\/ _ \\/ _\` | '_/ _\` | | (__| |__ | |
|_|\\___\\__,_|\\__|\\_,_|_| \\___|___/\\___/\\__,_|_| \\__,_| \\___|____|___|
`

const program = new Command()
.description(`${titleText}\nA Code generator for FeatureBoard`)
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"@testing-library/react": "^14.0.0",
"@types/debug": "^4.1.10",
"@types/ejs": "^3.1.4",
"@types/figlet": "^1.5.7",
"@types/node": "20.8.9",
"@types/prompts": "^2.4.7",
"@types/react": "^18.2.32",
Expand All @@ -75,7 +74,6 @@
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"figlet": "^1.7.0",
"happy-dom": "^12.9.1",
"jsonc-eslint-parser": "^2.4.0",
"msw": "^2.0.0",
Expand Down
45 changes: 34 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"disableSourceOfProjectReferenceRedirect": true
},
"references": [
{
"path": "./apps/cli"
},
{
"path": "./libs/contracts"
},
Expand Down

0 comments on commit 4959701

Please sign in to comment.