mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-27 20:36:33 -04:00
Add TypeScript type declarations (#23)
* feat: add ambient module stubs for declaration generation Provide TypeScript ambient declarations for 'message_keys' (Pebble SDK module) and './tmp/config-page.html' (build artefact) so tsc can resolve these imports when generating .d.ts files. * feat: add tsconfig for declaration generation Configures tsc --allowJs --emitDeclarationOnly to generate per-file .d.ts reference output in dist-types/ from the library source files. * feat: add curated TypeScript declarations for public API Hand-curated index.d.ts covering Clay, ClayConfig, ClayItem, ClayEvents, manipulators, and all supporting types. Necessary because tsc cannot infer the ClayEvents mixin or dynamically-bound manipulator methods. All types are exported via the Clay namespace. * test: add type-checking verification for index.d.ts Exercises the full public API surface — constructor, instance/static methods, ClayConfig/ClayItem event methods, manipulator methods, namespace-exported types, and customFn this-context. * build: add typescript devDependency, types field, and build scripts Adds typescript 6.0.2 as a devDependency. Sets "types": "index.d.ts" in package.json. Adds build:types and check:types scripts. * build: add gulp types task to validate declarations on build Validates index.d.ts against test/type-checks.ts as part of the default gulp build. Reference declaration generation via build:types remains available as a separate manual step. * chore: update ignore files for TypeScript declarations Add dist-types/ to .gitignore (build artefact). Whitelist index.d.ts in .npmignore so type declarations ship with the package. * ci: add typecheck workflow to validate TypeScript declarations Runs npm run check:types on push and PR to main, matching the existing lint/test/build workflow pattern.
This commit is contained in:
@@ -2,12 +2,15 @@
|
||||
"name": "@rebble/clay",
|
||||
"version": "1.0.8",
|
||||
"description": "Pebble Config Framework",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"test-travis": "./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --single-run --browsers chromeTravisCI",
|
||||
"test-debug": "(export DEBUG=true && ./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --no-single-run)",
|
||||
"test": "./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --single-run",
|
||||
"lint": "./node_modules/.bin/eslint ./",
|
||||
"build": "gulp",
|
||||
"build:types": "tsc -p tsconfig.declarations.json",
|
||||
"check:types": "tsc -p tsconfig.typecheck.json",
|
||||
"dev": "gulp dev",
|
||||
"pebble-clean": "rm -rf tmp src/js/index.js && pebble clean",
|
||||
"pebble-publish": "npm run pebble-clean && npm run build && pebble build && pebble package publish && npm run pebble-clean",
|
||||
@@ -85,6 +88,7 @@
|
||||
"stringify": "^3.2.0",
|
||||
"through": "^2.3.8",
|
||||
"tosource": "^1.0.0",
|
||||
"typescript": "6.0.2",
|
||||
"vinyl-buffer": "^1.0.0",
|
||||
"vinyl-source-stream": "^2.0.0",
|
||||
"watchify": "^3.11.1"
|
||||
|
||||
Reference in New Issue
Block a user