Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #35 from blockstack/develop
Browse files Browse the repository at this point in the history
Version 0.5.0
  • Loading branch information
hstove authored Nov 28, 2018
2 parents 5535d45 + 59bbeb3 commit 0eeb149
Show file tree
Hide file tree
Showing 8 changed files with 5,950 additions and 5,346 deletions.
44 changes: 44 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:8.11.3

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

working_directory: ~/repo

steps:
- checkout
- run:
name: "Update npm"
command: |
npm install npm@latest
sudo rm -rf /usr/local/lib/node_modules/npm
sudo mv node_modules/npm /usr/local/lib/node_modules/npm
sudo chown -R 500:500 /usr/local/lib/node_modules/npm
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# run tests!
- run: npm test
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
language: node_js
node_js:
- v7
- v6
- v5
- v4
- '0.12'
- v8
140 changes: 67 additions & 73 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var Generator = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');

module.exports = Generator.extend({
prompting: function () {
class BlockstackGenerator extends Generator {
prompting() {
// Have Yeoman greet the user.
this.log(yosay(
'Welcome to the ' + chalk.red('Blockstack') + ' app generator!'
Expand All @@ -21,80 +21,74 @@ module.exports = Generator.extend({
// To access props later use this.props.someAnswer
this.props = props;
}.bind(this));
},
}

writing: {
configs: function () {
this.fs.copy(
this.templatePath('_package.json'),
this.destinationPath('package.json')
);
this.fs.copy(
this.templatePath('editorconfig'),
this.destinationPath('.editorconfig')
);
this.fs.copy(
this.templatePath('gitignore'),
this.destinationPath('.gitignore')
);
this.fs.copy(
this.templatePath('requires.js'),
this.destinationPath('requires.js')
);
this.fs.copy(
this.templatePath('firebase.json'),
this.destinationPath('firebase.json')
);
},
server: function () {
this.fs.copy(
this.templatePath('server.js'),
this.destinationPath('server.js')
);
},
styles: function () {
this.fs.copy(
this.templatePath('public/app.css'),
this.destinationPath('public/app.css')
);
this.fs.copy(
this.templatePath('public/bootstrap.min.css'),
this.destinationPath('public/bootstrap.min.css')
);
},
scripts: function () {
this.fs.copy(
this.templatePath('public/app.js'),
this.destinationPath('public/app.js')
);
},
images: function () {
this.fs.copy(
this.templatePath('public/icon-192x192.png'),
this.destinationPath('public/icon-192x192.png')
)
},
html: function () {
this.fs.copy(
this.templatePath('public/index.html'),
this.destinationPath('public/index.html')
);
},
publicExtras: function () {
this.fs.copy(
this.templatePath('public/robots.txt'),
this.destinationPath('public/robots.txt')
);
this.fs.copy(
this.templatePath('public/manifest.json'),
this.destinationPath('public/manifest.json')
);
}
},
writing() {
this.fs.copy(
this.templatePath('_package.json'),
this.destinationPath('package.json')
);
this.fs.copy(
this.templatePath('editorconfig'),
this.destinationPath('.editorconfig')
);
this.fs.copy(
this.templatePath('gitignore'),
this.destinationPath('.gitignore')
);
this.fs.copy(
this.templatePath('requires.js'),
this.destinationPath('requires.js')
);
this.fs.copy(
this.templatePath('firebase.json'),
this.destinationPath('firebase.json')
);
// server
this.fs.copy(
this.templatePath('server.js'),
this.destinationPath('server.js')
);
// styles
this.fs.copy(
this.templatePath('public/app.css'),
this.destinationPath('public/app.css')
);
this.fs.copy(
this.templatePath('public/bootstrap.min.css'),
this.destinationPath('public/bootstrap.min.css')
);
// scripts
this.fs.copy(
this.templatePath('public/app.js'),
this.destinationPath('public/app.js')
);
// images
this.fs.copy(
this.templatePath('public/icon-192x192.png'),
this.destinationPath('public/icon-192x192.png')
)
// html
this.fs.copy(
this.templatePath('public/index.html'),
this.destinationPath('public/index.html')
);
// publicExtras
this.fs.copy(
this.templatePath('public/robots.txt'),
this.destinationPath('public/robots.txt')
);
this.fs.copy(
this.templatePath('public/manifest.json'),
this.destinationPath('public/manifest.json')
);
}

install: function () {
install() {
this.installDependencies({
bower: false
});
}
});
}

module.exports = BlockstackGenerator;
10 changes: 5 additions & 5 deletions app/templates/server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const express = require('express')
const express = require('express')
const opn = require('opn')

const app = express()
const app = express()
const port = 5000

function allowCrossDomain(req, res, next) {
Expand All @@ -13,10 +13,10 @@ function allowCrossDomain(req, res, next) {

app.use(allowCrossDomain)
app.use('/', express.static(__dirname + '/public'))
app.listen(port, (err) => {
app.listen(port, (err) => {
if (err) {
return console.log('something bad happened', err)
}
console.log(`server is listening on ${port}`)
opn('http://localhost:5000')
})
opn(`http://localhost:${port}`)
})
42 changes: 6 additions & 36 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ var gulp = require('gulp');
var eslint = require('gulp-eslint');
var excludeGitignore = require('gulp-exclude-gitignore');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var nsp = require('gulp-nsp');
var plumber = require('gulp-plumber');
var coveralls = require('gulp-coveralls');

gulp.task('static', function () {
return gulp.src('**/*.js')
Expand All @@ -21,42 +19,14 @@ gulp.task('nsp', function (cb) {
nsp({package: path.resolve('package.json')}, cb);
});

gulp.task('pre-test', function () {
return gulp.src('generators/**/*.js')
.pipe(excludeGitignore())
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function (cb) {
var mochaErr;

gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec'}))
.on('error', function (err) {
mochaErr = err;
})
.pipe(istanbul.writeReports())
.on('end', function () {
cb(mochaErr);
});
});
gulp.task('test', () =>
gulp.src(['test/**/*.js'])
.pipe(plumber())
.pipe(mocha()));

gulp.task('watch', function () {
gulp.watch(['generators/**/*.js', 'test/**'], ['test']);
});

gulp.task('coveralls', ['test'], function () {
if (!process.env.CI) {
return;
}

return gulp.src(path.join(__dirname, 'coverage/lcov.info'))
.pipe(coveralls());
});

gulp.task('prepublish', ['nsp']);
gulp.task('default', ['static', 'test']);
gulp.task('prepublish', gulp.series('nsp'));
gulp.task('default', gulp.series('static', 'test'));
Loading

0 comments on commit 0eeb149

Please sign in to comment.