Skip to content

Commit

Permalink
chore: init
Browse files Browse the repository at this point in the history
  • Loading branch information
fmal committed Oct 9, 2019
0 parents commit 969891d
Show file tree
Hide file tree
Showing 25 changed files with 11,593 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": ["fmal", "fmal/babel", "fmal/import", "fmal/typescript"]
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# auto-generated stuff
coverage
dist
node_modules
.eslintcache
packages/**/package-lock.json

# cruft
.DS_Store
npm-debug.log
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact = true
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
dist
coverage
__fixtures__
__mocks__
CHANGELOG.md
package-lock.json
3 changes: 3 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
Empty file added @types/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# monorepo

📦 A monorepo for my NPM libraries.
Managed with [repo-cooker](https://github.com/cerebral/repo-cooker) library.
Using [Jest](https://github.com/facebook/jest), [eslint](https://github.com/eslint/eslint), [prettier](https://github.com/prettier/prettier) and TypeScript through [babel](https://github.com/babel/babel) 7. Semantically versioned and automatically released, following [conventional-commits](https://github.com/conventional-commits/conventionalcommits.org)!

## 🛠 Tasks

- `npm run commit`: guide you through creating commits with correct commit messages
- `npm run checkdeps`: check if all dependencies are correctly installed and in sync
- `npm run fixdeps`: add missing dependencies to the monorepo when you add or upgrade dependencies for your packages
- `npm test`: run the tests for all packages
- `npm run test:coverage` run tests across packages and output coverage
- `npm run lint`: check for linting errors
- `npm run typecheck`: check if the types of your packages are correct
- `npm run build` compile source for all packages
- `npm run release` build & publish using `repo-cooker --release`
- `npm run link` an alias for `repo-cooker --link` which symlinks dependencies. This is automatically run through the `postinstall` hook when you do `npm install`

To compile source or run tests for an individual package, `npm run build` or `npm run test` from the package root.
38 changes: 38 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
'use strict'; // eslint-disable-line strict

const MIN_IE_VERSION = 11;

// eslint-disable-next-line import/no-commonjs
module.exports = api => {
const isTest = api.cache(() => process.env.NODE_ENV === 'test');
const babelEnv = api.cache(() => process.env.BABEL_ENV);
const isNodeTarget = api.cache(() => process.env.BABEL_TARGET === 'node');

const envTargets =
isTest || isNodeTarget ? { node: 'current' } : { ie: MIN_IE_VERSION };

const envOpts = {
loose: true,
modules: babelEnv === 'cjs' || isTest ? 'commonjs' : false,
targets: envTargets
};

const presets = [['@babel/preset-env', envOpts], '@babel/typescript'];

const plugins = [
['@babel/plugin-proposal-class-properties', { loose: true }],
!isNodeTarget && [
'@babel/plugin-transform-runtime',
{
regenerator: false,
useESModules: babelEnv === 'es'
}
]
].filter(Boolean);

return {
presets,
plugins,
ignore: babelEnv === 'cjs' || babelEnv === 'es' ? ['**/__tests__/**'] : []
};
};
16 changes: 16 additions & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict'; // eslint-disable-line strict

const isCI = Boolean(process.env.CI);

// eslint-disable-next-line import/no-commonjs
module.exports = {
roots: ['<rootDir>/src'],
collectCoverageFrom: ['src/**/*.{js,ts}', '!**/*.d.ts', '!**/__tests__/**'],
coverageDirectory: '<rootDir>/coverage',
collectCoverage: isCI,
coverageReporters: ['text', isCI && 'lcov'].filter(Boolean),
bail: isCI,
transform: {
'^.+\\.(js|tsx?)$': ['babel-jest', { rootMode: 'upward' }]
}
};
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'; // eslint-disable-line strict

// eslint-disable-next-line import/no-commonjs
const baseConfig = require('./jest.config.base');

// eslint-disable-next-line import/no-commonjs
module.exports = {
...baseConfig,
roots: ['<rootDir>'],
projects: ['<rootDir>/packages/@fmal/*']
};
Loading

0 comments on commit 969891d

Please sign in to comment.