@sr-labs/devkit 0.0.0-stage → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +3 -0
- package/dist/commands.d.ts +7 -0
- package/dist/commands.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +24 -0
- package/package.json +31 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sr-labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sr-labs/devkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
One `devkit` command for the tools that set up a project's development environment.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
devkit release [--apply] [--push] ... # same as release-tag
|
|
7
|
+
devkit changelog [--stdout] ... # same as changelog
|
|
8
|
+
devkit --help | --version
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
An unknown subcommand prints an error and the help text and exits non-zero. See the [devkit README](../../README.md).
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface Command {
|
|
2
|
+
description: string;
|
|
3
|
+
/** Runs the tool with the remaining args and returns the exit code. */
|
|
4
|
+
run: (argv: string[]) => number;
|
|
5
|
+
}
|
|
6
|
+
/** Subcommand registry. Adding a tool is one entry. */
|
|
7
|
+
export declare const commands: Record<string, Command>;
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { main as changelog } from '@sr-labs/changelog';
|
|
2
|
+
import { main as release } from '@sr-labs/release-tag';
|
|
3
|
+
/** Subcommand registry. Adding a tool is one entry. */
|
|
4
|
+
export const commands = {
|
|
5
|
+
release: { description: 'Compute the next vX.Y.Z, bump files, update CHANGELOG.md, commit and tag', run: release },
|
|
6
|
+
changelog: { description: 'Generate CHANGELOG.md from Conventional Commits between tags', run: changelog }
|
|
7
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/main.d.ts
ADDED
package/dist/main.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { commands } from "./commands.js";
|
|
3
|
+
const help = () => `Usage: devkit <command> [options]\n\nCommands:\n${Object.entries(commands)
|
|
4
|
+
.map(([name, c]) => ` ${name.padEnd(10)}${c.description}`)
|
|
5
|
+
.join('\n')}\n\nOptions:\n --help, -h Show this help\n --version, -v Show the devkit version\n`;
|
|
6
|
+
/** Runs the devkit CLI with args (without node/script) and returns the exit code. */
|
|
7
|
+
export function main(argv) {
|
|
8
|
+
const [name, ...rest] = argv;
|
|
9
|
+
if (name === '--help' || name === '-h' || name === undefined) {
|
|
10
|
+
process.stdout.write(help());
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
if (name === '--version' || name === '-v') {
|
|
14
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
15
|
+
console.log(pkg.version);
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
if (!Object.hasOwn(commands, name)) {
|
|
19
|
+
console.error(`Unknown command: ${name}\n`);
|
|
20
|
+
process.stderr.write(help());
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
return commands[name].run(rest);
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sr-labs/devkit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "One devkit command for project development-environment tools: release, changelog.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://gitlab.com/sr-labs/devkit.git",
|
|
10
|
+
"directory": "packages/devkit"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"devkit": "./dist/cli.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@sr-labs/changelog": "^0.1.3",
|
|
32
|
+
"@sr-labs/release-tag": "^0.1.3"
|
|
33
|
+
}
|
|
6
34
|
}
|