Skip to content

Commit 45191db

Browse files
committed
yarn: migrate sample-nodejs-app example
Signed-off-by: Vladimir Aleksandrov <valeksan@redhat.com>
1 parent 593f3bd commit 45191db

File tree

10 files changed

+656
-3
lines changed

10 files changed

+656
-3
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
node_modules
3+

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
7+
[*.{js,json,yml}]
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 2

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.yarn/** linguist-vendored
2+
/.yarn/releases/* binary
3+
/.yarn/plugins/**/* binary
4+
/.pnp.* binary linguist-generated

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,16 @@ CLAUDE.md
1818
hermeto-output/
1919
hermeto.env
2020

21+
.yarn/*
22+
!.yarn/patches
23+
!.yarn/plugins
24+
!.yarn/releases
25+
!.yarn/sdks
26+
!.yarn/versions
27+
28+
# Swap the comments on the following lines if you wish to use zero-installs
29+
# In that case, don't forget to run `yarn config set enableGlobalCache false`!
30+
# Documentation here: https://yarnpkg.com/features/caching#zero-installs
31+
32+
#!.yarn/cache
33+
.pnp.*

.yarnrc.yml

Whitespace-only changes.

Containerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM docker.io/node:20
2+
3+
COPY . /src
4+
WORKDIR /src
5+
6+
RUN yarn install
7+
8+
EXPOSE 9000
9+
10+
CMD ["yarn", "run", "start"]
11+

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# Repo of examples for Hermeto docs
1+
# Sample NodeJS App
22

3-
Individual examples each live in their own branch (e.g. the basic `pip` example is in
4-
the 'pip-basic' branch)
3+
This is a simple web application based on [Express](https://expressjs.com) used to test container
4+
builds that rely on the yarn ecossystem.
5+
6+
## How to run it
7+
```
8+
yarn install
9+
yarn start
10+
```

index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const express = require("express");
2+
3+
const port = 9000;
4+
const app = express();
5+
6+
app.get("/", (req, res) => res.send("Hello world!"));
7+
8+
app.listen(port, () => console.log(`App started on port ${port}...`));

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "yarn-basic-example",
3+
"packageManager": "yarn@3.6.2",
4+
"version": "1.0.0",
5+
"description": "A sample NodeJS app",
6+
"main": "index.js",
7+
"scripts": {
8+
"start": "node index.js",
9+
"test": "echo \"Error: no test specified\" && exit 1"
10+
},
11+
"author": "",
12+
"license": "ISC",
13+
"dependencies": {
14+
"express": "^4.18.2"
15+
}
16+
}

0 commit comments

Comments
 (0)