-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,405 additions
and
1,404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
const path = require('path') | ||
|
||
const chokidar = require('chokidar') | ||
const esbuild = require('esbuild') | ||
const liveServer = require('live-server') | ||
|
||
const root = './public' | ||
|
||
const build = process.argv[2] === 'build' || false | ||
const dev = process.argv[2] === 'dev' || false | ||
const watch = (dev && process.argv[3] === '--watch') || false | ||
|
||
const common = { | ||
bundle: true, | ||
inject: [path.join(__dirname, './react-shim.js')], | ||
sourcemap: false, | ||
} | ||
|
||
if (build) { | ||
const options = { | ||
...common, | ||
entryPoints: ['./src/index.ts'], | ||
external: Object.keys(require('./package.json').dependencies || {}), | ||
logLevel: 'info', | ||
minify: true, | ||
target: ['esnext'], | ||
} | ||
|
||
esbuild.build({ | ||
...options, | ||
format: 'esm', | ||
outfile: './dist/index.esm.js', | ||
}) | ||
|
||
esbuild.build({ | ||
...options, | ||
format: 'cjs', | ||
outfile: './dist/index.js', | ||
}) | ||
} | ||
|
||
if (dev) { | ||
;(async () => { | ||
const builder = await esbuild.build({ | ||
...common, | ||
define: { | ||
'process.env.NODE_ENV': JSON.stringify( | ||
process.env.NODE_ENV || 'development' | ||
), | ||
}, | ||
entryPoints: ['./src/example/index.tsx'], | ||
incremental: true, | ||
minify: !watch, | ||
outfile: `./${root}/script.js`, | ||
}) | ||
|
||
if (!watch) { | ||
process.exit(0) | ||
} | ||
|
||
chokidar | ||
.watch('./src/**/*.{ts,tsx}', { | ||
interval: 0, | ||
}) | ||
.on('all', () => { | ||
builder.rebuild() | ||
}) | ||
|
||
liveServer.start({ | ||
open: true, | ||
port: +process.env.PORT || 8080, | ||
root, | ||
}) | ||
})() | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import * as React from 'react' | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export { React } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import React from 'react' | ||
|
||
import { render } from '@testing-library/react' | ||
|
||
import { Styled } from '../styled' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.