Skip to content

Commit

Permalink
Merge pull request #890 from Codeminer42/feat/husky
Browse files Browse the repository at this point in the history
Feat/add husky
  • Loading branch information
GabrielRMuller authored Aug 19, 2024
2 parents 8d3019a + ea9941f commit 757584c
Show file tree
Hide file tree
Showing 9 changed files with 899 additions and 264 deletions.
8 changes: 3 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
],
"env": {
"test": {
"plugins": [
"@babel/plugin-transform-modules-commonjs"
]
"plugins": ["@babel/plugin-transform-modules-commonjs"]
}
},
"plugins": [
Expand All @@ -29,7 +27,7 @@
"spec": true
}
],
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator"
"@babel/plugin-transform-optional-chaining",
"@babel/plugin-transform-nullish-coalescing-operator"
]
}
18 changes: 9 additions & 9 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ engines:
enabled: true
eslint:
enabled: true
channel: "eslint-6"
channel: 'eslint-8'
config:
config: .eslintrc
duplication:
Expand All @@ -30,11 +30,11 @@ engines:
- 'app/operations/story_operations/state_change_notification.rb'
- 'app/admin/*.rb'
exclude_paths:
- "Gemfile.lock"
- "db/schema.rb"
- "db/migrate/*.rb"
- "spec/"
- "fixtures/"
- "doc/"
- "vendor/"
- "public/javascripts"
- 'Gemfile.lock'
- 'db/schema.rb'
- 'db/migrate/*.rb'
- 'spec/'
- 'fixtures/'
- 'doc/'
- 'vendor/'
- 'public/javascripts'
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"env": { "jquery": true },
"extends": ["plugin:backbone/recommended", "prettier"],
"plugins": ["react", "backbone", "prettier"],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"rules": {
"eqeqeq": 1,
"backbone/initialize-on-top": 0,
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/cm42-central.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "CM42 Central CI"
name: 'CM42 Central CI'
on:
push:
branches: [master]
Expand All @@ -14,7 +14,7 @@ jobs:
postgres:
image: postgres:11-alpine
ports:
- "5432:5432"
- '5432:5432'
env:
POSTGRES_DB: rails_test
POSTGRES_USER: rails
Expand All @@ -29,12 +29,12 @@ jobs:
--health-timeout 5s
--health-retries 5
ports:
- "6379:6379"
- '6379:6379'

env:
CI: true
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
DATABASE_URL: 'postgres://rails:password@localhost:5432/rails_test'
MAILER_SENDER: [email protected]
CLOUDINARY_URL: cloudinary://username:password@localhost

Expand Down Expand Up @@ -68,8 +68,8 @@ jobs:
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 16.20.0
cache: "yarn"
node-version: 18.12.0
cache: 'yarn'
- name: Install JS dependencies
run: yarn install
# Add or replace test runners here
Expand All @@ -83,7 +83,7 @@ jobs:
postgres:
image: postgres:11-alpine
ports:
- "5432:5432"
- '5432:5432'
env:
POSTGRES_DB: rails_test
POSTGRES_USER: rails
Expand All @@ -98,12 +98,12 @@ jobs:
--health-timeout 5s
--health-retries 5
ports:
- "6379:6379"
- '6379:6379'

env:
CI: true
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
DATABASE_URL: 'postgres://rails:password@localhost:5432/rails_test'
MAILER_SENDER: [email protected]
CLOUDINARY_URL: cloudinary://username:password@localhost

Expand All @@ -121,8 +121,8 @@ jobs:
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 16.20.0
cache: "yarn"
node-version: 18.12.0
cache: 'yarn'
- name: Install JS dependencies
run: yarn install

Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ruby:2.7.8

ENV DEBIAN_FRONTEND noninteractive
ENV NODE_VERSION=16.20.0
ENV NODE_VERSION=18.12.0

RUN sed -i '/deb-src/d' /etc/apt/sources.list && \
apt-get update
Expand Down
77 changes: 38 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CM42 Central
============
# CM42 Central

[CM42 Central](http://www.centralcm42.com/) is an application to provide a user story based backlog management
system for agile development teams.
Expand All @@ -11,8 +10,7 @@ system for agile development teams.
![Project Screenshot](https://raw.githubusercontent.com/Codeminer42/cm42-central/master/doc/cm42-central-screenshot.png)
![Reports Screenshot](https://raw.githubusercontent.com/Codeminer42/cm42-central/master/doc/cm42-central-reports.png)

The Codeminer 42 Feature Set
----------------------------
## The Codeminer 42 Feature Set

CM42-Central is a fork of the discontinued Fulcrum project.
The old project has not received anything new in the last couple of years, but our fork has evolved considerably
Expand Down Expand Up @@ -68,8 +66,7 @@ Some of the improvements we added since the end of 2015:

We already have more features in development and you can follow what needs to be built or fixed in the [Issues](http://github.com/codeminer42/cm42-central/issues) page.

Goals
-----
## Goals

CM42-Central starts as a clone of [Pivotal Tracker](http://pivotaltracker.com/).

Expand All @@ -84,8 +81,7 @@ The principles that we believe in are:
- Velocity is the the key managerial element.
- Stakeholders must test and accept/reject stories within the same Iteration.

Installation
------------
## Installation

**WARNING**: It is **NOT** recommended to create the database using the db:migrate command during the installation process. Some migrations in the project have become outdated due to Rails updates during the application's development. Therefore, if you create the database from scratch using these outdated migrations instead of loading the current schema, the application will not function as intended, and some tests will fail. Be aware!

Expand All @@ -104,7 +100,7 @@ Once you have these:
# Install the project dependencies
$ gem install bundler
$ bundle install
$ yarn install
$ npm install (or yarn install)

# If you want working with import option, have to activated the option memcached
$ CentOS 6.4
Expand All @@ -113,11 +109,14 @@ Once you have these:
- sudo apt-get install memcached
$ MacOS
- brew install memcached
$ Option memcached
$ Option memcached
- sudo /etc/init.d/memcached start
- sudo /etc/init.d/memcached stop
- sudo /etc/init.d/memcached restart


# Prepare husky
$ npm run prepare (or yarn prepare)

# Set up the development database
$ bundle exec rake fulcrum:setup db:setup

Expand All @@ -139,6 +138,10 @@ Or using docker:
$ docker compose run --rm web yarn install
$ docker compose run --rm web bundle exec rake db:setup

# Prepare husky
$ npm install (to install husky locally)
$ npm run prepare (or yarn prepare)

# Up container
$ docker compose up

Expand All @@ -155,8 +158,7 @@ If you need to cleanup your docker install, run:

$ docker compose down -v

Heroku setup
------------
## Heroku setup

You can use the Deploy button above or manually install like this:

Expand Down Expand Up @@ -235,65 +237,62 @@ Once that's done, you will be able to view your site at

The recommendation is to create a proper domain and add the herokuapp URL as the CNAME.

Translating
-----------
## Translating

Below is an example of how you might go about translating to German.

* Find the name of your locale, in this case we are using `de`
* Copy the `config/locales/en.yml` file to `config/locales/de.yml`
* Edit the file and update all the translated strings in quotes on the right
- Find the name of your locale, in this case we are using `de`
- Copy the `config/locales/en.yml` file to `config/locales/de.yml`
- Edit the file and update all the translated strings in quotes on the right
hand side.
* Add your new locale to `config.i18n.available_locales` in
- Add your new locale to `config.i18n.available_locales` in
`config/application.rb`

Thats it! Ideally you should send your translation as a pull request so you
Thats it! Ideally you should send your translation as a pull request so you
get credit for it, but if you do not wish to do this please send the file to
one of the mailing lists.

If we have already translated for your language, please take the time
to check the translation database is complete for your language. You can do
this by running the `rake i18n:missing_keys` task. If you find any missing
to check the translation database is complete for your language. You can do
this by running the `rake i18n:missing_keys` task. If you find any missing
keys for your language please add them.

Disabling registration
-----------
## Disabling registration

To disable public registration you can set the enviroment variable `DISABLE_REGISTRATION`
to true. If set to true, users will need to be invited to a project rather than being
able to self sign-up.

Development
-----------
## Development

If you'd like to help:

* Check the [issue queue](http://github.com/codeminer42/cm42-central/issues) for a
list of the major features which are yet to be implemented. These have the
`feature` and `unstarted` labels. If a feature you'd like to work on isn't
- Check the [issue queue](http://github.com/codeminer42/cm42-central/issues) for a
list of the major features which are yet to be implemented. These have the
`feature` and `unstarted` labels. If a feature you'd like to work on isn't
there, add an issue.
* Leave a description of how you are going to implement the feature. Failure
- Leave a description of how you are going to implement the feature. Failure
to do this may lead to you implementing the feature in a way that might
conflict with future plans, and so increase the chances of your
work being rejected or needing a rework.

Here are some general guidelines for contributing:

* Make your changes on a branch, and use that branch as the base for pull
- Make your changes on a branch, and use that branch as the base for pull
requests.
* Try to break changes up into the smallest logical blocks possible. We'd
- Try to break changes up into the smallest logical blocks possible. We'd
prefer to receive many small commits to one large one in a pull request.
* Feel free to open unfinished pull requests if you'd like to discuss work
- Feel free to open unfinished pull requests if you'd like to discuss work
in progress, or would like other developers to test it.
* All patches changes be covered by tests, and should not break the existing
tests, unless a current test is invalidated by a code change. This includes
- All patches changes be covered by tests, and should not break the existing
tests, unless a current test is invalidated by a code change. This includes
Javascript, which is covered with a Jasmine test suite in `spec/javascripts/`.
* Run `bundle exec rspec spec/` to check the Rails test suite is green. You will need
- Run `bundle exec rspec spec/` to check the Rails test suite is green. You will need
Chrome installed to run the integration tests.
* To run the Javascript test suite, run `npm test`.
- To run the Javascript test suite, run `npm test`.

## License

License
-------
Copyright 2011-2015, Malcolm Locke.
Copyright 2015-2022, [Codeminer42](https://www.codeminer42.com).

Expand Down
24 changes: 17 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"lint": "eslint app/assets/javascripts",
"start:test": "rails s -e test -p 5000 & wait-on http://localhost:5000",
"cy:run": "cypress run -P spec/",
"format": "prettier --write 'app/assets/javascripts/**/*.{js,jsx}'"
"format": "prettier --write 'app/assets/javascripts/**/*.{js,jsx}'",
"prepare": "husky install"
},
"jest": {
"setupFilesAfterEnv": [
Expand Down Expand Up @@ -41,7 +42,6 @@
}
},
"dependencies": {
"@babel/core": "^7.7.4",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.4",
"@babel/polyfill": "^7.7.0",
Expand Down Expand Up @@ -108,31 +108,35 @@
"wait-on": "^3.3.0"
},
"devDependencies": {
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
"@babel/core": "^7.23.2",
"@babel/eslint-parser": "^7.22.15",
"@babel/plugin-transform-modules-commonjs": "^7.7.4",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.22.11",
"@babel/plugin-transform-optional-chaining": "^7.23.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "12",
"@testing-library/user-event": "^14.4.3",
"babel-eslint": "^10.1.0",
"babel-jest": "^24.9.0",
"core-js": "^2.6.3",
"coveralls": "^3.0.9",
"cypress": "^10.1.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.1",
"es6-promise": "^4.2.8",
"eslint": "^7.32.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-react-app": "^5.0.2",
"eslint-plugin-backbone": "^2.1.1",
"eslint-plugin-flowtype": "^4.5.2",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.16.0",
"husky": "^8.0.0",
"jest": "^26.6.3",
"jest-enzyme": "^7.1.2",
"jest-sinon": "^1.0.1",
"lint-staged": "^15.0.2",
"mini-css-extract-plugin": "^0.8.0",
"prettier": "^3.0.3",
"react-addons-test-utils": "^15.6.2",
Expand All @@ -142,6 +146,12 @@
"vite-plugin-ruby": "^3.2.0"
},
"engines": {
"node": "16.20.0"
"node": "18.12.0"
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix",
"prettier --write"
]
}
}
Loading

0 comments on commit 757584c

Please sign in to comment.