Skip to content

Commit 844f8a4

Browse files
committedSep 7, 2021
chore(example): Update example.
1 parent 7253da3 commit 844f8a4

File tree

9 files changed

+34
-6
lines changed

9 files changed

+34
-6
lines changed
 

‎example/express-typeorm/src/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const env = dotenv.config();
1414
async function run() {
1515
try {
1616
const entities = await getEntity();
17+
console.log('entities:', entities);
1718
if (!env.parsed) env.parsed = {};
1819
const options: PostgresConnectionOptions = {
1920
type: 'postgres',

‎example/express-typeorm/src/utils/entity.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from 'fs';
33

44
export async function getEntity(entityPath: string = '../entity') {
55
const dirPath = path.resolve(__dirname, entityPath);
6-
const dirArr = (await fs.promises.readdir(dirPath)).filter((fileName) => !/\.js\.map$/.test(fileName));
6+
const dirArr = (await fs.promises.readdir(dirPath)).filter((fileName) => !/(.js.map|.d.ts)$/.test(fileName));
77
const arr: string[] = [];
88
dirArr.forEach((fileName) => {
99
const ePath = path.resolve(dirPath, fileName).replace(/\.(js|ts)$/, '');

‎example/hapi/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "hapi Example.",
66
"main": "index.js",
77
"scripts": {
8-
"start": "node lib/app.js",
8+
"start": "npm run build && node lib/app.js",
99
"dev": "nodemon --inspect lib/app.js",
1010
"watch": "tsbb watch --entry ./src/app.ts --no-esm",
1111
"build": "tsbb build --entry ./src/app.ts --no-esm",

‎example/koa/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"description": "Koa Example",
66
"scripts": {
7-
"start": "node lib/app.js",
7+
"start": "npm run build && node lib/app.js",
88
"dev": "nodemon --inspect lib/app.js",
99
"watch": "tsbb watch --entry ./src/app.ts --no-esm",
1010
"build": "tsbb build --entry ./src/app.ts --no-esm",

‎example/react-component-tsx/.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
node_modules
21
lib
32
esm
43
build
4+
node_modules
5+
__snapshots__
6+
57
npm-debug.log*
68
package-lock.json
9+
710
.DS_Store
811
.cache
912
.rdoc-dist

‎example/react-component-tsx/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"css:build": "compile-less -d src -o esm",
1414
"css:watch": "compile-less -d src -o esm --watch",
1515
"css:build:dist": "compile-less -d src --combine lib/dist.css --rm-global",
16+
"test": "tsbb test",
17+
"coverage": "tsbb test --coverage",
1618
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\""
1719
},
1820
"repository": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* eslint-disable jest/no-conditional-expect */
2+
import React from 'react';
3+
import TestRenderer from 'react-test-renderer';
4+
import Button from '../src';
5+
6+
describe('<Button />', () => {
7+
it('Should output a Button', () => {
8+
const component = TestRenderer.create(
9+
<Button type="danger">BUTTON</Button>
10+
);
11+
let tree = component.toJSON();
12+
expect(tree).toMatchSnapshot();
13+
if (tree) {
14+
expect(tree.type).toBe('button');
15+
expect(tree.props.className).toBe('w-btn w-btn-default w-btn-danger');
16+
expect(tree.children).toHaveLength(1);
17+
if (tree.children) {
18+
expect(tree.children[0].type).toBe('span');
19+
expect(tree.children[0].children[0]).toEqual('BUTTON');
20+
}
21+
}
22+
});
23+
});

‎example/react-component/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@babel/plugin-transform-modules-umd": "7.14.5",
3535
"@babel/plugin-transform-runtime": "7.15.0",
3636
"@babel/runtime": "7.15.4",
37-
"@parcel/transformer-less": "2.0.0-rc.0",
37+
"@parcel/transformer-less": "2.0.0-alpha.3",
3838
"@tsbb/babel-preset-tsbb": "1.14.2",
3939
"babel-plugin-transform-remove-imports": "1.5.5",
4040
"babel-plugin-transform-rename-import": "2.3.0",

‎example/transform-typescript/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"version": "3.0.4",
55
"description": "Transform Typescript Example.",
66
"scripts": {
7-
"start": "node lib/index.js",
87
"watch": "tsbb watch --disable-babel-option --no-esm",
98
"build": "tsbb build --disable-babel-option --no-esm",
109
"test": "tsbb test",

0 commit comments

Comments
 (0)
Please sign in to comment.