bruh-license 1.0.0

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.
@@ -0,0 +1,18 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(unzip:*)",
5
+ "Bash(chmod:*)",
6
+ "Bash(npm test)",
7
+ "Bash(node bin/licenseme.js:*)",
8
+ "Bash(git init:*)",
9
+ "Bash(git add:*)",
10
+ "Bash(git commit:*)",
11
+ "Bash(git remote add:*)",
12
+ "Bash(git branch:*)",
13
+ "Bash(git push:*)",
14
+ "Bash(git rm:*)",
15
+ "Bash(npm publish:*)"
16
+ ]
17
+ }
18
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bruh.tools
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 ADDED
@@ -0,0 +1,45 @@
1
+ # licenseme
2
+
3
+ Generate LICENSE files. no cap.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g licenseme
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ # Show help
15
+ licenseme --help
16
+
17
+ # List available licenses
18
+ licenseme --list
19
+
20
+ # Generate MIT license
21
+ licenseme mit
22
+
23
+ # Generate with author name
24
+ licenseme apache -n "Your Company"
25
+
26
+ # Print to stdout
27
+ licenseme isc --stdout
28
+ ```
29
+
30
+ ## Available Licenses
31
+
32
+ - `mit` - MIT License
33
+ - `apache` - Apache License 2.0
34
+ - `isc` - ISC License
35
+ - `bsd3` - BSD 3-Clause License
36
+ - `unlicense` - The Unlicense
37
+
38
+ ## Links
39
+
40
+ - [Docs](https://bruh.tools/licenseme)
41
+ - [Issues](https://github.com/bruh-tools/licenseme/issues)
42
+
43
+ ---
44
+
45
+ *bruh.tools - no cap, fr fr*
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { generate, list, getTypes } = require('../src/generator');
6
+
7
+ const args = process.argv.slice(2);
8
+
9
+ function showHelp() {
10
+ console.log(`
11
+ licenseme - generate LICENSE files. no cap.
12
+
13
+ Usage:
14
+ licenseme [license] [options]
15
+
16
+ Licenses:
17
+ mit MIT License (default)
18
+ apache Apache License 2.0
19
+ isc ISC License
20
+ bsd3 BSD 3-Clause License
21
+ unlicense The Unlicense
22
+
23
+ Options:
24
+ -n, --name Author name (default: "Your Name")
25
+ -y, --year Year (default: current year)
26
+ --stdout Print to stdout instead of file
27
+ -l, --list List all available licenses
28
+ -h, --help Show this help
29
+
30
+ Examples:
31
+ licenseme mit
32
+ licenseme apache -n "ACME Inc"
33
+ licenseme isc --stdout
34
+
35
+ Docs: https://bruh.tools/licenseme
36
+ Issues: https://github.com/bruh-tools/licenseme/issues
37
+
38
+ bruh.tools - no cap, fr fr
39
+ `);
40
+ }
41
+
42
+ function parseArgs(args) {
43
+ const opts = { type: 'mit', name: 'Your Name', year: new Date().getFullYear(), stdout: false };
44
+
45
+ for (let i = 0; i < args.length; i++) {
46
+ const arg = args[i];
47
+
48
+ if (arg === '-h' || arg === '--help') {
49
+ showHelp();
50
+ process.exit(0);
51
+ }
52
+ if (arg === '-l' || arg === '--list') {
53
+ console.log('\nAvailable licenses:\n');
54
+ list().forEach(l => console.log(` ${l.key.padEnd(12)} ${l.name}`));
55
+ console.log('');
56
+ process.exit(0);
57
+ }
58
+ if (arg === '-n' || arg === '--name') {
59
+ opts.name = args[++i] || opts.name;
60
+ continue;
61
+ }
62
+ if (arg === '-y' || arg === '--year') {
63
+ opts.year = parseInt(args[++i]) || opts.year;
64
+ continue;
65
+ }
66
+ if (arg === '--stdout') {
67
+ opts.stdout = true;
68
+ continue;
69
+ }
70
+ if (!arg.startsWith('-') && getTypes().includes(arg)) {
71
+ opts.type = arg;
72
+ }
73
+ }
74
+
75
+ return opts;
76
+ }
77
+
78
+ function main() {
79
+ if (args.length === 0) {
80
+ showHelp();
81
+ process.exit(0);
82
+ }
83
+
84
+ const opts = parseArgs(args);
85
+ const content = generate(opts.type, { name: opts.name, year: opts.year });
86
+
87
+ if (!content) {
88
+ console.error(`Unknown license: ${opts.type}`);
89
+ console.error('Use --list to see available licenses');
90
+ process.exit(1);
91
+ }
92
+
93
+ if (opts.stdout) {
94
+ console.log(content);
95
+ } else {
96
+ const outPath = path.join(process.cwd(), 'LICENSE');
97
+ fs.writeFileSync(outPath, content);
98
+ console.log(`✓ Created LICENSE (${opts.type.toUpperCase()})`);
99
+ }
100
+ }
101
+
102
+ main();
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "bruh-license",
3
+ "version": "1.0.0",
4
+ "description": "Generate LICENSE files. no cap.",
5
+ "main": "src/generator.js",
6
+ "bin": {
7
+ "licenseme": "./bin/licenseme.js"
8
+ },
9
+ "scripts": {
10
+ "test": "node test.js"
11
+ },
12
+ "keywords": ["license", "generator", "cli"],
13
+ "author": "bruh.tools",
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/bruh-tools/licenseme"
18
+ },
19
+ "homepage": "https://bruh.tools/licenseme"
20
+ }
@@ -0,0 +1,26 @@
1
+ const licenses = require('./licenses');
2
+
3
+ function generate(type, options = {}) {
4
+ const license = licenses[type];
5
+ if (!license) return null;
6
+
7
+ const year = options.year || new Date().getFullYear();
8
+ const name = options.name || 'Your Name';
9
+
10
+ return license.template
11
+ .replace(/{year}/g, year)
12
+ .replace(/{name}/g, name);
13
+ }
14
+
15
+ function list() {
16
+ return Object.entries(licenses).map(([key, val]) => ({
17
+ key,
18
+ name: val.name
19
+ }));
20
+ }
21
+
22
+ function getTypes() {
23
+ return Object.keys(licenses);
24
+ }
25
+
26
+ module.exports = { generate, list, getTypes, licenses };
@@ -0,0 +1,118 @@
1
+ const MIT = `MIT License
2
+
3
+ Copyright (c) {year} {name}
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.`;
22
+
23
+ const APACHE = `Apache License
24
+ Version 2.0, January 2004
25
+ http://www.apache.org/licenses/
26
+
27
+ Copyright {year} {name}
28
+
29
+ Licensed under the Apache License, Version 2.0 (the "License");
30
+ you may not use this file except in compliance with the License.
31
+ You may obtain a copy of the License at
32
+
33
+ http://www.apache.org/licenses/LICENSE-2.0
34
+
35
+ Unless required by applicable law or agreed to in writing, software
36
+ distributed under the License is distributed on an "AS IS" BASIS,
37
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38
+ See the License for the specific language governing permissions and
39
+ limitations under the License.`;
40
+
41
+ const ISC = `ISC License
42
+
43
+ Copyright (c) {year} {name}
44
+
45
+ Permission to use, copy, modify, and/or distribute this software for any
46
+ purpose with or without fee is hereby granted, provided that the above
47
+ copyright notice and this permission notice appear in all copies.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
50
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
51
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
52
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
53
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
54
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
55
+ PERFORMANCE OF THIS SOFTWARE.`;
56
+
57
+ const BSD3 = `BSD 3-Clause License
58
+
59
+ Copyright (c) {year} {name}
60
+ All rights reserved.
61
+
62
+ Redistribution and use in source and binary forms, with or without
63
+ modification, are permitted provided that the following conditions are met:
64
+
65
+ 1. Redistributions of source code must retain the above copyright notice, this
66
+ list of conditions and the following disclaimer.
67
+
68
+ 2. Redistributions in binary form must reproduce the above copyright notice,
69
+ this list of conditions and the following disclaimer in the documentation
70
+ and/or other materials provided with the distribution.
71
+
72
+ 3. Neither the name of the copyright holder nor the names of its
73
+ contributors may be used to endorse or promote products derived from
74
+ this software without specific prior written permission.
75
+
76
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
77
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
78
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
79
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
80
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
81
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
82
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
83
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
84
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
85
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.`;
86
+
87
+ const UNLICENSE = `This is free and unencumbered software released into the public domain.
88
+
89
+ Anyone is free to copy, modify, publish, use, compile, sell, or
90
+ distribute this software, either in source code form or as a compiled
91
+ binary, for any purpose, commercial or non-commercial, and by any
92
+ means.
93
+
94
+ In jurisdictions that recognize copyright laws, the author or authors
95
+ of this software dedicate any and all copyright interest in the
96
+ software to the public domain. We make this dedication for the benefit
97
+ of the public at large and to the detriment of our heirs and
98
+ successors. We intend this dedication to be an overt act of
99
+ relinquishment in perpetuity of all present and future rights to this
100
+ software under copyright law.
101
+
102
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
103
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
104
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
105
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
106
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
107
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
108
+ OTHER DEALINGS IN THE SOFTWARE.
109
+
110
+ For more information, please refer to <http://unlicense.org/>`;
111
+
112
+ module.exports = {
113
+ mit: { name: 'MIT License', template: MIT },
114
+ apache: { name: 'Apache License 2.0', template: APACHE },
115
+ isc: { name: 'ISC License', template: ISC },
116
+ bsd3: { name: 'BSD 3-Clause License', template: BSD3 },
117
+ unlicense: { name: 'The Unlicense', template: UNLICENSE }
118
+ };
package/test.js ADDED
@@ -0,0 +1,85 @@
1
+ const { generate, list, getTypes } = require('./src/generator');
2
+
3
+ let passed = 0;
4
+ let failed = 0;
5
+
6
+ function test(name, fn) {
7
+ try {
8
+ fn();
9
+ console.log(`✓ ${name}`);
10
+ passed++;
11
+ } catch (e) {
12
+ console.log(`✗ ${name}`);
13
+ console.log(` ${e.message}`);
14
+ failed++;
15
+ }
16
+ }
17
+
18
+ function assert(condition, msg) {
19
+ if (!condition) throw new Error(msg || 'Assertion failed');
20
+ }
21
+
22
+ // Tests
23
+ test('generate mit returns string', () => {
24
+ const result = generate('mit');
25
+ assert(typeof result === 'string', 'should be string');
26
+ assert(result.includes('MIT License'), 'should contain MIT License');
27
+ });
28
+
29
+ test('generate apache returns string', () => {
30
+ const result = generate('apache');
31
+ assert(typeof result === 'string', 'should be string');
32
+ assert(result.includes('Apache License'), 'should contain Apache License');
33
+ });
34
+
35
+ test('generate isc returns string', () => {
36
+ const result = generate('isc');
37
+ assert(typeof result === 'string', 'should be string');
38
+ assert(result.includes('ISC License'), 'should contain ISC License');
39
+ });
40
+
41
+ test('generate with name replaces placeholder', () => {
42
+ const result = generate('mit', { name: 'Test Author' });
43
+ assert(result.includes('Test Author'), 'should contain author name');
44
+ });
45
+
46
+ test('generate with year replaces placeholder', () => {
47
+ const result = generate('mit', { year: 2020 });
48
+ assert(result.includes('2020'), 'should contain year');
49
+ });
50
+
51
+ test('generate invalid returns null', () => {
52
+ const result = generate('invalid');
53
+ assert(result === null, 'should return null for invalid');
54
+ });
55
+
56
+ test('list returns array', () => {
57
+ const result = list();
58
+ assert(Array.isArray(result), 'should be array');
59
+ assert(result.length === 5, 'should have 5 licenses');
60
+ });
61
+
62
+ test('list items have key and name', () => {
63
+ const result = list();
64
+ result.forEach(item => {
65
+ assert(item.key, 'should have key');
66
+ assert(item.name, 'should have name');
67
+ });
68
+ });
69
+
70
+ test('getTypes returns array of strings', () => {
71
+ const result = getTypes();
72
+ assert(Array.isArray(result), 'should be array');
73
+ assert(result.includes('mit'), 'should include mit');
74
+ assert(result.includes('apache'), 'should include apache');
75
+ });
76
+
77
+ test('default year is current year', () => {
78
+ const result = generate('mit');
79
+ const currentYear = new Date().getFullYear().toString();
80
+ assert(result.includes(currentYear), 'should contain current year');
81
+ });
82
+
83
+ // Summary
84
+ console.log(`\n${passed}/${passed + failed} tests passed`);
85
+ process.exit(failed > 0 ? 1 : 0);