Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS-to-TS migration #536

Merged
merged 174 commits into from Aug 5, 2019

Conversation

@MurakamiShinyu
Copy link
Member

commented Aug 5, 2019

johanneswilm and others added 30 commits Aug 21, 2018
fix "Type 'ElementStyle' is not assignable to type 'ElementStyleMap'"…
… error

I'm not sure this fix (`target as ElementStyleMap`) makes sense but it's just to eliminate the error.
change `if (goog.DEBUG)` to `if (DEBUG)` and put `declare var DEBUG: …
…boolean;` for compile time configuration using webpack.DefinePlugin.
Merge pull request #449 from vivliostyle/TS-namespace
change `namespace.exportSymbol(...);` to `export namespace X { ... }`
reformat TypeScript source code with Prettier
```
prettier --write "src/ts/**/*.ts"
```

(Beautify TypeScript source code #528)
change `function() {...}` to `() => {...}` in `forEach(...)` etc.
(Related issue: Beautify TypeScript source code #528)
Sort import order eslint setting
- add "import/order": "error" setting in .eslintrc.js
- change import path "./base" to "../adapt/base" etc. for consistent import order
Change function style: `export const foo = () => {...}` --> `export f…
…unction foo() {...}`

(Related issue: Beautify TypeScript source code #528)
Adjust source file names to make consistent with import names
Before this update, the import names and file names are:
```
import * as Exprs from "../adapt/expr";
import * as LayoutImpl from "../adapt/layout";
import * as ViewerImpl from "../adapt/viewer";
import * as Columns from "../vivliostyle/column";
import * as Footnotes from "../vivliostyle/footnote";
import * as LayoutRetryers from "../vivliostyle/layoutretryer";
import * as Matchers from "../vivliostyle/matcher";
import * as MathUtil from "../vivliostyle/math";
import * as Pages from "../vivliostyle/page";
import * as RepetitiveElementImpl from "../vivliostyle/repetitiveelements";
```

After this update:
```
import * as Exprs from "../adapt/exprs";
import * as LayoutImpl from "../adapt/layoutimpl";
import * as AdaptViewer from "../adapt/adaptviewer";
import * as Columns from "../vivliostyle/columns";
import * as Footnotes from "../vivliostyle/footnotes";
import * as LayoutRetryers from "../vivliostyle/layoutretryers";
import * as Matchers from "../vivliostyle/matchers";
import * as MathUtil from "../vivliostyle/mathutil";
import * as Pages from "../vivliostyle/pages";
import * as RepetitiveElementImpl from "../vivliostyle/repetitiveelementimpl";
```

All file names are now same as the import names changed to lowercase.
(The import names were determined at bc72ed4 )

This update also renames "adapt/viewer" to "adapt/adaptviewer" (import * as AdaptViewer) to distinguish clearly with "vivliostyle/viewer".
The module "adapt/viewer" was originally the main module of the EPUB Adaptive Layout viewer. Now I decided to prefix "Adapt" to respect the original work.
Remove import/export of "viewerapp" from the entry module "vivliostyl…
…e.ts"

The "viewerapp" module has been not used since the [Vivliostyle-UI](https://github.com/vivliostyle/vivliostyle-ui/) was created as a separate component.
Update src/ts/README.md
WIP: Update README and dev document for TypeScript source #533
Adjust again source files, imports and namespace names
- make consistent name between namespace (for interface defined in types.ts) and its correnpoiding implementation module file and import names.
  - e.g., namespace `Vtree` in types.ts, and implementation module file name `vtree.ts` and its import name is `Vtree` or `VtreeImpl`
- don't use "impl" suffix in source file name
  - e.g., × `layoutimpl.ts` → `layout.ts`
- use "Impl" suffix in import name only when need import same name namespace. e.g.:
    ```ts
    import * as VtreeImpl from "./vtree";
    import { Vtree } from "../vivliostyle/types";
    ```
    and when `import { Vtree } from ...` is not necessary:
    ```ts
    import * as Vtree from "./vtree";
    ```
minor fix: missing argument
Change
        cont.schedule();
to
        cont.schedule(true);
for fix error: An argument for 'result' was not provided.

NOTE: seems this boolean result value is not important and changing `undefined` to `true` will have no effect (need check)
minor fix: misspeling in property name
Change
            result.marginoutside = 0;
to
            result.marginOutside = 0;

`marginoutside` was misspeling
Sort again import order, eslint setting
- use "sort-imports" default setting.
- not use "import/order"

Now `import * as` lines are sorted alphabetically without grouping by source directory.
This is eslint "sort-imports" default setting and it is less problematic because in the current
source structure grouping by directory 'adapt' or 'vivliostyle' is not semantically important.
('adapt' directory contains modules originally from the adaptive-layout project and
'vivliostyle' directory contains modules created for vivliostyle.)
Update package description and README
WIP: Update README and dev document for TypeScript source #533
Adjust package description and README
Update README and dev document for TypeScript source #533

@MurakamiShinyu MurakamiShinyu requested a review from spring-raining Aug 5, 2019

@MurakamiShinyu MurakamiShinyu merged commit 9aa6176 into master Aug 5, 2019

3 checks passed

clahub All contributors have signed the Contributor License Agreement.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@MurakamiShinyu

This comment has been minimized.

Copy link
Member Author

commented Aug 5, 2019

A bug found after the merge and fixed:

  • Fix "user-agent-Base.css" → "user-agent-base.css" fe24ad9
@spring-raining
Copy link
Member

left a comment

🎉

@MurakamiShinyu MurakamiShinyu added this to the JS-to-TS migration milestone Aug 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.