-
Notifications
You must be signed in to change notification settings - Fork 13
Rewrite package on typescript #108
base: master
Are you sure you want to change the base?
Conversation
5bc4e17
to
a44c3d4
Compare
Запушил вариант с переименование файлов, теперь если смотреть ПР по коммитам, то можно смотреть на изменения, а не проверять файл целиком. |
a44c3d4
to
96bc669
Compare
Запушил для запуска проверок |
"proxyquire": "^1.7.3", | ||
"sinon": "^2.2.0" | ||
"sinon": "^2.2.0", | ||
"typescript": "^4.5.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to pin exact versions (even in devDeps).
"prepare-calibrate-script": "uglifyjs ./lib/browser/client-scripts/calibrate.js -m > ./lib/browser/client-scripts/calibrate.min.js --support-ie8", | ||
"build": "tsc -p tsconfig.json", | ||
"postbuild": "npm run prepare-calibrate-script", | ||
"prepare-calibrate-script": "uglifyjs ./build/lib/browser/client-scripts/calibrate.js -m > ./build/lib/browser/client-scripts/calibrate.min.js --support-ie8", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of prepare-calibrate-script
and place it's script to postbuild
?
"test-unit": "mocha test", | ||
"test": "npm run lint && npm run test-unit", | ||
"pretest": "npm run build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we must always build project before run tests?
"test-unit": "mocha test", | ||
"test": "npm run lint && npm run test-unit", | ||
"pretest": "npm run build", | ||
"test": "run-s lint test-unit", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: add command for run unit tests only.
import options from "./lib/config/options"; | ||
export const config = { options }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Такая махинация нужна, чтобы сохранить API, но понял, что можно сделать лучше так:
- добавить файл
./lib/config/index.ts
с содержимымexport * as options from "./options";
- здесь оставить лишь
export * as config from "./lib/config";
Что сделано
Переписал пакет на
typescript
. Из нюансов:tsconfig.json
. Первый в корень, второй – вlib/browser/client-scripts
. Это нужно, так как клиентские скрипты нужно собирать дляES3
.lib/browser/client-scripts/polyfills
.transform
пакетаbrowserify
(ссылка на текущий код, ссылка на новый). Пакет поддерживает оба варианта передачи аргументов, но тайпинги из пакета@types/browserify
позволяют использовать лишь один вариант. Предпочел сменить порядок аргументов, чем делать пулл-реквест в тайпинги.jest
.