diff --git a/.goreleaser.yml b/.goreleaser.yml index fbf3ec687..f49082b2f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -11,8 +11,8 @@ before: - sed -i "s/REPLACE_ME/{{ incpatch .Version }}/" docs/api/swagger.yaml - cp docs/api/swagger.yaml web/assets/swagger.yaml # install and bundle the web assets and styling - - yarn install --cwd web/gotosocial-styling - - node web/gotosocial-styling/index.js --build-dir="web/assets" + - yarn install --cwd web/source + - BUDO_BUILD=1 node web/source builds: # https://goreleaser.com/customization/build/ - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4cedd6698..7eb74ca5b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,19 +70,21 @@ To work with the stylesheet for templates, you need [Node.js](https://nodejs.org To install Yarn dependencies: ```bash -yarn install --cwd web/gotosocial-styling +yarn install --cwd web/source ``` To recompile bundles: ```bash -node web/gotosocial-styling/index.js --build-dir="web/assets" +BUDO_BUILD=1 node web/source ``` -You can do automatic live-reloads of bundles with: +Or you can run livereloading in development. It will start a webserver (ip/port printed in console, default localhost:8081), while also keeping the bundles +up-to-date on disk. You can access the user/admin panels at localhost:8080/user, localhost:8080/admin, or run in tandem with the GoToSocial testrig, which will also +serve the updated bundles from disk. ``` bash -NODE_ENV=development node web/gotosocial-styling/index.js --build-dir="web/assets" +NODE_ENV=development node web/source ``` ### Golang forking quirks diff --git a/Dockerfile b/Dockerfile index a4beea7ec..dd8c09296 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,17 +5,18 @@ FROM --platform=${BUILDPLATFORM} node:17.6.0-alpine3.15 AS admin_builder RUN apk update && apk upgrade --no-cache RUN apk add git -RUN git clone https://github.com/superseriousbusiness/gotosocial-admin -WORKDIR /gotosocial-admin - -RUN npm install -RUN node index.js - FROM --platform=${TARGETPLATFORM} alpine:3.15.0 AS executor # copy over the binary from the first stage COPY --chown=1000:1000 gotosocial /gotosocial/gotosocial +# bundle frontend stuff +WORKDIR "web/source" +RUN yarn install +RUN BUDO_BUILD=1 node index.js +# sources no longer needed +RUN rm -rf web/source + # copy over the web directory with templates etc COPY --chown=1000:1000 web /gotosocial/web diff --git a/docs/admin/admin_panel.md b/docs/admin/admin_panel.md index da801f0d9..7443b5253 100644 --- a/docs/admin/admin_panel.md +++ b/docs/admin/admin_panel.md @@ -1,6 +1,6 @@ # Admin Control Panel -[gotosocial-admin](https://github.com/superseriousbusiness/gotosocial-admin) is a simple webclient that uses the [admin api routes](https://docs.gotosocial.org/en/latest/api/swagger/#operations-tag-admin) to manage your instance. It uses the same OAUTH mechanism as normal clients (with scope: admin), and as such can be hosted anywhere, separately from your instance, or run locally. A public installation is available here: [https://gts.superseriousbusiness.org/admin](https://gts.superseriousbusiness.org/admin). +The GoToSocial admin panel is a simple webclient that uses the [admin api routes](https://docs.gotosocial.org/en/latest/api/swagger/#operations-tag-admin) to manage your instance. It uses the same OAUTH mechanism as normal clients (with scope: admin), and as such can be hosted anywhere, separately from your instance, or run locally. A public installation is available here: [https://gts.superseriousbusiness.org/admin](https://gts.superseriousbusiness.org/admin). ## Using the panel To use the Admin API your account has to be promoted as such: @@ -16,11 +16,11 @@ any other client. You can change the instance's settings like the title and descriptions, and add/remove/change domain blocks including a bulk import/export. -## Installing the panel +## Building the panel Build requirements: some version of [Node.js](https://nodejs.org) and yarn. ``` -git clone https://github.com/superseriousbusiness/gotosocial-admin.git && cd gotosocial-admin -yarn install -node index.js +yarn install --cwd web/source +BUDO_BUILD=1 node web/source ``` -This will compile a static bundle in `public/`, which can be copied to any webhost, or put into your GoToSocial installation in the `web/admin` directory. \ No newline at end of file + +See also: [Contributing.md Stylesheet / Web dev](https://github.com/superseriousbusiness/gotosocial/blob/main/CONTRIBUTING.md#stylesheet--web-dev) \ No newline at end of file diff --git a/web/source/index.js b/web/source/index.js index 91459b4a2..214bb655c 100644 --- a/web/source/index.js +++ b/web/source/index.js @@ -73,7 +73,7 @@ function splitCSS() { } const browserifyConfig = { - transform: babelify.configure({ presets: ["@babel/preset-env", "@babel/preset-react"] }), + transform: babelify.configure({ presets: [require.resolve("@babel/preset-env"), require.resolve("@babel/preset-react")] }), plugin: [ [icssify, { parser: require('postcss-scss'), @@ -95,7 +95,7 @@ fs.readdirSync(path.join(__dirname, "./css")).forEach((file) => { }); budoExpress({ - port: 8080, + port: 8081, host: "localhost", entryFiles: entryFiles, basePath: __dirname,