Skip to content

Commit

Permalink
update stack
Browse files Browse the repository at this point in the history
  • Loading branch information
lagden committed Nov 16, 2023
1 parent c9e1906 commit 333d100
Show file tree
Hide file tree
Showing 21 changed files with 289 additions and 3,253 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- name: Checkout
Expand Down
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
.conf/local.sh
.vite
.registry-*
docker-compose-*.yml

# Boilerplate
_cleanup
_init

# node
node_modules
Expand All @@ -17,4 +13,6 @@ logs
# Coverage
coverage/**
!coverage/lcov.info
!coverage/cobertura-coverage.xml

_init
_cleanup
28 changes: 28 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
variables:
KUBE_NAMESPACE: boilerplate
HELM_RELEASE_NAME: rest

include:
- project: "inovacao/devops/template-cicd"
file: "sonar-js.yaml"
- project: "inovacao/devops/template-cicd"
file: "test-nodejs.yaml"
- project: "inovacao/devops/template-cicd"
file: "build-nodejs.yaml"
- project: "inovacao/devops/template-cicd"
file: "deploy.yaml"

test:
extends: .test

sonar:
extends: .sonar_js

build:
extends: .build

stages:
- test
- sonar
- build
- deploy
8 changes: 8 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
engine-strict=true
resolution-mode=highest
auto-install-peers=true

# TEx pkgs
//gitlab.textecnologia.io/api/v4/packages/npm/:_authToken=glpat-SzBHz58z8KCtXSqvKFAR
//gitlab.textecnologia.io/api/v4/:_authToken=glpat-SzBHz58z8KCtXSqvKFAR
@xet:registry=https://gitlab.textecnologia.io/api/v4/packages/npm/
@texsvelte:registry=https://gitlab.textecnologia.io/api/v4/packages/npm/
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.css
.*
bin
build
coverage
dist
node_modules
package
# template.js
vite.config.js.timestamp-*

*.json
*.yaml
*.yml
*.md
16 changes: 16 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
arrowParens: avoid
bracketSameLine: false
bracketSpacing: false
# embeddedLanguageFormatting: auto
insertPragma: false
htmlWhitespaceSensitivity: css
printWidth: 720
proseWrap: preserve
quoteProps: as-needed
requirePragma: false
semi: false
singleAttributePerLine: true
singleQuote: true
trailingComma: all
tabWidth: 4
useTabs: true
26 changes: 26 additions & 0 deletions cli/listen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import process from 'node:process'
import la from '@tadashi/local-access'
import * as debug from '@tadashi/debug'
import app from '../server/app.js'

// prettier-ignore
const {
PORT: port = 5001,
HOSTNAME_CUSTOM: hostname = '127.0.0.1',
VERSION = 'dev',
} = process.env

// prettier-ignore
const {
local,
network,
} = la({port, hostname})

app.listen(port, () => {
debug.info('Server listening')
debug.info('----------------')
debug.info(`Local: ${local}`)
debug.info(`Network: ${network}`)
debug.info('----------------')
debug.info(`Version: ${VERSION}`)
})
3 changes: 2 additions & 1 deletion server/reset.js → cli/reset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import process from 'node:process'
import * as debug from '@tadashi/debug'

// prettier-ignore
const {
APP_ENV,
GITLAB_ENVIRONMENT_NAME,
Expand All @@ -9,4 +10,4 @@ const {
/* c8 ignore next */
process.env.APP_ENV = APP_ENV ?? GITLAB_ENVIRONMENT_NAME ?? 'production'

debug.info('reset | process.env', process.env)
debug.info('reset.js | process.env', process.env)
27 changes: 2 additions & 25 deletions cli/run.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
#!/usr/bin/env node

import '../server/reset.js'
import process from 'node:process'
import la from '@tadashi/local-access'
import * as debug from '@tadashi/debug'
import app from '../server/app.js'

const {
PORT: port = 5001,
HOSTNAME_CUSTOM: hostname = '0.0.0.0',
VERSION = 'dev',
} = process.env

const {
local,
network,
} = la({port, hostname})

app.listen(port, () => {
debug.info('Server listening')
debug.info('----------------')
debug.info(`Local: ${local}`)
debug.info(`Network: ${network}`)
debug.info('----------------')
debug.info(`Version: ${VERSION}`)
})
await import('./reset.js')
await import('./listen.js')
54 changes: 34 additions & 20 deletions coverage/cobertura-coverage.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage lines-valid="81" lines-covered="81" line-rate="1" branches-valid="8" branches-covered="8" branch-rate="1" timestamp="1693349651191" complexity="0" version="0.1">
<coverage lines-valid="95" lines-covered="95" line-rate="1" branches-valid="11" branches-covered="11" branch-rate="1" timestamp="1700172398237" complexity="0" version="0.1">
<sources>
<source>/Users/lagden/_dev/old/htdocs/lab/boilerplate/rest</source>
</sources>
Expand All @@ -23,19 +23,41 @@
<line number="10" hits="1" branch="false"/>
<line number="11" hits="1" branch="false"/>
<line number="12" hits="1" branch="false"/>
<line number="13" hits="1" branch="false"/>
<line number="13" hits="1" branch="true" condition-coverage="100% (1/1)"/>
<line number="14" hits="1" branch="false"/>
<line number="15" hits="1" branch="false"/>
<line number="16" hits="1" branch="false"/>
<line number="17" hits="1" branch="false"/>
<line number="18" hits="1" branch="false"/>
<line number="19" hits="1" branch="false"/>
<line number="20" hits="1" branch="false"/>
<line number="21" hits="1" branch="false"/>
<line number="22" hits="1" branch="false"/>
<line number="23" hits="1" branch="false"/>
<line number="24" hits="1" branch="false"/>
<line number="25" hits="1" branch="false"/>
<line number="26" hits="1" branch="false"/>
<line number="27" hits="1" branch="false"/>
<line number="28" hits="1" branch="false"/>
<line number="29" hits="1" branch="true" condition-coverage="100% (1/1)"/>
<line number="30" hits="1" branch="false"/>
<line number="31" hits="1" branch="false"/>
<line number="32" hits="1" branch="true" condition-coverage="100% (1/1)"/>
<line number="33" hits="1" branch="false"/>
<line number="34" hits="1" branch="false"/>
<line number="35" hits="1" branch="false"/>
<line number="36" hits="1" branch="false"/>
<line number="37" hits="1" branch="false"/>
<line number="38" hits="1" branch="false"/>
<line number="39" hits="1" branch="false"/>
<line number="40" hits="1" branch="false"/>
</lines>
</class>
</classes>
</package>
<package name="server.routes" line-rate="1" branch-rate="1">
<classes>
<class name="_hey-joe.js" filename="server/routes/_hey-joe.js" line-rate="1" branch-rate="1">
<class name="_example.js" filename="server/routes/_example.js" line-rate="1" branch-rate="1">
<methods>
<method name="hey" hits="2" signature="()V">
<lines>
Expand All @@ -44,7 +66,7 @@
</method>
<method name="echo" hits="1" signature="()V">
<lines>
<line number="24" hits="1"/>
<line number="22" hits="1"/>
</lines>
</method>
</methods>
Expand All @@ -68,11 +90,11 @@
<line number="17" hits="2" branch="false"/>
<line number="18" hits="2" branch="false"/>
<line number="19" hits="2" branch="false"/>
<line number="20" hits="2" branch="false"/>
<line number="21" hits="2" branch="false"/>
<line number="22" hits="1" branch="false"/>
<line number="20" hits="1" branch="false"/>
<line number="21" hits="1" branch="false"/>
<line number="22" hits="1" branch="true" condition-coverage="100% (1/1)"/>
<line number="23" hits="1" branch="false"/>
<line number="24" hits="1" branch="true" condition-coverage="100% (1/1)"/>
<line number="24" hits="1" branch="false"/>
<line number="25" hits="1" branch="false"/>
<line number="26" hits="1" branch="false"/>
<line number="27" hits="1" branch="false"/>
Expand All @@ -83,16 +105,13 @@
<line number="32" hits="1" branch="false"/>
<line number="33" hits="1" branch="false"/>
<line number="34" hits="1" branch="false"/>
<line number="35" hits="1" branch="false"/>
<line number="36" hits="1" branch="false"/>
<line number="37" hits="1" branch="false"/>
</lines>
</class>
<class name="routes.js" filename="server/routes/routes.js" line-rate="1" branch-rate="1">
<methods>
<method name="importFilesGenerator" hits="1" signature="()V">
<lines>
<line number="12" hits="1"/>
<line number="10" hits="1"/>
</lines>
</method>
</methods>
Expand All @@ -104,11 +123,11 @@
<line number="5" hits="1" branch="false"/>
<line number="6" hits="1" branch="false"/>
<line number="7" hits="1" branch="false"/>
<line number="8" hits="1" branch="false"/>
<line number="9" hits="1" branch="true" condition-coverage="100% (1/1)"/>
<line number="8" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="9" hits="1" branch="false"/>
<line number="10" hits="1" branch="true" condition-coverage="100% (1/1)"/>
<line number="11" hits="1" branch="false"/>
<line number="12" hits="1" branch="true" condition-coverage="100% (1/1)"/>
<line number="12" hits="1" branch="false"/>
<line number="13" hits="1" branch="false"/>
<line number="14" hits="1" branch="false"/>
<line number="15" hits="1" branch="false"/>
Expand All @@ -118,11 +137,6 @@
<line number="19" hits="1" branch="false"/>
<line number="20" hits="1" branch="false"/>
<line number="21" hits="1" branch="false"/>
<line number="22" hits="1" branch="false"/>
<line number="23" hits="1" branch="false"/>
<line number="24" hits="1" branch="false"/>
<line number="25" hits="1" branch="false"/>
<line number="26" hits="1" branch="false"/>
</lines>
</class>
</classes>
Expand Down
Loading

0 comments on commit 333d100

Please sign in to comment.