refactor: update baseurl for import, create subfolders (#12)

This commit is contained in:
r1oga
2023-01-17 23:06:32 +01:00
committed by GitHub
parent c41d5f0c4a
commit 12d6573020
19 changed files with 28 additions and 24 deletions

View File

@@ -1 +1,7 @@
extends: ['@r1oga']
overrides:
- files: ['scripts/*.ts']
rules:
no-console: off
'@typescript-eslint/restrict-template-expressions': off
'@typescript-eslint/ban-ts-comment': off

View File

@@ -1,7 +1,7 @@
import 'cross-fetch/polyfill'
import { Request, Response } from 'express'
import { getGhGroup } from '../src'
import { getGhGroup } from 'gh/get-gh-group'
export default async (_: Request, res: Response) => {
try {

View File

@@ -1,7 +1,7 @@
import 'cross-fetch/polyfill'
import { Request, Response } from 'express'
import { getGhOrgs } from '../src/get-gh-orgs'
import { getGhOrgs } from 'snapshot/get-gh-orgs'
export default async (_: Request, res: Response) => {
try {

View File

@@ -1,7 +1,7 @@
import 'cross-fetch/polyfill'
import { Request, Response } from 'express'
import { get100TopDaosWithMin10kFollowers } from '../src/get-spaces'
import { get100TopDaosWithMin10kFollowers } from 'snapshot/get-spaces'
export default async (_: Request, res: Response) => {
try {

View File

@@ -1,4 +1,4 @@
import { getGhGroup } from '../src'
import { getGhGroup } from 'gh/get-gh-group'
const main = async () => {
console.log('Fetching gh group (top 100 DAOs with >= 10_000 followers)...')

View File

@@ -1,7 +1,7 @@
import { hideBin } from 'yargs/helpers'
import yargs from 'yargs/yargs'
import { getSpaces } from '../src/get-spaces'
import { getSpaces } from 'snapshot/get-spaces'
const options = {
maxOrgs: {

View File

@@ -1,6 +1,6 @@
import { ok } from 'assert'
import { URLS } from './constants'
import committersQuery from './graphql/committers-query'
import committersQuery from 'graphql/committers-query'
import { URLS } from '../constants'
const parseDate = (date: Date) => date.toISOString().split('.')[0] + 'Z'

View File

@@ -1,5 +1,5 @@
import { getGhOrgs } from 'snapshot/get-gh-orgs'
import { getCommittersByOrg } from './get-commiters-by-org'
import { getGhOrgs } from './get-gh-orgs'
const minusOneMonth = (date: Date) =>
new Date(new Date().setMonth(date.getMonth() - 1))

View File

@@ -1 +0,0 @@
export * from './get-gh-group'

View File

@@ -1,6 +1,6 @@
import { CHUNK_SIZE, URLS } from './constants'
import spacesGqlQuery from 'graphql/spaces-gql-query'
import { CHUNK_SIZE, URLS } from '../constants'
import { getSpaces } from './get-spaces'
import spacesGqlQuery from './graphql/spaces-gql-query'
const split = (arr: string[]) => {
const chunks = []

View File

@@ -1,5 +1,5 @@
import { URLS } from './constants'
import { Space } from './types'
import { URLS } from '../constants'
import { Space } from '../types'
export const filterSpaces =
(minFollowers: number) =>

View File

@@ -9,6 +9,7 @@ const jestConfig: JestConfigWithTsJest = {
'./test/jest.prettier.ts',
'./test/jest.unit.ts',
],
testTimeout: 20_000,
watchPlugins: [
'jest-watch-select-projects',
'jest-watch-typeahead/filename',

View File

@@ -14,9 +14,8 @@ const jestUnitConfig: JestConfigWithTsJest = {
},
},
displayName: 'unit',
moduleDirectories: ['node_modules', __dirname],
moduleFileExtensions: ['ts', 'js', 'json'],
moduleDirectories: ['node_modules', '<rootDir>/src'],
moduleFileExtensions: ['js', 'ts'],
preset: 'ts-jest',
setupFilesAfterEnv: ['jest-chain', './test/setup.ts'],
}

View File

@@ -1,4 +1,4 @@
import { filterSpaces } from '../../src/get-spaces'
import { filterSpaces } from 'snapshot/get-spaces'
describe('filterSpaces', () => {
it('should return true if followers is greater than min', () => {

View File

@@ -1,4 +1,4 @@
import { getCommittersByOrg } from '../../src/get-commiters-by-org'
import { getCommittersByOrg } from 'gh/get-commiters-by-org'
describe('getCommitters', () => {
it('should return a list of committers', async () => {

View File

@@ -1,6 +1,4 @@
import { getGhGroup } from '../../src/get-gh-group'
jest.setTimeout(20_000)
import { getGhGroup } from 'gh/get-gh-group'
describe('getGhGroup', () => {
it('should return a list of users', async () => {
@@ -12,6 +10,7 @@ describe('getGhGroup', () => {
expect(user.includes('[bot]')).toBeFalsy()
})
// no duplicates
// eslint-disable-next-line @typescript-eslint/require-array-sort-compare
expect(Array.from(new Set(users)).sort()).toEqual(users.sort())
})
})

View File

@@ -1,4 +1,4 @@
import { getGhOrgs } from '../../src/get-gh-orgs'
import { getGhOrgs } from '../../src/snapshot/get-gh-orgs'
describe('get-gh-orgs', () => {
it('should return an array of github orgs', async () => {

View File

@@ -1,7 +1,7 @@
import {
get100TopDaosWithMin10kFollowers,
getSpaces,
} from '../../src/get-spaces'
} from '../../src/snapshot/get-spaces'
describe('getSpaces', () => {
it('should return an array of spaces', async () => {

View File

@@ -4,7 +4,7 @@
"files": ["node_modules/jest-chain/types/index.d.ts"],
"compilerOptions": {
"noEmit": true,
"baseUrl": ".",
"baseUrl": "./src",
"sourceRoot": "src",
"target": "ESNext",
"module": "commonjs",