Skip to content

Commit

Permalink
Makes TGUI build also run prettier automatically (ParadiseSS13#22985)
Browse files Browse the repository at this point in the history
* makes TGUI build also run prettier automatically

* Update tgui/bin/tgui-build.bat

* another error

* and this

* i lied

* final tweaks?

* oh and this lol

* nuke styles because they just get changed for no reason
  • Loading branch information
S34NW authored Oct 26, 2023
1 parent dae51e9 commit 308a38e
Show file tree
Hide file tree
Showing 19 changed files with 1,110 additions and 51 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ __pycache__/
dmm-tools.exe
OpenDream
paradise.json
$RECYCLE.BIN
3 changes: 2 additions & 1 deletion tgui/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Ignore built packages:
# Ignore built packages and styles:
packages/tgui/public
packages/tgui/styles
2 changes: 1 addition & 1 deletion tgui/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const createBabelConfig = (options) => {
targets: [],
},
],
require.resolve('@babel/preset-react'),
...presets,
].filter(Boolean),
plugins: [
Expand All @@ -31,7 +32,6 @@ const createBabelConfig = (options) => {
require.resolve('@babel/plugin-transform-jscript'),
require.resolve('babel-plugin-inferno'),
removeConsole && require.resolve('babel-plugin-transform-remove-console'),
require.resolve('common/string.babel-plugin.cjs'),
...plugins,
].filter(Boolean),
};
Expand Down
1 change: 1 addition & 0 deletions tgui/bin/tgui-build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@echo off
cd "%~dp0\.."
call yarn install
call yarn prettier --write
call yarn run build
timeout /t 9
7 changes: 7 additions & 0 deletions tgui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
},
"dependencies": {
"@babel/eslint-parser": "^7.22.15",
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-react": "^7.22.15",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-transform-jscript": "^7.22.5",
"babel-plugin-inferno": "^6.7.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
Expand Down
4 changes: 3 additions & 1 deletion tgui/packages/tgui/components/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export const Slider = (props) => {
'Slider',
disabled && 'Slider__disabled',
'ProgressBar',
(disabled ? 'ProgressBar--color--disabled' : 'ProgressBar--color--' + effectiveColor),
disabled
? 'ProgressBar--color--disabled'
: 'ProgressBar--color--' + effectiveColor,
className,
computeBoxClassName(rest),
])}
Expand Down
45 changes: 31 additions & 14 deletions tgui/packages/tgui/interfaces/BotMed.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { useBackend } from '../backend'
import { Button, Flex, LabeledList, ProgressBar, Section, Slider } from '../components'
import { Window } from '../layouts'
import { BotStatus } from './common/BotStatus'
import { useBackend } from '../backend';
import {
Button,
Flex,
LabeledList,
ProgressBar,
Section,
Slider,
} from '../components';
import { Window } from '../layouts';
import { BotStatus } from './common/BotStatus';

export const BotMed = (props, context) => {
const { act, data } = useBackend(context);
Expand All @@ -22,7 +29,7 @@ export const BotMed = (props, context) => {
injection_amount,
use_beaker,
treat_virus,
reagent_glass
reagent_glass,
} = data;
return (
<Window>
Expand Down Expand Up @@ -52,11 +59,13 @@ export const BotMed = (props, context) => {
minValue={heal_threshold.min}
maxValue={heal_threshold.max}
step={5}
stepPixelSize={300 / ((heal_threshold.max - heal_threshold.min) / 5)}
stepPixelSize={
300 / ((heal_threshold.max - heal_threshold.min) / 5)
}
disabled={noaccess}
onChange={(e, value) =>
act('set_heal_threshold', {
target: value
target: value,
})
}
/>
Expand All @@ -67,20 +76,22 @@ export const BotMed = (props, context) => {
minValue={injection_amount.min}
maxValue={injection_amount.max}
step={5}
stepPixelSize={300 / ((injection_amount.max - injection_amount.min) / 5)}
stepPixelSize={
300 / ((injection_amount.max - injection_amount.min) / 5)
}
format={(value) => `${value}u`}
disabled={noaccess}
onChange={(e, value) =>
act('set_injection_amount', {
target: value
target: value,
})
}
/>
</LabeledList.Item>
<LabeledList.Item label="Reagent Source">
<Button
content={use_beaker ? "Beaker" : "Internal Synthesizer"}
icon={use_beaker ? "flask" : "cogs"}
content={use_beaker ? 'Beaker' : 'Internal Synthesizer'}
icon={use_beaker ? 'flask' : 'cogs'}
disabled={noaccess}
onClick={() => act('toggle_use_beaker')}
/>
Expand All @@ -89,7 +100,13 @@ export const BotMed = (props, context) => {
<LabeledList.Item label="Beaker">
<Flex inline width="100%">
<Flex.Item grow={1}>
<ProgressBar value={reagent_glass.amount} minValue={0} maxValue={reagent_glass.max_amount}>{reagent_glass.amount} / {reagent_glass.max_amount}</ProgressBar>
<ProgressBar
value={reagent_glass.amount}
minValue={0}
maxValue={reagent_glass.max_amount}
>
{reagent_glass.amount} / {reagent_glass.max_amount}
</ProgressBar>
</Flex.Item>
<Flex.Item ml={1}>
<Button
Expand Down Expand Up @@ -130,5 +147,5 @@ export const BotMed = (props, context) => {
)}
</Window.Content>
</Window>
)
}
);
};
5 changes: 3 additions & 2 deletions tgui/packages/tgui/interfaces/NTRecruiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ export const NTRecruiter = (props, context) => {
>
<LabeledList>
<LabeledListItem label="1#" color="silver">
To win this game you must hire/dismiss <b>{total_curriculums}</b> candidates,
one wrongly made choice leads to a game over.
To win this game you must hire/dismiss{' '}
<b>{total_curriculums}</b> candidates, one wrongly made choice
leads to a game over.
</LabeledListItem>
<LabeledListItem label="2#" color="silver">
Make the right choice by truly putting yourself into the skin of
Expand Down
6 changes: 3 additions & 3 deletions tgui/packages/tgui/interfaces/RoboticsControlConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export const RoboticsControlConsole = (props, context) => {
const Cyborgs = (props, context) => {
const { cyborgs, can_hack } = props;
const { act, data } = useBackend(context);
let detonateText = "Detonate";
if(data.detonate_cooldown > 0){
let detonateText = 'Detonate';
if (data.detonate_cooldown > 0) {
detonateText += ' (' + data.detonate_cooldown + 's)';
}
if (!cyborgs.length) {
Expand Down Expand Up @@ -85,7 +85,7 @@ const Cyborgs = (props, context) => {
<Button.Confirm
icon="bomb"
content={detonateText}
disabled={!data.auth || data.detonate_cooldown > 0}
disabled={!data.auth || data.detonate_cooldown > 0}
color="bad"
onClick={() =>
act('killbot', {
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/SeedExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const SeedsContent = (props, context) => {
onClick={() =>
act('vend', {
seedid: seed.id,
seedvariant: seed.variant,
seedvariant: seed.variant,
})
}
/>
Expand Down
8 changes: 4 additions & 4 deletions tgui/packages/tgui/interfaces/SpecMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ const GarMenu = (props, context) => {
</p>
<p>
<b>Overwhelming force</b>: Unlocked at 600 blood, when toggled, if you
bump into a door that you do not have access to, it will force it open.
In addition, you cannot be pushed or pulled while it is active.
bump into a door that you do not have access to, it will force it
open. In addition, you cannot be pushed or pulled while it is active.
</p>
<p>
<b>Demonic grasp</b>: Unlocked at 800 blood, allows you to send out a
Expand Down Expand Up @@ -222,8 +222,8 @@ const DantMenu = (props, context) => {
<p>
<b>Full Power</b>
<Divider />
<b>Mass Hysteria</b>: Casts a powerful illusion that blinds and then makes
everyone nearby perceive others as random animals.
<b>Mass Hysteria</b>: Casts a powerful illusion that blinds and then
makes everyone nearby perceive others as random animals.
</p>
<Button content="Dantalion" onClick={() => act('dantalion')} />
</Section>
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/public/tgui.bundle.js

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions tgui/packages/tgui/styles/themes/abductor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@
);
@include meta.load-css(
'../components/ProgressBar.scss',
$with: (
'color-background': rgba(0, 0, 0, 0.5),
'color-disabled': #363636
)
$with: ('color-background': rgba(0, 0, 0, 0.5), 'color-disabled': #363636)
);
@include meta.load-css('../components/Section.scss');
@include meta.load-css(
Expand Down
5 changes: 1 addition & 4 deletions tgui/packages/tgui/styles/themes/cardtable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
);
@include meta.load-css(
'../components/ProgressBar.scss',
$with: (
'color-background': rgba(0, 0, 0, 0.5),
'color-disabled': #363636
)
$with: ('color-background': rgba(0, 0, 0, 0.5), 'color-disabled': #363636)
);
@include meta.load-css('../components/Section.scss');

Expand Down
4 changes: 1 addition & 3 deletions tgui/packages/tgui/styles/themes/hackerman.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
);
@include meta.load-css(
'../components/ProgressBar.scss',
$with: (
'color-disabled': #4a6a4a,
)
$with: ('color-disabled': #4a6a4a)
);
@include meta.load-css('../components/Modal.scss');
@include meta.load-css('../components/Section.scss');
Expand Down
5 changes: 1 addition & 4 deletions tgui/packages/tgui/styles/themes/malfunction.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
);
@include meta.load-css(
'../components/ProgressBar.scss',
$with: (
'color-background': rgba(0, 0, 0, 0.5),
'color-disabled': #363636
)
$with: ('color-background': rgba(0, 0, 0, 0.5), 'color-disabled': #363636)
);
@include meta.load-css('../components/Section.scss');
@include meta.load-css(
Expand Down
5 changes: 1 addition & 4 deletions tgui/packages/tgui/styles/themes/retro.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@
);
@include meta.load-css(
'../components/ProgressBar.scss',
$with: (
'color-background': rgba(0, 0, 0, 0.5),
'color-disabled': #363636
)
$with: ('color-background': rgba(0, 0, 0, 0.5), 'color-disabled': #363636)
);
@include meta.load-css('../components/Section.scss');

Expand Down
5 changes: 1 addition & 4 deletions tgui/packages/tgui/styles/themes/syndicate.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
);
@include meta.load-css(
'../components/ProgressBar.scss',
$with: (
'color-background': rgba(0, 0, 0, 0.5),
'color-disabled': #363636
)
$with: ('color-background': rgba(0, 0, 0, 0.5), 'color-disabled': #363636)
);
@include meta.load-css('../components/Section.scss');
@include meta.load-css(
Expand Down
Loading

0 comments on commit 308a38e

Please sign in to comment.