Skip to content

Commit

Permalink
feat(First working version): This is the first working version, it ge…
Browse files Browse the repository at this point in the history
…nerates the architecture notes
  • Loading branch information
nfroidure committed Mar 7, 2017
1 parent 1320163 commit 51b9b4e
Show file tree
Hide file tree
Showing 17 changed files with 888 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overriden.
engines:
eslint:
enabled: true

ratings:
paths:
- "src/*.js"
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overriden.

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
# 2 space indentation
[*.{js,css}]
charset = utf-8
indent_style = space
trim_trailing_whitespace = true
indent_size = 2
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
extends: 'eslint-config-simplifield/lib/backend',
parserOptions: {
sourceType: 'script',
modules: true,
},
rules: {
'no-magic-numbers': 0,
},
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.js text eol=lf
10 changes: 10 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Code of Conduct

Be kind, except if i behave like an asshole,
if so, tell me by linking to this file.

I try hard to automate things so that you cannot
create noises without really willing to do so.

This is why i'll just delete issues/comments
making be sad.
8 changes: 8 additions & 0 deletions .github/CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Contributing to this project requires you to be
a gentleman.

By contributing you must agree with publishing your
changes int the same license than the actual code.

You will find the license in the LICENSE file at
the root of this repository.
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Issue
<!--

Thanks for reporting an issue.

Before doing so, there are a few checks to do in
order to optimize its resolution. Just fill in the
following template.

Beware that you also can create a pull request
if you know how to solve the issue.

Finally scroll down if you asking for a feature ;)

-->

I'm a gentledev i:
[ ] fully read the README recently
[ ] searched for existing issues
[ ] checked i'm up to date with the latest version of the project

### Expected behavior

### Actual behavior

### Steps to reproduce the behavior

### Debugging informations
- `node -v` result:
```
<paste here>
```

- `npm -v` result:
```
<paste here>
```
If the result is lower than 6.9.5, there is
poor chances i even have a look to it. Please,
use the last [NodeJS LTS version](https://nodejs.org/en/).

## Feature request
<!--

If you think a feature need to be added, your suggestions
are welcome. Beware though that:
- I try to keep my module simple so please ensure the requested
feature is really related to this module. If not, you may
instead create a module that augment/work with this one,
- I am not your employee so keep calm and be aware that your
request may stay incomplete for ever. Nothing impeach you
to implement the feature and get it merged though.
-->

### Feature description

### Use cases

[ ] I will do it
50 changes: 50 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!--

Thanks for improving this project!

Before doing so, there are a few checks to do in
order to get your PR merged asap. Just fill in the
following template.

-->

Fixes #

### Proposed changes
-
-

<!-- Check the boxes with a `x` like so `[x]` -->

### Code quality
[ ] I made some tests for my changes
[ ] I added my name in the
[contributors](https://docs.npmjs.com/files/package.json#people-fields-author-contributors)
field of the package.json file

### License
To get your contribution merged, you must check the following.

[ ] I read the project license in the LICENSE file
[ ] I agree with publishing under this project license

<!--

If you already maintain several NPM modules / NodeJS
project, making significant changes on one of my modules
automatically legitimates you as a core developer.

This is because i could die or even not give a shit to
this project someday and i don't want people to get
stuck.

If you want to help, fill the following with to get
GitHub/NPM r/w access.

-->
### Join
[ ] I wish to join the core team
[ ] I agree that with great powers comes responsibilities
[ ] I'm a nice person

My NPM username:
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overriden.

# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# Coveralls key
.coveralls.yml

# Dist files
dist
14 changes: 14 additions & 0 deletions .readme/contents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Usage

You may want to generate this project's architecture notes:

```
npm i -g jsarch
git clone git@github.com:nfroidure/jsarch.git
cd jsarch
jsarch **/*.js > ARCHITECTURE.md
```
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overriden.

language: node_js
node_js:
- 6
- 6.9.5
- 7
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright © 2017 Nicolas Froidure

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
<!--
# This file is automatically generated by a `metapak`
# module. Do not change it elsewhere, changes would
# be overriden.
-->
# jsarch
> A simple module to extract architecture notes from your code.
[![NPM version](https://badge.fury.io/js/jsarch.svg)](https://npmjs.org/package/jsarch)
[![Build status](https://secure.travis-ci.org/nfroidure/jsarch.svg)](https://travis-ci.org/nfroidure/jsarch)
[![Dependency Status](https://david-dm.org/nfroidure/jsarch.svg)](https://david-dm.org/nfroidure/jsarch)
[![devDependency Status](https://david-dm.org/nfroidure/jsarch/dev-status.svg)](https://david-dm.org/nfroidure/jsarch#info=devDependencies)
[![Coverage Status](https://coveralls.io/repos/nfroidure/jsarch/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/jsarch?branch=master)
[![Code Climate](https://codeclimate.com/github/nfroidure/jsarch.svg)](https://codeclimate.com/github/nfroidure/jsarch)
[![Dependency Status](https://dependencyci.com/github/nfroidure/jsarch/badge)](https://dependencyci.com/github/nfroidure/jsarch)

# Usage

```
npm i -g jsarch
jsarch **/*.js > ARCHITECTURE.md
```

# License
[MIT](https://github.com/nfroidure/jsarch/blob/master/LICENSE)
59 changes: 59 additions & 0 deletions bin/jsarch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#! /usr/bin/env node

/* Architecture Note #2: CLI
The JSArch CLI tool basically wraps the jsArch service
to make it usable from the CLI.
To see its options, run:
```
jsarch -h
```
*/

'use strict';

const Knifecycle = require('knifecycle').default;
const debug = require('debug')('jsarch');
const fs = require('fs');
const os = require('os');
const path = require('path');
const glob = require('glob');
const program = require('commander');
const Promise = require('bluebird');

const initJSArch = require('../src/jsarch');
const packageConf = require(path.join(__dirname, '..', 'package.json'));

const $ = new Knifecycle();

$.constant('fs', Promise.promisifyAll(fs));
$.constant('EOL', os.EOL);
$.constant('glob', Promise.promisify(glob));
$.constant('log', (type, ...args) => {
if('debug' === type || 'stack' === type) {
debug(...args);
return;
}
console[type](...args); // eslint-disable-line
});
initJSArch($);

program
.version(packageConf.version)
.option('-b, --base', 'Base for links')
.parse(process.argv);

$.run([
'log', 'jsArch',
])
.then(({ log, jsArch }) =>
jsArch({ patterns: program.args, cwd: process.cwd(), base: program.base })
.then((content) => {
process.stdout.write(content);
})
)
.catch((err) => {
console.error(err); // eslint-disable-line
process.exit(1);
});
Loading

0 comments on commit 51b9b4e

Please sign in to comment.