Parcourir la source

improve packaging with npm

pull/2/head
Guillaume Vincent il y a 9 ans
Parent
révision
1c2e8f6a49
8 fichiers modifiés avec 186 ajouts et 49 suppressions
  1. +34
    -7
      README.md
  2. +2
    -11
      app/app.js
  3. +14
    -0
      app/app.old.js
  4. +3
    -0
      app/styles/styles.scss
  5. +41
    -31
      package.json
  6. +70
    -0
      package.json.old
  7. +12
    -0
      static/index.html
  8. +10
    -0
      static/test/test.html

+ 34
- 7
README.md Voir le fichier

@@ -1,18 +1,45 @@
# lesspass
lesspass is like keepass without the need to persist passwords

## install
## requirements

* node v4.2.x LTS
* npm v2.14

## try lesspass

clone application:

git clone https://github.com/guillaumevincent/lesspass.git

move inside lesspass folder

cd lesspass

install dependencies

npm install

## run tests
start application

npm start

open the application in a browser: [http://localhost:5000](http://localhost:5000)

## contribute

### run tests

npm run test

### run tests in watch mode

npm tests
npm run test:watch

## build app
### start lesspass in watch mode

npm build
npm run start:watch

## run application
### build for production

npm start
npm run build:production

+ 2
- 11
app/app.js Voir le fichier

@@ -1,14 +1,5 @@
import PasswordGenerator from './password-generator';

document.getElementById("help-btn").onclick = function () {
$('body').chardinJs('start');
};
console.log(PasswordGenerator.make_password('t','t'));

document.getElementById('foo').focus();
var clipboard = new Clipboard('#copy-btn',{
text: function(trigger) {
$('body').chardinJs('stop');
var elements = document.getElementById('foo').value.split(':');
return PasswordGenerator.make_password(elements[0], elements[1]);
}
});
import * as stylesheet from './styles/styles.scss';

+ 14
- 0
app/app.old.js Voir le fichier

@@ -0,0 +1,14 @@
import PasswordGenerator from './password-generator';

document.getElementById("help-btn").onclick = function () {
$('body').chardinJs('start');
};

document.getElementById('foo').focus();
var clipboard = new Clipboard('#copy-btn',{
text: function(trigger) {
$('body').chardinJs('stop');
var elements = document.getElementById('foo').value.split(':');
return PasswordGenerator.make_password(elements[0], elements[1]);
}
});

+ 3
- 0
app/styles/styles.scss Voir le fichier

@@ -0,0 +1,3 @@
body{
background-color: red;
}

+ 41
- 31
package.json Voir le fichier

@@ -1,19 +1,25 @@
{
"name": "lesspass",
"version": "1.0.0",
"description": "lesspass is like keepass without the need to persist password",
"main": "lesspass.js",
"description": "lesspass is like keepass without the need to persist passwords",
"main": "app/app.js",
"scripts": {
"test": "mocha --compilers js:babel-core/register --ui bdd --reporter min --recursive ./tests",
"build": "npm-run-all clean copy build_app",
"build_app": "browserify -e ./app/app.js -o ./dist/app.js",
"clean": "rimraf ./dist/**/* && rimraf dist",
"copy": "mkdir dist && cp -r public/* dist/",
"serve": "static -p 5000 --gzip --host-address 0.0.0.0 dist/",
"start": "npm run serve",
"pretest": "npm install",
"test": "mocha --compilers js:babel-core/register tests",
"test:watch": "npm test -- -w",
"lint": "jshint app/**",
"build:production": "npm prune && npm install && npm run lint && npm test && npm run build",
"build": "npm-run-all clean build:html build:app",
"clean": "rimraf dist",
"build:html": "cpy '**/*.html' '../dist/' --cwd=static --parents",
"build:app": "browserify -e ./app/app.js -o ./dist/app.js",
"prestart": "npm run build",
"watch": "npm-run-all --parallel serve watch_app",
"watch_app": "watchify -dv -e ./app/app.js -o ./dist/app.js"
"start": "npm run serve",
"serve": "http-server -p 5000 dist/",
"watch": "npm run start:watch",
"start:watch": "npm-run-all --parallel serve watch:html watch:app",
"watch:html": "watch 'npm run build:html' static",
"watch:app": "watchify -dv -e ./app/app.js -o ./dist/app.js"
},
"repository": {
"type": "git",
@@ -21,8 +27,7 @@
},
"keywords": [
"keepass",
"nodejs",
"node"
"lesspass"
],
"author": "Guillaume Vincent",
"license": "MIT",
@@ -30,25 +35,21 @@
"url": "https://github.com/guillaumevincent/lesspass/issues"
},
"homepage": "https://github.com/guillaumevincent/lesspass#readme",
"dependencies": {
"bootstrap": "^4.0.0-alpha.2",
"chardinjs": "git://github.com/heelhook/chardin.js.git",
"clipboard": "^1.5.5",
"font-awesome": "^4.5.0",
"jquery": "^2.1.4"
},
"jshintConfig": {
"esnext": true
},
"devDependencies": {
"babel-core": "^6.3.15",
"babel-preset-es2015": "^6.3.13",
"babelify": "^7.2.0",
"browserify": "^12.0.1",
"mocha": "^2.3.4",
"node-static": "^0.7.7",
"npm-run-all": "^1.4.0",
"rimraf": "^2.4.4"
"babel-core": "latest",
"babel-preset-es2015": "latest",
"babelify": "latest",
"browserify": "latest",
"cpy": "latest",
"http-server": "latest",
"jshint": "latest",
"mocha": "latest",
"nodemon": "latest",
"npm-run-all": "latest",
"rimraf": "latest",
"sassify": "latest",
"watch": "latest",
"watchify": "latest"
},
"babel": {
"presets": [
@@ -64,7 +65,16 @@
"es2015"
]
}
],
[
"sassify",
{
"auto-inject": true
}
]
]
},
"jshintConfig": {
"esnext": true
}
}

+ 70
- 0
package.json.old Voir le fichier

@@ -0,0 +1,70 @@
{
"name": "lesspass",
"version": "1.0.0",
"description": "lesspass is like keepass without the need to persist password",
"main": "lesspass.js",
"scripts": {
"test": "mocha --compilers js:babel-core/register --ui bdd --reporter min --recursive ./tests",
"build": "npm-run-all clean copy build_app",
"build_app": "browserify -e ./app/app.js -o ./dist/app.js",
"clean": "rimraf ./dist/**/* && rimraf dist",
"copy": "mkdir dist && cp -r public/* dist/",
"serve": "static -p 5000 --gzip --host-address 0.0.0.0 dist/",
"start": "npm run serve",
"prestart": "npm run build",
"watch": "npm-run-all --parallel serve watch_app",
"watch_app": "watchify -dv -e ./app/app.js -o ./dist/app.js"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/guillaumevincent/lesspass.git"
},
"keywords": [
"keepass",
"nodejs",
"node"
],
"author": "Guillaume Vincent",
"license": "MIT",
"bugs": {
"url": "https://github.com/guillaumevincent/lesspass/issues"
},
"homepage": "https://github.com/guillaumevincent/lesspass#readme",
"dependencies": {
"bootstrap": "^4.0.0-alpha.2",
"chardinjs": "git://github.com/heelhook/chardin.js.git",
"clipboard": "^1.5.5",
"font-awesome": "^4.5.0",
"jquery": "^2.1.4"
},
"jshintConfig": {
"esnext": true
},
"devDependencies": {
"babel-core": "^6.3.15",
"babel-preset-es2015": "^6.3.13",
"babelify": "^7.2.0",
"browserify": "^12.0.1",
"mocha": "^2.3.4",
"node-static": "^0.7.7",
"npm-run-all": "^1.4.0",
"rimraf": "^2.4.4"
},
"babel": {
"presets": [
"es2015"
]
},
"browserify": {
"transform": [
[
"babelify",
{
"presets": [
"es2015"
]
}
]
]
}
}

+ 12
- 0
static/index.html Voir le fichier

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>lesspass</title>
</head>
<body>
hello world 20015
<button class="btn btn-success">test</button>
<script src="app.js"></script>
</body>
</html>

+ 10
- 0
static/test/test.html Voir le fichier

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>lesspass</title>
</head>
<body>
test
</body>
</html>

Chargement…
Annuler
Enregistrer