Skip to content

Commit

Permalink
Merge pull request #51 from Adamant-im/dev
Browse files Browse the repository at this point in the history
Node v0.6.5
  • Loading branch information
adamant-al authored Sep 25, 2021
2 parents fef0c69 + f08049c commit 1c3bae2
Show file tree
Hide file tree
Showing 195 changed files with 36,620 additions and 36,872 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ tmp
public/node_modules
public/bower_components
public/static
test/lisk-js
helpers/bignum.js
docs/jsdoc/scripts/prettify/prettify.js
57 changes: 38 additions & 19 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,52 @@
{
"env": {
"commonjs": true,
"es2021": true,
"browser": true,
"node": true
},
"extends": [
"google"
],
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "module"
"ecmaVersion": 12
},
"rules": {
"semi": "error",
"no-eq-null": "off",
"indent": ["off", 4],
"eqeqeq": "off",
"curly": "error",
"no-undef": "error",
"quotes": ["error", "single"],
"max-len": ["error",
{ "code": 200,
"ignoreTrailingComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}],
"require-jsdoc": ["off"],
"no-var": ["off"],
"comma-dangle": ["error", "never"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"block-spacing": ["error", "always"],
"new-cap": ["off"],
"prefer-rest-params": ["off"],
"no-unused-vars": ["off"],
"no-invalid-this": ["off"],
"camelcase": ["off"],
"one-var": ["off"],
"no-throw-literal": ["off"],
"object-curly-spacing": ["error", "always"],
"prefer-const": ["off"],
"quote-props": ["off"],
"guard-for-in": ["off"],
"valid-jsdoc": ["off"],
"prefer-spread": ["off"],
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "always",
"asyncArrow": "ignore"
}],
"callback-return": "off",
"global-require": "off",
"handle-callback-err": "off",
"no-mixed-requires": "off",
"no-new-require": "off"
},
"env": {
"browser": true,
"node": true
"space-infix-ops": ["error", { "int32Hint": true }]
},
"globals": {
"PR": true,
"it": true,
"describe": true,
"before": true,
Expand All @@ -35,5 +55,4 @@
"afterEach": true
},
"plugins": []

}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.ed25519-node
.idea/
.project
.vscode/
__MACOSX/
dapps/
docs/jsdoc/
Expand All @@ -13,7 +14,11 @@ release
ssl/
stacktrace*
test/.coverage-unit
test/.coverage
test/.nyc_output
tmp
sftp-config.json
*.swp
*.swo
package-lock.json

5 changes: 5 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict'

module.exports = {
timeout: '1200s'
}
267 changes: 131 additions & 136 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,140 +4,135 @@ var moment = require('moment');
var util = require('util');

module.exports = function (grunt) {
var files = [
'logger.js',
'api/**/*.js',
'helpers/**/*.js',
'modules/**/*.js',
'logic/*.js',
'schema/**/*.js',
'sql/**/*.js',
'app.js'
];

var today = moment().format('HH:mm:ss DD/MM/YYYY');

var config = require('./config.json');

var release_dir = __dirname + '/release/';
var version_dir = release_dir + config.version;

var maxBufferSize = require('buffer').kMaxLength - 1;

grunt.initConfig({
obfuscator: {
files: files,
entry: 'app.js',
out: 'release/app.js',
strings: true,
root: __dirname
},

exec: {
package: {
command: function () {
return [
util.format('mkdir -p %s', version_dir),
util.format('mkdir -p %s/logs', version_dir),
util.format('mkdir -p %s/pids', version_dir),
util.format('mkdir -p %s/public', version_dir),
util.format('cp %s/app.js %s', release_dir, version_dir),
util.format('cp %s/config.json %s', __dirname, version_dir),
util.format('cp %s/package.json %s', __dirname, version_dir),
util.format('cp %s/genesisBlock.json %s', __dirname, version_dir),
util.format('cp %s/LICENSE %s', __dirname, version_dir),
util.format('mkdir -p %s/sql/migrations', version_dir),
util.format('cp %s/sql/*.sql %s/sql/', __dirname, version_dir),
util.format('cp %s/sql/migrations/*.sql %s/sql/migrations/', __dirname, version_dir),
util.format('cd %s/public && mkdir -p ./static', __dirname),
'npm install && bower install && grunt release && cd ../',
util.format('cp %s/public/wallet.html %s/public/', __dirname, version_dir),
util.format('cp %s/public/loading.html %s/public/', __dirname, version_dir),
util.format('cp -Rf %s/public/images %s/public/', __dirname, version_dir),
util.format('cp -Rf %s/public/partials %s/public/', __dirname, version_dir),
util.format('cp -RfL %s/public/static %s/public/', __dirname, version_dir),
util.format('mkdir -p %s/public/node_modules', version_dir),
util.format('cp -Rf %s/public/node_modules/chart.js %s/public/node_modules', __dirname, version_dir),
util.format('mkdir -p %s/public/bower_components', version_dir),
util.format('mkdir -p %s/public/socket.io', version_dir),
util.format('cp -Rf %s/public/bower_components/jquery %s/public/bower_components', __dirname, version_dir),
util.format('cp -Rf %s/public/bower_components/materialize %s/public/bower_components', __dirname, version_dir),
util.format('cp -Rf %s/public/bower_components/blob %s/public/bower_components', __dirname, version_dir),
util.format('cp -Rf %s/public/bower_components/file-saver %s/public/bower_components', __dirname, version_dir)
].join(' && ');
}
},

folder: {
command: 'mkdir -p ' + release_dir
},

build: {
command: 'cd ' + version_dir + '/ && touch build && echo "v' + today + '" > build'
},

coverage: {
command: 'export NODE_ENV=TEST && node_modules/.bin/istanbul cover --dir test/.coverage-unit ./node_modules/.bin/_mocha',
maxBuffer: maxBufferSize
},

coverageSingle: {
command: 'export NODE_ENV=TEST && node_modules/.bin/istanbul cover --dir test/.coverage-unit ./node_modules/.bin/_mocha $TEST',
maxBuffer: maxBufferSize
},

fetchCoverage: {
command: 'rm -rf ./test/.coverage-func.zip; curl -o ./test/.coverage-func.zip $HOST/coverage/download',
maxBuffer: maxBufferSize
}
},

compress: {
main: {
options: {
archive: version_dir + '.tar.gz',
mode: 'tgz',
level: 6
},
files: [
{ expand: true, cwd: release_dir, src: [config.version + '/**'], dest: './' }
]
}
},

eslint: {
options: {
configFile: '.eslintrc.json',
format: 'codeframe',
fix: false
},
target: [
'api',
'helpers',
'modules',
'logic',
'schema',
'tasks',
'test'
]
}
});

grunt.loadTasks('tasks');

grunt.loadNpmTasks('grunt-obfuscator');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-eslint');

grunt.registerTask('default', ['release']);
grunt.registerTask('release', ['exec:folder', 'obfuscator', 'exec:package', 'exec:build', 'compress']);
grunt.registerTask('jenkins', ['exec:coverageSingle']);
grunt.registerTask('eslint-nofix', ['eslint']);
grunt.registerTask('test', ['eslint', 'exec:coverage']);

grunt.registerTask('eslint-fix', 'Run eslint and fix formatting', function () {
grunt.config.set('eslint.options.fix', true);
grunt.task.run('eslint');
});
var files = [
'logger.js',
'api/**/*.js',
'helpers/**/*.js',
'modules/**/*.js',
'logic/*.js',
'schema/**/*.js',
'sql/**/*.js',
'app.js'
];

var today = moment().format('YYYY-MM-DD HH:mm:ss');

var config = require('./config.json');

var release_dir = __dirname + '/release/';
var version_dir = release_dir + 'current';

var maxBufferSize = require('buffer').kMaxLength - 1;

grunt.initConfig({
obfuscator: {
files: files,
entry: 'app.js',
out: 'release/app.js',
strings: true,
root: __dirname
},

exec: {
package: {
command: function () {
return [
util.format('mkdir -p %s', version_dir),
util.format('mkdir -p %s/logs', version_dir),
util.format('mkdir -p %s/pids', version_dir),
util.format('mkdir -p %s/public', version_dir),
util.format('cp %s/app.js %s', release_dir, version_dir),
util.format('cp %s/config.json %s', __dirname, version_dir),
util.format('cp %s/package.json %s', __dirname, version_dir),
util.format('cp %s/genesisBlock.json %s', __dirname, version_dir),
util.format('cp %s/LICENSE %s', __dirname, version_dir),
util.format('mkdir -p %s/sql/migrations', version_dir),
util.format('cp %s/sql/*.sql %s/sql/', __dirname, version_dir),
util.format('cp %s/sql/migrations/*.sql %s/sql/migrations/', __dirname, version_dir),
util.format('cd %s/public && mkdir -p ./static', __dirname),
'npm install && bower install && grunt release && cd ../',
util.format('cp %s/public/wallet.html %s/public/', __dirname, version_dir),
util.format('cp %s/public/loading.html %s/public/', __dirname, version_dir),
util.format('cp -Rf %s/public/images %s/public/', __dirname, version_dir),
util.format('cp -Rf %s/public/partials %s/public/', __dirname, version_dir),
util.format('cp -RfL %s/public/static %s/public/', __dirname, version_dir),
util.format('mkdir -p %s/public/node_modules', version_dir),
util.format('cp -Rf %s/public/node_modules/chart.js %s/public/node_modules', __dirname, version_dir),
util.format('mkdir -p %s/public/bower_components', version_dir),
util.format('mkdir -p %s/public/socket.io', version_dir),
util.format('cp -Rf %s/public/bower_components/jquery %s/public/bower_components', __dirname, version_dir),
util.format('cp -Rf %s/public/bower_components/materialize %s/public/bower_components', __dirname, version_dir),
util.format('cp -Rf %s/public/bower_components/blob %s/public/bower_components', __dirname, version_dir),
util.format('cp -Rf %s/public/bower_components/file-saver %s/public/bower_components', __dirname, version_dir)
].join(' && ');
}
},

folder: {
command: 'mkdir -p ' + release_dir
},

build: {
command: 'cd ' + version_dir + '/ && touch build && echo "v' + today + '" > build'
},

coverage: {
command: 'export NODE_ENV=TEST && npx nyc --reporter html --temp-dir test/.nyc_output --report-dir test/.coverage npm run test:all',
maxBuffer: maxBufferSize
},

coverageSingle: {
command: 'export NODE_ENV=TEST && npx nyc --reporter html --temp-dir test/.nyc_output --report-dir test/.coverage mocha $TEST',
maxBuffer: maxBufferSize
},

fetchCoverage: {
command: 'rm -rf ./test/.coverage-func.zip; curl -o ./test/.coverage-func.zip $HOST/coverage/download',
maxBuffer: maxBufferSize
}
},

compress: {
main: {
options: {
archive: version_dir + '.tar.gz',
mode: 'tgz',
level: 6
},
files: [
{ expand: true, cwd: release_dir, src: ['current' + '/**'], dest: './' }
]
}
},

eslint: {
options: {
configFile: '.eslintrc.json',
format: 'codeframe',
fix: false
},
target: [
'api',
'helpers',
'modules',
'logic',
'schema',
'tasks',
'test'
]
}
});

grunt.loadTasks('tasks');

grunt.loadNpmTasks('grunt-contrib-obfuscator');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-eslint');

grunt.registerTask('default', ['release']);
grunt.registerTask('release', ['exec:folder', 'obfuscator', 'exec:package', 'exec:build', 'compress']);
grunt.registerTask('test-single', ['exec:coverageSingle']);
grunt.registerTask('eslint-nofix', ['eslint']);
grunt.registerTask('test', ['eslint', 'exec:coverage']);
};
Loading

0 comments on commit 1c3bae2

Please sign in to comment.