Skip to content

Commit

Permalink
Merge pull request #5 from nodecfdi/dev
Browse files Browse the repository at this point in the history
Version bump 1.2.0
  • Loading branch information
luffynando authored Jul 5, 2022
2 parents b0a74c1 + 2f0d9b4 commit de6fcac
Show file tree
Hide file tree
Showing 70 changed files with 9,931 additions and 715 deletions.
46 changes: 46 additions & 0 deletions .babelrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const pkg = require('./package.json');
const { execSync } = require('child_process');

const pkgVersion = process.env.PKG_VERSION || pkg.version;
const nodeEnv = process.env.NODE_ENV || 'production';

const buildDate = execSync('git show -s --format=%ci HEAD')
.toString()
.replace(/[\r\n]+$/, '');

const commitSha = execSync('git rev-parse --short HEAD')
.toString()
.replace(/[\r\n]+$/, '');

const replacements = {
'__VERSION__': pkgVersion,
'__BUILD_DATE__': buildDate,
'__COMMIT_SHA__': commitSha,
'process.env.NODE_ENV': nodeEnv,
};

const plugins = ['dev-expression', ['transform-define', replacements]];

//default babel config
const config = { plugins };

//babel config for Jest tests
const jestConfig = {
plugins,
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
'@babel/preset-typescript',
],
ignore: ['node_modules'],
sourceMaps: 'inline',
};

module.exports = process.env.NODE_ENV === 'test' ? jestConfig : config;
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
10 changes: 9 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
7 changes: 4 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
dist
build
docs

jest.config.js
examples
coverage
web_modules
tsconfig.json
62 changes: 0 additions & 62 deletions .eslintrc

This file was deleted.

89 changes: 89 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
module.exports = {
root: true,
env: {
// commonjs: true,
es6: true,
node: true,
jest: true,
},
globals: {
__DEV__: true,
__VERSION__: true,
__COMMIT_SHA__: true,
__BUILD_DATE__: true,
},
plugins: ['@typescript-eslint/eslint-plugin', 'eslint-plugin-tsdoc', 'prettier'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:jest/recommended', 'prettier'],
parser: '@typescript-eslint/parser',
reportUnusedDisableDirectives: true,
parserOptions: {
/* enabling "project" field is a performance hit
https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md#performance
*/
sourceType: 'module',
},
rules: {
'indent': 'off',
'tsdoc/syntax': 'warn',
'@typescript-eslint/no-unused-vars': [2, { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'semi': 'error',
'quote-props': ['error', 'consistent'],
'generator-star-spacing': ['error', { before: false, after: true }],
'space-before-function-paren': 'off',
'no-dupe-class-members': 'off',
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': 'off',
'prettier/prettier': ['error'],
'lines-between-class-members': ['error', 'always'],
'padding-line-between-statements': ['error', { blankLine: 'always', prev: '*', next: 'return' }],
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
},
],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'explicit',
overrides: {
constructors: 'no-public',
},
},
],
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-expect-error': 'allow-with-description',
},
],
'@typescript-eslint/no-non-null-assertion': [2],
'@typescript-eslint/no-explicit-any': [2, { ignoreRestArgs: true }],
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
multilineDetection: 'brackets',
},
],
'@typescript-eslint/indent': ['error', 4],
'@typescript-eslint/no-empty-interface': 'off',
},
overrides: [
{
files: ['*.js', '*.jsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
},
],
};
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Auto detect text files and perform LF normalization
* text=auto

# Do not put this files on a distribution package
/.changeset/ export-ignore
/.github/ export-ignore
/.husky/ export-ignore
/.vscode/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/sonar-project.properties export-ignore
/assets/ export-ignore

# Do not count these files on github code language
/tests/_files/** linguist-detectable=false
/docs/** linguist-detectable=false
/.husky/** linguist-detectable=false
*.cjs linguist-detectable=false
/examples/** linguist-detectable=false
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: build
on:
push:
branches:
- '*'
pull_request:
branches:
- main
- dev
schedule:
- cron: '0 16 * * 0' # sunday 16:00

jobs:
build:
name: Node unit tests
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14', '16', '17', '18']
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache .pnpm-store
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
uses: pnpm/[email protected]
with:
version: 6.23.6
run_install: true

- name: Lint source
run: |
pnpm lint:ci
- name: Build package
run: |
pnpm build
- name: Run tests
run: |
pnpm test:ci
env:
CI: true

- name: 'Consume changesets'
if: github.event_name == 'push' && matrix.node == 16 && github.ref == 'refs/heads/main'
uses: changesets/action@v1
id: 'changesets'
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
commit: 'chore: version bump'
title: Next release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: 'Generate docs'
if: steps.changesets.outputs.published == 'true'
run: pnpm gen:docs

- name: Commit docs
if: steps.changesets.outputs.published == 'true'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'docs: generate docs'
40 changes: 0 additions & 40 deletions .github/workflows/main.yml

This file was deleted.

Loading

0 comments on commit de6fcac

Please sign in to comment.