Giter Site home page Giter Site logo

aegir's Introduction

AEgir

GitHub Workflow Status

Automated JavaScript project management.

Lead Maintainer

Hugo Dias

Project Structure

The project structure when using this is quite strict, to ease replication and configuration overhead.

All source code should be placed under src, with the main entry point being src/index.js or src/index.ts.

All test files should be placed under test. Individual test files should end in .spec.js or .spec.ts and will be ran in all environments (node, browser, webworker, electron-main and electron-renderer). To run node specific tests a file named test/node.js or test/node.ts should be used to require all node test files and the same thing for the other environments with a file named test/browser.js or test/browser.ts.

Your package.json should have the following entries and should pass aegir lint-package-json.

"main": "src/index.js",
"files": [
  "src",
  "dist"
],
"scripts": {
  "lint": "aegir lint",
  "release": "aegir release",
  "build": "aegir build",
  "test": "aegir test",
  "test:node": "aegir test --target node",
  "test:browser": "aegir test --target browser"
}

CLI

Run aegir --help

Usage: aegir <command> [options]

Commands:
  aegir build                        Builds a browser bundle and TS type declarations from the `src` folder.
  aegir check                        Check project
  aegir docs                         Generate documentation from TS type declarations.
  aegir lint                         Lint all project files
  aegir release                      Release your code onto the world
  aegir test-dependant [repo]        Run the tests of an module that depends on this module to see if the current changes have caused a regression
  aegir test                         Test your code in different environments
  aegir ts                           Typescript command with presets for specific tasks.
  aegir dependency-check [input...]  Run `dependency-check` cli with aegir defaults.                                                                                                                              [aliases: dep-check, dep]
  aegir lint-package-json            Lint package.json with aegir defaults.                                                                                                                                    [aliases: lint-package, lpj]
  aegir completion                   generate completion script

Global Options:
  -h, --help     Show help                                                                                                                                                                                                        [boolean]
  -v, --version  Show version number                                                                                                                                                                                              [boolean]
  -d, --debug    Show debug output.                                                                                                                                                                              [boolean] [default: false]
      --ts-repo  Enable support for Typescript repos.                                                                                                                                                            [boolean] [default: false]

Examples:
  aegir build                                   Runs the build command to bundle JS code for the browser.
  npx aegir build                               Can be used with `npx` to use a local version
  aegir test -t webworker -- --browser firefox  If the command supports `--` can be used to forward options to the underlying tool.
  npm test -- -- --browser firefox              If `npm test` translates to `aegir test -t browser` and you want to forward options you need to use `-- --` instead.

Use `aegir <command> --help` to learn more about each command.

Configuration

Aegir can be fully configured using a config file named .aegir.js or the package.json using the property aegir.

// file: .aegir.js



/** @type {import('aegir').PartialOptions} */
module.exports = {
  tsRepo: true,
  release: {
    build: false
  }
}
// file: package.json
"main": "src/index.js",
"files": [
  "src",
  "dist"
],
"scripts": {
  "lint": "aegir lint",
  "release": "aegir release",
  "build": "aegir build",
  "test": "aegir test",
  "test:node": "aegir test --target node",
  "test:browser": "aegir test --target browser"
},
"aegir" : {
  "tsRepo": false
}

You can find the complete default config here and the types here.

Continuous Integration

Check this template for Github Actions https://github.com/ipfs/aegir/blob/master/md/github-actions.md

Testing helpers

In addition to running the tests aegir also provides several helpers to be used by the tests.

Check the documentation

Typescript

JSDoc Typescript support

aegir ts --help

More documentation here

Native Typescript support

For native typescript add --ts-repo to any command.

aegir build --ts-repo
aegir test --ts-repo

Release steps

  1. Run linting
  2. Run type check
  3. Run tests
  4. Bump the version in package.json
  5. Build everything
  6. Update contributors based on the git history
  7. Generate a changelog based on the git log
  8. Commit the version change & CHANGELOG.md
  9. Create a git tag
  10. Run git push to origin/master
  11. Publish a release to Github releases
  12. Generate documentation and push to Github Pages
  13. Publish to npm
aegir release --help

License

MIT

aegir's People

Contributors

dignifiedquire avatar hugomrdias avatar achingbrain avatar victorb avatar daviddias avatar semantic-release-bot avatar vmx avatar greenkeeperio-bot avatar dependabot[bot] avatar dependabot-preview[bot] avatar alanshaw avatar dryajov avatar jacobheun avatar gozala avatar vasco-santos avatar greenkeeper[bot] avatar hacdias avatar mpetrunic avatar web3-bot avatar mkg20001 avatar npmcdn-to-unpkg-bot avatar kumavis avatar ipfs-mgmt-read-write[bot] avatar hackergrrl avatar sgtpooki avatar galargh avatar oliveriosousa avatar mikeal avatar wraithgar avatar lidel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.