Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a CLI #50

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f81ac0c
feat!: setup oclif with a basic 'init' command
EmileRolley Sep 30, 2024
e398310
test: setup tests for the CLI
EmileRolley Oct 1, 2024
af5a39c
feat: install deps with the init command
EmileRolley Oct 1, 2024
66e5b6e
feat(commands/init): add the --pkg-manager flag
EmileRolley Oct 1, 2024
16081c3
ci: use bun to run tests files
EmileRolley Oct 1, 2024
8b035f0
fix(command/init): fix spinning in prod
EmileRolley Oct 1, 2024
b215bbe
feat(command/init): generate README and src/base.publicodes
EmileRolley Oct 1, 2024
9529f57
feat(command/init): ask to install deps
EmileRolley Oct 2, 2024
fb5e4c8
refactor(command): better error handling
EmileRolley Oct 2, 2024
5985901
refactor: typing nitpicks
EmileRolley Oct 2, 2024
32acb8e
refactor(command): better exitWithError API
EmileRolley Oct 2, 2024
bf5e641
feat(compilation): add resolveRuleTypes
EmileRolley Oct 2, 2024
9566a25
feat(command/compile): first version of the compile command
EmileRolley Oct 2, 2024
af207df
feat(command/init): add --yes flag
EmileRolley Oct 3, 2024
92baef5
refactor(command/init): try to have a simplier run function
EmileRolley Oct 3, 2024
bb364df
feat(command/init): setup test with vitest
EmileRolley Oct 3, 2024
ed49480
feat(command/compile): use publicodes object config from the package.…
EmileRolley Oct 24, 2024
853b44a
v1.3.0-0
EmileRolley Oct 24, 2024
5bce220
feat(command/compile): change default output dir and add comments for…
EmileRolley Oct 25, 2024
0bdc172
v1.3.0-1
EmileRolley Oct 25, 2024
3a3f986
nitpicks
EmileRolley Nov 15, 2024
7f15aa0
feat(command/compile): add RuleValue to the genereated d.ts file
EmileRolley Nov 18, 2024
af220eb
refactor(command/compile)!: serialized parsed rules instead of raw rules
EmileRolley Nov 18, 2024
e8ff6e9
v1.3.0-2
EmileRolley Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
- uses: actions/setup-node@v3
with:
cache: yarn
- uses: oven-sh/setup-bun@v2

- run: yarn install --immutable

- name: Build package
Expand Down
3 changes: 3 additions & 0 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
6 changes: 6 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bun

// eslint-disable-next-line n/shebang
import { execute } from '@oclif/core'

await execute({ development: true, dir: import.meta.url })
3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
5 changes: 5 additions & 0 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import { execute } from '@oclif/core'

await execute({ dir: import.meta.url })
58 changes: 36 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
{
"name": "@publicodes/tools",
"version": "1.2.5",
"description": "A set of utility functions to build tools around Publicodes models",
"version": "1.3.0-2",
"description": "A CLI tool for Publicodes",
"type": "module",
"main": "dist/index.js",
"scripts": {
"build": "tsup",
"watch": "tsup --watch",
"clean": "rm -rf dist docs",
"test": "jest",
"docs": "typedoc",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"engines": {
"node": ">=17"
"bin": {
"publicodes": "./bin/run.js"
},
"files": [
"dist",
"bin"
],
"exports": {
".": {
"import": "./dist/index.js",
Expand All @@ -38,9 +33,6 @@
"types": "./dist/migration/index.d.ts"
}
},
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/publicodes/tools.git"
Expand All @@ -55,31 +47,47 @@
],
"author": "Emile Rolley <[email protected]>",
"license": "MIT",
"scripts": {
"build": "tsup",
"watch": "tsup --watch",
"clean": "rm -rf dist docs",
"test": "vitest --globals",
"docs": "typedoc",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"engines": {
"node": ">=17"
},
"dependencies": {
"@clack/prompts": "^0.7.0",
"@oclif/core": "^4.0.23",
"@types/node": "^18.11.18",
"chalk": "^5.3.0",
"glob": "^10.4.1",
"path": "^0.12.7",
"publicodes": "^1.3.3",
"publicodes": "^1.5.1",
"yaml": "^2.4.5"
},
"devDependencies": {
"@types/jest": "^29.2.5",
"@oclif/test": "^4.0.9",
"@types/jest": "^29.5.13",
"docdash": "^2.0.1",
"jest": "^29.4.1",
"prettier": "^3.0.0",
"ts-jest": "^29.0.4",
"ts-node": "^10.9.2",
"tsup": "^8.0.2",
"typedoc": "^0.24.8",
"typedoc-plugin-export-functions": "^1.0.0",
"typescript": "^4.9.4"
"typescript": "^4.9.4",
"vitest": "^2.1.1"
},
"tsup": {
"entry": [
"src/index.ts",
"src/optims/index.ts",
"src/compilation/index.ts",
"src/migration/index.ts"
"src/migration/index.ts",
"src/commands"
],
"format": [
"cjs",
Expand All @@ -90,6 +98,12 @@
"clean": true,
"cjsInterop": true
},
"oclif": {
"bin": "publicodes",
"commands": "./dist/commands",
"dirname": "publicodes",
"topicSeparator": ":"
},
"publishConfig": {
"access": "public"
}
Expand Down
Loading