Skip to content
Merged
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
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
ecmaVersion: 'latest',
},
rules: {
'no-console': 'off',
'max-len': 'off',
},
overrides: [
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: build

on: [push, workflow_dispatch]
on:
push:
workflow_dispatch:
schedule:
- cron: '15 1 * * *'

jobs:
build:
Expand Down
36 changes: 15 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
visyn_scripts
=====================
[![NPM version][npm-image]][npm-url] [![Build Status][circleci-image]][circleci-url]
# visyn_scripts

This package includes scripts and configuration files used by [datavisyn](https://datavisyn.io/) repositories. Collecting everything in a single installable repository unifies configurations across many repositories, thus reducing the maintenance overhead.
[![NPM version](https://badge.fury.io/js/visyn_scripts.svg)](https://npmjs.org/package/visyn_scripts)
[![build](https://github.com/datavisyn/visyn_scripts/actions/workflows/build.yml/badge.svg)](https://github.com/datavisyn/visyn_scripts/actions/workflows/build.yml)

This package includes scripts and configuration files used by [datavisyn](https://datavisyn.io/) repositories. Collecting everything in a single installable repository unifies configurations across many repositories, thus reducing the maintenance overhead.

## Usage

Install visyn_scripts via npm: `npm i --save-dev git+ssh://git@github.com/datavisyn/visyn_scripts.git#develop`

Add visyn_scripts to your package.json scripts, i.e. add `"compile": "visyn_scripts compile"` and execute it with `npm run compile`, or alternatively directly execute it with `npx visyn_scripts compile`.
Add visyn_scripts to your package.json scripts, i.e. add `"compile": "visyn_scripts compile"` and execute it with `npm run compile`, or alternatively directly execute it with `npx visyn_scripts compile`.

## Scripts

The main purpose of visyn_scripts are the unified scripts:

### build
Builds a workspace using webpack.

Builds a workspace using webpack.

### compile

Builds a repository using typescript.

### copy

Copies assets, styles, and static files to the dist folder.

### docs

Generates docs of a repository using typedoc.

### lint

Lints a repository using ESLint.

### test

Tests a repository using Jest.

## Configurations
Expand All @@ -45,19 +52,6 @@ module.exports = require('visyn_scripts/config/prettierrc.template');

...

---

***

<a href="https://www.datavisyn.io"><img src="https://www.datavisyn.io/img/logos/datavisyn-logo.png" align="left" width="200px" hspace="10" vspace="6"></a>
This repository is part of the **Target Discovery Platform** (TDP). For tutorials, API docs, and more information about the build and deployment process, see the [documentation page](https://wiki.datavisyn.io).




[tdp-image-client]: https://img.shields.io/badge/Target%20Discovery%20Platform-Client%20Plugin-F47D20.svg
[tdp-image-server]: https://img.shields.io/badge/Target%20Discovery%20Platform-Server%20Plugin-10ACDF.svg
[tdp-url]: http://datavisyn.io
[npm-image]: https://badge.fury.io/js/visyn_scripts.svg
[npm-url]: https://npmjs.org/package/visyn_scripts
[circleci-image]: https://circleci.com/gh/datavisyn/visyn_scripts.svg?style=shield
[circleci-url]: https://circleci.com/gh/datavisyn/visyn_scripts
<a href="https://www.datavisyn.io"><img src="https://www.datavisyn.io/wp-content/uploads/2021/11/datavisyn_RGB_A.svg" align="left" width="200px" hspace="10" vspace="6"></a>
2 changes: 1 addition & 1 deletion bin/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
describe: 'Build a workspace using webpack',
handler: (args) => {
const configPath = resolve(__dirname, '../../config/webpack.config.js');
call('webpack', `--config ${configPath} ${(args.strings || []).join(' ')}`, {
call('webpack', `--config "${configPath}" ${(args.strings || []).join(' ')}`, {
env: {
NODE_OPTIONS: '--max-old-space-size=4096',
},
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ module.exports = {
type: 'boolean',
}),
handler: (args) => {
call('eslint', `${args.cache ? '--cache' : ''} ${(args.strings || []).join(' ')} "src/**/*.ts{,x}" "tests/**/*.ts{,x}"`);
call('eslint', `${args.cache ? '--cache' : ''} --no-error-on-unmatched-pattern ${(args.strings || []).join(' ')} "src/**/*.ts{,x}" "tests/**/*.ts{,x}" "cypress/**/*.ts{,x}"`);
},
};
2 changes: 1 addition & 1 deletion bin/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ module.exports = {
describe: 'Start webpack serve',
handler: (args) => {
const configPath = resolve(__dirname, '../../config/webpack.config.js');
call('webpack', `serve --mode development --config ${configPath} --progress ${(args.strings || []).join(' ')}`);
call('webpack', `serve --mode development --config "${configPath}" --progress ${(args.strings || []).join(' ')}`);
},
};
1 change: 0 additions & 1 deletion bin/commands/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const call = (command, args, options = {}) => {
},
});
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
process.exit(1);
}
Expand Down
49 changes: 31 additions & 18 deletions config/eslintrc.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module.exports = ({ tsconfigRootDir }) => ({
'plugin:import/recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'plugin:prettier/recommended',
],
plugins: ['react', '@typescript-eslint', 'jest'],
plugins: ['react', '@typescript-eslint'],
ignorePatterns: ['*.js'],
env: {
browser: true,
es6: true,
jest: true,
'cypress/globals': true,
},
globals: {
Atomics: 'readonly',
Expand All @@ -32,42 +32,43 @@ module.exports = ({ tsconfigRootDir }) => ({
rules: {
// Disables jsx-a11y https://github.com/import-js/eslint-plugin-import/blob/v2.25.4/docs/rules/no-webpack-loader-syntax.md
// eslint-disable-next-line global-require
...Object.keys(require('eslint-plugin-jsx-a11y').rules).reduce(
(acc, rule) => {
acc[`jsx-a11y/${rule}`] = 'off';
return acc;
},
{},
),
...Object.keys(require('eslint-plugin-jsx-a11y').rules).reduce((acc, rule) => {
acc[`jsx-a11y/${rule}`] = 'off';
return acc;
}, {}),
'class-methods-use-this': 'off',
'linebreak-style': 'off',
'no-console': 'off',
'no-continue': 'off',
'no-multi-assign': 'warn',
'no-nested-ternary': 'off',
'no-return-assign': 'warn',
'no-restricted-exports': 'off',
'no-restricted-syntax': 'off',
'no-plusplus': 'off',
'no-prototype-builtins': 'warn',
'no-minusminus': 'off',
'no-underscore-dangle': 'off',
'@typescript-eslint/no-unused-expressions': ['error', {
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
}],
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
'max-classes-per-file': 'off',
'no-param-reassign': ['warn', { props: true, ignorePropertyModificationsFor: ['state'] }], // Exclude state as required by redux-toolkit: https://redux-toolkit.js.org/usage/immer-reducers#linting-state-mutations
'import/no-extraneous-dependencies': 'off',
// Disable the following 2 lines because to allow webpack file-loaders syntax
'import/no-webpack-loader-syntax': 'off',
'import/no-unresolved': 'off',
'import/no-webpack-loader-syntax': 'off', // Disable to allow webpack file-loaders syntax
'import/no-unresolved': 'off', // Disable to allow webpack file-loaders syntax
'import/prefer-default-export': 'off',
'import/order': 'error',
'prefer-destructuring': ['warn', { object: true, array: false }],
'prefer-promise-reject-errors': 'warn',
'prefer-spread': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'react/destructuring-assignment': 'warn',
'react/destructuring-assignment': 'off',
'react/jsx-props-no-spreading': 'off',
'react/no-unused-class-component-methods': 'warn',
'react/prop-types': 'off',
Expand All @@ -83,4 +84,16 @@ module.exports = ({ tsconfigRootDir }) => ({
},
],
},
overrides: [
{
files: ['cypress/**/*'],
extends: ['plugin:cypress/recommended', 'plugin:chai-friendly/recommended'],
plugins: ['cypress', 'chai-friendly'],
},
{
files: ['{src|tests}/**/*.{test|spec}.ts'],
extends: ['plugin:jest/recommended'],
plugins: ['jest'],
},
],
});
Loading