Skip to content

Commit

Permalink
Updated to yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsaturn committed Aug 7, 2021
1 parent a340c6a commit 60f9a44
Show file tree
Hide file tree
Showing 24 changed files with 14,968 additions and 49,427 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm ci && npm run build
- run: yarn install --frozen-lockfile && yarn run build
2 changes: 1 addition & 1 deletion .github/workflows/format_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm ci && npm run formatter
- run: yarn install --frozen-lockfile && yarn run formatter
2 changes: 1 addition & 1 deletion .github/workflows/lint_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm ci && npm run tslint
- run: yarn install --frozen-lockfile && yarn run tslint
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
Run CapRover backend service in debug mode. Change `.env.development` to match your backend. Then run `npm start`

> **Note**: To create a simple backend API in debug mode, you can use [Play with Docker](https://labs.play-with-docker.com/). Just simply run the following commands and you'll be set:
>
> ```
> apk update && apk add nodejs npm
> git clone https://github.com/caprover/caprover.git
Expand All @@ -15,6 +16,7 @@ Run CapRover backend service in debug mode. Change `.env.development` to match y
> npm run clean
> echo "done"
> ```
>
> Then click on Open Port button and get the URL for port `3000`, it should be something like this (make sure to remove trailing slash): `http://ip172-18-0-76-abcdef123456-3000.direct.labs.play-with-docker.com`
We strive to keep CapRover code base consistent. This will ensure a high level of consistency and lower maintenance load.
Expand All @@ -23,15 +25,15 @@ We strive to keep CapRover code base consistent. This will ensure a high level o
In the project directory, you can run:
#### `npm start`
#### `yarn start`
Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br>
You will also see any lint errors in the console.
### `npm run build`
### `yarn run build`
Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
Expand All @@ -58,7 +60,7 @@ To ensure your elements work with both dark and light modes, following points ne
#### Dev Mode & Hot Reload
It can happen that modifying the `app.less` during `npm run dev` leads to `FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory less`. To overcome this, we need to set `max-old-space-size`.
It can happen that modifying the `app.less` during `yarn run dev` leads to `FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory less`. To overcome this, we need to set `max-old-space-size`.
```bash
export NODE_OPTIONS="--max-old-space-size=8192"
Expand Down
49,371 changes: 0 additions & 49,371 deletions package-lock.json

This file was deleted.

8 changes: 4 additions & 4 deletions src/api/ApiManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ export default class ApiManager {
detached ? '?detached=1' : ''
}`,
{
captainDefinitionContent: JSON.stringify(
captainDefinition
),
captainDefinitionContent:
JSON.stringify(captainDefinition),
gitHash,
}
)
Expand Down Expand Up @@ -210,7 +209,8 @@ export default class ApiManager {
http.fetch(http.POST, '/user/apps/appDefinitions/update', {
appName: appName,
instanceCount: instanceCount,
captainDefinitionRelativeFilePath: captainDefinitionRelativeFilePath,
captainDefinitionRelativeFilePath:
captainDefinitionRelativeFilePath,
notExposeAsWebApp: notExposeAsWebApp,
forceSsl: forceSsl,
websocketSupport: websocketSupport,
Expand Down
3 changes: 2 additions & 1 deletion src/containers/PageRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ class PageRoot extends ApiComponent<
// ignore error
})
this.setState({
collapsed: StorageHelper.getSiderCollapsedStateFromLocalStorage(),
collapsed:
StorageHelper.getSiderCollapsedStateFromLocalStorage(),
})
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/containers/apps/appDetails/AppConfigs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,8 @@ export default class AppConfigs extends Component<
const newApiData = Utils.copyObject(
this.props.apiData
)
newApiData.appDefinition.instanceCount = Number(
e.target.value
)
newApiData.appDefinition.instanceCount =
Number(e.target.value)
this.props.updateApiData(newApiData)
}}
/>
Expand Down
10 changes: 6 additions & 4 deletions src/containers/apps/appDetails/AppDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ class AppDetails extends ApiComponent<
<Checkbox
defaultChecked={!!self.volumesToDelete[v]}
onChange={(e: any) => {
self.volumesToDelete[v] = !self
.volumesToDelete[v]
self.volumesToDelete[v] =
!self.volumesToDelete[v]
}}
>
{v}
Expand All @@ -209,7 +209,8 @@ class AppDetails extends ApiComponent<
type="text"
placeholder={appDef.appName}
onChange={(e) => {
self.confirmedAppNameToDelete = e.target.value.trim()
self.confirmedAppNameToDelete =
e.target.value.trim()
}}
/>
</div>
Expand All @@ -233,7 +234,8 @@ class AppDetails extends ApiComponent<
self.apiManager
.deleteApp(appDef.appName!, volumes)
.then(function (data) {
const volumesFailedToDelete = data.volumesFailedToDelete as string[]
const volumesFailedToDelete =
data.volumesFailedToDelete as string[]
if (
volumesFailedToDelete &&
volumesFailedToDelete.length
Expand Down
24 changes: 12 additions & 12 deletions src/containers/apps/appDetails/HttpSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ export default class HttpSettings extends Component<

onEditDefaultNginxConfigClicked() {
const newApiData = Utils.copyObject(this.props.apiData!)
newApiData.appDefinition.customNginxConfig = this.props.apiData!.defaultNginxConfig
newApiData.appDefinition.customNginxConfig =
this.props.apiData!.defaultNginxConfig
this.props.updateApiData(newApiData)
}

createCustomNginx() {
const customNginxConfig = this.props.apiData!.appDefinition
.customNginxConfig!
const customNginxConfig =
this.props.apiData!.appDefinition.customNginxConfig!
if (!customNginxConfig) {
return (
<div>
Expand Down Expand Up @@ -355,9 +356,8 @@ export default class HttpSettings extends Component<
const newApiData = Utils.copyObject(
this.props.apiData
)
newApiData.appDefinition.containerHttpPort = Number(
e.target.value
)
newApiData.appDefinition.containerHttpPort =
Number(e.target.value)
this.props.updateApiData(newApiData)
}}
/>
Expand All @@ -377,8 +377,8 @@ export default class HttpSettings extends Component<
const newApiData = Utils.copyObject(
this.props.apiData!
)
newApiData.appDefinition.forceSsl = !!e.target
.checked
newApiData.appDefinition.forceSsl =
!!e.target.checked
this.props.updateApiData(newApiData)
}}
>
Expand All @@ -400,8 +400,8 @@ export default class HttpSettings extends Component<
const newApiData = Utils.copyObject(
this.props.apiData!
)
newApiData.appDefinition.websocketSupport = !!e
.target.checked
newApiData.appDefinition.websocketSupport =
!!e.target.checked
this.props.updateApiData(newApiData)
}}
>
Expand Down Expand Up @@ -549,8 +549,8 @@ export default class HttpSettings extends Component<
}
onChange={(e: any) => {
const newApiData = Utils.copyObject(this.props.apiData!)
newApiData.appDefinition.notExposeAsWebApp = !!e.target
.checked
newApiData.appDefinition.notExposeAsWebApp =
!!e.target.checked
this.props.updateApiData(newApiData)
}}
>
Expand Down
5 changes: 2 additions & 3 deletions src/containers/apps/appDetails/deploy/AppLogsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ export default class AppLogsView extends ApiComponent<

if (shouldScrollToBottom)
setTimeout(function () {
let textarea = document.getElementById(
'applogs-text-id'
)
let textarea =
document.getElementById('applogs-text-id')
if (textarea) textarea.scrollTop = textarea.scrollHeight
}, 100)
})
Expand Down
5 changes: 2 additions & 3 deletions src/containers/apps/appDetails/deploy/BuildLogsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ export default class BuildLogsView extends ApiComponent<

if (lineAdded) {
setTimeout(function () {
let textarea = document.getElementById(
'buildlog-text-id'
)
let textarea =
document.getElementById('buildlog-text-id')
if (textarea) textarea.scrollTop = textarea.scrollHeight
}, 100)
}
Expand Down
11 changes: 6 additions & 5 deletions src/containers/apps/appDetails/deploy/Deployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ export default class Deployment extends ApiComponent<
}
}
tokenConfig.enabled = !tokenConfig.enabled
newApiData.appDefinition.appDeployTokenConfig = tokenConfig
newApiData.appDefinition.appDeployTokenConfig =
tokenConfig
self.props.updateApiData(newApiData)
// This is a hack! Find a better way!
// We need this delay, otherwise the new state will not be used by onUpdateConfigAndSave
Expand Down Expand Up @@ -297,9 +298,8 @@ export default class Deployment extends ApiComponent<
updateRepoInfo={(newRepo) => {
const newApiData = Utils.copyObject(this.props.apiData)
if (newApiData.appDefinition.appPushWebhook) {
newApiData.appDefinition.appPushWebhook.repoInfo = Utils.copyObject(
newRepo
)
newApiData.appDefinition.appPushWebhook.repoInfo =
Utils.copyObject(newRepo)
} else {
newApiData.appDefinition.appPushWebhook = {
repoInfo: Utils.copyObject(newRepo),
Expand Down Expand Up @@ -409,7 +409,8 @@ export default class Deployment extends ApiComponent<
}
onClick={() =>
this.setState({
forceEditableCaptainDefinitionPath: true,
forceEditableCaptainDefinitionPath:
true,
})
}
>
Expand Down
6 changes: 3 additions & 3 deletions src/containers/apps/oneclick/OneClickAppDeployManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function replaceWith(
}

export default class OneClickAppDeployManager {
private deploymentHelper: OneClickAppDeploymentHelper = new OneClickAppDeploymentHelper()
private deploymentHelper: OneClickAppDeploymentHelper =
new OneClickAppDeploymentHelper()
private template: IOneClickTemplate | undefined
constructor(
private onDeploymentStateChanged: (
Expand Down Expand Up @@ -78,8 +79,7 @@ export default class OneClickAppDeployManager {
if (!apps) {
self.onDeploymentStateChanged({
steps: ['Parsing the template'],
error:
'Cannot parse the template. Dependency tree cannot be resolved. Infinite loop!!',
error: 'Cannot parse the template. Dependency tree cannot be resolved. Infinite loop!!',
currentStep: 0,
})
} else if (apps.length === 0) {
Expand Down
7 changes: 4 additions & 3 deletions src/containers/apps/oneclick/OneClickAppDeploymentHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ export default class OneClickAppDeploymentHelper {
})
})

const overrideYaml = DockerComposeToServiceOverride.convertComposeToService(
dockerComposeService
)
const overrideYaml =
DockerComposeToServiceOverride.convertComposeToService(
dockerComposeService
)

if (!!overrideYaml) {
appDef.serviceUpdateOverride = overrideYaml
Expand Down
9 changes: 5 additions & 4 deletions src/containers/apps/oneclick/selector/OneClickGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ export default class OneClickGrid extends Component<
) {
score = 0.99
} else {
score = StringSimilarity.compareTwoStrings(
searchTerm,
appNameForSearch
)
score =
StringSimilarity.compareTwoStrings(
searchTerm,
appNameForSearch
)
}

sortScores[app.name] = score || 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ export default class OneClickAppConfigPage extends ApiComponent<
const template = Utils.copyObject(
self.state.apiData!
)
const valuesAugmented = Utils.copyObject(
values
)
const valuesAugmented =
Utils.copyObject(values)

template.caproverOneClickApp.variables.push(
{
Expand Down
6 changes: 4 additions & 2 deletions src/containers/nodes/DockerRegistryAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export default class DockerRegistryAdd extends Component<
const newData = Utils.copyObject(
self.state.remoteRegistryToAdd
)
newData.registryImagePrefix = e.target.value.trim()
newData.registryImagePrefix =
e.target.value.trim()
self.setState({ remoteRegistryToAdd: newData })
}}
/>
Expand All @@ -180,7 +181,8 @@ export default class DockerRegistryAdd extends Component<
onClick={() =>
self.setState({
modalShowing: ADDING_REMOTE,
remoteRegistryToAdd: self.getPlainRegistryInfo(),
remoteRegistryToAdd:
self.getPlainRegistryInfo(),
})
}
>
Expand Down
1 change: 1 addition & 0 deletions src/redux/reducers/DefaultRegistryReducer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DEFAULT_REGISTRY_CHANGED } from '../actions/DefaultRegistryActions'

// eslint-disable-next-line import/no-anonymous-default-export
export default function (state = {}, action: { payload: any; type: string }) {
switch (action.type) {
case DEFAULT_REGISTRY_CHANGED:
Expand Down
1 change: 1 addition & 0 deletions src/redux/reducers/GlobalReducer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Utils from '../../utils/Utils'
import { ROOT_KEY_CHANGED, SIZE_CHANGED } from '../actions/GlobalActions'

// eslint-disable-next-line import/no-anonymous-default-export
export default function (state = {}, action: { payload: any; type: string }) {
switch (action.type) {
case ROOT_KEY_CHANGED:
Expand Down
1 change: 1 addition & 0 deletions src/utils/CrashReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const getInstance = function () {
return instance
}

// eslint-disable-next-line import/no-anonymous-default-export
export default {
getInstance: getInstance,
}
1 change: 1 addition & 0 deletions src/utils/DomUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function scrollToFixedFromTop(fromTopPx: number, el: HTMLElement) {
})
}

// eslint-disable-next-line import/no-anonymous-default-export
export default {
scrollToTopBar(delay?: number) {
const el = document.getElementById('main-content-layout')
Expand Down
1 change: 1 addition & 0 deletions src/utils/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line import/no-anonymous-default-export
export default {
copyObject<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj)) as T
Expand Down
Loading

0 comments on commit 60f9a44

Please sign in to comment.