Skip to content

Commit 3796922

Browse files
committed
comply anca
1 parent 73e8a08 commit 3796922

13 files changed

+108
-94
lines changed

.devcontainer/Dockerfile

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
FROM docker.io/ubuntu:22.04
1+
FROM docker.io/node:22.4.1
22

3-
ENV NODE_VERSION 22.2.0
4-
ENV NODE_CHECKSUM sha256:2c6eaf8bfd0f886ed8764ffce19c795e909639105e4056b1d9f8f917bad12cf1
5-
6-
RUN apt-get update \
7-
&& apt-get install -y git tar gnupg2 \
8-
&& apt-get clean \
9-
&& rm -rf /var/lib/apt/lists/*
10-
ADD --checksum=$NODE_CHECKSUM https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz /node.tar.gz
11-
RUN tar -xz -f /node.tar.gz -C /usr/local --remove-files --strip-components=1
12-
13-
RUN useradd -m -s /bin/bash developer
14-
USER developer
3+
USER node

.devcontainer/devcontainer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"name": "Clivo",
32
"build": {
43
"context": ".",
54
"dockerfile": "./Dockerfile"
@@ -12,5 +11,6 @@
1211
"streetsidesoftware.code-spell-checker"
1312
]
1413
}
15-
}
14+
},
15+
"name": "Node.js 22"
1616
}

.github/workflows/release.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@ name: Release
33
on:
44
release:
55
types: [created]
6-
workflow_dispatch:
76

87
jobs:
98
publish-npm:
109
runs-on: ubuntu-latest
10+
env:
11+
ANCA_CI: true
1112
name: "Publish package to npm registry"
1213
steps:
1314
- uses: actions/checkout@v4
1415
name: "Checkout repo"
1516
- uses: actions/setup-node@v4
1617
with:
17-
node-version: 22
18+
node-version: 22.4.1
1819
registry-url: https://registry.npmjs.org/
1920
name: "Install Node.js"
2021
- run: npm ci
2122
name: "Install dependencies"
2223
- run: npm test
2324
name: "Run tests"
24-
- run: npm run build
25-
name: "Build distribution bundle"
2625
- run: npm publish
2726
env:
2827
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
29-
name: "Publish to registry"
28+
name: "Build and publish to registry"

.github/workflows/test.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ name: Test
33
on:
44
push:
55
branches: ["**"]
6-
workflow_dispatch:
76

87
jobs:
98
test-commit:
109
runs-on: ubuntu-latest
1110
strategy:
1211
matrix:
13-
node: [18, 20, 22]
12+
node: [18.20.4, 20.15.1, 22.4.1]
1413
name: Test repo on Node.js ${{ matrix.node }}
1514
steps:
1615
- uses: actions/checkout@v4

.gitignore

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1+
# Editor directories and files
2+
.idea
3+
.DS_Store
4+
*.suo
5+
*.ntvs*
6+
*.njsproj
7+
*.sln
8+
*.sw?
9+
.vscode
10+
111
# Logs
212
logs
313
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
pnpm-debug.log*
8-
lerna-debug.log*
9-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
10-
11-
# Dependency directories
12-
node_modules/
13-
jspm_packages/
14-
.yarn/cache
15-
.yarn/unplugged
16-
.yarn/build-state.yml
17-
.yarn/install-state.gz
18-
.pnp.*
19-
.yarn-integrity
2014

2115
# Runtime data
2216
pids
2317
*.pid
2418
*.seed
2519
*.pid.lock
2620

27-
# Editor directories and files
28-
.idea
29-
.DS_Store
30-
*.suo
31-
*.ntvs*
32-
*.njsproj
33-
*.sln
34-
*.sw?
35-
.vscode
21+
# Temp folder
22+
tmp
3623

3724
# Built sources
3825
/dist
3926
/build
4027
*.spec
4128

42-
# Output of 'npm pack'
43-
*.tgz
29+
# Dependency directories
30+
node_modules/
31+
jspm_packages/
32+
.yarn/cache
33+
.yarn/unplugged
34+
.yarn/build-state.yml
35+
.yarn/install-state.gz
36+
.pnp.*
37+
.yarn-integrity
4438

4539
# Local settings
4640
.env
4741
.env.development.local
4842
.env.test.local
4943
.env.production.local
5044
.env.local
51-
config.json
5245

53-
# Data
54-
/data
55-
/public/assets
46+
# Node.js logs
47+
npm-debug.log*
48+
yarn-debug.log*
49+
yarn-error.log*
50+
pnpm-debug.log*
51+
lerna-debug.log*
52+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
53+
54+
# Output of 'npm pack'
55+
*.tgz

.prettierignore

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
package-lock.json
1515

1616
# Distributions
17+
/build
1718
/dist
1819

19-
# Cinnabar Forge
20-
cinnabar.js
20+
# Cinnabar Meta
21+
**/cinnabar.js
22+
**/cinnabar.ts
2123
cinnabar.json
24+
CHANGELOG.md
25+
26+
# Anca
27+
anca.json

CONTRIBUTING.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributing
2+
3+
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.
4+
5+
## Installation
6+
7+
We support [Devcontainers](https://containers.dev/). You can use the provided development container to work on this project. The development container includes all the necessary tools and dependencies to work on this project.
8+
9+
Otherwise, download, install and configure [Node.js](https://nodejs.org/en/download/).
10+
11+
Then, run the following commands to install the dependencies and run the tests:
12+
13+
```bash
14+
npm ci
15+
npm test
16+
```
17+
18+
## Authors
19+
20+
### Maintainers
21+
22+
- Timur Moziev ([@TimurRin](https://github.com/TimurRin))

README.md

+16-26
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
# Clivo
22

3-
_By Cinnabar Forge_
4-
5-
**DISCLAIMER**: Until version 1.0.0, all versions below should be considered unstable.
3+
> **DISCLAIMER**: This project is not production ready. All versions below 1.0.0 should be considered unstable
64
75
Simple CLI tools library
86

9-
## Getting Started
10-
11-
### Installation
7+
## Installation
128

13-
Install clivo using npm:
9+
### npm
1410

1511
```bash
1612
npm install clivo
1713
```
1814

19-
### Usage
15+
## Usage
2016

21-
#### Parsing CLI arguments
17+
### Parsing CLI arguments
2218

2319
You can assign one or multiple variables to an option in any fashion:
2420

@@ -45,6 +41,8 @@ const result = parseCli({
4541
// result = { _: [ 'burger-earl' ], takeout: [ 'yes' ], order: [ 'burger', 'cola', 'fries', 'salad' ] }
4642
```
4743

44+
#### Equal Sign Values Only
45+
4846
Alternatively, you can set values with equal sign only using `equalSignValuesOnly`:
4947

5048
```javascript
@@ -67,7 +65,9 @@ const result = parseCli({
6765
// result = { takeout: [ 'yes' ], order: [ 'burger', 'cola', 'fries', 'salad' ], _: [ 'burger-earl' ] }
6866
```
6967

70-
#### Prompt
68+
### Prompt
69+
70+
Prompt the user for input in various ways:
7171

7272
```javascript
7373
import { promptOptions } from "clivo";
@@ -128,26 +128,16 @@ await promptMenu("Main Menu", [
128128

129129
## Contributing
130130

131-
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.
132-
133-
You need Node.js installed on your device.
134-
135-
You can also develop in the Devcontainer mode.
131+
Visit [`CONTRIBUTING.md`](CONTRIBUTING.md).
136132

137-
After preparations, install:
133+
Current maintainers:
138134

139-
```bash
140-
npm ci
141-
```
142-
143-
### Road to 1.0
144-
145-
`TODO`
135+
- Timur Moziev ([@TimurRin](https://github.com/TimurRin))
146136

147137
## License
148138

149-
Clivo is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.
139+
Visit [`LICENSE`](LICENSE).
150140

151-
## Authors
141+
## Anca
152142

153-
- Timur Moziev ([@TimurRin](https://github.com/TimurRin))
143+
This repository is a part of [Anca](https://github.com/cinnabar-forge/anca) standardization project. Parts of the files and code are generated by Anca.

anca.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
"development": {
3434
"readme": {}
3535
},
36-
"type": "app",
36+
"type": "library",
3737
"stack": "nodejs"
3838
}

eslint.config.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import cinnabarPlugin from "@cinnabar-forge/eslint-plugin";
22

3+
const files = ["src/**/*.ts"];
4+
const ignores = ["bin/**/*", "build/**/*", "dist/**/*"];
5+
36
export default [
47
...cinnabarPlugin.default.map((config) => ({
58
...config,
6-
files: ["src/**/*.ts"],
9+
files,
710
})),
811
{
9-
files: ["src/**/*.ts"],
12+
files,
1013
rules: {
1114
"security/detect-object-injection": "off",
1215
},
1316
},
1417
{
15-
ignores: ["bin/**/*", "build/**/*", "dist/**/*"],
18+
ignores,
1619
},
1720
];

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
"scripts": {
2222
"build": "tsup",
2323
"build:dev": "tsc",
24+
"fix": "prettier . --write && eslint --fix .",
2425
"format": "prettier . --write",
2526
"lint": "eslint --fix .",
26-
"prepack": "npm run build",
27-
"test": "eslint --max-warnings 0 . && tsc && mocha './build/dev/test'"
27+
"test": "prettier . -c && eslint --max-warnings 0 . && tsc && mocha './build/dev/test'"
2828
},
2929
"devDependencies": {
3030
"@cinnabar-forge/eslint-plugin": "0.6.1",
@@ -41,6 +41,9 @@
4141
"tsup": "8.2.1",
4242
"typescript": "5.5.3"
4343
},
44+
"engines": {
45+
"node": ">=18"
46+
},
4447
"pre-commit": [
4548
"format",
4649
"test"

src/prompts.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ const emitter = new EventEmitter();
1010
* @param {string} event - The event to emit.
1111
* @param {(...args: unknown[]) => void} listener - The listener to call when the event is emitted.
1212
*/
13-
export function listenClivoEvent(event: string, listener: (...args: unknown[]) => void): void {
13+
export function listenClivoEvent(
14+
event: string,
15+
listener: (...args: unknown[]) => void,
16+
): void {
1417
emitter.on(event, listener);
1518
}
1619

tsconfig.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"compilerOptions": {
3-
"target": "es2022",
3+
"esModuleInterop": true,
4+
"forceConsistentCasingInFileNames": true,
45
"module": "es2022",
6+
"moduleResolution": "node",
57
"outDir": "./build/dev",
68
"rootDir": "./",
7-
"moduleResolution": "node",
8-
"strict": true,
9-
"esModuleInterop": true,
109
"skipLibCheck": true,
11-
"forceConsistentCasingInFileNames": true
10+
"strict": true,
11+
"target": "es2022"
1212
},
13-
"include": ["./src/*", "./test/*"]
13+
"include": ["./src/**/*", "./test/**/*"]
1414
}

0 commit comments

Comments
 (0)