Skip to content

Commit 00d2353

Browse files
author
Nathanael CHERRIER
authored
Merge pull request #40 from Mindsers/develop
Version 0.3.0
2 parents 7592061 + ba9e53c commit 00d2353

43 files changed

Lines changed: 4528 additions & 306 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1+
root = true
2+
13
[*]
4+
charset = utf-8
5+
indent_style = space
26
indent_size = 2
37
insert_final_newline = true
48
end_of_line = lf
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
max_line_length = 0
13+
trim_trailing_whitespace = false
14+
indent_size = 4
15+
16+
[Dockerfile]
17+
indent_size = 4

.eslintrc.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"extends": "standard",
3+
"env": {
4+
"es6": true,
5+
"node": true
6+
},
7+
"rules": {
8+
"arrow-body-style": ["error", "as-needed"],
9+
"arrow-parens": ["error", "as-needed"],
10+
"arrow-spacing": "error",
11+
"default-case": "error",
12+
"guard-for-in": "error",
13+
"generator-star-spacing": ["error", { "before": true, "after": false }],
14+
"getter-return": ["error", { "allowImplicit": true }],
15+
"no-compare-neg-zero": "error",
16+
"no-confusing-arrow": "error",
17+
"no-else-return": "error",
18+
"no-empty": "error",
19+
"no-implicit-coercion": "error",
20+
"no-useless-return": "error",
21+
"no-redeclare": "error",
22+
"no-var": "error",
23+
"prefer-arrow-callback": "error",
24+
"prefer-const": "error",
25+
"prefer-rest-params": "error",
26+
"prefer-spread": "error",
27+
"prefer-template": "error",
28+
"space-before-function-paren": ["error", {
29+
"anonymous": "always",
30+
"named": "never",
31+
"asyncArrow": "always"
32+
}]
33+
}
34+
}

.github/issue_template.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[...description...]
2+
3+
### Steps to reproduce
4+
5+
* ...
6+
7+
### Expected behavior
8+
Tell us what should happen
9+
10+
### Actual behavior
11+
Tell us what happens instead
12+
13+
### System configuration
14+
**OS and version**:
15+
16+
**NodeJS version**:
17+
18+
**Yarn version**:

.github/pull_request_template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Summary
2+
3+
Provide a general description of the code changes in your pull
4+
request... were there any bugs you had fixed? If so, mention them. If
5+
these bugs have open GitHub issues, be sure to tag them here as well,
6+
to keep the conversation linked together.
7+
8+
### Other Informations
9+
10+
If there's anything else that's important and relevant to your pull
11+
request, mention that information here. This could include
12+
benchmarks, or other information.
13+
14+
If you are updating any of the CHANGELOG files or are asked to update the
15+
CHANGELOG files by reviewers, please add the CHANGELOG entry at the top of the file.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
## [0.3.0] - 2017-11-15
10+
### Added
11+
- A contribution guide (CONTRIBUTING.md) to help new contributors.
12+
- The local deployment of configuration file. (`-l` on `modules deploy`)
13+
14+
### Changed
15+
- Adopte a git like command style: `configfile run` => `configfile scritps run`.
16+
- Create a "saved version" if preexisting file exist when user deploy a module.
17+
- Do not indentify the modules to deploy cause the deployment of all available modules. User authorization is required.
18+
919
## [0.2.1] - 2017-10-13
1020
### Fixed
1121
- Replace the JS error message (non-handled error) on `scripts` and `modules` commands
@@ -36,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3646
- The README file to give first information on the project (installation, usage, etc.).
3747

3848
[Unreleased]: https://github.com/Mindsers/configfile/tree/develop
49+
[0.3.0]: https://github.com/Mindsers/configfile/tree/0.3.0
3950
[0.2.1]: https://github.com/Mindsers/configfile/tree/0.2.1
4051
[0.2.0]: https://github.com/Mindsers/configfile/tree/0.2.0
4152
[0.1.1]: https://github.com/Mindsers/configfile/tree/0.1.1

CONTRIBUTING.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# How to contribute to Configfile
2+
3+
*First off, thanks for taking the time to contribute!*
4+
5+
This file is a set of guilines for contributing to *Configfile* project. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
6+
7+
#### Table of contents
8+
9+
[How can I contribute?](#how-can-i-contribute)
10+
11+
* [Did you find a bug?](#did-you-find-a-bug)
12+
* [Did you write a patch that fixes a bug?](#did-you-write-a-patch-that-fixes-a-bug)
13+
* [Did you fix whitespace, format code, or make a purely cosmetic patch?](#did-you-fix-whitespace-format-code-or-make-a-purely-cosmetic-patch)
14+
* [Do you intend to add a new feature or change an existing one?](#do-you-intend-to-add-a-new-feature-or-change-an-existing-one)
15+
* [Do you have questions about the source code?](#do-you-have-questions-about-the-source-code)
16+
* [Do you want to contribute to the Configfile documentation?](#do-you-want-to-contribute-to-the-Configfile-documentation)
17+
18+
[Styleguides](#styleguides)
19+
20+
* [JavaScript styleguide](#javaScript-styleguide)
21+
* [Git commit messages](#git-commit-messages)
22+
23+
## How can I contribute?
24+
25+
### Did you find a bug?
26+
27+
* **Ensure the bug was not already reported** by searching on GitHub under [Issues][Issues].
28+
29+
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/Mindsers/configfile/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
30+
31+
* If possible, use the relevant bug report templates to create the issue.
32+
33+
### Did you write a patch that fixes a bug?
34+
35+
* Write new unit test(s) that match the bug case to limit future regression.
36+
37+
* Open a new GitHub pull request with the patch.
38+
39+
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
40+
41+
* Before submitting, please ensure your code follow the code convention.
42+
43+
### Did you fix whitespace, format code, or make a purely cosmetic patch?
44+
45+
* Your changes must follow the coding convention.
46+
47+
* Please ensure that your changes does not include regression.
48+
49+
### Do you intend to add a new feature or change an existing one?
50+
51+
* Please ask first ([open an issue][Issues] or [talk about it on gitter][gitter]) before embarking on any significant pull request (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
52+
53+
* Please adhere to the coding conventions used in this project (indentation, accurate comments, etc.) and any other requirements (such as test coverage, documentation).
54+
55+
### Do you have questions about the source code?
56+
57+
* Ask any question about how to use Configfile in the [gitter channel][gitter] or on [Stack Overflow](https://stackoverflow.com).
58+
59+
### Do you want to contribute to the Configfile documentation?
60+
61+
Documentation file are stored in the project source code.
62+
63+
* Please refer to "Do you intend to add a new feature or change an existing one?" section.
64+
65+
## Styleguides
66+
67+
### JavaScript styleguide
68+
69+
All JavaScript must adhere to [JavaScript Standard Style](https://standardjs.com).
70+
71+
Exepctions to Standard style:
72+
73+
* We do not want space after function name `function name(arg) { ... }`
74+
75+
Additional rules:
76+
77+
* Prefer spread operator (`prefer-spread`)
78+
* No useless brackets for arrow functions (`arrow-body-style`)
79+
* No useless parens for arrow functions (`arrow-parens`)
80+
* Require space before/after arrow function’s arrow (`arrow-spacing`)
81+
* `switch` must have a default case (`default-case`)
82+
* `for...in` loop must be guard by an `if` (`guard-for-in`)
83+
* Require space before the star of generator function (`generator-star-spacing`)
84+
* Getter properties must return a value (`getter-return`)
85+
* Compare to `-0` is an error (`no-compare-neg-zero`)
86+
* Use brackets if arrow function body could be confused with comparisons (`no-confusing-arrow`)
87+
* No `else` when return is used (`no-else-return`)
88+
* No empty block statements (`no-empty`)
89+
* No type conversion with shorter notations (`no-implicit-coercion`)
90+
* No useless `return` statement (`no-useless-return`)
91+
* No redeclare variables (`no-redeclare`)
92+
* Using `var` statement is an error (`no-var`)
93+
* Prefer arrow function for callback (`prefer-arrow-callback`)
94+
* Prefer using constant (`prefer-const`)
95+
* Prefer rest parameter (`prefer-rest-params`)
96+
* Prefer using template literals (`prefer-template`)
97+
98+
All the rules are listed in `.eslinrc.json` on the root directory.
99+
100+
### Git commit messages
101+
102+
* Use the present tense ("Add feature" not "Added feature").
103+
104+
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...").
105+
106+
* Limit the first line to 72 characters or less.
107+
108+
* Reference issues and pull requests liberally after the first line.
109+
110+
111+
[Issues]: https://github.com/Mindsers/configfile/issues
112+
[gitter]: https://gitter.im/mindsers/configfile

README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## Data storage
1212

13-
This tool **does not store** configuration files for you. A git repo is needed to store your configuration files.
13+
This tool **does not store** configuration files for you. A git repo ([dotfiles](https://github.com/topics/dotfiles)) is needed to store your configuration files.
1414

1515
Please follow this structure:
1616

@@ -25,27 +25,26 @@ Please follow this structure:
2525
/scriptfile.sh
2626
```
2727

28-
## Usage
29-
30-
### Initialization / configuration
31-
32-
`configfile init` Initialize *configfile* on the current user session.
33-
34-
### List of modules
28+
## Installation
3529

36-
`configfile modules` Display a list of all modules available via *Configfile*.
30+
To install *Configfile*, you need to use NPM or Yarn.
3731

38-
### Deploy configuration files (module)
39-
40-
`configfile deploy [moduleName...]` Deploy the configuration files for the given module name.
32+
```bash
33+
yarn global add configfile@latest
34+
```
4135

42-
### List of scripts
36+
## Usage
4337

44-
`configfile scripts` Display a list of all scripts available via *Configfile*.
38+
- `configfile init` or `configfile i`: Initialize *configfile* on the current user session.
39+
- `configfile modules list` or `configfile m l`: Display a list of all modules available via *Configfile*.
40+
- `configfile modules deploy [moduleName...]` or `configfile m d [moduleName...]`: Deploy the configuration files for the given module name.
41+
- `-l, --local` deploy authorized file to the current directory.
42+
- `configfile scripts` or `configfile s`: Display a list of all scripts available via *Configfile*.
43+
- `configfile scripts run <scriptName>` or `configfile s r <scriptName>`: Execute the script identifying by the given script name.
4544

46-
### Run script
45+
## Contribution
4746

48-
`configfile run <scriptName>` Execute the script identifying by the given script name.
47+
Contributions to the source code of *Configfile* are welcomed and greatly appreciated. For help on how to contribute in this project, please refer to [How to contribute to Configfile](https://github.com/Mindsers/configfile/blob/develop/CONTRIBUTING.md).
4948

5049
## Support
5150

bin/configfile-modules.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env node
2+
3+
const program = require('commander')
4+
const fs = require('fs')
5+
const path = require('path')
6+
7+
const { deployCommand, modulesCommand } = require('../src/commands')
8+
9+
const { ConfigService } = require('../src/services/config')
10+
const { FileService } = require('../src/services/file')
11+
12+
const packageData = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')))
13+
const optionsFilePath = packageData.config.optionsFilePath.replace('~', process.env.HOME)
14+
15+
const configService = new ConfigService(optionsFilePath)
16+
const fileService = new FileService(configService)
17+
18+
program
19+
.version(packageData.version)
20+
.description('Configuration modules manager.')
21+
22+
program
23+
.command('list')
24+
.alias('l')
25+
.description('list all modules available.')
26+
.action(modulesCommand(fileService))
27+
28+
program
29+
.command('deploy [modules...]')
30+
.alias('d')
31+
.description('deploy configuration files.')
32+
.option('-l, --local', 'deploy only local files of the module(s) in the current folder')
33+
.action(deployCommand(fileService))
34+
35+
program.parse(process.argv)

bin/configfile-scripts.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
3+
const program = require('commander')
4+
const fs = require('fs')
5+
const path = require('path')
6+
7+
const { runCommand, scriptsCommand } = require('../src/commands')
8+
9+
const { ConfigService } = require('../src/services/config')
10+
const { FileService } = require('../src/services/file')
11+
12+
const packageData = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')))
13+
const optionsFilePath = packageData.config.optionsFilePath.replace('~', process.env.HOME)
14+
15+
const configService = new ConfigService(optionsFilePath)
16+
const fileService = new FileService(configService)
17+
18+
program
19+
.version(packageData.version)
20+
.description('Custom scripts manager.')
21+
22+
program
23+
.command('list')
24+
.alias('l')
25+
.description('list all custom configuration scripts available.')
26+
.action(scriptsCommand(fileService))
27+
28+
program
29+
.command('run <name>')
30+
.alias('r')
31+
.description('run custom configuration scripts.')
32+
.action(runCommand(configService, fileService))
33+
34+
program.parse(process.argv)

bin/configfile.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env node
2+
3+
const program = require('commander')
4+
const fs = require('fs')
5+
const path = require('path')
6+
7+
const { ConfigService } = require('../src/services/config')
8+
9+
const { initCommand } = require('../src/commands')
10+
11+
const packageData = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')))
12+
const optionsFilePath = packageData.config.optionsFilePath.replace('~', process.env.HOME)
13+
14+
const configService = new ConfigService(optionsFilePath)
15+
16+
program
17+
.version(packageData.version)
18+
.description('Configuration files manager.')
19+
20+
program
21+
.command('init')
22+
.alias('i')
23+
.description('activate configfiles on user session.')
24+
.option('-f, --force', 'force parameters file overwrite.')
25+
.action(initCommand(configService))
26+
27+
program
28+
.command('scripts', 'work with custom scripts available.')
29+
.alias('s')
30+
31+
program
32+
.command('modules', 'work with modules available.')
33+
.alias('m')
34+
35+
program.parse(process.argv)

0 commit comments

Comments
 (0)