Skip to content

Commit

Permalink
chore: update ci configuration
Browse files Browse the repository at this point in the history
- Update ESLint rules
- Add steps to update yarn lock files after release
- Fix Linter issues
- Fix Mixpanel mock issues
- Enable publish on Master branch
  • Loading branch information
oscb committed Feb 5, 2024
1 parent 71e7eae commit 5891bd3
Show file tree
Hide file tree
Showing 14 changed files with 4,031 additions and 4,651 deletions.
12 changes: 5 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
module.exports = {
extends: [
'@react-native-community',
'prettier',
"@react-native",
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
plugins: ['@typescript-eslint'],
rules: {
'prettier/prettier': [
'error',
'warn',
{
quoteProps: 'consistent',
singleQuote: true,
Expand Down Expand Up @@ -48,8 +46,8 @@ module.exports = {
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unused-vars": ["error"],
"@typescript-eslint/unbound-method": "warn",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/ban-ts-comment": "warn"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
# End workaround

- name: Install
run: yarn install --frozen-lockfile
run: yarn install --immutable
- name: Build
run: yarn build
# Linter has to run after the build because it relies on TS types
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Config and Build
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
yarn install --frozen-lockfile
yarn install --immutable
yarn build
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -45,3 +45,17 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Update Apps
run: |
yarn install --no-immutable
yarn e2e install --no-immutable
yarn example install --no-immutable
- name: Commit Updated App Locks
run: |
git add yarn.lock
git add examples/E2E/yarn.lock
git add examples/AnalyticsReactNativeExample/yarn.lock
git commit -m "chore(release): update lockfiles [skip ci]" --no-verify
git push
3 changes: 2 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nodeLinker: node-modules
nodeLinker: node-modules
npmPublishAccess: public
1,624 changes: 812 additions & 812 deletions examples/AnalyticsReactNativeExample/yarn.lock

Large diffs are not rendered by default.

2,048 changes: 1,024 additions & 1,024 deletions examples/E2E/yarn.lock

Large diffs are not rendered by default.

13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@changesets/cli": "^2.26.2",
"@commitlint/config-conventional": "^18.4.2",
"@react-native-async-storage/async-storage": "^1.19",
"@react-native-community/eslint-config": "^3.2.0",
"@react-native/eslint-config": "^0.73.2",
"@segment/analytics-rn-shared": "workspace:^",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^11.1.0",
Expand All @@ -42,19 +42,14 @@
"@types/react": "^18.2.37",
"@types/react-native": "0.72.6",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"babel-jest": "^29.7.0",
"commitlint": "^18.4.2",
"conventional-changelog-conventionalcommits": "^7.0.2",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint": "^8.56.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"metro-react-native-babel-preset": "^0.77.0",
"prettier": "^3.1.0",
"prettier": "^2.8.8",
"react": "18.2.0",
"react-native": "^0.72.7",
"react-native-builder-bob": "^0.23.1",
Expand All @@ -64,5 +59,5 @@
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"packageManager": "yarn@4.0.2"
"packageManager": "yarn@4.1.0"
}
63 changes: 0 additions & 63 deletions packages/core/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/plugins/plugin-appsflyer/src/AppsflyerPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class AppsflyerPlugin extends DestinationPlugin {
},
};

if (is_first_launch && JSON.parse(is_first_launch) === true) {
if (Boolean(is_first_launch) && JSON.parse(is_first_launch) === true) {
if (af_status === 'Non-organic') {
void this.analytics?.track('Install Attributed', properties);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class Mixpanel {
flush = jest.fn();
getDeviceId = jest.fn();
setFlushOnBackground = jest.fn();
setFlushBatchSize = jest.fn();
}

export class People {
Expand Down
1 change: 0 additions & 1 deletion packages/shared/.eslintrc.js

This file was deleted.

32 changes: 15 additions & 17 deletions packages/sovran/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,16 @@ export const createStore = <T extends object>(
if (saveTimeout !== undefined) {
clearTimeout(saveTimeout);
}
saveTimeout = setTimeout(
() => {
void (async () => {
try {
saveTimeout = undefined;
await persistor.set(storeId, state);
} catch (error) {
console.warn(error);
}
})();
},
config.persist?.saveDelay ?? DEFAULT_SAVE_STATE_DELAY_IN_MS
);
saveTimeout = setTimeout(() => {
void (async () => {
try {
saveTimeout = undefined;
await persistor.set(storeId, state);
} catch (error) {
console.warn(error);
}
})();
}, config.persist?.saveDelay ?? DEFAULT_SAVE_STATE_DELAY_IN_MS);
};

const observable = createObservable<T>();
Expand All @@ -165,7 +162,9 @@ export const createStore = <T extends object>(
function getState(): T;
function getState(safe: true): Promise<T>;
function getState(safe?: boolean): T | Promise<T> {
if (safe !== true) return { ...state };
if (safe !== true) {
return { ...state };
}
return new Promise<T>((resolve) => {
queue.push({
call: (state) => {
Expand All @@ -188,7 +187,6 @@ export const createStore = <T extends object>(
};

const processQueue = async (): Promise<T> => {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
queueObserve.unsubscribe(processQueue);
while (queue.length > 0) {
const action = queue.shift();
Expand All @@ -210,11 +208,11 @@ export const createStore = <T extends object>(
action?.finally?.(state);
}
}
// eslint-disable-next-line @typescript-eslint/no-misused-promises

queueObserve.subscribe(processQueue);
return state;
};
// eslint-disable-next-line @typescript-eslint/no-misused-promises

queueObserve.subscribe(processQueue);

const subscribe = (callback: Notify<T>) => {
Expand Down
16 changes: 5 additions & 11 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
module.exports = {
plugins: [
['@semantic-release/commit-analyzer', { preset: 'conventionalcommits' }],
[
'@semantic-release/release-notes-generator',
{ preset: 'conventionalcommits' },
'@semantic-release/commit-analyzer',
{ preset: 'conventionalcommits' }
],
'@semantic-release/changelog',
[
'semantic-release-yarn',
{
npmPublish: false,
tarballDir: "dist"
}
],
'semantic-release-yarn',
'@semantic-release/github',
'@semantic-release/git',
'@semantic-release/git'
],
debug: true
};
Loading

0 comments on commit 5891bd3

Please sign in to comment.