-
Notifications
You must be signed in to change notification settings - Fork 511
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
sw-yx
committed
Aug 26, 2019
1 parent
a7b09da
commit 990f115
Showing
11 changed files
with
1,483 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Fixtures testing | ||
|
||
here are some fixtures for manual testing things we don't have Jest tests for. | ||
|
||
- `build-default` focuses on our zero config defaults | ||
- `build-invalid` lets us check what happens when we have invalid builds due to type errors | ||
- `build-withConfig` lets us check that `tsdx.config.js` works as expected |
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,9 @@ | ||
|
||
function ErrorDev(message) { | ||
const error = new Error(message); | ||
error.name = 'Invariant Violation'; | ||
return error; | ||
} | ||
|
||
export default ErrorDev; | ||
|
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,15 @@ | ||
|
||
function ErrorProd(code) { | ||
// TODO: replace this URL with yours | ||
let url = 'https://reactjs.org/docs/error-decoder.html?invariant=' + code; | ||
for (let i = 1; i < arguments.length; i++) { | ||
url += '&args[]=' + encodeURIComponent(arguments[i]); | ||
} | ||
return new Error( | ||
`Minified BuildWithconfig error #${code}; visit ${url} for the full message or ` + | ||
'use the non-minified dev environment for full errors and additional ' + | ||
'helpful warnings. ' | ||
); | ||
} | ||
|
||
export default ErrorProd; |
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 @@ | ||
{ | ||
"0": "this is an old error that shouldn't be overwritten", | ||
"1": "error occurred! o no" | ||
} |
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,17 @@ | ||
{ | ||
"scripts": { | ||
"build": "tsdx build --extractErrors" | ||
}, | ||
"name": "build-withconfig", | ||
"license": "MIT", | ||
"dependencies": { | ||
"tiny-invariant": "^1.0.6", | ||
"tiny-warning": "^1.0.3" | ||
}, | ||
"devDependencies": { | ||
"autoprefixer": "^9.6.1", | ||
"cssnano": "^4.1.10", | ||
"eslint-config-postcss": "^3.0.7", | ||
"rollup-plugin-postcss": "^2.0.3" | ||
} | ||
} |
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 @@ | ||
export const foo = () => 'bar'; |
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,12 @@ | ||
import invariant from 'tiny-invariant'; | ||
import warning from 'tiny-warning'; | ||
invariant(true, 'error occurred! o no'); | ||
warning(false, 'warning - water is wet'); | ||
export { foo } from './foo'; | ||
|
||
export const sum = (a: number, b: number) => { | ||
if ('development' === process.env.NODE_ENV) { | ||
console.log('fuck'); | ||
} | ||
return a + b; | ||
}; |
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,7 @@ | ||
import { sum } from '../src'; | ||
|
||
describe('fuck', () => { | ||
it('works', () => { | ||
expect(sum(1, 1)).toEqual(2); | ||
}); | ||
}); |
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,29 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "ESNext", | ||
"lib": ["dom", "esnext"], | ||
"declaration": true, | ||
"sourceMap": true, | ||
"rootDir": "./", | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"strictFunctionTypes": true, | ||
"strictPropertyInitialization": true, | ||
"noImplicitThis": true, | ||
"alwaysStrict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"moduleResolution": "node", | ||
"baseUrl": "./", | ||
"paths": { | ||
"*": ["src/*", "node_modules/*"] | ||
}, | ||
"jsx": "react", | ||
"esModuleInterop": true | ||
}, | ||
"include": ["src", "types"], | ||
} |
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,22 @@ | ||
const postcss = require('rollup-plugin-postcss'); | ||
const autoprefixer = require('autoprefixer'); | ||
const cssnano = require('cssnano'); | ||
|
||
module.exports = { | ||
rollup(config, options) { | ||
config.plugins.push( | ||
postcss({ | ||
plugins: [ | ||
autoprefixer(), | ||
cssnano({ | ||
preset: 'default', | ||
}), | ||
], | ||
inject: false, | ||
// only write out CSS for the first bundle (avoids pointless extra files): | ||
extract: !!options.writeMeta, | ||
}) | ||
); | ||
return config; | ||
}, | ||
}; |
Oops, something went wrong.