Skip to content

Commit 16d17ce

Browse files
committed
first version
1 parent d00d102 commit 16d17ce

19 files changed

+1595
-51
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
# oazo-configuration
2-
This is repository with JSON files that contain feature toggles for staging and prod. We're going to create github action that will then upload JSON files to S3 bucket and then oasis.app will load it from S3 bucket to turn features on/off.

configs/oasis-borrow/index.ts

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { ConfigHelperType } from "../../types";
2+
3+
export default function ({
4+
isProduction,
5+
isStaging,
6+
isDevelopment,
7+
notProduction,
8+
}: ConfigHelperType) {
9+
return {
10+
TestFeature: false, // used in unit tests
11+
AnotherTestFeature: true, // used in unit tests
12+
"🌞": false, // or https://summer.fi/harheeharheeharhee to enable. https://summer.fi/<any vault ID> to disable.
13+
AaveV3Arbitrum: false,
14+
AaveV3Borrow: false,
15+
AaveV3EarncbETHeth: false,
16+
AaveV3EarnrETHeth: false,
17+
AaveV3Multiply: false,
18+
AaveV3History: false,
19+
AaveV3Protection: true,
20+
AaveV3ProtectionWrite: true,
21+
AjnaPoolFinder: true,
22+
AjnaReusableDPM: false,
23+
AjnaSafetySwitch: true,
24+
AjnaSuppressValidation: false,
25+
ConstantMultipleReadOnly: false,
26+
DaiSavingsRate: true,
27+
DisableSidebarScroll: false,
28+
FollowAAVEVaults: false,
29+
ProxyCreationDisabled: false,
30+
ProxyReveal: false,
31+
ReadOnlyAutoTakeProfit: false,
32+
ReadOnlyBasicBS: false,
33+
Referrals: true,
34+
Sillyness: false,
35+
StopLossOpenFlow: false,
36+
StopLossRead: true,
37+
StopLossWrite: true,
38+
UseNetworkSwitcher: true,
39+
UseNetworkSwitcherArbitrum: false,
40+
UseNetworkSwitcherForks: false,
41+
UseNetworkSwitcherOptimism: true,
42+
UseNetworkSwitcherTestnets: false,
43+
SparkProtocol: true,
44+
SparkProtocolEarn: true,
45+
SparkProtocolBorrow: true,
46+
SparkProtocolMultiply: true,
47+
SparkProtocolSDAIETH: false,
48+
SomeTestingFeatureIWantToTest: isProduction ? false : true,
49+
SomeOtherTestingFeatureIWantToTest: notProduction ? false : true,
50+
};
51+
}

configs/test-config/index.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { ConfigHelperType } from "../../types";
2+
3+
export default function ({
4+
isProduction,
5+
isStaging,
6+
isDevelopment,
7+
notProduction,
8+
}: ConfigHelperType) {
9+
return {
10+
TestConfigTestValueAlwaysTrue: true,
11+
TestConfigTestValueAlwaysFalse: false,
12+
TestConfigTestValueFalseOnProductionTrueOnOthers: notProduction
13+
? true
14+
: false,
15+
TestConfigTestValueTrueOnStaging: isStaging ? true : false,
16+
};
17+
}

eslintrs.json

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{
2+
"ignorePatterns": ["node_modules"],
3+
"env": {
4+
"es6": true
5+
},
6+
"extends": ["typestrict"],
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"project": "./tsconfig.json",
10+
"sourceType": "module"
11+
},
12+
"rules": {
13+
"unused-imports/no-unused-imports-ts": "error",
14+
"react/jsx-uses-react": "error",
15+
"react/jsx-uses-vars": "error",
16+
"import/no-duplicates": "error",
17+
"simple-import-sort/sort": [
18+
"error",
19+
{
20+
"groups": [["^\\u0000"], ["^@?\\w"], ["^[^.]"], ["(^\\.|src/)"]]
21+
}
22+
],
23+
"@typescript-eslint/no-use-before-define": "off",
24+
"@typescript-eslint/no-useless-constructor": "error",
25+
"@typescript-eslint/no-non-null-assertion": "warn",
26+
"@typescript-eslint/no-shadow": [
27+
"warn",
28+
{ "builtinGlobals": true, "hoist": "all" }
29+
],
30+
"accessor-pairs": "error",
31+
"constructor-super": "error",
32+
"eqeqeq": [
33+
"error",
34+
"always",
35+
{
36+
"null": "ignore"
37+
}
38+
],
39+
"handle-callback-err": ["error", "^(err|error)$"],
40+
"new-parens": "error",
41+
"no-array-constructor": "error",
42+
"no-async-promise-executor": "error",
43+
"no-caller": "error",
44+
"no-class-assign": "error",
45+
"no-compare-neg-zero": "error",
46+
"no-cond-assign": "error",
47+
"no-const-assign": "error",
48+
"no-constant-condition": [
49+
"error",
50+
{
51+
"checkLoops": false
52+
}
53+
],
54+
"no-control-regex": "error",
55+
"no-debugger": "error",
56+
"no-delete-var": "error",
57+
"no-dupe-args": "error",
58+
"no-dupe-keys": "error",
59+
"no-duplicate-case": "error",
60+
"no-empty-character-class": "error",
61+
"no-empty-pattern": "error",
62+
"no-eval": "error",
63+
"no-ex-assign": "error",
64+
"no-extend-native": "error",
65+
"no-extra-bind": "error",
66+
"no-extra-boolean-cast": "error",
67+
"no-fallthrough": "error",
68+
"no-floating-decimal": "error",
69+
"no-func-assign": "error",
70+
"no-global-assign": "error",
71+
"no-implied-eval": "error",
72+
"no-inner-declarations": ["error", "functions"],
73+
"no-invalid-regexp": "error",
74+
"no-iterator": "error",
75+
"no-label-var": "error",
76+
"no-labels": [
77+
"error",
78+
{
79+
"allowLoop": false,
80+
"allowSwitch": false
81+
}
82+
],
83+
"no-lone-blocks": "error",
84+
"no-misleading-character-class": "error",
85+
"no-multi-str": "error",
86+
"no-multiple-empty-lines": [
87+
"error",
88+
{
89+
"max": 1,
90+
"maxEOF": 0
91+
}
92+
],
93+
"no-negated-in-lhs": "error",
94+
"no-new": "error",
95+
"no-new-func": "error",
96+
"no-new-object": "error",
97+
"no-new-require": "error",
98+
"no-new-symbol": "error",
99+
"no-new-wrappers": "error",
100+
"no-obj-calls": "error",
101+
"no-octal": "error",
102+
"no-octal-escape": "error",
103+
"no-path-concat": "error",
104+
"no-proto": "error",
105+
"@typescript-eslint/no-redeclare": "warn",
106+
"no-invalid-this": "off",
107+
"no-use-before-define": "off",
108+
"no-regex-spaces": "error",
109+
"no-return-assign": ["error", "except-parens"],
110+
"no-self-assign": "error",
111+
"no-self-compare": "error",
112+
"no-sequences": "error",
113+
"no-shadow": "off",
114+
"no-shadow-restricted-names": "error",
115+
"no-sparse-arrays": "error",
116+
"no-tabs": "error",
117+
"no-this-before-super": "error",
118+
"no-throw-literal": "error",
119+
"no-unexpected-multiline": "error",
120+
"no-unmodified-loop-condition": "error",
121+
"no-unneeded-ternary": [
122+
"error",
123+
{
124+
"defaultAssignment": false
125+
}
126+
],
127+
"no-unreachable": "error",
128+
"no-unsafe-finally": "error",
129+
"no-unsafe-negation": "error",
130+
"no-restricted-imports": ["error"],
131+
"no-useless-call": "error",
132+
"no-useless-catch": "error",
133+
"no-useless-computed-key": "error",
134+
"no-useless-escape": "error",
135+
"no-useless-rename": "error",
136+
"no-useless-return": "error",
137+
"no-with": "error",
138+
"object-curly-spacing": ["error", "always"],
139+
"object-property-newline": [
140+
"error",
141+
{
142+
"allowMultiplePropertiesPerLine": true
143+
}
144+
],
145+
"one-var": [
146+
"error",
147+
{
148+
"initialized": "never"
149+
}
150+
],
151+
"prefer-const": [
152+
"error",
153+
{
154+
"destructuring": "all"
155+
}
156+
],
157+
"prefer-promise-reject-errors": "error",
158+
"symbol-description": "error",
159+
"unicode-bom": ["error", "never"],
160+
"use-isnan": "error",
161+
"valid-typeof": [
162+
"error",
163+
{
164+
"requireStringLiterals": true
165+
}
166+
],
167+
"wrap-iife": [
168+
"error",
169+
"any",
170+
{
171+
"functionPrototypeMethods": true
172+
}
173+
],
174+
"yoda": ["error", "never"],
175+
"no-only-tests/no-only-tests": "error",
176+
"no-relative-import-paths/no-relative-import-paths": [
177+
"warn",
178+
{ "allowSameFolder": true }
179+
],
180+
"deprecation/deprecation": "warn",
181+
"react-hooks/rules-of-hooks": "warn",
182+
"react-hooks/exhaustive-deps": "warn",
183+
"no-console": ["error", { "allow": ["warn", "error", "info", "debug"] }]
184+
}
185+
}

features/prod.json

-25
This file was deleted.

features/staging.json

-25
This file was deleted.

helpers/constants.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import path = require("path");
2+
import { Environments } from "⌨️";
3+
4+
export const constants = {
5+
environments: [
6+
Environments.development,
7+
Environments.production,
8+
Environments.staging,
9+
],
10+
configFolder: path.join(__dirname, "../configs"),
11+
};

helpers/create-config-files.ts

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { existsSync, mkdirSync, promises } from "fs";
2+
import { ConfigModule, Environments } from "⌨️";
3+
4+
export const createConfigFiles = async (configs: {
5+
[configName: string]: Record<Environments, ConfigModule>;
6+
}) => {
7+
const configCreationResults = await Object.entries(configs).map(
8+
([configName, config]) => {
9+
const configCreationResult = Object.entries(config).map(
10+
([env, configModule]) => {
11+
const configModuleString = JSON.stringify(configModule, null, 2);
12+
const configModuleFolderPath = `./dist/${configName}`;
13+
const configModuleFilePath = `./dist/${configName}/${configName}-${env}.json`;
14+
if (!existsSync(configModuleFolderPath)) {
15+
mkdirSync(configModuleFolderPath, { recursive: true });
16+
}
17+
const saveFile = promises.writeFile(
18+
configModuleFilePath,
19+
configModuleString,
20+
{
21+
encoding: "utf-8",
22+
}
23+
);
24+
if (!saveFile) {
25+
throw new Error(
26+
`Error while saving config file: ${configModuleFilePath}`
27+
);
28+
}
29+
return {
30+
configName,
31+
env,
32+
configModuleFilePath,
33+
};
34+
}
35+
);
36+
return configCreationResult;
37+
}
38+
);
39+
return configCreationResults;
40+
};

0 commit comments

Comments
 (0)