diff --git a/enums/placeholders.html b/enums/placeholders.html index a2909dd..cc43153 100644 --- a/enums/placeholders.html +++ b/enums/placeholders.html @@ -89,7 +89,7 @@
A sample async function (to demo Typescript's es7 async/await downleveling).
import { asyncABC } from 'typescript-starter'
+ import { asyncABC } from 'typescript-starter'
console.log(await asyncABC())
-// => ['a','b','c']
-
+// => ['a','b','c']
var double = require('typescript-starter').asyncABC;
+ var double = require('typescript-starter').asyncABC;
asyncABC().then(console.log);
-// => ['a','b','c']
-
+// => ['a','b','c']
a Promise which should contain ['a','b','c']
Multiplies a value by 2. (Also a full example of Typedoc's functionality.)
import { double } from 'typescript-starter'
+ import { double } from 'typescript-starter'
console.log(double(4))
-// => 8
-
+// => 8
var double = require('typescript-starter').double;
+ var double = require('typescript-starter').double;
console.log(double(4))
-// => 8
-
+// => 8
Some other value.
@@ -402,7 +398,7 @@ asyncABC().then(console.log);Raise the value of the first parameter to the power of the second using the es7 ** operator.
import { power } from 'typescript-starter'
+ import { power } from 'typescript-starter'
console.log(power(2,3))
-// => 8
-
+// => 8
var power = require('typescript-starter').power;
+ var power = require('typescript-starter').power;
console.log(power(2,3))
-// => 8
-
+// => 8
Calculate the sha256 digest of a string.
import { sha256 } from 'typescript-starter'
+ import { sha256 } from 'typescript-starter'
sha256('test')
-// => '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
-
+// => '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
A faster implementation of sha256 which requires the native Node.js module. Browser consumers should use sha256, instead.
import { sha256Native as sha256 } from 'typescript-starter'
+ import { sha256Native as sha256 } from 'typescript-starter'
sha256('test')
-// => '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
-
+// => '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08'
Run one simple command to install and use the interactive project generator. You'll need Node v8.9 (the current LTS release) or later.
npx typescript-starter
-
+ npx typescript-starter
The interactive CLI will help you create and configure your project automatically.
Since this repo includes the CLI and it's tests, you'll only need to fork or clone this project if you want to contribute. If you find this project useful, please consider leaving a star so others can find it. Thanks!
@@ -110,8 +109,7 @@Developing with typescript-starter
Development zen
To start working, run the
-watchtask usingnpmoryarn.+npm run watch -npm run watchThis starter includes a watch task which makes development faster and more interactive. It's particularly helpful for TDD/BDD workflows.
The watch task will build and watch the entire project for changes (to both the library source files and test source files). As you develop, you can add tests for new functionality – which will initially fail – before developing the new functionality. Each time you save, any changes will be rebuilt and retested.
@@ -124,45 +122,38 @@
To enable additional Typescript type checking features (a good idea for mission-critical or large projects), review the commented-out lines in your typescript compiler options.
View test coverage
To generate and view test coverage, run:
-+npm run cov -npm run covThis will create an HTML report of test coverage – source-mapped back to Typescript – and open it in your default browser.
![]()
Generate your API docs
The src folder is analyzed and documentation is automatically generated using TypeDoc.
-+npm run doc -npm run docThis command generates API documentation for your library in HTML format and opens it in a browser.
Since types are tracked by Typescript, there's no need to indicate types in JSDoc format. For more information, see the TypeDoc documentation.
To generate and publish your documentation to GitHub Pages use the following command:
-+npm run doc:publish -npm run doc:publishOnce published, your documentation should be available at the proper GitHub Pages URL for your repo. See
typescript-starter's GitHub Pages for an example.
![]()
For more advanced documentation generation, you can provide your own TypeDoc theme, or build your own documentation using the JSON TypeDoc export:
-+npm run doc:json -npm run doc:jsonBump version, update changelog, commit, & tag release
It's recommended that you install
-commitizento make commits to your project.npm install -g commitizen ++git cznpm install -g commitizen # commit your changes: -git cz -This project is tooled for conventional changelog to make managing releases easier. See the standard-version documentation for more information on the workflow, or
-CHANGELOG.mdfor an example.+# bump package.json version, update CHANGELOG.md, git tag the release -npm run version -# bump package.json version, update CHANGELOG.md, git tag the release +npm run versionYou may find a tool like
wiphelpful for managing work in progress before you're ready to create a meaningful commit.One-step publish preparation script
Bringing together many of the steps above, this repo includes a one-step release preparation command.
-+# Prepare a standard release: -npm run prepare-release -# Prepare a standard release: +npm run prepare-releaseThis command runs the following tasks:
- @@ -172,11 +163,10 @@ npm run prepare-release
reset: cleans the repo by removing all untracked files and resetting--hardto the latest commit. (Note: this could be destructive.)version: bump package.json version, update CHANGELOG.md, and git tag the releaseWhen the script finishes, it will log the final command needed to push the release commit to the repo and publish the package on the
-npmregistry:+git push --follow-tags origin master; npm publish -git push --follow-tags origin master; npm publishLook over the release if you'd like, then execute the command to publish everything.
You can also prepare a non-standard release:
-# Or a non-standard release: ++npm run doc:publish# Or a non-standard release: # Build everything npm run all @@ -194,8 +184,7 @@ npm run version -- --first-release # $ npm run version -- --prerelease alpha # And don't forget to push the docs to GitHub pages: -npm run doc:publish -Get scripts info
You can run the
infoscript for information on each script intended to be individually run.npm run info @@ -223,8 +212,7 @@ doc:json: reset: Delete all untracked files and reset the repo to the last commit prepare-release: - One-step: clean, build, test, publish docs, and prep a release -FAQs
+ One-step: clean, build, test, publish docs, and prep a releaseFAQs
Why are there two builds? (
mainandmodule)The
srcoftypescript-starteris compiled into two separate builds:mainandmodule. Themainbuild is configured to use the CommonJS module system. Themodulebuild uses the new es6 module system.Because Node.js LTS releases do not yet support the es6 module system, some projects which depend on your project will follow the
@@ -260,18 +248,16 @@ reset:mainfield inpackage.json. Tools which support the new system (like Rollup, Webpack, or Parcel) will follow themodulefield, giving them the ability to statically analyze your project. These tools can tree-shake yourmodulebuild to import only the code they need.Providing a public API where consumer code is the same between browsers and Node.js is desirable, but it comes at the cost of significant configuration and complexity. In many cases, it requires that code be aware of its environment at runtime, requiring additional complexity and testing.
A better way to provide this developer experience is to provide similar APIs for each environment, and then encourage the use of es6 import aliasing to standardize between them.
For example, in the documentation for
-typescript-starter, we encourage Node.js users to importsha256Native as sha256. With this convention, we get a standard API without loaders or dependency substitution hacks.// browser-application.js +-// browser-application.js import { sha256 } from 'typescript-starter'; // fully-portable code -console.log(sha256('test')); -+// node-application.js +console.log(sha256('test'));+console.log(sha256('test'));// node-application.js import { sha256Native as sha256 } from 'typescript-starter'; // fully-portable code -console.log(sha256('test')); -What about Git hooks to validate commit messages?
This project uses standard-version to automatically update the changelog based on commit messages since the last release. To do this, each relevant commit must be properly formatted.
To ensure all commits follow the proper conventions, you can use a package like commitlint with Husky. However, keep in mind that commit hooks can be confusing, especially for new contributors. They also interfere with some development tools and workflows.
@@ -283,14 +269,11 @@ reset: cd typescript-starter npm install npm test -npm link -To manually test the CLI, you can use the
+npm linkTYPESCRIPT_STARTER_REPO_URLenvironment variable to test a clone from your local repo. Runnpm run watchas you're developing, then in a different testing directory:To manually test the CLI, you can use the
TYPESCRIPT_STARTER_REPO_URLenvironment variable to test a clone from your local repo. Runnpm run watchas you're developing, then in a different testing directory:mkdir typescript-starter-testing cd typescript-starter-testing -TYPESCRIPT_STARTER_REPO_URL='/local/path/to/typescript-starter' typescript-starter -You can also set
-TYPESCRIPT_STARTER_REPO_URLto any valid Git URL, such as your fork of this repo:TYPESCRIPT_STARTER_REPO_URL='https://github.com/YOUR_USERNAME/typescript-starter.git' typescript-starter -If
+TYPESCRIPT_STARTER_REPO_URL='/local/path/to/typescript-starter' typescript-starterTYPESCRIPT_STARTER_REPO_BRANCHis not provided, it will default tomaster.You can also set
+TYPESCRIPT_STARTER_REPO_URLto any valid Git URL, such as your fork of this repo:TYPESCRIPT_STARTER_REPO_URL='https://github.com/YOUR_USERNAME/typescript-starter.git' typescript-starterIf
TYPESCRIPT_STARTER_REPO_BRANCHis not provided, it will default tomaster.If you're using VS Code, the
Debug CLIlaunch configuration also allows you to immediately build and step through execution of the CLI.In the wild
You can find more advanced configurations, usage examples, and inspiration from other projects using
diff --git a/interfaces/tasks.html b/interfaces/tasks.html index 6993dd3..41d3b94 100644 --- a/interfaces/tasks.html +++ b/interfaces/tasks.html @@ -97,7 +97,7 @@typescript-starter:cloneRepo: function @@ -142,7 +142,7 @@initialCommit: function @@ -179,7 +179,7 @@install: functiondiff --git a/interfaces/typescriptstarterclioptions.html b/interfaces/typescriptstarterclioptions.html index 5e35d9a..9a3a662 100644 --- a/interfaces/typescriptstarterclioptions.html +++ b/interfaces/typescriptstarterclioptions.html @@ -111,7 +111,7 @@appveyor: boolean@@ -121,7 +121,7 @@circleci: boolean@@ -131,7 +131,7 @@description: string@@ -141,7 +141,7 @@dom@@ -151,7 +151,7 @@Definitions: boolean immutable: boolean@@ -161,7 +161,7 @@install: boolean@@ -171,7 +171,7 @@node@@ -181,7 +181,7 @@Definitions: boolean project@@ -191,7 +191,7 @@Name: string runner: Runner@@ -201,7 +201,7 @@strict: boolean@@ -211,7 +211,7 @@travis: boolean@@ -221,7 +221,7 @@vscode: booleandiff --git a/interfaces/typescriptstarterinferredoptions.html b/interfaces/typescriptstarterinferredoptions.html index 6fe4fa1..dd688ec 100644 --- a/interfaces/typescriptstarterinferredoptions.html +++ b/interfaces/typescriptstarterinferredoptions.html @@ -104,7 +104,7 @@email: string@@ -114,7 +114,7 @@full@@ -124,7 +124,7 @@Name: string github@@ -134,7 +134,7 @@Username: string repoInfo: object @@ -155,7 +155,7 @@workingdiff --git a/interfaces/typescriptstarteroptions.html b/interfaces/typescriptstarteroptions.html index 83f47b2..2a563d1 100644 --- a/interfaces/typescriptstarteroptions.html +++ b/interfaces/typescriptstarteroptions.html @@ -120,7 +120,7 @@ @@ -131,7 +131,7 @@ @@ -142,7 +142,7 @@ @@ -153,7 +153,7 @@ @@ -164,7 +164,7 @@ @@ -175,7 +175,7 @@ @@ -186,7 +186,7 @@ @@ -197,7 +197,7 @@ @@ -208,7 +208,7 @@ @@ -219,7 +219,7 @@ @@ -230,7 +230,7 @@ @@ -241,7 +241,7 @@Directory: string @@ -263,7 +263,7 @@ @@ -274,7 +274,7 @@ @@ -285,7 +285,7 @@ @@ -296,7 +296,7 @@ @@ -307,7 +307,7 @@ diff --git a/interfaces/typescriptstarterrequiredconfig.html b/interfaces/typescriptstarterrequiredconfig.html index f3422fe..c74c879 100644 --- a/interfaces/typescriptstarterrequiredconfig.html +++ b/interfaces/typescriptstarterrequiredconfig.html @@ -96,7 +96,7 @@install: boolean@@ -106,7 +106,7 @@starterVersion: string