@igea/oac_backend 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +90 -0
- package/README.md +2 -0
- package/package.json +28 -0
- package/src/config/development.json +4 -0
- package/src/config/production.json +4 -0
- package/src/config.js +13 -0
- package/src/index.js +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
checker:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Check if NPM_TOKEN is available
|
|
17
|
+
run: |
|
|
18
|
+
if [ -z "${{secrets.NPM_TOKEN}}" ]; then
|
|
19
|
+
echo "NPM_TOKEN is NOT set => ${{secrets.NPM_TOKEN}}"
|
|
20
|
+
exit 1
|
|
21
|
+
else
|
|
22
|
+
echo "NPM_TOKEN is set => ${{secrets.NPM_TOKEN}}"
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
build:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
|
|
28
|
+
strategy:
|
|
29
|
+
matrix:
|
|
30
|
+
node-version: [23.x]
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v3
|
|
34
|
+
|
|
35
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
36
|
+
uses: actions/setup-node@v3
|
|
37
|
+
with:
|
|
38
|
+
node-version: ${{ matrix.node-version }}
|
|
39
|
+
cache: 'npm'
|
|
40
|
+
|
|
41
|
+
- name: Install dependencies
|
|
42
|
+
run: npm ci
|
|
43
|
+
|
|
44
|
+
#- name: Run tests
|
|
45
|
+
# run: npm test
|
|
46
|
+
|
|
47
|
+
publish-npm:
|
|
48
|
+
needs: build
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
if: github.ref == 'refs/heads/main'
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@v3
|
|
53
|
+
|
|
54
|
+
- name: Use Node.js
|
|
55
|
+
uses: actions/setup-node@v3
|
|
56
|
+
with:
|
|
57
|
+
node-version: 23.x
|
|
58
|
+
cache: 'npm'
|
|
59
|
+
|
|
60
|
+
- name: Install dependencies
|
|
61
|
+
run: npm ci
|
|
62
|
+
|
|
63
|
+
- name: Configure Git identity
|
|
64
|
+
run: |
|
|
65
|
+
git config user.name "github-actions[bot]"
|
|
66
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
67
|
+
|
|
68
|
+
- name: Bump version
|
|
69
|
+
run: npm version patch -m "ci:bump version to %s [skip ci]"
|
|
70
|
+
|
|
71
|
+
- name: Use NPM Token
|
|
72
|
+
uses: dkershner6/use-npm-token-action@v2
|
|
73
|
+
with:
|
|
74
|
+
token: ${{ secrets.NPM_TOKEN }}
|
|
75
|
+
|
|
76
|
+
- name: Show whoami to confirm auth
|
|
77
|
+
run: npm whoami
|
|
78
|
+
|
|
79
|
+
- name: Publish to npm
|
|
80
|
+
run: npm publish --access public
|
|
81
|
+
env:
|
|
82
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
83
|
+
|
|
84
|
+
- name: Push changes
|
|
85
|
+
uses: ad-m/github-push-action@v0.6.0
|
|
86
|
+
with:
|
|
87
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
88
|
+
branch: main
|
|
89
|
+
tags: true
|
|
90
|
+
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@igea/oac_backend",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Backend service for the OAC project",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "cross-env NODE_ENV=production node src/index.js",
|
|
8
|
+
"dev": "cross-env NODE_ENV=development nodemon src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/chpigea/oac_backend.git"
|
|
13
|
+
},
|
|
14
|
+
"author": "Christian R. Picone",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/chpigea/oac_backend/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/chpigea/oac_backend#readme",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"axios": "1.10.0",
|
|
22
|
+
"express": "5.1.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"cross-env": "^7.0.3",
|
|
26
|
+
"nodemon": "^3.1.10"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// config.js
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
function loadConfig() {
|
|
6
|
+
const env = process.env.NODE_ENV || 'development';
|
|
7
|
+
const configFolder = process.env.OAC_CONFIG_FOLDER || __dirname;
|
|
8
|
+
const configPath = path.join(configFolder, 'config', `${env}.json`);
|
|
9
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
10
|
+
return config;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = loadConfig();
|
package/src/index.js
ADDED
|
File without changes
|