-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from mailjet/version_4
Version 4
- Loading branch information
Showing
178 changed files
with
16,985 additions
and
9,783 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,65 @@ | ||
{ | ||
"env": { | ||
"es2021": true, | ||
"node": true, | ||
"browser": true, | ||
"commonjs": true, | ||
"mocha": true | ||
}, | ||
"extends": [ | ||
"airbnb-base" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 12 | ||
}, | ||
"settings": { | ||
"import/resolver": { | ||
"typescript": {}, | ||
"node": { | ||
"extensions": [".js", ".ts"] | ||
} | ||
} | ||
}, | ||
"ignorePatterns": ["dist/**", "docs/**", "examples/**"], | ||
"rules": { | ||
"tsdoc/syntax": "warn", | ||
"indent": ["error", 2, { "SwitchCase": 1 }], | ||
"semi": ["error", "always"], | ||
"quotes": ["error", "single"], | ||
"linebreak-style": ["error", "unix"], | ||
"spaced-comment": "off", | ||
"func-names": "off", | ||
"no-shadow": "off", | ||
"class-methods-use-this": "off", | ||
"dot-notation": "off", | ||
"no-param-reassign": ["error", { "props": false }], | ||
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts"], | ||
"extends": [ | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"rules": { | ||
"import/extensions": 0, | ||
"@typescript-eslint/no-shadow": ["error"], | ||
"@typescript-eslint/ban-types": [ | ||
"error", | ||
{ | ||
"extendDefaults": true, | ||
"types": { | ||
"{}": false | ||
} | ||
} | ||
] | ||
}, | ||
"plugins": [ | ||
"eslint-plugin-tsdoc", | ||
"@typescript-eslint" | ||
] | ||
} | ||
] | ||
} |
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 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
# $1 - file path to temp file with commit message | ||
npx --no-install 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 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run pkg:precommit |
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 |
---|---|---|
|
@@ -5,6 +5,10 @@ node_modules/ | |
# Internal lib data | ||
examples/ | ||
test/ | ||
webpack/ | ||
|
||
# Coverage directory | ||
.coverage | ||
|
||
# Docs | ||
docs/ |
Empty file.
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,64 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const childProcess = require('child_process'); | ||
|
||
const DIST_PATH = path.join(__dirname, './dist'); | ||
|
||
function readJSONFile(filePath) { | ||
const source = fs.readFileSync(filePath).toString('utf-8'); | ||
return JSON.parse(source); | ||
} | ||
|
||
function changePackageData(packageData) { | ||
delete packageData.scripts; | ||
delete packageData.directories; | ||
delete packageData.devDependencies; | ||
delete packageData['standard-version']; | ||
|
||
packageData.private = false; | ||
packageData.files = ['*']; | ||
|
||
Object | ||
.entries(packageData) | ||
.forEach(([key, value]) => { | ||
if (key === 'typescript') { | ||
packageData[key].definition = value.definition.replace('./dist/', './'); | ||
} else if (typeof value === 'string' && value.startsWith('./dist/')) { | ||
packageData[key] = value.replace('./dist/', './'); | ||
} | ||
}); | ||
} | ||
|
||
function changePackageLockData(packageLockData) { | ||
delete packageLockData.packages; | ||
} | ||
|
||
function main() { | ||
// ts declarations | ||
if (fs.existsSync(path.join(DIST_PATH, './declarations'))) { | ||
fs.rmSync(path.join(DIST_PATH, './declarations'), { recursive: true }); | ||
} | ||
fs.renameSync(path.join(DIST_PATH, './lib'), path.join(DIST_PATH, './declarations')); | ||
|
||
// package.json | ||
const packageData = readJSONFile(path.join(__dirname, './package.json')); | ||
changePackageData(packageData); | ||
|
||
// common files | ||
fs.writeFileSync(path.join(DIST_PATH, './package.json'), Buffer.from(JSON.stringify(packageData, null, 2), 'utf-8').toString()); | ||
fs.writeFileSync(path.join(DIST_PATH, './VERSION.md'), Buffer.from(packageData.version, 'utf-8').toString()); | ||
|
||
fs.copyFileSync(path.join(__dirname, 'LICENSE'), path.join(DIST_PATH, './LICENSE')); | ||
fs.copyFileSync(path.join(__dirname, 'README.md'), path.join(DIST_PATH, './README.md')); | ||
fs.copyFileSync(path.join(__dirname, 'CHANGELOG.md'), path.join(DIST_PATH, './CHANGELOG.md')); | ||
|
||
// package-lock.json | ||
childProcess.execSync('npm i --prefix ./dist/ --package-lock-only'); | ||
|
||
const packageLockData = readJSONFile(path.join(DIST_PATH, './package-lock.json')); | ||
changePackageLockData(packageLockData); | ||
|
||
fs.writeFileSync(path.join(DIST_PATH, './package-lock.json'), Buffer.from(JSON.stringify(packageLockData, null, 2), 'utf-8').toString()); | ||
} | ||
|
||
main(); |
Oops, something went wrong.