mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-24 07:39:10 -04:00
spike: use babel preset typescript to transpile app (#4142)
* use babel-preset-typescript * run type-check in release process
This commit is contained in:
1 parent
5c02273757
commit
28378dc3fd
15 files changed
+3322
-116
No files matched your search
@@ -30,6 +30,8 @@ jobs:
|
||||
node-version: ${{ steps.nvm.outputs.NVMRC }}
|
||||
- name: Bootstrap packages
|
||||
run: npm run bootstrap
|
||||
- name: Type checks
|
||||
run: npm run type-check
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
|
||||
|
||||
@@ -54,6 +54,9 @@ jobs:
|
||||
- name: Lint markdown
|
||||
run: npm run lint:markdown
|
||||
|
||||
- name: Type checks
|
||||
run: npm run type-check
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
|
||||
|
||||
+2
-1
@@ -37,7 +37,8 @@
|
||||
"test:smoke:build": "npm run test:build --prefix packages/insomnia-smoke-test",
|
||||
"test:smoke:package": "npm run test:package --prefix packages/insomnia-smoke-test",
|
||||
"test:smoke:cli": "npm run test:cli --prefix packages/insomnia-smoke-test",
|
||||
"hard-reset": "npm run clean && npm run bootstrap && npm run app-start"
|
||||
"hard-reset": "npm run clean && npm run bootstrap && npm run app-start",
|
||||
"type-check": "lerna run type-check"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.10.5",
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/** @type { import('@babel/core').TransformOptions } */
|
||||
module.exports = {
|
||||
presets: [
|
||||
['@babel/preset-env',{targets: {electron: '11.2.3'}}],
|
||||
'@babel/preset-typescript',
|
||||
'@babel/preset-react',
|
||||
],
|
||||
plugins: [
|
||||
["@babel/plugin-proposal-nullish-coalescing-operator"],
|
||||
['@babel/plugin-proposal-decorators', { legacy: true }],
|
||||
['@babel/plugin-proposal-class-properties', { loose: true }],
|
||||
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
|
||||
['@babel/plugin-proposal-private-methods', { loose: true }]
|
||||
],
|
||||
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
import 'core-js/stable';
|
||||
import 'regenerator-runtime/runtime';
|
||||
|
||||
import * as electron from 'electron';
|
||||
import installExtension, { REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } from 'electron-devtools-installer';
|
||||
import path from 'path';
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
import 'core-js/stable';
|
||||
import 'regenerator-runtime/runtime';
|
||||
import './ui';
|
||||
@@ -1,5 +1,5 @@
|
||||
/// <reference types="webpack-env" />
|
||||
import { applyMiddleware, compose, createStore } from 'redux';
|
||||
import { applyMiddleware, compose, createStore, Store } from 'redux';
|
||||
import thunkMiddleware from 'redux-thunk';
|
||||
|
||||
import { reducer } from './modules';
|
||||
@@ -24,5 +24,5 @@ export default function() {
|
||||
});
|
||||
}
|
||||
|
||||
return store;
|
||||
return store as Store;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bindActionCreators, combineReducers } from 'redux';
|
||||
import { bindActionCreators, combineReducers, Store } from 'redux';
|
||||
|
||||
import * as fetch from '../../../account/fetch';
|
||||
import { isLoggedIn, onLoginLogout } from '../../../account/session';
|
||||
@@ -8,7 +8,7 @@ import configureStore from '../create';
|
||||
import * as entities from './entities';
|
||||
import * as global from './global';
|
||||
|
||||
export async function init() {
|
||||
export async function init(): Promise<Store> {
|
||||
const store = configureStore();
|
||||
// Do things that must happen before initial render
|
||||
const { addChanges, initializeWith: initEntities } = bindActionCreators({ addChanges: entities.addChanges, initializeWith: entities.initializeWith }, store.dispatch);
|
||||
|
||||
Generated
+3274
-99
File diff suppressed because it is too large.
Load diff
@@ -20,6 +20,8 @@
|
||||
"postclean": "rimraf build app/main.min.js",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"type-check": "tsc --noEmit -p tsconfig.build.json",
|
||||
"type-check:watch": "npm run type-check -- --watch",
|
||||
"start:electron": "cross-env TS_NODE_PROJECT=\"tsconfig.webpack.json\" cross-env NODE_ENV=development webpack --config webpack/webpack.config.electron.ts && electron .",
|
||||
"start:dev-server": "cross-env TS_NODE_PROJECT=\"tsconfig.webpack.json\" webpack-dev-server --config webpack/webpack.config.development.ts",
|
||||
"start": "concurrently -n dev,app --kill-others \"npm run start:dev-server\" \"npm run start:electron\"",
|
||||
@@ -175,6 +177,9 @@
|
||||
"zprint-clj": "0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.15.8",
|
||||
"@babel/preset-react": "^7.14.5",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"@develohpanda/fluent-builder": "^2.1.2",
|
||||
"@grpc/grpc-js": "^1.1.8",
|
||||
"@grpc/proto-loader": "^0.5.5",
|
||||
@@ -246,7 +251,6 @@
|
||||
"redux-mock-store": "^1.5.4",
|
||||
"source-map-loader": "^1.0.0",
|
||||
"style-loader": "^0.23.1",
|
||||
"ts-loader": "^8.2.0",
|
||||
"ts-node": "^9.1.1",
|
||||
"tsconfig-paths": "^3.9.0",
|
||||
"type-fest": "^1.0.2",
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
import 'core-js/stable';
|
||||
import 'regenerator-runtime/runtime';
|
||||
export { getSendRequestCallbackMemDb, getSendRequestCallback } from '../app/common/send-request';
|
||||
@@ -7,7 +7,8 @@
|
||||
"strict": false,
|
||||
"strictNullChecks": true,
|
||||
"jsx": "react",
|
||||
"experimentalDecorators": true
|
||||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.d.ts",
|
||||
@@ -26,7 +27,9 @@
|
||||
"**/main.min.js",
|
||||
"__jest__",
|
||||
"assets",
|
||||
".babelrc.js",
|
||||
"bin",
|
||||
"build",
|
||||
"config",
|
||||
"jest.config.js",
|
||||
"node_modules",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"**/@types/mocha",
|
||||
"**/main.min.js",
|
||||
"bin",
|
||||
"build",
|
||||
"config",
|
||||
"node_modules"
|
||||
]
|
||||
|
||||
@@ -20,11 +20,8 @@ const configuration: Configuration = {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: 'ts-loader',
|
||||
exclude: [/node_modules/],
|
||||
options: {
|
||||
configFile: 'tsconfig.build.json',
|
||||
},
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
{
|
||||
test: /\.(less|css)$/,
|
||||
|
||||
@@ -26,11 +26,8 @@ const configuration: Configuration = {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: 'ts-loader',
|
||||
exclude: [/node_modules/],
|
||||
options: {
|
||||
configFile: 'tsconfig.build.sr.json',
|
||||
},
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
{
|
||||
test: require.resolve('../app/network/ca-certs.js'),
|
||||
|
||||
Reference in new issue
Block a user