Skip to content

Commit

Permalink
chore: keep babel
Browse files Browse the repository at this point in the history
  • Loading branch information
johncardiologs committed Jun 4, 2024
1 parent f7b9b33 commit e88775b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 36 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ props_template/performance/**/*.png
.tool-versions
testapp/

built/
5 changes: 4 additions & 1 deletion superglue/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
plugins: [
["transform-react-remove-prop-types", {removeImport: true}]
["transform-react-remove-prop-types", { removeImport: true }]
],
presets: [
[
Expand All @@ -14,5 +14,8 @@ module.exports = {
[
"@babel/preset-react"
],
[
"@babel/preset-typescript"
],
],
};
25 changes: 7 additions & 18 deletions superglue/lib/components/Nav.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import React from 'react'
import { urlToPageKey, pathWithoutBZParams } from '../utils'
import { REMOVE_PAGE, HISTORY_CHANGE } from '../actions'
import { object, func, string } from 'prop-types'

interface Props {
store: any, // object
history: any, // object
mapping: any, // object
visit: any, // fund
remote: any, // func
initialPageKey: string,
store: any
history: any
mapping: any
visit: any
remote: any
initialPageKey: any
}

interface State {
pageKey: any,
pageKey: any
ownProps: any
}

Expand Down Expand Up @@ -229,14 +228,4 @@ class Nav extends React.Component<Props, State> {
}
}

// TODO: remove now that we have Props ?
// Nav.propTypes = {
// store: object,
// history: object,
// mapping: object,
// visit: func,
// remote: func,
// initialPageKey: string,
// }

export default Nav
17 changes: 7 additions & 10 deletions superglue/lib/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import thunk from 'redux-thunk'
import { Provider, connect } from 'react-redux'
import { createBrowserHistory, createMemoryHistory } from 'history'
import Nav from './components/Nav'
import PropTypes from 'prop-types'

export {
BEFORE_FETCH,
Expand Down Expand Up @@ -93,10 +92,15 @@ class NotImplementedError extends Error {
}
}

interface Props {
initialPage: any
baseUrl: any
path: any
}

interface Props {}
interface Store {}

export class ApplicationBase extends React.Component<Props> {
export class ApplicationBase extends React.Component<Props, Store> {
public hasWindow: any
public navigatorRef: any
public initialPageKey: any
Expand Down Expand Up @@ -232,10 +236,3 @@ export class ApplicationBase extends React.Component<Props> {
)
}
}

ApplicationBase.propTypes = {
initialPage: PropTypes.object,
baseUrl: PropTypes.string,
path: PropTypes.string,
appEl: PropTypes.object,
}
6 changes: 5 additions & 1 deletion superglue/lib/utils/ujs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { withoutBusters, urlToPageKey } from './url'

export class HandlerBuilder {
public attributePrefix: any
public visit: any
public remote: any

constructor({ ujsAttributePrefix, visit, remote }) {
this.attributePrefix = ujsAttributePrefix
this.isUJS = this.isUJS.bind(this)
Expand Down Expand Up @@ -84,7 +88,7 @@ export class HandlerBuilder {
this.visitOrRemote(link, url, { method: 'GET' })
}

visitOrRemote(linkOrForm, url, opts = {}) {
visitOrRemote(linkOrForm, url, opts: any = {}) {
let target

if (linkOrForm.getAttribute(this.attributePrefix + '-visit')) {
Expand Down
8 changes: 6 additions & 2 deletions superglue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"copy:package": "cat ./package.json | jq 'del(.scripts)' > dist/package.json",
"copy:readme": "cp ../README.md dist/",
"build:index": "babel lib -d dist",
"build": "npm run clean && npm run build:index && npm run copy:package && npm run copy:readme",
"build": "npm run clean && npm run build:js && npm run copy:package && npm run copy:readme",
"build:js": "babel lib --out-dir dist --extensions \".ts,.tsx\" --source-maps inline",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"prepublishOnly": "npm run build"
},
"repository": {
Expand All @@ -27,6 +30,8 @@
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.4",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.24.6",
"@types/url-parse": "^1.4.11",
"core-js": "^2.6.12",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
Expand Down Expand Up @@ -56,7 +61,6 @@
"redux-thunk": ">=2.3"
},
"dependencies": {
"@types/url-parse": "^1.4.11",
"abortcontroller-polyfill": "^1.7.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"url-parse": "^1.5.1"
Expand Down
7 changes: 4 additions & 3 deletions superglue/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"compilerOptions": {
"jsx": "react",
"outDir": "./built",
"allowJs": true,
"target": "es5",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": ["./lib/**/*"]
}
"include": [
"./lib/**/*"
]
}

0 comments on commit e88775b

Please sign in to comment.