Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .eslintrc.js

This file was deleted.

7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
logs
*.log

# Test directory generated by unit test tools
.nyc_output

# Coverage directory used by tools like istanbul
coverage
.coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand All @@ -26,6 +30,3 @@ dist/

# MAC finder files
.DS_Store

# Tags file (generated by ctags)
tags
9 changes: 9 additions & 0 deletions .mocharc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"watch-files": ["src/**/*.js", "test/**/*.js"],
"spec": [
"test/**/*.js"
],
"timeout": "5000",
"loader": ["esmock"],
"parallel": false
}
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ logs

# Coverage directory used by tools like istanbul
coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand Down
5 changes: 5 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"reporter": ["text", "html"],
"temp-dir": ".nyc_output",
"report-dir": ".coverage"
}
8 changes: 8 additions & 0 deletions .projections.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@
"src/*.js": {
"alternate": "test/unit/{}-spec.js",
"type": "src"
},
"test/unit/*-spec.ts": {
"alternate": "src/{}.ts",
"type": "unit"
},
"src/*.ts": {
"alternate": "test/unit/{}-spec.ts",
"type": "src"
}
}
54 changes: 9 additions & 45 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,15 @@
'use strict';

/**
* Dynamically defines develop/test/build/deploy tasks for the current project
* based on metadata present in package.json.
*/
const _log = require('fancy-log');
const _colors = require('ansi-colors');

const { Project, taskBuilders } = require('@vamship/build-utils');

const project = new Project(require('./package.json'));

const projectInfo = `${_colors.cyan.bold(project.name)} (${_colors.blue(
project.projectType
)}, ${_colors.green(project.language)})`;

_log.info(`Initializing tasks for project: ${projectInfo}`);

const builders = [
{ build: taskBuilders.clean },
{ build: taskBuilders.format },
{ build: taskBuilders.lint },
{ build: taskBuilders.build },
{ build: taskBuilders.docs },
{ build: taskBuilders.package },
{ build: taskBuilders.package, options: { types: true } },
{ build: taskBuilders.publish },
{ build: taskBuilders.publish, options: { latestOnly: true } },
{ build: taskBuilders.publish, options: { types: true } },
{ build: taskBuilders.package, options: { types: true, latestOnly: true } },

{ build: taskBuilders.test, options: { testType: 'unit' } },
{ build: taskBuilders.test, options: { testType: 'api' } },
{ build: taskBuilders.format, options: { watch: true } },
{ build: taskBuilders.lint, options: { watch: true } },
{ build: taskBuilders.build, options: { watch: true } },
{ build: taskBuilders.test, options: { testType: 'unit', watch: true } },
{ build: taskBuilders.test, options: { testType: 'api', watch: true } },
];
import _log from 'fancy-log';
import _fs from 'fs';
import _gulp from 'gulp';
import { Project, getTaskFactory } from '@vamship/build-utils';

const tasks = builders
.map(({ build, options }) => build(project, Object.assign({}, options)))
.reduce((result, tasks) => result.concat(tasks), [])
.filter((task) => !!task)
.reduce((result, task) => {
result[task.displayName] = task;
return result;
}, {});
const _package = JSON.parse(_fs.readFileSync('./package.json', 'utf-8'));
const project = new Project(_package);

module.exports = tasks;
_log.info(`Initializing tasks for project: ${project.banner}`);
const factory = getTaskFactory(project);
factory.createTasks().forEach((task) => _gulp.task(task));
65 changes: 65 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import tselPlugin from '@typescript-eslint/eslint-plugin';
import tselParser from '@typescript-eslint/parser';

const tselRules = tselPlugin.configs.recommended.rules;

function mapRuleNamespace(rules, sourceNamespace, targetNamespace) {
const pattern = new RegExp(sourceNamespace);
return Object.keys(rules).reduce((result, key) => {
const newKey = key.replace(pattern, targetNamespace);
result[newKey] = rules[key];
return result;
}, {});
}

const commonRules = {
semi: 'error',
'no-trailing-spaces': 'error',
};

export default [
'eslint:recommended',
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
globals: {
console: true,
it: true,
describe: true,
setInterval: true,
clearInterval: true,
beforeEach: true,
setTimeout: true,
},
},
rules: {
...commonRules,
'no-unused-vars': ['error', { args: 'none' }],
},
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tselParser,
globals: {
console: true,
it: true,
describe: true,
setInterval: true,
clearInterval: true,
beforeEach: true,
setTimeout: true,
},
},
plugins: {
tsel: tselPlugin,
},
rules: Object.assign(
mapRuleNamespace(tselRules, '@typescript-eslint', 'tsel'),
{
...commonRules,
'tsel/no-unused-vars': ['error', { args: 'none' }],
}
),
},
];
Loading