Skip to content

Commit

Permalink
feat: 增加ts demo
Browse files Browse the repository at this point in the history
  • Loading branch information
xuasir committed Mar 17, 2021
1 parent d567058 commit d0a517a
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/playground/js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "playground-js",
"version": "10.0.0",
"description": "",
"version": "0.0.0",
"scripts": {
"build": "npx xus lib-build"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/js/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// es6+
export const trim = ' 123'.trimStart()
export const arrFalt = [['1', '2'], 3].falt()
export const arrFlat = [['1', '2'], 3].flat()

// dynamic import
export const di = async () => {
Expand Down
8 changes: 8 additions & 0 deletions packages/playground/ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "playground-ts",
"version": "0.0.0",
"scripts": {
"build": "npx xus lib-build"
},
"license": "MIT"
}
1 change: 1 addition & 0 deletions packages/playground/ts/src/di.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const dires = 23
12 changes: 12 additions & 0 deletions packages/playground/ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// es6+
export const trim = ' 123'.trimStart()
export const arrFlat = [['1', '2'], 3].flat()

// dynamic import
export const di = async () => {
await Promise.resolve(3)
await import('./di')
}

// types
export const t = '1'
10 changes: 10 additions & 0 deletions packages/playground/ts/xus.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from '@xus/cli'

export default defineConfig({
libBuild: {
target: ['es2015'],
formats: ['esm', 'cjs'],
sourcemap: false,
minify: false
}
})
3 changes: 2 additions & 1 deletion packages/playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"outDir": "./dist"
"outDir": "./dist",
"lib": ["ESNext"]
},
"extends": "../../tsconfig.json",
"include": ["./src/**/*"],
Expand Down

0 comments on commit d0a517a

Please sign in to comment.