Skip to content

Commit

Permalink
add typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Nov 29, 2022
1 parent 1752ebd commit c2b8f69
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ coverage
.nyc_output
yarn.lock
.project

dist
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"files": [
"lib"
],
"main": "lib",
"type": "module",
"keywords": [
"development",
Expand Down Expand Up @@ -42,7 +41,8 @@
"xo": "^0.53.1",
"yeoman-assert": "^3.1.1",
"yeoman-environment": "^3.12.1",
"yeoman-test": "^6.0.0"
"yeoman-test": "^6.0.0",
"typescript": "^4.9.3"
},
"license": "BSD-2-Clause",
"repository": "yeoman/generator",
Expand All @@ -56,7 +56,9 @@
"doc": "npm run doc:generate && npm run doc:fix && npm run doc:prettier",
"doc:generate": "jsdoc -c jsdoc.json -d $npm_package_config_doc_path$DOC_FOLDER",
"doc:prettier": "prettier $npm_package_config_doc_path$DOC_FOLDER --write --ignore-path .prettierignore-doc",
"doc:fix": "sed -i -e 's:^[[:space:]]*<!--[[:space:]]*$::g' -e 's:^[[:space:]]*-->[[:space:]]*$::g' $npm_package_config_doc_path$DOC_FOLDER/global.html || true"
"doc:fix": "sed -i -e 's:^[[:space:]]*<!--[[:space:]]*$::g' -e 's:^[[:space:]]*-->[[:space:]]*$::g' $npm_package_config_doc_path$DOC_FOLDER/global.html || true",
"prepare": "npm run build",
"build": "tsc"
},
"dependencies": {
"chalk": "^5.1.2",
Expand All @@ -79,5 +81,14 @@
"yeoman-environment": {
"optional": true
}
},
"exports": {
".": {
"default": "./dist/index.js"
},
"./typed": {
"types": "./dist/index.d.js",
"default": "./dist/index.js"
}
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"include": ["src/**/*"],
"compilerOptions": {
/* Language and Environment */
"target": "ES2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": ["ES2022"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
"types": [],

/* Modules */
"module": "node16" /* Specify what module code is generated. */,
"rootDir": "./src" /* Specify the root folder within your source files. */,
"resolveJsonModule": true,

/* JavaScript Support */
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,

/* Emit */
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
"declaration": true,

/* Interop Constraints */
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,

/* Type Checking */
"strict": true /* Enable all strict type-checking options. */,
"noImplicitAny": false,

/* Completeness */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
8 changes: 8 additions & 0 deletions tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"include": ["**/*"],
"exclude": [],
"extends": "./tsconfig.json",
"compilerOptions": {
"types": ["mocha"]
}
}

0 comments on commit c2b8f69

Please sign in to comment.