brick-break 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.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/package.json +41 -0
- package/sound.mp3 +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ShinniUwU
|
|
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,57 @@
|
|
|
1
|
+
# 🧱 brick-break
|
|
2
|
+
|
|
3
|
+
> *that satisfying lego break sound when your build fails*
|
|
4
|
+
|
|
5
|
+
saw this idea on tiktok and had to make it real. now every failed build hits different.
|
|
6
|
+
|
|
7
|
+
## install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -D brick-break
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
then wrap your build command:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "brick-break next dev",
|
|
19
|
+
"build": "brick-break next build"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or just run it directly:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx brick-break next build
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## works with everything
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
brick-break next build
|
|
34
|
+
brick-break npm run build
|
|
35
|
+
brick-break tsc
|
|
36
|
+
brick-break cargo build
|
|
37
|
+
brick-break go build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
if it can fail, brick-break can make it funnier.
|
|
41
|
+
|
|
42
|
+
## how it works
|
|
43
|
+
|
|
44
|
+
1. runs your command
|
|
45
|
+
2. build fails? plays the sound
|
|
46
|
+
3. thats it
|
|
47
|
+
|
|
48
|
+
## requirements
|
|
49
|
+
|
|
50
|
+
uses your system audio player (already installed):
|
|
51
|
+
- **mac** - afplay
|
|
52
|
+
- **linux** - paplay/aplay
|
|
53
|
+
- **windows** - powershell
|
|
54
|
+
|
|
55
|
+
## license
|
|
56
|
+
|
|
57
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
if (!args.length) {
|
|
7
|
+
console.log('usage: brick-break <command>');
|
|
8
|
+
console.log('example: brick-break npm run build');
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
(0, index_1.runCommand)(args);
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.playSound = playSound;
|
|
7
|
+
exports.runCommand = runCommand;
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const sound = path_1.default.join(__dirname, '..', 'sound.mp3');
|
|
11
|
+
function playSound() {
|
|
12
|
+
const p = process.platform;
|
|
13
|
+
if (p === 'darwin') {
|
|
14
|
+
(0, child_process_1.spawn)('afplay', [sound]);
|
|
15
|
+
}
|
|
16
|
+
else if (p === 'win32') {
|
|
17
|
+
(0, child_process_1.spawn)('powershell', ['-c', `(New-Object Media.SoundPlayer '${sound}').PlaySync()`]);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
// linux - try pulseaudio first, fallback to alsa
|
|
21
|
+
const player = (0, child_process_1.spawn)('paplay', [sound]);
|
|
22
|
+
player.on('error', () => (0, child_process_1.spawn)('aplay', [sound]));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function runCommand(args) {
|
|
26
|
+
const cmd = args[0];
|
|
27
|
+
const rest = args.slice(1);
|
|
28
|
+
const proc = (0, child_process_1.spawn)(cmd, rest, { stdio: 'inherit', shell: true });
|
|
29
|
+
proc.on('close', code => {
|
|
30
|
+
if (code !== 0)
|
|
31
|
+
playSound();
|
|
32
|
+
process.exit(code ?? 1);
|
|
33
|
+
});
|
|
34
|
+
proc.on('error', err => {
|
|
35
|
+
console.error(`failed to run: ${err.message}`);
|
|
36
|
+
playSound();
|
|
37
|
+
process.exit(1);
|
|
38
|
+
});
|
|
39
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "brick-break",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Play a Lego break sound when your build fails",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"brick-break": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"sound.mp3"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"build",
|
|
20
|
+
"lego",
|
|
21
|
+
"sound",
|
|
22
|
+
"error",
|
|
23
|
+
"fun",
|
|
24
|
+
"developer-experience",
|
|
25
|
+
"nextjs"
|
|
26
|
+
],
|
|
27
|
+
"author": "ShinniUwU",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"homepage": "https://github.com/ShinniUwU/brick-break#readme",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/ShinniUwU/brick-break.git"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/ShinniUwU/brick-break/issues"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^20.0.0",
|
|
39
|
+
"typescript": "^5.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/sound.mp3
ADDED
|
Binary file
|