-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup repo structure and dev workflow (#1)
- Loading branch information
1 parent
24543c7
commit d96f3b0
Showing
25 changed files
with
7,405 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
'jest/globals': true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
project: "packages/*/tsconfig.json", | ||
sourceType: 'module', | ||
tsconfigRootDir: __dirname, | ||
}, | ||
plugins: [ | ||
'@typescript-eslint', | ||
'jest', | ||
], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
'plugin:jest/recommended', | ||
'prettier', | ||
], | ||
rules: { | ||
'@typescript-eslint/member-delimiter-style': 0, | ||
'@typescript-eslint/no-explicit-any': 0, | ||
'@typescript-eslint/semi': 0, | ||
'@typescript-eslint/space-before-function-paren': 0, | ||
'comma-dangle': 0, | ||
'new-cap': 0, | ||
'eol-last': [2, "always"], | ||
'no-multiple-empty-lines': [2, { max: 1, maxEOF: 0 }], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [12.x, 14.x, 16.x] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Check out git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install project dependencies | ||
run: | | ||
yarn install --frozen-lockfile | ||
- name: Build all packages | ||
run: | | ||
yarn build | ||
- name: Test all packages | ||
run: | | ||
yarn test | ||
- name: Lint all packages | ||
run: | | ||
yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/ | ||
|
||
dist/ | ||
esm | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn lint:staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"printWidth": 120, | ||
"proseWrap": "always", | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Amplitude-TypeScript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
transform: { | ||
'^.+\\.ts$': 'ts-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'json'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "independent", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,37 @@ | ||
{ | ||
"private": true | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"build": "lerna run build --stream", | ||
"fix": "lerna run fix --stream", | ||
"lint": "lerna run lint --stream", | ||
"lint:staged": "lint-staged", | ||
"postinstall": "husky install", | ||
"test": "lerna run test --stream" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^16.1.0", | ||
"@commitlint/config-conventional": "^16.0.0", | ||
"@types/jest": "^27.4.0", | ||
"@typescript-eslint/eslint-plugin": "^5.10.0", | ||
"@typescript-eslint/parser": "^5.10.0", | ||
"eslint": "^8.7.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-jest": "^25.7.0", | ||
"husky": "^7.0.4", | ||
"jest": "^27.4.7", | ||
"lerna": "^4.0.0", | ||
"lint-staged": "^12.2.2", | ||
"prettier": "^2.5.1", | ||
"ts-jest": "^27.1.3", | ||
"typescript": "^4.5.5" | ||
}, | ||
"lint-staged": { | ||
"*.ts": [ | ||
"eslint --fix", | ||
"prettier --write" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# @amplitude/core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const baseConfig = require('../../jest.config.js'); | ||
const package = require('./package'); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
displayName: package.name, | ||
rootDir: '.', | ||
testEnvironment: 'node', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "@amplitude/core", | ||
"version": "0.0.0", | ||
"description": "", | ||
"author": "Amplitude Inc", | ||
"homepage": "https://github.com/amplitude/Amplitude-TypeScript", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"module": "esm/index.js", | ||
"types": "dist/index.d.ts", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/amplitude/Amplitude-TypeScript.git" | ||
}, | ||
"scripts": { | ||
"build": "yarn build:es5 & yarn build:esm", | ||
"build:es5": "tsc -p ./tsconfig.es5.json", | ||
"build:esm": "tsc -p ./tsconfig.esm.json", | ||
"fix": "yarn fix:eslint & yarn fix:prettier", | ||
"fix:eslint": "eslint '{src,test}/**/*.ts' --fix", | ||
"fix:prettier": "prettier --write \"{src,test}/**/*.ts\"", | ||
"lint": "yarn lint:eslint & yarn lint:prettier", | ||
"lint:eslint": "eslint '{src,test}/**/*.ts'", | ||
"lint:prettier": "prettier --check \"{src,test}/**/*.ts\"", | ||
"test": "jest", | ||
"typecheck": "tsc -p ./tsconfig.json" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/amplitude/Amplitude-TypeScript/issues" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class AmplitudeCore {} | ||
|
||
export default AmplitudeCore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import AmplitudeCore from './AmplitudeCore'; | ||
|
||
export { AmplitudeCore }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import AmplitudeCore from '../src/AmplitudeCore'; | ||
|
||
describe('index', () => { | ||
describe('AmplitudeCore', () => { | ||
test('should instantiate AmplitudeCore', () => { | ||
const instance = new AmplitudeCore(); | ||
expect(instance).toBeDefined(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { AmplitudeCore } from '../src/index'; | ||
|
||
describe('index', () => { | ||
describe('AmplitudeCore', () => { | ||
test('should export AmplitudeCore', () => { | ||
const instance = new AmplitudeCore(); | ||
expect(instance).toBeDefined(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": ["src/**/*"], | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"noEmit": false, | ||
"outDir": "dist", | ||
"rootDir": "./src" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": ["src/**/*"], | ||
"compilerOptions": { | ||
"module": "es6", | ||
"noEmit": false, | ||
"outDir": "esm", | ||
"rootDir": "./src" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["src/**/*", "test/**/*"], | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"noEmit": true, | ||
"rootDir": "." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"compilerOptions": { | ||
"alwaysStrict": false, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"downlevelIteration": true, | ||
"inlineSources": true, | ||
"importHelpers": true, | ||
"lib": ["es6"], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"noEmitHelpers": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitUseStrict": true, | ||
"noImplicitThis": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"pretty": true, | ||
"sourceMap": true, | ||
"resolveJsonModule": true, | ||
"strict": true, | ||
"strictBindCallApply": true, | ||
"target": "es5", | ||
"types": ["jest"], | ||
} | ||
} |
Oops, something went wrong.