Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

License

NotificationsYou must be signed in to change notification settings

dojo/scripts

Repository files navigation

Build Statusnpm version

A package of scripts to aid with Dojo package development.

Features

Building

You can build your project using the regulartsc command. Sometsconfig.json templates are provided to make configuration eaasier.

TSConfig FileDescription
tsconfig/base.jsonProvides common tsconfig settings.
tsconfig/umd.jsonOverrides the base config and provides UMD module compilation.
tsconfig/esm.jsonOverrides the base config and provides ESM module compilation.
tsconfig/commonjs.jsonOverrides the base config and provides CommonJS module compilation.

In your local project, you would extend one of these configs. For example to use UMD modules, yourtsconfig.json would look like this:

{"extends":"./node_modules/@dojo/scripts/tsconfig/umd.json"}

To further enable ESM modules, create atsconfig.esm.json with the following:

{"extends":"./node_modules/@dojo/scripts/tsconfig/esm.json"}

You can now usetsc to compile your code to thedist/umd anddist/esm directories.

# compile UMD$ tsc# compile ESM$ tsc -p tsconfig.esm.json

Static Files

You can use other npm scripts to copy static assets into your build process. For example thecopyfiles command can take.html files for your functional tests and put them in thedist/dev directory for testing.

{"scripts": {"build:static":"copyfiles\"tests/**/*.html\" dist/dev"  }}

Watching

It can be helpful during development to not have to rerun a full build every time you make a change. To help with this, you can use thedojo-tsc-watcher script. This script will watch one or more tsc compiles, and when they all compile successfully, will run a specified command.

For example, to repackage yourdev andrelease directories automatically on a code change,

dojo-tsc-watcher -p tsconfig.json tsconfig.esm.json -- npm run package

By default, the watcher willnot run the target script if compilation fails on one of the tsc processes. If you want run the target script regardless of if the compilation succeeded or failed, you can pass the—force flag.

Linting

This package also includes a base set of tslint rules you can use. Update yourtslint.json to include,

{"extends":"./node_modules/@dojo/scripts/tslint/base.json"}

You can now lint your project with,

$ tslint -p.

Packaging

The provideddojo-package script will take all of the directories in thedist directory (umd,cjs, andesm) and merge them together to createdev andrelease directories. When you run tests, they are run from thedev directory. Production, or release, code is stored in therelease directory. The release directory will contain the files from thedev/src directory as well as a modifiedpackage.json from your project root.

Once in this format, you can easily create a.tar.gz of your package withnpm pack dist/release.

Testing

Projects can extend the provided Intern configs and avoid boilerplate configuration. To use the intern config, create anintern.json in your project with the following,

{"extends":"./node_modules/@dojo/scripts/intern/base.json","capibilities": {"name":"@dojo/your-project"  }}

In this file, you can add further configuration to override the base config (for example, custom loader configuration).

Now, with a regularintern.json you can run Intern from the command line to run your tests.

# run node unit tests$ npx intern# run browser unit tests$ npx intern config=intern.json@local

See theIntern docs for more options on running Intern.

Releasing

Several scripts are provided to ease the release process.

Can Publish Checks

To check if the user is allowed to publish, run thedojo-can-publish-check script. The script will fail with a1 exit code if the user cannot publish. The script checks that the user is logged into npm and that the user is in the maintainers list for the package.

If the package has never been published, the maintainers list will be empty and the check will always fail. Pass the--initial flag to skip the maintainers check.

Clean Repo Checks

A safe release is a clean release. To check if there are no uncommitted changes, and the user is on the correct branch for release, run thedojo-repo-is-clean-check script. The script will fail with a1 exit code if the repo is dirty.

Release

Thedojo-release script can release a dojo package. Thedist/release directory is what gets released. The script takes a number of arguments:

ParameterDefaultDescription
—releaseThe version to release
—nextThe next version (package.json version gets set to this)
—dry-runfalseShows the commands that will be run but does not run the commands
-branchmasterThe branch to perform the release on
—tagnextThe tag to pass tonpm publish
—initialfalseIs this the initial release? If true, thenpm publish command is run with—access public

How do I use this package?

Add this package as a dependency and reference the provided scripts from npm scripts.

For example,

{"scripts": {"prepublish":"dojo-install-peer-deps","lint":"tslint\"src/**/*.ts\"\"tests/**/*.ts\"","test":"npm run build:umd && intern","test:local":"intern config=intern.json@local","test:browserstack":"intern config=intern.json@browserstack","test:saucelabs":"intern config=intern.json@saucelabs","build:static":"copyfiles\"tests/**/*.html\"\"src/**/*.d.ts\"","build:umd":"tsc -p . && npm run build:static -- dist/umd","build:esm":"tsc -p ./node_modules/@dojo/scripts/tsconfig.esm.json && npm run build:static -- dist/esm","clean":"rimraf dist","dist":"npm run lint && npm run clean && npm run build:umd && npm run build:esm && npm run package","package":"dojo-package","release":"dojo-can-publish-check && dojo-repo-is-clean-check && npm run dist && npm run package && dojo-release"  },}

How do I contribute?

We appreciate your interest! Please see theDojo Meta Repository for theContributing Guidelines and Style Guide.

Licensing information

© 2017JS Foundation.New BSD license.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors5

Languages


[8]ページ先頭

©2009-2025 Movatter.jp