Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package cleaning and update #1221

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .dockerignore

This file was deleted.

22 changes: 6 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
node: true,
mocha: true,
},
extends: ['airbnb-base', 'prettier'],
extends: ['eslint:recommended', 'airbnb-base', 'prettier'],
parserOptions: {
ecmaVersion: 'latest',
},
Expand Down Expand Up @@ -54,22 +54,12 @@ module.exports = {
rules: {
'no-restricted-syntax': [
'error',
{
selector: 'ForInStatement',
message:
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'LabeledStatement',
message:
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message:
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
'ForInStatement',
'LabeledStatement',
'WithStatement',
],
'prefer-destructuring': ['error', { object: true, array: false }],
'prettier/prettier': 'error',
},
plugins: ['prettier'],
};
4 changes: 1 addition & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'
- name: Cache node modules
uses: actions/cache@v2
env:
Expand All @@ -39,8 +39,6 @@ jobs:
${{ runner.os }}-

- run: npm ci
- name: Prettier
run: npm run prettier
- name: Lint
run: npm run lint

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master_grottocenter-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Node.js version
uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'

- name: Cache node modules
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"trailingComma": "es5",
"singleQuote": true
}
1 change: 1 addition & 0 deletions .sailsrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"modules": {}
},
"hooks": {
"grunt": false,
"session": false
}
}
112 changes: 0 additions & 112 deletions .snyk

This file was deleted.

21 changes: 0 additions & 21 deletions Gruntfile.js

This file was deleted.

121 changes: 54 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,63 +50,59 @@ Decharte, Dominique Lagrenee.

Software requirement:

- NodeJS (v18.x.x recommended, you can also use the .nvmrc file with nvm)
- NPM (v8.x.x recommended)
- NodeJS + NPM (v20 minimum)
- Git client (see [Git usage](#git) for configuration)
- Docker
- [docker-compose](https://docs.docker.com/compose/install/)

Clone the project on your computer:
Clone the project on your computer and install dependencies:

```
> git clone https://github.com/GrottoCenter/Grottocenter-api.git
```shell
$ git clone git@github.com:GrottoCenter/grottocenter-api.git
$ cd grottocenter-api
$ npm install
```

## Usage

### Development deployment

The development deployment aims to launch locally all the tools needed for the GrottoCenter development:

First copy `/docker/sample.env` to `/docker/.env`.
### Development setup

Make sure the sql files in `/sql/` have reading and execution access rights (a+rx), including the sql directory itself.
Same goes with `/postgresql-connector.jar`. `/docker/esdata` folder needs writing, reading and execution rights (
a+wrx).
The development setup aims to launch locally all tools needed for the GrottoCenter API development:
- Postgresql database containers (main + test)
- A Elasticsearch container
- A Logstash container

Then launch the orchestrated containers:
> All the definition for containers is located in the `docker/` folder

To launch the development setup run:
```shell
$ cd docker
$ docker-compose up --remove-orphans
$ npm run dev:up
```

Wait until you see the following lines in the logs:

```
: Grunt :: Running "watch" task
: Grunt :: Waiting...
Then the Grottocenter API app can be launched using:
```shell
$ npm run dev
```

At this point you are good to go. The API is available at http://localhost:1337/, and you can monitor the evolution of ES
indices at http://localhost:9200/\_cat/indices?v
The API should now be available at http://localhost:1337/

Each time you change a file in the source code, the code is recompiled automatically, you just need to refresh the page
in your browser.
Each time you change a file in the source code, the server is restarted automatically.

To stop and clear your docker compose you should run :
To stop the development setup you can run :

```shell
$ docker-compose down -v
$ npm run dev:stop # Stop all containers
$ npm run dev:down # Stop and destroy all containers
```
## Development

### Tests
Caver's community needs YOU!

Log in the node container:
Yon can also join us on Slack! (using the QR-code above)

```shell
$ docker exec -it nodegrotto sh -l
```
> For more details, read [the development guide](https://github.com/GrottoCenter/Grottocenter3/wiki/Development-guide)

### Tests

Run all tests:

Expand All @@ -127,18 +123,38 @@ Check code coverage:
```shell
$ npm run coverage
```
### I18n / Translation

For more details, read [the installation guide](https://github.com/GrottoCenter/Grottocenter3/wiki/Installation-guide)
See the wiki article [translation workflow](https://github.com/GrottoCenter/Grottocenter3/wiki/Translation-workflow)

## Development
### Data versioning

Caver's community needs YOU!
See the wiki article [Automated data versioning](https://github.com/GrottoCenter/Grottocenter3/wiki/Automated-data-versioning)

Yon can also join us on Slack! (using the QR-code above)
### Build

Build is run by GitHub Actions on every push. See `build.yaml` to see what is run during the build workflow.

If the build is triggered from a push on `master` then a deployment of the API to Azure App Service is automatically triggered.

### Deployment in production

Deployment done with GitHub Actions and Azure App Service.

You first need to merge your changes to `master` using if possible the `git flow release start vXX.X.X` command.

Don't forget to update the version number on the `swagger` file and on the `package.json` file.

~~For more details, read [the development guide](https://github.com/GrottoCenter/Grottocenter3/wiki/Development-guide)
when the merge on master is completed, you should create a release for the newly pushed tag.

For more information see the wiki page [Production deployment](https://github.com/GrottoCenter/Grottocenter3/wiki/Production-deployment)

### ElasticSearch

See [ElasticSearch Wiki page](<https://github.com/GrottoCenter/Grottocenter3/wiki/Elasticsearch-(quick-&-advanced-search)>)

## Git

### Git

#### Workflow

Expand Down Expand Up @@ -185,35 +201,6 @@ The commit linter accepts the following types:
- **test**: Adding missing or correcting existing tests
- **revert**: Reverts a previous work

## I18n / Translation

See the wiki article [translation workflow](https://github.com/GrottoCenter/Grottocenter3/wiki/Translation-workflow)

## Data versioning

See the wiki article [Automated data versioning](https://github.com/GrottoCenter/Grottocenter3/wiki/Automated-data-versioning)

## Build

Build is run by GitHub Actions on every push. See `build.yaml` to see what is run during the build workflow.

If the build is triggered from a push on `master` then a deployment of the API to Azure App Service is automatically triggered.

## Deployment in production

Deployment done with GitHub Actions and Azure App Service.

You first need to merge your changes to `master` using if possible the `git flow release start vXX.X.X` command.

Don't forget to update the version number on the `swagger` file and on the `package.json` file.

when the merge on master is completed, you should create a release for the newly pushed tag.

For more information see the wiki page [Production deployment](https://github.com/GrottoCenter/Grottocenter3/wiki/Production-deployment)

## ElasticSearch

See [ElasticSearch Wiki page](<https://github.com/GrottoCenter/Grottocenter3/wiki/Elasticsearch-(quick-&-advanced-search)>)

## Licence

Expand Down
Loading
Loading