Skip to content

Commit fe720e4

Browse files
committed
shared: Use tsc-generated versions of shared code
This will prepare us for a future where some of the source files are in TypeScript, not JavaScript, so that we can't use the source files directly and actually need the JavaScript generated by `tsc`.
1 parent 4d2545f commit fe720e4

File tree

12 files changed

+16
-11
lines changed

12 files changed

+16
-11
lines changed

docs/howto/yarn-link.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ $ readlink node_modules/@zulip/shared
4646
$ readlink -f node_modules/@zulip/shared
4747
/home/greg/z/zulip/static/shared
4848
49+
# Start `tsc --watch`, to mirror your edits into lib/.
50+
# (Consider doing this in a separate terminal.)
51+
$ ( cd node_modules/@zulip/shared && yarn && yarn prepare && yarn tsc --watch ) &
52+
4953
# Restart Flow to make it notice the symlink.
5054
# (Then it'll automatically notice edits, as usual.)
5155
$ npx flow stop && npx flow start
@@ -64,6 +68,7 @@ Quick reference for the second and subsequent time you do it:
6468
```
6569
# in your zulip-mobile clone
6670
$ yarn link @zulip/shared && yarn
71+
$ ( cd node_modules/@zulip/shared && yarn && yarn prepare && yarn tsc --watch ) &
6772
$ npx flow stop && npx flow start
6873
6974
# ... develop, test, etc. ...

docs/style.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ For background, see [`docs/howto/shared.md`](howto/shared.md).
757757
**Use `import *` for shared code**: When importing a shared module,
758758
write the import with `import *` and the module's name, like this:
759759
```js
760-
import * as typing_status from '@zulip/shared/js/typing_status';
760+
import * as typing_status from '@zulip/shared/lib/typing_status';
761761
```
762762
763763
We use this style because it matches how these modules are imported in

metro.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = {
5757
// own node_modules.
5858
extraNodeModules: objectFromEntries(
5959
// @babel/runtime makes the list because our Babel config (?) causes
60-
// files like @zulip/shared/js/typing_status.js to need it, whereas
60+
// files like @zulip/shared/lib/typing_status.js to need it, whereas
6161
// it's not a dependency of @zulip/shared itself.
6262
['@babel/runtime', ...arrayFlatMap(linkablePackages, packageDeps)].map(name => [
6363
name,

src/action-sheets/__tests__/action-sheet-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow strict-local
22
import deepFreeze from 'deep-freeze';
3-
import * as resolved_topic from '@zulip/shared/js/resolved_topic';
3+
import * as resolved_topic from '@zulip/shared/lib/resolved_topic';
44

55
import { HOME_NARROW } from '../../utils/narrow';
66
import * as eg from '../../__tests__/lib/exampleData';

src/action-sheets/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @flow strict-local */
22
import { Clipboard, Share, Alert } from 'react-native';
33
import invariant from 'invariant';
4-
import * as resolved_topic from '@zulip/shared/js/resolved_topic';
4+
import * as resolved_topic from '@zulip/shared/lib/resolved_topic';
55

66
import type {
77
Auth,

src/autocomplete/WildcardMentionItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, { useCallback, useContext, useMemo } from 'react';
33
import type { Node } from 'react';
44
import { View } from 'react-native';
5-
import * as typeahead from '@zulip/shared/js/typeahead';
5+
import * as typeahead from '@zulip/shared/lib/typeahead';
66

77
import type { GetText, Narrow } from '../types';
88
import { IconWildcardMention } from '../common/Icons';

src/compose/ComposeBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { LayoutEvent } from 'react-native/Libraries/Types/CoreEventTypes';
1414
import { SafeAreaView } from 'react-native-safe-area-context';
1515
import invariant from 'invariant';
1616
// $FlowFixMe[untyped-import]
17-
import * as fenced_code from '@zulip/shared/js/fenced_code';
17+
import * as fenced_code from '@zulip/shared/lib/fenced_code';
1818

1919
import { usePrevious } from '../reactUtils';
2020
import * as apiConstants from '../api/constants';

src/emoji/data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow strict-local */
2-
import * as typeahead from '@zulip/shared/js/typeahead';
2+
import * as typeahead from '@zulip/shared/lib/typeahead';
33
import { defaultMemoize } from 'reselect';
44

55
import * as api from '../api';

src/users/userHelpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @flow strict-local */
22
// $FlowFixMe[untyped-import]
33
import uniq from 'lodash.uniq';
4-
import * as typeahead from '@zulip/shared/js/typeahead';
4+
import * as typeahead from '@zulip/shared/lib/typeahead';
55

66
import type {
77
MutedUsersState,

src/users/usersActions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* @flow strict-local */
2-
import * as typing_status from '@zulip/shared/js/typing_status';
2+
import * as typing_status from '@zulip/shared/lib/typing_status';
33

44
import type { Auth, PerAccountState, Narrow, UserId, ThunkAction } from '../types';
55
import * as api from '../api';

0 commit comments

Comments
 (0)