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

2.0.14578 • 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
  • generate-components-data: generates a JSON file with components event handlers data.
  • wix-module-list: generates 3 JSON files:
    • wixModules.json: all wix-modules (EDMs) names. Used for auto-suggestions in the editor.
    • deprecatedWixModules.json: all wix-modules that should be marked as deprecated, as they have SDK equivalents.
    • nonDeprecatedWixModules.json: all wix-modules (EDMs) that don't have SDK equivalents. Used for auto-suggestions in the editor.
  • generate-wix-sdk-list: generates a JSON file with all Wix SDK packages. Used for auto-suggestions in the editor.
  • generate-wix-sdk-contextual-client: generates a special d.ts file to support contextual client for Wix SDKs in Velo environment.
  • 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
│  ├── componentsData.json
│  ├── fullWixCodeTypes.json
│  ├── deprecatedWixModules.json
│  ├── nonDeprecatedWixModules.json
│  ├── wixSdks.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.json
  • ****dist/jsons/componentsData.json
  • ****dist/jsons/wixModules.json
  • ****dist/jsons/deprecatedWixModules.json
  • ****dist/jsons/nonDeprecatedWixModules.json
  • ****dist/jsons/wixSdks.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

32,208

Version

2.0.14578

License

MIT

Unpacked Size

72.5 MB

Total Files

721

Last publish

Collaborators

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