Skip to content

Commit b86c7d7

Browse files
committed
Initial project configuration
0 parents  commit b86c7d7

17 files changed

+11002
-0
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc.js

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
node: true,
6+
},
7+
parserOptions: {
8+
parser: '@typescript-eslint/parser',
9+
},
10+
extends: [
11+
'plugin:@typescript-eslint/recommended',
12+
'plugin:vue/essential',
13+
'prettier/vue',
14+
'plugin:prettier/recommended',
15+
],
16+
plugins: ['@typescript-eslint', 'vue'],
17+
// add your custom rules here
18+
rules: {
19+
semi: ['error', 'always'],
20+
'comma-dangle': ['error', 'always-multiline'],
21+
'arrow-parens': 'off',
22+
'object-curly-newline': [
23+
'error',
24+
{
25+
ObjectExpression: { consistent: true },
26+
ObjectPattern: { consistent: true },
27+
ImportDeclaration: { consistent: true },
28+
ExportDeclaration: { consistent: true },
29+
},
30+
],
31+
'space-before-function-paren': [
32+
'error',
33+
{
34+
anonymous: 'always',
35+
named: 'never',
36+
asyncArrow: 'always',
37+
},
38+
],
39+
'no-multiple-empty-lines': [
40+
'error',
41+
{
42+
max: 1,
43+
maxEOF: 0,
44+
maxBOF: 0,
45+
},
46+
],
47+
indent: 'off',
48+
'@typescript-eslint/indent': 'off',
49+
'@typescript-eslint/no-explicit-any': 'off',
50+
'@typescript-eslint/no-inferrable-types': 'off',
51+
'@typescript-eslint/no-non-null-assertion': 'off',
52+
'no-useless-constructor': 'off',
53+
'@typescript-eslint/no-useless-constructor': 'off',
54+
'@typescript-eslint/no-parameter-properties': 'off',
55+
'no-use-before-define': 'off',
56+
'@typescript-eslint/no-use-before-define': ['error'],
57+
'no-unused-vars': 'off',
58+
'@typescript-eslint/no-unused-vars': ['error'],
59+
'@typescript-eslint/consistent-type-assertions': [
60+
'error',
61+
{
62+
assertionStyle: 'as',
63+
objectLiteralTypeAssertions: 'allow-as-parameter',
64+
},
65+
],
66+
'@typescript-eslint/explicit-function-return-type': [
67+
'warn',
68+
{
69+
allowExpressions: true,
70+
},
71+
],
72+
},
73+
overrides: [
74+
{
75+
files: ['*.js'],
76+
rules: {
77+
'@typescript-eslint/no-var-requires': 'off',
78+
},
79+
},
80+
{
81+
files: ['*.ts'],
82+
rules: {
83+
// allow TypeScript method signature overloading, see https://github.com/typescript-eslint/typescript-eslint/issues/291
84+
'no-dupe-class-members': 'off',
85+
// disable no-undef rule for TypeScript, see https://github.com/typescript-eslint/typescript-eslint/issues/342
86+
'no-undef': 'off',
87+
},
88+
},
89+
{
90+
files: ['*.vue'],
91+
rules: {
92+
'vue/html-self-closing': [
93+
'error',
94+
{
95+
html: {
96+
void: 'always',
97+
normal: 'any',
98+
component: 'always',
99+
},
100+
svg: 'always',
101+
math: 'always',
102+
},
103+
],
104+
// allow TypeScript method signature overloading, see https://github.com/typescript-eslint/typescript-eslint/issues/291
105+
'no-dupe-class-members': 'off',
106+
},
107+
},
108+
],
109+
};

.github/workflows/cleanup.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Cleanup
2+
3+
on:
4+
schedule:
5+
- cron: '0 1 * * *' # every day at 1am
6+
7+
jobs:
8+
remove-old-artifacts:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 10
11+
12+
steps:
13+
- name: Remove old artifacts
14+
uses: c-hive/gha-remove-artifacts@v1
15+
with:
16+
age: '1 days' # delete artifacts older than this
17+
skip-tags: false # don't treat artifacts created by runs on tagged commits any differently
18+
skip-recent: 2 # keep the last 2 runs, regardless of age

.github/workflows/publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
#
9+
# npm job
10+
#
11+
npm:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Use Node.js 12.x
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '12.x'
20+
always-auth: true
21+
registry-url: https://registry.npmjs.org
22+
# Dependencies
23+
- id: cache_npm
24+
name: Cache Node.js modules
25+
uses: actions/cache@v2
26+
with:
27+
path: |
28+
~/.npm
29+
./node_modules.tar.zstd
30+
key: ${{ runner.OS }}-npm-${{ hashFiles('**/package-lock.json') }}
31+
restore-keys: |
32+
${{ runner.OS }}-npm-
33+
${{ runner.OS }}-
34+
- name: Install dependencies with NPM
35+
if: steps.cache_npm.outputs.cache-hit != 'true'
36+
run: npm ci
37+
env:
38+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
39+
- name: Unarchive node_modules
40+
if: steps.cache_npm.outputs.cache-hit == 'true'
41+
run: tar --use-compress-program "zstd -d --long=31" -xf node_modules.tar.zstd
42+
# Build
43+
- name: Build application
44+
run: npm run build
45+
env:
46+
CI: true
47+
- name: Check build worked correctly
48+
run: |
49+
if [ ! -f ./dist/index.js ]; then
50+
echo "Something went wrong: no ./dist/index.js file was built!"
51+
exit 1
52+
else
53+
echo "Build appears to be successful: ./dist/index.js was created"
54+
fi
55+
# Publish
56+
- name: Copy extra files into dist directory
57+
run: cp package.json README* dist/
58+
- name: Publish release to NPM registry
59+
run: npm publish dist
60+
env:
61+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISHING }}

.github/workflows/test.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Test
2+
3+
on: [push]
4+
5+
jobs:
6+
#
7+
# dependencies job
8+
#
9+
dependencies:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Use Node.js 12.x
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: '12.x'
18+
always-auth: true
19+
registry-url: https://registry.npmjs.org
20+
- id: cache_npm
21+
name: Cache Node.js modules
22+
uses: actions/cache@v2
23+
with:
24+
path: |
25+
~/.npm
26+
./node_modules.tar.zstd
27+
key: ${{ runner.OS }}-npm-${{ hashFiles('**/package-lock.json') }}
28+
restore-keys: |
29+
${{ runner.OS }}-npm-
30+
${{ runner.OS }}-
31+
- name: Install dependencies with NPM
32+
if: steps.cache_npm.outputs.cache-hit != 'true'
33+
run: npm ci
34+
env:
35+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
36+
- name: Archive node_modules
37+
if: steps.cache_npm.outputs.cache-hit != 'true'
38+
run: tar --use-compress-program "zstd -T0 --long=31 -1" -cf node_modules.tar.zstd -P node_modules
39+
- name: Persisting node_modules artifact
40+
uses: actions/upload-artifact@v2
41+
with:
42+
name: node_modules.tar.zstd
43+
path: node_modules.tar.zstd
44+
45+
#
46+
# lint job
47+
#
48+
lint:
49+
runs-on: ubuntu-latest
50+
needs: [dependencies]
51+
52+
steps:
53+
# Setup
54+
- uses: actions/checkout@v2
55+
- name: Use Node.js 12.x
56+
uses: actions/setup-node@v2
57+
with:
58+
node-version: '12.x'
59+
always-auth: true
60+
registry-url: https://registry.npmjs.org
61+
- name: Restore node_modules artifact
62+
uses: actions/download-artifact@v2
63+
with:
64+
name: node_modules.tar.zstd
65+
- name: Unarchive node_modules
66+
run: tar --use-compress-program "zstd -d --long=31" -xf node_modules.tar.zstd
67+
# ESLint
68+
- name: Lint source code
69+
run: npm run lint
70+
71+
#
72+
# build job
73+
#
74+
build:
75+
runs-on: ubuntu-latest
76+
needs: [dependencies]
77+
78+
steps:
79+
# Setup
80+
- uses: actions/checkout@v2
81+
- name: Use Node.js 12.x
82+
uses: actions/setup-node@v2
83+
with:
84+
node-version: '12.x'
85+
always-auth: true
86+
registry-url: https://registry.npmjs.org
87+
- name: Restore node_modules artifact
88+
uses: actions/download-artifact@v2
89+
with:
90+
name: node_modules.tar.zstd
91+
- name: Unarchive node_modules
92+
run: tar --use-compress-program "zstd -d --long=31" -xf node_modules.tar.zstd
93+
# Build
94+
- name: Build application
95+
run: npm run build
96+
env:
97+
CI: true
98+
- name: Check build worked correctly
99+
run: |
100+
if [ ! -f ./dist/index.js ]; then
101+
echo "Something went wrong: no ./dist/index.js file was built!"
102+
exit 1
103+
else
104+
echo "Build appears to be successful: ./dist/index.js was created"
105+
fi
106+
107+
#
108+
# test job
109+
#
110+
test:
111+
runs-on: ubuntu-latest
112+
needs: [build, lint]
113+
114+
steps:
115+
# Setup
116+
- uses: actions/checkout@v2
117+
- name: Restore node_modules artifact
118+
uses: actions/download-artifact@v2
119+
with:
120+
name: node_modules.tar.zstd
121+
- name: Unarchive node_modules
122+
run: tar --use-compress-program "zstd -d --long=31" -xf node_modules.tar.zstd
123+
# Tests
124+
- name: Run project tests
125+
run: node_modules/.bin/dotenv -e .env.ci -- npm run test:ci
126+
env:
127+
CI: true
128+
- if: always()
129+
name: Persisting test-results.html artifact
130+
uses: actions/upload-artifact@v2
131+
with:
132+
name: test-results.html
133+
path: test/.results/test-results.html

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Build files
2+
dist/
3+
4+
# Node modules
5+
node_modules
6+
7+
# Environment variables, never commit these
8+
.env
9+
.env.*
10+
11+
# Example and CI environments should be committed
12+
!*.example
13+
!.env.ci
14+
!.env.staging
15+
16+
# When npm runs error it write logs to the below file
17+
npm-debug.log
18+
19+
# ESLint cache file
20+
.eslintcache
21+
22+
# IDE
23+
.idea
24+
.graphqlconfig
25+
26+
# Operating System files
27+
.DS_Store

.np-config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"contents": "dist",
3+
"publish": false,
4+
"yarn": false,
5+
"cleanup": false,
6+
"tests": false
7+
}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14.16.0

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"arrowParens": "avoid",
6+
"printWidth": 120
7+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# vue-apollo-smart-ops
2+
3+
Create TypeScript-typed operation functions for your Vue Apollo queries and mutations.

0 commit comments

Comments
 (0)