Skip to content

Commit

Permalink
remove yarn (#507)
Browse files Browse the repository at this point in the history
* remove yarn

* fix type error
  • Loading branch information
butlerx authored Oct 2, 2023
1 parent 2be7a76 commit 798dc5f
Show file tree
Hide file tree
Showing 17 changed files with 8,230 additions and 7,245 deletions.
10 changes: 6 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
node_modules
.esm-cache
dist
*.yml
.git
.gitignore
*.md
*.log
*.yml
*.png
**/*.conf
**/*.service
dist
build
docs
Dockerfile
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

14 changes: 9 additions & 5 deletions .github/workflows/build-and-test.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ jobs:
with:
fetch-depth: 2

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup env
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn install
run: pnpm install

- name: ESLint checks
run: yarn lint
run: pnpm lint

- run: yarn build
- run: pnpm build
name: Compile Typescript

- run: yarn test
- run: pnpm test
name: Run tests
env:
CI: true
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup env
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
cache: 'pnpm'

- uses: actions/cache@v3
id: restore-build
Expand Down
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ websockets rather than Ajax and hence better response time.
## Install

```sh
yarn global add wetty
npm -g i wetty
```

## Usage
Expand Down
23 changes: 16 additions & 7 deletions containers/wetty/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
FROM node:current-alpine as builder
FROM node:current-alpine as base
RUN apk add -U build-base python3
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN npx pnpm i -g pnpm@latest
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN yarn global add node-gyp
RUN yarn install
RUN yarn build

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build

FROM node:current-alpine
LABEL maintainer="[email protected]"
WORKDIR /usr/src/app
ENV NODE_ENV=production
EXPOSE 3000
COPY --from=builder /usr/src/app/build /usr/src/app/build
COPY --from=builder /usr/src/app/node_modules /usr/src/app/node_modules
COPY --from=prod-deps /usr/src/app/node_modules /usr/src/app/node_modules
COPY --from=build /usr/src/app/build /usr/src/app/build
COPY package.json /usr/src/app
RUN apk add -U coreutils openssh-client sshpass && \
mkdir ~/.ssh

ENTRYPOINT ["yarn", "start"]
EXPOSE 8000
CMD [ "pnpm", "start" ]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
build:
context: .
dockerfile: containers/wetty/Dockerfile
entrypoint: yarn docker-compose-entrypoint
entrypoint: pnpm run docker-compose-entrypoint
tty: true
working_dir: /usr/src/app
ports:
Expand Down
4 changes: 2 additions & 2 deletions docs/apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ here `idp.xml` and exchange you foo.xml with it.
</Location>
# security hazard for switching between users, disabled if remote-user set as recent github commit
# but not yet published via yarn, so we put here a double security belt
# but not yet published via npm, so we put here a double security belt
<Location /wetty/ssh/>
Deny from all
</Location>
Expand All @@ -120,7 +120,7 @@ After=network.target
[Service]
User=wetty
Type=simple
WorkingDirectory=/home/wetty/.config/yarn/global/node_modules/wetty/
WorkingDirectory=/home/wetty/.node_modules/wetty/
ExecStart=/usr/bin/node . -p 3000 --host 127.0.0.1 --ssh-key /home/wetty/.ssh/wetty --ssh-auth publickey --force-ssh --title "Foo bar terminal services"
TimeoutStopSec=20
KillMode=mixed
Expand Down
24 changes: 8 additions & 16 deletions docs/atoz.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ non root user later in the guide.
`apt-get` command to be safe.

`build-essential` - We need this specifically for `node-gyp` to build packages
when using `npm` or `yarn` to install packages.
when using `npm` to install packages.

As the `root` or `sudo` user run these commands:

Expand Down Expand Up @@ -191,9 +191,9 @@ sed -r '/^ssh-ed25519(.*)wetty-keyfile$/d' -i ~/.ssh/authorized_keys

## Install WeTTY

**Note:** we are using `-g` for `npm` or `global` for `yarn` along with
`--prefix ~/` so that the application's symbolic link is installed to our
`~/bin` directory and available in our local user's `PATH`.
**Note:** we are using `-g` for `npm` along with `--prefix ~/` so that the
application's symbolic link is installed to our `~/bin` directory and available
in our local user's `PATH`.

As your local user run these commands:

Expand All @@ -204,16 +204,10 @@ please run the following command.
mkdir -p ~/bin && source ~/.profile
```

Now use `npm` to install the `yarn` packet manager.
Then use `npm` to install `wetty`.

```bash
npm install -g yarn --prefix ~/
```

Then use `yarn` to install `wetty`.

```bash
yarn global add wetty --prefix ~/
npm -g i wetty --prefix ~/
```

Once successfully installed the application should be available in your local
Expand Down Expand Up @@ -649,16 +643,14 @@ behind either:
## Updating WeTTY
With `yarn`:
```bash
yarn global upgrade wetty --prefix ~/
npm -g update wetty --prefix ~/
```
To update or downgrade to a specific version you use this command:
```bash
yarn global add [email protected] --prefix ~/
npm -g i [email protected] --prefix ~/
```
Now restart your `wetty` service.
Expand Down
6 changes: 3 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ To install from source run:
```bash
$ git clone https://github.com/butlerx/wetty.git
$ cd wetty
$ yarn install
$ yarn build
$ pnpm install
$ pnpm build
```

## Development Env

To run WeTTY in dev mode you can run `yarn dev`.
To run WeTTY in dev mode you can run `pnpm dev`.

WeTTY will then be served from `http://localhost:3000/wetty` on your machine.

Expand Down
6 changes: 3 additions & 3 deletions docs/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ bundled with the npm package to make this easier.
### init.d

```bash
$ yarn global add wetty
$ sudo cp ~/.config/yarn/global/node_modules/wetty/conf/wetty.conf /etc/init
$ npm -g i wetty
$ sudo cp ~/.node_modules/wetty/conf/wetty.conf /etc/init
$ sudo start wetty
```

### systemd

```bash
$ yarn global add wetty
$ cp ~/.config/yarn/global/node_modules/wetty/conf/wetty.service ~/.config/systemd/user/
$ cp ~/.node_modules/wetty/conf/wetty.service ~/.config/systemd/user/
$ systemctl --user enable wetty
$ systemctl --user start wetty
```
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
],
"scripts": {
"build": "snowpack build",
"clean": "rm -rf build yarn-error.log",
"clean": "rm -rf build",
"contributor": "all-contributors",
"dev": "NODE_ENV=development concurrently --kill-others --success first \"snowpack build --watch\" \"nodemon . --conf conf/config.json5\"",
"docker-compose-entrypoint": "ssh-keyscan -H wetty-ssh >> ~/.ssh/known_hosts; yarn start",
"docker-compose-entrypoint": "ssh-keyscan -H wetty-ssh >> ~/.ssh/known_hosts; pnpm start",
"lint": "eslint src",
"lint:fix": "eslint --fix src",
"start": "NODE_ENV=production node .",
Expand Down Expand Up @@ -113,6 +113,7 @@
"prom-client": "^14.0.1",
"response-time": "^2.3.2",
"sass": "^1.54.4",
"serve-static": "^1.15.0",
"socket.io": "^4.5.1",
"socket.io-client": "^4.5.1",
"toastify-js": "^1.9.1",
Expand Down Expand Up @@ -141,6 +142,7 @@
"@types/node": "^20.2.6",
"@types/parseurl": "^1.3.1",
"@types/response-time": "^2",
"@types/serve-static": "^1.15.3",
"@types/sinon": "^10.0.13",
"@types/toastify-js": "^1.9.2",
"@types/yargs": "^17.0.24",
Expand Down Expand Up @@ -228,5 +230,5 @@
"Tri Nguyen <[email protected]>",
"Vamshi K Ponnapalli <[email protected]>"
],
"packageManager": "[email protected]"
"packageManager": "[email protected]"
}
Loading

0 comments on commit 798dc5f

Please sign in to comment.