Skip to content

Commit 795d7b8

Browse files
authored
fix: remove circular dep warning and switch from travis to GH actions (#350)
1 parent f9d55ed commit 795d7b8

File tree

10 files changed

+68
-34
lines changed

10 files changed

+68
-34
lines changed

.gitattributes

-1
This file was deleted.

.github/workflows/build.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build
2+
on: [push]
3+
jobs:
4+
build:
5+
name: build
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
with:
10+
ref: ${{ github.head_ref }}
11+
- uses: actions/setup-node@v2
12+
with:
13+
node-version: '14'
14+
registry-url: 'https://registry.npmjs.org'
15+
- run: git diff --quiet
16+
- run: npm install
17+
- run: npm link
18+
- run: cd $GITHUB_WORKSPACE/examples/dev-expressions && klap build
19+
- run: cd $GITHUB_WORKSPACE/examples/dynamic-imports && klap build
20+
- run: cd $GITHUB_WORKSPACE/examples/jsx-runtime && klap build
21+
- run: cd $GITHUB_WORKSPACE/examples/minimal && klap build
22+
- run: cd $GITHUB_WORKSPACE/examples/react-component && klap build
23+
- run: cd $GITHUB_WORKSPACE/examples/react-sc-typescript && klap build
24+
- run: cd $GITHUB_WORKSPACE/examples/react-typescript && klap build
25+
- run: cd $GITHUB_WORKSPACE/examples/scaffold && klap build
26+
- run: cd $GITHUB_WORKSPACE/examples/scaffold-typescript && klap build
27+
- run: cd $GITHUB_WORKSPACE/examples/typedefs && klap build
28+
- run: npm run format
29+
- run: git diff --quiet
30+
- run: npm run semantic-release
31+
env:
32+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33+

.travis.yml

-22
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## a zero config, zero dependency bundler for tiny javascript packages.
44

55
<!-- prettier-ignore-start -->
6-
[![Build Status](https://img.shields.io/travis/osdevisnot/klap/master?style=flat-square)](https://travis-ci.org/osdevisnot/klap)
6+
[![Build Status](https://github.com/osdevisnot/klap/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/osdevisnot/klap/actions/workflows/build.yml)
77
![David](https://img.shields.io/david/osdevisnot/klap?style=flat-square)
88
![David](https://img.shields.io/david/dev/osdevisnot/klap?style=flat-square)
99
![npm](https://img.shields.io/npm/v/klap?style=flat-square)

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"build": "ncc build src/klap.js -e typescript -mo dist",
1919
"prepare": "npm run build",
2020
"semantic-release": "semantic-release",
21+
"format": "prettier --write 'examples/**/dist/*.js'",
2122
"presetup": "git clean -fdX",
2223
"setup": "npm install",
2324
"test": "echo 'run ./test.sh'",
@@ -67,8 +68,8 @@
6768
"@rollup/plugin-replace": "3.0.0",
6869
"@rollup/plugin-typescript": "8.2.5",
6970
"@rollup/pluginutils": "4.1.1",
70-
"@types/node": "16.4.13",
71-
"@vercel/ncc": "0.29.0",
71+
"@types/node": "16.6.1",
72+
"@vercel/ncc": "0.29.1",
7273
"babel-plugin-codegen": "4.1.4",
7374
"babel-plugin-dev-expression": "0.2.2",
7475
"babel-plugin-macros": "3.1.0",
@@ -82,15 +83,15 @@
8283
"mkdirp": "1.0.4",
8384
"patch-package": "6.4.7",
8485
"pretty-bytes": "5.6.0",
85-
"rollup": "2.56.0",
86+
"rollup": "2.56.2",
8687
"rollup-plugin-dts": "3.0.2",
8788
"rollup-plugin-polyfill-node": "0.7.0",
8889
"semantic-release": "17.4.4",
8990
"servor": "4.0.2",
9091
"sort-package-json": "1.50.0",
9192
"terser": "5.7.1",
9293
"typescript": "^4.3.5",
93-
"xo": "0.43.0",
94+
"xo": "0.44.0",
9495
"xo-quick": "0.0.8"
9596
}
9697
}

release.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
branches: ['master'],
3+
plugins: [
4+
[
5+
'@semantic-release/commit-analyzer',
6+
{
7+
preset: 'angular',
8+
releaseRules: [
9+
{ type: 'build(deps-dev)', release: 'patch' },
10+
{ type: 'refactor', release: 'patch' },
11+
{ type: 'fix', release: 'patch' },
12+
{ type: 'perf', release: 'patch' },
13+
{ type: 'feat', release: 'minor' },
14+
],
15+
},
16+
],
17+
],
18+
}

src/init.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const writePackage = async (ext, { user, email }) => {
7171
types: `dist/${name}.d.ts`,
7272
source,
7373
sideEffects: false,
74-
files: ['dist'],
74+
files: ['dist', 'src'],
7575
scripts: {
7676
build: 'klap build',
7777
prepublishOnly: 'klap build',

src/klap.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { getOptions } from './options.js'
44
import { plugins, dtsPlugins } from './plugins.js'
55
import { exists, read } from './utils.js'
66

7-
const defaultInputOptions = { inlineDynamicImports: true }
7+
const defaultInputOptions = {
8+
inlineDynamicImports: true,
9+
onwarn: (warning, warn) => warning.code !== 'CIRCULAR_DEPENDENCY' && warn(warning),
10+
}
11+
812
const defaultOutputOptions = { esModule: false, strict: false, freeze: false }
913

1014
const validateConfig = (inputOptions, outputOptions) => {
@@ -163,7 +167,7 @@ const klap = async (command, pkg) => {
163167
break
164168
case 'prod':
165169
config = await startConfig(command, pkg, options)
166-
build(config.outputOptions, config.inputOptions)
170+
await build(config.outputOptions, config.inputOptions)
167171
break
168172
default:
169173
error('Unknown command :', command)

src/packages/sizeme.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import { info } from '../logger.js'
1212
export const sizeme = () => {
1313
const showSize = (bundle) => {
1414
const { code, fileName } = bundle
15-
const size = prettyBytes(gzip.sync(code))
16-
info(`\t${size}\t${fileName}`)
15+
const size = gzip.sync(code)
16+
const pretty = prettyBytes(gzip.sync(code))
17+
info(`\t${pretty}\t(${size})\t${fileName}`)
1718
}
1819

1920
return {

test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ npm link
55
cd examples
66
for dir in $(ls | grep -v const-enums)
77
do
8-
cd ${dir} && yarn install --prod --silent && klap build && rm -rf dist/*.map && cd ..
8+
cd "${dir}" && yarn install --prod --silent && klap build && rm -rf dist/*.map && cd ..
99
done
1010
yarn prettier --write "examples/**/dist/*.js"

0 commit comments

Comments
 (0)