Skip to content

Commit

Permalink
fix: build files
Browse files Browse the repository at this point in the history
  • Loading branch information
dword-design committed Aug 23, 2020
1 parent 78ca57f commit 8771a16
Show file tree
Hide file tree
Showing 7 changed files with 1,642 additions and 1,311 deletions.
99 changes: 51 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,14 @@
name: build
on:
push:
branches:
- "**"
jobs:
cancel-existing:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@v0.2.2
env:
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test:
needs: cancel-existing
strategy:
matrix:
os:
- macos-latest
- windows-latest
- ubuntu-latest
node:
- 10
- 12
exclude:
- os: macos-latest
node: 10
- os: windows-latest
node: 10
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: git config --global user.email "actions@github.com"
- run: git config --global user.name "GitHub Actions"
- run: yarn --frozen-lockfile
- run: yarn test
- name: Coveralls
if: matrix.os == 'ubuntu-latest' && matrix.node == 12
run: yarn dw-ci coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
COVERALLS_GIT_COMMIT: ${{ github.sha }}
COVERALLS_GIT_BRANCH: ${{ github.ref }}
uses: rokroskar/workflow-run-cleanup-action@v0.2.2
release:
needs: test
if: github.ref == 'refs/heads/master'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -56,14 +18,55 @@ jobs:
- run: git config --global user.email "actions@github.com"
- run: git config --global user.name "GitHub Actions"
- run: yarn --frozen-lockfile
- run: yarn clean
- run: yarn lint
- name: Push changed files
run: yarn dw-ci push-changed-files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- env:
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Push changed files
run: yarn dw-ci push-changed-files
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
name: Release
run: yarn semantic-release
test:
needs: cancel-existing
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: git config --global user.email "actions@github.com"
- run: git config --global user.name "GitHub Actions"
- run: yarn --frozen-lockfile
- run: yarn clean
- run: yarn test
- env:
COVERALLS_GIT_BRANCH: ${{ github.ref }}
COVERALLS_GIT_COMMIT: ${{ github.sha }}
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
if: matrix.os == 'ubuntu-latest' && matrix.node == 12
name: Coveralls
run: yarn dw-ci coveralls
strategy:
matrix:
exclude:
- node: 10
os: macos-latest
- node: 10
os: windows-latest
node:
- 10
- 12
os:
- macos-latest
- windows-latest
- ubuntu-latest
name: build
on:
push:
branches:
- "**"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.DS_Store
/.babelrc.json
/.commitlintrc.json
/.cz.json
/.editorconfig
/.env.json
/.eslintrc.json
/.huskyrc.json
/.nyc_output
/.releaserc.json
/.test.env.json
Expand Down
8 changes: 5 additions & 3 deletions .renovaterc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"extends": [
":semanticCommits"
],
"labels": [
"maintenance"
],
"packageRules": [
{
"packagePatterns": [
Expand All @@ -20,7 +23,6 @@
}
],
"lockFileMaintenance": {
"enabled": true,
"schedule": "at any time"
"enabled": true
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"dist"
],
"scripts": {
"clean": "base clean",
"commit": "base commit",
"dev": "base dev",
"lint": "base lint",
Expand Down
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ import { paramCase } from 'param-case'
import P from 'path'

export default {
presets: [
[
getPackageName(require.resolve('@babel/preset-env')),
{ targets: { node: 10 } },
],
getPackageName(require.resolve('@vue/babel-preset-jsx')),
],
plugins: [
getPackageName(require.resolve('@babel/plugin-proposal-optional-chaining')),
[
Expand Down Expand Up @@ -49,4 +42,11 @@ export default {
},
],
],
presets: [
[
getPackageName(require.resolve('@babel/preset-env')),
{ targets: { node: 10 } },
],
getPackageName(require.resolve('@vue/babel-preset-jsx')),
],
}
102 changes: 51 additions & 51 deletions src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,25 @@ const runTest = config => {
}

export default {
'alias: valid': {
files: {
src: {
'bar/index.js': 'export default 1',
'foo/index.js': endent`
import bar from '@/src/bar'
export default bar
`,
},
},
test: () => expect(require(resolve('dist', 'foo'))).toEqual(1),
},
'alias: root': {
'alias: package.json': {
files: {
src: {
'foo.js': 'export default 1',
'.root': '',
'index.js': endent`
import foo from '@/foo'
export default foo
`,
'package.json': JSON.stringify({}),
},
},
test: () => expect(require(resolve('dist'))).toEqual(1),
},
'alias: package.json': {
'alias: root': {
files: {
src: {
'.root': '',
'foo.js': 'export default 1',
'package.json': JSON.stringify({}),
'index.js': endent`
import foo from '@/foo'
Expand All @@ -65,6 +52,7 @@ export default {
test: () => expect(require(resolve('dist'))).toEqual(1),
},
'alias: root behind cwd': {
cwd: 'sub',
files: {
'.root': '',
'sub/src': {
Expand All @@ -76,9 +64,21 @@ export default {
`,
},
},
cwd: 'sub',
test: () => expect(require(resolve('sub', 'dist'))).toEqual(1),
},
'alias: valid': {
files: {
src: {
'bar/index.js': 'export default 1',
'foo/index.js': endent`
import bar from '@/src/bar'
export default bar
`,
},
},
test: () => expect(require(resolve('dist', 'foo'))).toEqual(1),
},
functions: {
files: {
'src/index.js': endent`
Expand All @@ -88,28 +88,15 @@ export default {
},
test: () => expect(require(resolve('dist'))).toBeTruthy(),
},
'optional chaining': {
files: {
'src/index.js': endent`
const foo = undefined
export default foo?.bar
`,
},
test: () => expect(require(resolve('dist'))).toBeUndefined(),
},
'pipeline operator': {
files: {
'src/index.js': 'export default 1 |> x => x * 2',
},
test: () => expect(require(resolve('dist'))).toEqual(2),
},
'jsx: normal': {
'jsx: functional: context': {
files: {
'src/index.js': endent`
export default {
render() {
return <div>Hello world</div>
functional: true,
props: {
foo: {},
},
render: context => <div>{ context.props.foo }</div>,
}
`,
},
Expand All @@ -123,11 +110,11 @@ export default {
});
exports.default = void 0;
var _default = {
render() {
const h = arguments[0];
return h("div", ["Hello world"]);
}
functional: true,
props: {
foo: {}
},
render: (h, context) => h("div", [context.props.foo])
};
exports.default = _default;
module.exports = exports.default;
Expand Down Expand Up @@ -159,15 +146,13 @@ export default {
module.exports = exports.default;
`),
},
'jsx: functional: context': {
'jsx: normal': {
files: {
'src/index.js': endent`
export default {
functional: true,
props: {
foo: {},
render() {
return <div>Hello world</div>
},
render: context => <div>{ context.props.foo }</div>,
}
`,
},
Expand All @@ -181,14 +166,29 @@ export default {
});
exports.default = void 0;
var _default = {
functional: true,
props: {
foo: {}
},
render: (h, context) => h("div", [context.props.foo])
render() {
const h = arguments[0];
return h("div", ["Hello world"]);
}
};
exports.default = _default;
module.exports = exports.default;
`),
},
'optional chaining': {
files: {
'src/index.js': endent`
const foo = undefined
export default foo?.bar
`,
},
test: () => expect(require(resolve('dist'))).toBeUndefined(),
},
'pipeline operator': {
files: {
'src/index.js': 'export default 1 |> x => x * 2',
},
test: () => expect(require(resolve('dist'))).toEqual(2),
},
} |> mapValues(runTest)
Loading

0 comments on commit 8771a16

Please sign in to comment.