@wix/wix-code-types
TypeScript icon, indicating that this package has built-in type declarations

2.0.10893 • Public • Published

Wix Code Types Generator

This package includes scripts that generate Typescript declarations for use in wix-code's auto-completion.

Scripts:

  • full-wix-code-types: generates a single JSON file with all the wix-code Typescript declarations for runtime consumption. E.g. $w definitions, The @types/node package for backend code, ES2020 declarations, various @wix module declarations etc.
  • generate-model-packages-dts: generates .d.ts files for each @wix module from the auto-velo flow
    • Creates declarations for the 3 contexts (backend, public, page) via index.d.ts files using triple slash directives.
    • The output is merged into fullCorvidTypes.json.
  • generate-model-docworks-dts: generates .d.ts files for each @wix module from the docworks flow
  • components-handlers: generates a JSON file with components event handlers data
  • wix-module-list: generates a JSON file that includes all wix-modules names
  • Various ast-patches: post processing of types that orginally were generated by docworks

Build Script

The build scripts runs the scripts in the following order.

"build": "
  npm run generate-model-docworks-dts &&
  npm run generate-model-packages-dts &&
  npm run patch-declarations &&
  npm run generate-full-wix-code-types &&
  npm run generate-module-list &&
  npm run generate-components-data &&
  npm run typescript
",

The output is eventually:

dist
├── jsons
│  ├── eventHandlers.json
│  ├── fullWixCodeTypes.json
│  └── wixModules.json
└── types
   ├── backend
   │  ├── $w.d.ts
   │  ├── docworks-packages.d.ts
   │  ├── index.d.ts
   │  ├── wix-alarm-backend.d.ts
   │  ├── wix-core-services-dev.d.ts
   │  ├── ...
   ├── common
   │  ├── $w.d.ts
   │  ├── anyProperties.d.ts
   │  ├── docworks-packages.d.ts
   │  ├── emptyBuffer.d.ts
   │  ├── wix-animations.d.ts
   │  ├── ...
   ├── page
   │  ├── $w.d.ts
   │  ├── docworks-packages.d.ts
   │  ├── index.d.ts
   │  └── wix-packages.d.ts
   └── public
      ├── $w.d.ts
      ├── docworks-packages.d.ts
      ├── index.d.ts
      └── wix-packages.d.ts

Getting Started

yarn install
yarn build

Release Process

  • wix-code-types is updated automatically by @wix/wix-code-types-service which opens PRs and lands them once they pass CI.
  • On every master change (landed PR), Falcon bumps the patch version on NPM
  • If you want to break the contract between wix-code-types and wix-code-editor-types you will need to manually bump the major version
    • By breaking the contract we mean modifying the generated JSONs structure in a way that the consumers can't handle
    • To do this, manually change the package.json version field to next major or run npm version major.
  • Falcon will pick this up and release the new major version

Override wix-code-types

wix-code-types can be overridden for dev needs. To do this, simply use the query parameter wix-code-types-override. Note that wix-code-editor-types looks for the Json files in the following relative paths:

  • ****dist/jsons/fullWixCodeTypes.beta.json
  • ****dist/jsons/componentsData.json
  • ****dist/jsons/wixModules.beta.json

Using Local Build of wix-code-types

To make it easier, if you are interested in using a local build of wix-code-types, just run the following command from your local wix-code-types package:

yarn serve

Then, use this query parameter:

&wix-code-types-override=http://localhost:8080/

Readme

Keywords

none

Package Sidebar

Install

npm i @wix/wix-code-types

Weekly Downloads

230,652

Version

2.0.10893

License

MIT

Unpacked Size

55.9 MB

Total Files

589

Last publish

Collaborators

  • mayaco
  • itaytay
  • amitde007
  • oferb-wix
  • varzager
  • youngshinobi
  • tombenezra
  • domasmak
  • yurynix
  • tuvit.wix
  • usability-sessions
  • yoav
  • wix-ci
  • shahata
  • wixnpm
  • wix-ambassador
  • netanelgilad
  • wix-ci-publisher
  • wix-bi-publisher
  • galil-team
  • lxgreen
  • ariki
  • liorgwix
  • arielh
  • falconci
  • itai.benda