Skip to content

Commit 65d3dbb

Browse files
committed
Initial commit
0 parents  commit 65d3dbb

33 files changed

+9636
-0
lines changed

.dependency-cruiser.js

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
module.exports = {
2+
extends: "dependency-cruiser/configs/recommended-strict",
3+
/*
4+
the 'dependency-cruiser/configs/recommended-strict' preset
5+
contains these rules:
6+
no-circular - flags all circular dependencies
7+
no-orphans - flags orphan modules (except typescript .d.ts files)
8+
no-deprecated-core - flags dependencies on deprecated node 'core' modules
9+
no-deprecated-npm - flags dependencies on deprecated npm modules
10+
no-non-package-json - flags (npm) dependencies that don't occur in package.json
11+
not-to-unresolvable - flags dependencies that can't be resolved
12+
no-duplicate-dep-types - flags dependencies that occur more than once in package.json
13+
14+
If you need to, you can override these rules. E.g. to ignore the
15+
no-duplicate-dep-types rule, you can set its severity to "ignore" by
16+
adding this to the 'forbidden' section:
17+
{
18+
name: 'no-duplicate-dep-types',
19+
severity: 'ignore'
20+
}
21+
22+
Also, by default, the preset does not follow any external modules (things in
23+
node_modules or in yarn's plug'n'play magic). If you want to have that
24+
differently, just override it the options.doNotFollow key.
25+
*/
26+
forbidden: [
27+
{
28+
name: "not-to-test",
29+
comment:
30+
"This module depends on code within a folder that should only contain tests. As tests don't " +
31+
"implement functionality this is odd. Either you're writing a test outside the test folder " +
32+
"or there's something in the test folder that isn't a test.",
33+
severity: "error",
34+
from: {
35+
pathNot: "^(test|spec)",
36+
},
37+
to: {
38+
path: "^(test|spec)",
39+
},
40+
},
41+
{
42+
name: "not-to-spec",
43+
comment:
44+
"This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. " +
45+
"If there's something in a spec that's of use to other modules, it doesn't have that single " +
46+
"responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.",
47+
severity: "error",
48+
from: {},
49+
to: {
50+
path: "\\.spec\\.(js|ts|ls|coffee|litcoffee|coffee\\.md)$",
51+
},
52+
},
53+
{
54+
name: "not-to-dev-dep",
55+
severity: "error",
56+
comment:
57+
"This module depends on an npm package from the 'devDependencies' section of your " +
58+
"package.json. It looks like something that ships to production, though. To prevent problems " +
59+
"with npm packages that aren't there on production declare it (only!) in the 'dependencies'" +
60+
"section of your package.json. If this module is development only - add it to the " +
61+
"from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration",
62+
from: {
63+
path: "^(src|app|lib)",
64+
pathNot: "\\.spec\\.(js|ts|ls|coffee|litcoffee|coffee\\.md)$",
65+
},
66+
to: {
67+
dependencyTypes: ["npm-dev"],
68+
},
69+
},
70+
{
71+
name: "optional-deps-used",
72+
severity: "info",
73+
comment:
74+
"This module depends on an npm package that is declared as an optional dependency " +
75+
"in your package.json. As this makes sense in limited situations only, it's flagged here. " +
76+
"If you're using an optional dependency here by design - add an exception to your" +
77+
"depdency-cruiser configuration.",
78+
from: {},
79+
to: {
80+
dependencyTypes: ["npm-optional"],
81+
},
82+
},
83+
{
84+
name: "peer-deps-used",
85+
comment:
86+
"This module depends on an npm package that is declared as a peer dependency " +
87+
"in your package.json. This makes sense if your package is e.g. a plugin, but in " +
88+
"other cases - maybe not so much. If the use of a peer dependency is intentional " +
89+
"add an exception to your dependency-cruiser configuration.",
90+
severity: "warn",
91+
from: {},
92+
to: {
93+
dependencyTypes: ["npm-peer"],
94+
},
95+
},
96+
],
97+
options: {
98+
/* conditions specifying which files not to follow further when encountered:
99+
- path: a regular expression to match
100+
- dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/develop/doc/rules-reference.md#dependencytypes
101+
for a complete list
102+
*/
103+
doNotFollow: {
104+
// path: 'node_modules',
105+
dependencyTypes: ["npm", "npm-dev", "npm-optional", "npm-peer", "npm-bundled", "npm-no-pkg"],
106+
},
107+
108+
/* conditions specifying which dependencies to exclude
109+
- path: a regular expression to match
110+
- dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.
111+
leave out if you want to exclude neither (recommended!)
112+
*/
113+
// , exclude : {
114+
// path: ''
115+
// , dynamic: true
116+
// }
117+
118+
/* pattern specifying which files to include (regular expression)
119+
dependency-cruiser will skip everything not matching this pattern
120+
*/
121+
// , includeOnly : ''
122+
123+
/* list of module systems to cruise */
124+
// , moduleSystems: ['amd', 'cjs', 'es6', 'tsd']
125+
126+
/* prefix for links in html and svg output (e.g. https://github.com/you/yourrepo/blob/develop/) */
127+
// , prefix: ''
128+
129+
/* if true detect dependencies that only exist before typescript-to-javascript compilation */
130+
tsPreCompilationDeps: true,
131+
132+
/* if true combines the package.jsons found from the module up to the base
133+
folder the cruise is initiated from. Useful for how (some) mono-repos
134+
manage dependencies & dependency definitions.
135+
*/
136+
// , combinedDependencies: false
137+
138+
/* if true leave symlinks untouched, otherwise use the realpath */
139+
// , preserveSymlinks: false
140+
141+
/* Typescript project file ('tsconfig.json') to use for
142+
(1) compilation and
143+
(2) resolution (e.g. with the paths property)
144+
145+
The (optional) fileName attribute specifies which file to take (relative to
146+
dependency-cruiser's current working directory). When not provided
147+
defaults to './tsconfig.json'.
148+
*/
149+
tsConfig: {
150+
fileName: "./tsconfig.json",
151+
},
152+
153+
/* Webpack configuration to use to get resolve options from.
154+
155+
The (optional) fileName attribute specifies which file to take (relative to dependency-cruiser's
156+
current working directory. When not provided defaults to './webpack.conf.js'.
157+
158+
The (optional) `env` and `args` attributes contain the parameters to be passed if
159+
your webpack config is a function and takes them (see webpack documentation
160+
for details)
161+
*/
162+
// , webpackConfig: {
163+
// fileName: './webpack.conf.js'
164+
// , env: {}
165+
// , args: {}
166+
// }
167+
168+
/* How to resolve external modules - use "yarn-pnp" if you're using yarn's Plug'n'Play.
169+
otherwise leave it out (or set to the default, which is 'node_modules')
170+
*/
171+
// , externalModuleResolutionStrategy: 'node_modules'
172+
},
173+
};
174+
// generated: [email protected] on 2019-11-21T01:41:12.817Z

.eslintrc.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
},
6+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:import/typescript", "prettier/@typescript-eslint"],
7+
parser: "@typescript-eslint/parser",
8+
parserOptions: {
9+
ecmaVersion: 12,
10+
project: "tsconfig.json",
11+
sourceType: "module",
12+
},
13+
plugins: ["@typescript-eslint"],
14+
rules: {
15+
"no-unused-vars": "error",
16+
"@typescript-eslint/ban-types": "warn",
17+
},
18+
};

.github/workflows/build.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node-version: [12.x]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
ref: ${{ github.event.pull_request.head.sha }}
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
- name: Test & Build
24+
run: |
25+
yarn install --frozen-lockfile
26+
yarn test
27+
yarn build
28+
env:
29+
CI: true

.github/workflows/codeql-analysis.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
# ******** NOTE ********
12+
13+
name: "CodeQL"
14+
15+
on:
16+
push:
17+
branches: [main]
18+
pull_request:
19+
# The branches below must be a subset of the branches above
20+
branches: [main]
21+
schedule:
22+
- cron: "37 13 * * 4"
23+
24+
jobs:
25+
analyze:
26+
name: Analyze
27+
runs-on: ubuntu-latest
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
language: ["javascript"]
33+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
34+
# Learn more...
35+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v2
40+
41+
# Initializes the CodeQL tools for scanning.
42+
- name: Initialize CodeQL
43+
uses: github/codeql-action/init@v1
44+
with:
45+
languages: ${{ matrix.language }}
46+
# If you wish to specify custom queries, you can do so here or in a config file.
47+
# By default, queries listed here will override any specified in a config file.
48+
# Prefix the list here with "+" to use these queries and those in the config file.
49+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
50+
51+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52+
# If this step fails, then you should remove it and run the build manually (see below)
53+
- name: Autobuild
54+
uses: github/codeql-action/autobuild@v1
55+
56+
# ℹ️ Command-line programs to run using the OS shell.
57+
# 📚 https://git.io/JvXDl
58+
59+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60+
# and modify them (or add more) to build your code if your project
61+
# uses a compiled language
62+
63+
#- run: |
64+
# make bootstrap
65+
# make release
66+
67+
- name: Perform CodeQL Analysis
68+
uses: github/codeql-action/analyze@v1

.github/workflows/release.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release Workflow
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
with:
13+
ref: main
14+
- uses: actions/setup-node@v1
15+
with:
16+
node-version: "12.x"
17+
registry-url: https://npm.pkg.github.com
18+
scope: "@Himenon"
19+
- run: |
20+
yarn install --frozen-lockfile
21+
yarn build
22+
23+
release-github-registry:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
with:
28+
ref: main
29+
- uses: actions/setup-node@v1
30+
with:
31+
node-version: "12.x"
32+
registry-url: https://npm.pkg.github.com
33+
scope: "@Himenon"
34+
- run: |
35+
yarn install --frozen-lockfile
36+
yarn build
37+
yarn --cwd ./lib release:github:registry
38+
env:
39+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
release-npm-registry:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v2
45+
with:
46+
ref: main
47+
- uses: actions/setup-node@v1
48+
with:
49+
node-version: "12.x"
50+
registry-url: "https://registry.npmjs.org"
51+
- run: yarn install --frozen-lockfile
52+
- run: yarn build
53+
- run: yarn --cwd ./lib release:npm:registry
54+
env:
55+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/versionUp.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Version Up
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
auto-version-up:
9+
if: github.event_name != 'pull_request'
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
ref: main
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: "12.x"
18+
- name: Auto version update
19+
run: |
20+
git config --global user.email "[email protected]"
21+
git config --global user.name "gh-actions"
22+
yarn install --frozen-lockfile
23+
yarn lerna:version:up

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
lib
3+
coverage
4+
node_modules
5+
package-lock.json
6+
.env*
7+
*.log
8+
private_npm_cache

.huskyrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"hooks": {
3+
"pre-commit": "lint-staged",
4+
"commit-msg": "commitlint --config commitlint.config.js -e $GIT_PARAMS"
5+
}
6+
}

.lintstagedrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"*.{js,jsx,json,yml,yaml,html,md}": ["prettier --write"],
3+
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
4+
"package.json": ["sort-package-json"]
5+
}

.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
always-auth=true
2+
engine-strict=true
3+
package-lock=false

0 commit comments

Comments
 (0)