Skip to content

Commit

Permalink
switch to microbundle build
Browse files Browse the repository at this point in the history
  • Loading branch information
ivandotv committed Dec 9, 2021
1 parent 103f71d commit 5328e10
Show file tree
Hide file tree
Showing 15 changed files with 1,489 additions and 2,136 deletions.
6 changes: 6 additions & 0 deletions .changeset/wild-ravens-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'dumba': patch
---

Switch to microbundle build.
Fix Eslint errors.
25 changes: 16 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
branches:
- master
- develop
jobs:
build:
name: Node unit tests
Expand All @@ -28,19 +29,25 @@ jobs:
with:
node-version: ${{ matrix.node }}

- name: Install pnpm
run: curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6

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

- name: Lint source
run: |
pnpm lint:ci
- name: Check types
- name: Build packages
if: matrix.node != 12
run: |
pnpm build
- name: Build packages for Node V12 only
if: matrix.node == 12
run: |
pnpm type:check
pnpm build -- --filter=!docs
- name: Run tests
run: |
Expand All @@ -55,9 +62,9 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: 'Publish to NPM'
- name: 'Consume changesets'
if: github.event_name == 'push' && github.repository == 'ivandotv/dumba' && matrix.node == 16 && github.ref == 'refs/heads/master'
uses: changesets/action@master
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
Expand All @@ -69,7 +76,7 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 'Generate docs'
if: steps.changesets.outputs.published == 'true'
run: pnpm docs
run: pnpm gen:docs

- name: Commit docs
if: steps.changesets.outputs.published == 'true'
Expand Down
21 changes: 18 additions & 3 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
coverage:
status:
project:
default:
target: auto
dumba:
target: auto
flags:
- dumba

comment:
layout: 'reach, diff, flags, files'
behavior: default
require_changes: false
require_base: true
require_head: true

flags:
# filter the folder(s) you wish to measure by that flag
dumba:
# only include files in the backend folder
carryforward: true
paths:
- packages/dumba/
carryforward: true
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@
"lint": "pnpm multi run lint",
"lint:ci": "pnpm multi run lint:ci",
"type:build": "pnpm multi run type:build",
"type:check": "pnpm multi run type:check",
"build": "pnpm multi run build",
"prepare": "husky install",
"release": "pnpm multi run prepublishOnly --workspace-concurrency 1 && pnpm changeset publish"
},
"dependencies": {
"husky": "^7.0.2",
"lint-staged": "^11.1.2"
"husky": "^7.0.4",
"lint-staged": "^12.1.2"
},
"devDependencies": {
"@changesets/cli": "^2.17.0",
"async": "^3.2.1",
"@changesets/cli": "^2.18.1",
"del": "^6.0.0",
"minimist": "^1.2.5"
}
Expand Down
51 changes: 51 additions & 0 deletions packages/dumba/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* 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',
{
allowDeclareFields: true
}
]
],
ignore: ['node_modules'],
sourceMaps: 'inline'
}

module.exports = process.env.NODE_ENV === 'test' ? jestConfig : config
213 changes: 0 additions & 213 deletions packages/dumba/babel.config.js

This file was deleted.

Loading

0 comments on commit 5328e10

Please sign in to comment.