Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Himenon committed Dec 15, 2020
0 parents commit a5444b5
Show file tree
Hide file tree
Showing 33 changed files with 9,599 additions and 0 deletions.
174 changes: 174 additions & 0 deletions .dependency-cruiser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
module.exports = {
extends: "dependency-cruiser/configs/recommended-strict",
/*
the 'dependency-cruiser/configs/recommended-strict' preset
contains these rules:
no-circular - flags all circular dependencies
no-orphans - flags orphan modules (except typescript .d.ts files)
no-deprecated-core - flags dependencies on deprecated node 'core' modules
no-deprecated-npm - flags dependencies on deprecated npm modules
no-non-package-json - flags (npm) dependencies that don't occur in package.json
not-to-unresolvable - flags dependencies that can't be resolved
no-duplicate-dep-types - flags dependencies that occur more than once in package.json
If you need to, you can override these rules. E.g. to ignore the
no-duplicate-dep-types rule, you can set its severity to "ignore" by
adding this to the 'forbidden' section:
{
name: 'no-duplicate-dep-types',
severity: 'ignore'
}
Also, by default, the preset does not follow any external modules (things in
node_modules or in yarn's plug'n'play magic). If you want to have that
differently, just override it the options.doNotFollow key.
*/
forbidden: [
{
name: "not-to-test",
comment:
"This module depends on code within a folder that should only contain tests. As tests don't " +
"implement functionality this is odd. Either you're writing a test outside the test folder " +
"or there's something in the test folder that isn't a test.",
severity: "error",
from: {
pathNot: "^(test|spec)",
},
to: {
path: "^(test|spec)",
},
},
{
name: "not-to-spec",
comment:
"This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. " +
"If there's something in a spec that's of use to other modules, it doesn't have that single " +
"responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.",
severity: "error",
from: {},
to: {
path: "\\.spec\\.(js|ts|ls|coffee|litcoffee|coffee\\.md)$",
},
},
{
name: "not-to-dev-dep",
severity: "error",
comment:
"This module depends on an npm package from the 'devDependencies' section of your " +
"package.json. It looks like something that ships to production, though. To prevent problems " +
"with npm packages that aren't there on production declare it (only!) in the 'dependencies'" +
"section of your package.json. If this module is development only - add it to the " +
"from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration",
from: {
path: "^(src|app|lib)",
pathNot: "\\.spec\\.(js|ts|ls|coffee|litcoffee|coffee\\.md)$",
},
to: {
dependencyTypes: ["npm-dev"],
},
},
{
name: "optional-deps-used",
severity: "info",
comment:
"This module depends on an npm package that is declared as an optional dependency " +
"in your package.json. As this makes sense in limited situations only, it's flagged here. " +
"If you're using an optional dependency here by design - add an exception to your" +
"depdency-cruiser configuration.",
from: {},
to: {
dependencyTypes: ["npm-optional"],
},
},
{
name: "peer-deps-used",
comment:
"This module depends on an npm package that is declared as a peer dependency " +
"in your package.json. This makes sense if your package is e.g. a plugin, but in " +
"other cases - maybe not so much. If the use of a peer dependency is intentional " +
"add an exception to your dependency-cruiser configuration.",
severity: "warn",
from: {},
to: {
dependencyTypes: ["npm-peer"],
},
},
],
options: {
/* conditions specifying which files not to follow further when encountered:
- path: a regular expression to match
- dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/develop/doc/rules-reference.md#dependencytypes
for a complete list
*/
doNotFollow: {
// path: 'node_modules',
dependencyTypes: ["npm", "npm-dev", "npm-optional", "npm-peer", "npm-bundled", "npm-no-pkg"],
},

/* conditions specifying which dependencies to exclude
- path: a regular expression to match
- dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.
leave out if you want to exclude neither (recommended!)
*/
// , exclude : {
// path: ''
// , dynamic: true
// }

/* pattern specifying which files to include (regular expression)
dependency-cruiser will skip everything not matching this pattern
*/
// , includeOnly : ''

/* list of module systems to cruise */
// , moduleSystems: ['amd', 'cjs', 'es6', 'tsd']

/* prefix for links in html and svg output (e.g. https://github.com/you/yourrepo/blob/develop/) */
// , prefix: ''

/* if true detect dependencies that only exist before typescript-to-javascript compilation */
tsPreCompilationDeps: true,

/* if true combines the package.jsons found from the module up to the base
folder the cruise is initiated from. Useful for how (some) mono-repos
manage dependencies & dependency definitions.
*/
// , combinedDependencies: false

/* if true leave symlinks untouched, otherwise use the realpath */
// , preserveSymlinks: false

/* Typescript project file ('tsconfig.json') to use for
(1) compilation and
(2) resolution (e.g. with the paths property)
The (optional) fileName attribute specifies which file to take (relative to
dependency-cruiser's current working directory). When not provided
defaults to './tsconfig.json'.
*/
tsConfig: {
fileName: "./tsconfig.json",
},

/* Webpack configuration to use to get resolve options from.
The (optional) fileName attribute specifies which file to take (relative to dependency-cruiser's
current working directory. When not provided defaults to './webpack.conf.js'.
The (optional) `env` and `args` attributes contain the parameters to be passed if
your webpack config is a function and takes them (see webpack documentation
for details)
*/
// , webpackConfig: {
// fileName: './webpack.conf.js'
// , env: {}
// , args: {}
// }

/* How to resolve external modules - use "yarn-pnp" if you're using yarn's Plug'n'Play.
otherwise leave it out (or set to the default, which is 'node_modules')
*/
// , externalModuleResolutionStrategy: 'node_modules'
},
};
// generated: [email protected] on 2019-11-21T01:41:12.817Z
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:import/typescript", "prettier/@typescript-eslint"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
project: "tsconfig.json",
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {
"no-unused-vars": "error",
"@typescript-eslint/ban-types": "warn",
},
};
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v2
with:
ref: main
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Test & Build
run: |
yarn install --frozen-lockfile
yarn test
yarn build
env:
CI: true
68 changes: 68 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
# ******** NOTE ********

name: "CodeQL"

on:
push:
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: "37 13 * * 4"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release Workflow

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: main
- uses: actions/setup-node@v1
with:
node-version: "12.x"
registry-url: https://npm.pkg.github.com
scope: "@Himenon"
- run: |
yarn install --frozen-lockfile
yarn build
release-github-registry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: main
- uses: actions/setup-node@v1
with:
node-version: "12.x"
registry-url: https://npm.pkg.github.com
scope: "@Himenon"
- run: |
yarn install --frozen-lockfile
yarn build
yarn --cwd ./lib release:github:registry
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-npm-registry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: main
- uses: actions/setup-node@v1
with:
node-version: "12.x"
registry-url: "https://registry.npmjs.org"
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn --cwd ./lib release:npm:registry
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/versionUp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Version Up

on:
push:
branches: [main]

jobs:
auto-version-up:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: main
- uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: Auto version update
run: |
git config --global user.email "[email protected]"
git config --global user.name "gh-actions"
yarn install --frozen-lockfile
yarn lerna:version:up
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
lib
coverage
node_modules
package-lock.json
.env*
*.log
private_npm_cache
6 changes: 6 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint --config commitlint.config.js -e $GIT_PARAMS"
}
}
5 changes: 5 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*.{js,jsx,json,yml,yaml,html,md}": ["prettier --write"],
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
"package.json": ["sort-package-json"]
}
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
always-auth=true
engine-strict=true
package-lock=false
Loading

0 comments on commit a5444b5

Please sign in to comment.