Cocos AIR project setup
Stop once you can answer the task. Do not read another same-topic reference for the same question.
Scope: Package imports, HTML shells, TypeScript declarations and identifiable build variants.
Environment: use package imports in apps; source paths require an AIR checkout. See context.
Quick Start
For complete setup and teardown, read Quick Start.
Siblings: direct dependencies; reuse loaded skills.
Triggers
- Install cocosair.js in a bundler app
- Wire a static page importmap and canvas
- Select a custom canvas or startup pixel ratio
- Find main-entry experimental HTML texture helpers
- Resolve TypeScript 4.9 or 5+ declarations
- Choose AIR_FEATURES and separate variant output
- Identify which build command owns an artifact
Exact API and symptom mappings: triggers.
Contracts
Use cocosair.js in bundler apps; cocosair is the repository importmap alias. Pass any selected canvas to createAirApp; repeated main calls share startup admission. Keep variant outputs separate from default builds.
Read references/contracts.md only when the task needs exact option rules, limits, error behavior or source annotations. Prefer the topic references below for a narrower question.
Common Mistakes
- [HIGH] Installed apps import cocosair.js, not the cocosair alias.
- [HIGH] src/index.ts alone does not define the package surface.
- [MEDIUM] Bootstrap/html-source package subpaths were removed.
- [MEDIUM] A variant build is a distinct candidate.
Read relevant wrong/right examples before implementation.
Reference map
- Which import or types? - Exports and artifacts
- What does a variant ship? - Features and outputs
- How should the page start? - Importmap and canvas