Coder Social home page Coder Social logo

ipfs / aegir Goto Github PK

View Code? Open in Web Editor NEW
98.0 22.0 58.0 7.95 MB

AEgir - Automated JavaScript project building

Home Page: https://ipfs.github.io/aegir

License: Other

JavaScript 96.37% TypeScript 3.63%
aegir typescript coverage testing linting esbuild

aegir's Introduction

ipfs.tech Discuss codecov CI

JavaScript project management

Install

$ npm i aegir

Browser <script> tag

Loading this module through a script tag will make it's exports available as Aegir in the global namespace.

<script src="https://unpkg.com/aegir/dist/index.min.js"></script>

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 completion                   generate completion script
  aegir build                        Builds a browser bundle and TS type declara
                                     tions from the `src` folder.
  aegir check-project                Ensure your project has the correct config.
  aegir check                        Check project
  aegir clean [files..]              Remove created build artifacts.
  aegir dependency-check [input...]  Run `dependency-check` cli with aegir defau
                                     lts.              [aliases: dep-check, dep]
  aegir docs                         Generate documentation from TS type declara
                                     tions.
  aegir document-check [input...]    Run `document-check` cli with aegir default
                                     s.                     [aliases: doc-check]
  aegir lint-package-json            Lint package.json with aegir defaults.
                                                    [aliases: lint-package, lpj]
  aegir lint                         Lint all project files
  aegir release                      Release using semantic-release
  aegir release-rc                   Release an RC version of the current module
                                      or monorepo
  aegir test-dependant [repo]        Run the tests of an module that depends on
                                     this module to see if the current changes h
                                     ave caused a regression
  aegir test                         Test your code in different environments
  aegir exec <command>               Run a command in each project of a monorepo
  aegir run <scripts..>              Run one or more npm scripts in each project
                                      of a monorepo

Global Options:
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]
  -d, --debug    Show debug output.                   [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 loca
                                            l version
  aegir test -t webworker -- --browser fir  If the command supports `--` can be
  efox                                      used to forward options to the under
                                            lying tool.
  npm test -- -- --browser firefox          If `npm test` translates to `aegir t
                                            est -t browser` and you want to forw
                                            ard 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

Aegir will detect the presence of tsconfig.json files and build typescript as appropriate.

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

API Docs

License

Licensed under either of

Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

aegir's People

Contributors

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aegir's Issues

Better align with the community around package.json jsnext:main field

I just read upon jsnext:main in https://github.com/rollup/rollup/wiki/jsnext:main and realised that the current setup is not correct. What we do is right now

  • main: ES5 transpiled code
  • jsnext:main ES6 original code, fully compatible with @4 and above

What the wiki article above actually suggest forjsnext:main is

jsnext:main will point to a module that has ES2015 module syntax but otherwise only syntax features that node supports.

My suggestion to fixing this, is to stop transpiling for node code as we are already setting the engine version to node >= 4 and running CI against the non transpiled version. As such we can drop the whole lib directory and just start pointing main to src/index.js.
This will also enable us to make npm link work much better out of the box when doing development on multiple modules.

cc @diasdavid

aegir.next()

Followed by #99 (comment) and as @dignifiedquire has mentioned several times:

I am not saying the current version is particularly good, in reality the whole thing just needs refactoring and clean up, this was never intended to support many options.

We need to take the project to the next level, establish what it is all about, create a Roadmap, list out every item that needs to be handled and refactor the codebase to a state where it is easy to understand what is going on.

@dignifiedquire I believe you are the best person to create the Roadmap.

Another thing that might make sense, is move this to the IPFS org and welcome the community to take ownership and contribute, right now, the fact that it is only under your user account kind of hides it from contributors, I feel.

An in-range update of eslint-plugin-standard is breaking the build 🚨

Version 2.2.0 of eslint-plugin-standard just got published.

Branch Build failing 🚨
Dependency eslint-plugin-standard
Current Version 2.1.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-plugin-standard is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Commits

The new version differs by 3 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of eslint-config-standard is breaking the build 🚨

Version 7.0.2 of eslint-config-standard just got published.

Branch Build failing 🚨
Dependency eslint-config-standard
Current Version 7.0.1
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-config-standard is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Commits

The new version differs by 2 commits .

  • d75816c 7.0.2
  • eb9b41f Relax rule: Allow tagged template string expressions (no-unused-expressions)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Add changelog generation and commit message convention

Can't `npm publish` :(

npm doesn't let me publish

» npm publish
npm http request PUT https://registry.npmjs.org/aegir
npm http 403 https://registry.npmjs.org/aegir
npm ERR! publish Failed PUT 403
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "publish"
npm ERR! node v4.3.2
npm ERR! npm  v3.8.7
npm ERR! code E403

npm ERR! you do not have permission to publish "aegir". Are you logged in as the correct user? : aegir

Although it lists me as an owner https://www.npmjs.com/package/aegir

Sometimes it is impossible to stop `aegir`

Sometimes, after npm run release is executed, doing ^c only stops the run of the tests, but the build + release steps are still executed, it is actually a way to bypass the tests.

Lint commit messages before pushing

Would be effective if we could really get into the habit of writing git commit msgs that conforms to our standard.

One way of enforcing this could be to look through the commits pre-push, to make sure that they match our expectations.

Could also run in a post-commit hook I guess.

Related: #30

Explain Linting Decisions in Documentation

What

I want a place describing rationale behind linting decisions in the documentation.

Background

I just went to ipfs/community to the js-guidelines to look for a place to add a note about not nesting deps too deeply. There isn't a good place to put this. I think this isn't great; we should be able to explain our linting decisions in aegir, somewhere, if only in this README, or in the js-guidelines README.

It would be great if we could add a section for each linting decision, or each major design decision. I am 100% ok with pointing to issues in brief sentences, but I think this should exist. Otherwise, I don't know how to find the rationale for something if I find it controversial.

An in-range update of webpack-merge is breaking the build 🚨

Version 4.1.0 of webpack-merge just got published.

Branch Build failing 🚨
Dependency webpack-merge
Current Version 4.0.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As webpack-merge is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Commits

The new version differs by 9 commits .

  • d9559b9 4.1.0
  • ca835a7 Update lib
  • 5ad8c5f chore: Add @herecydev to contributors
  • 5b643d5 chore: Update changelog
  • 6bf19b6 Merge pull request #74 from herecydev/master
  • 9e21275 Added multiple merging to readme
  • 8b9d376 Formatting fixes
  • f62d69f Added more tests to cover upsert
  • 237117c Added merge multiple that outputs an array

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Missing output from lint command (and possible others)

When adding a new example to js-ipfs-api and running git commit, aegir runs lint and it failed somewhere but not showing any real errors.

screenshot

Running eslint directly on the newly added code revealed the following error (but not sure if this is the only/right one)

➜  js-ipfs-api git:(master) ✗ ./node_modules/.bin/eslint -c node_modules/aegir/config/eslintrc.yml examples 

Oops! Something went wrong! :(

ESLint couldn't find the plugin "eslint-plugin-react". This can happen for a couple different reasons:

1. If ESLint is installed globally, then make sure eslint-plugin-react is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.

2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm i eslint-plugin-react@latest --save-dev

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

test fails: unknown oprtion ---r

When running the command aegis-test node, I get the following error:

Message:
    Command failed: mocha --colors ---r=spec --timeout=80000

  error: unknown option `---r'

Any clue? Also, am willing to contribute fix..

Make default timeout lower

From 80s to 20s (or even 15s), it is annoying to have to wait for some timeouts and in really, no test should need to take that long.

Zombie processes

Aegir leaves (often) zombie processes created by the gulpfile tasks, when the tests fail. I find myself constantly having to kill processes manually by finding it through the port:

» lsof -n -i4TCP:9095 | grep LISTEN
node    4660 ground-control   22u  IPv4 0x4d30d26af3bdd79b      0t0  TCP *:9095 (LISTEN)

Is there a way to get it to run the 'post:tests' tasks, so that it closes anything that it opened during the pre:test?

Enable Sauce Labs

  • There should be a new test task which runs tests on a matrix of browsers on sauce labs.
  • The task should be test:saucelabs, and enabled by running aegir-test --env saucelabs
  • There should be a way to overwrite the matrix of browsers on
  • Sauce Labs credentials should be read via $SAUCE_USERNAME and $SAUCE_ACCESS_KEY (already done by the karma-sauce-launcher)

Improve test speed

Current stats are showing we can do a lot to improve general test execution time.

  • npm run test:node 3.70s user 0.59s system 89% cpu 4.784 total
  • node_modules/.bin/aegir-test --env node 2.47s user 0.25s system 108% cpu 2.508 total
  • mocha 1.16s user 0.10s system 100% cpu 1.261 total

This also means we should not suggest to use npm run, but rather provide a global command which avoids the large overhead npm run has.

aegir is failing to release thanks to uglify

Getting this error on npm release

[22:37:55] Error: Cannot find module 'uglify-js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Gulp.gulp.task (/Users/koruza/code/js-ipfs-api/node_modules/aegir/tasks/build/browser.js:10:20)
    at module.exports (/Users/koruza/code/js-ipfs-api/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/koruza/code/js-ipfs-api/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/koruza/code/js-ipfs-api/node_modules/orchestrator/index.js:214:10)
    at /Users/koruza/code/js-ipfs-api/node_modules/orchestrator/index.js:279:18
    at finish (/Users/koruza/code/js-ipfs-api/node_modules/orchestrator/lib/runTask.js:21:8)
    at cb (/Users/koruza/code/js-ipfs-api/node_modules/orchestrator/lib/runTask.js:29:3)
    at next (/Users/koruza/code/js-ipfs-api/node_modules/rimraf/rimraf.js:74:7)
    at FSReqWrap.CB [as oncomplete] (/Users/koruza/code/js-ipfs-api/node_modules/rimraf/rimraf.js:110:9)

And if uglify-js is installed, I get a type error on .replace during the minify step

aegir 9.2.0 is failing in a weird way

When running ipfs-bitswap tests with aegir 9.2.0:

  • npm run test ✔︎
  • npm run release 𝙓

?

It is a very strange behaviour. aegir 9.1.2 is 👌🏽

Can we make aegir less verbose

Any strong reason to keep:

[623] ./~/chai/lib/chai/utils/overwriteProperty.js 1.53 kB {1} {2} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16} {17} {18} {19} {20} {21} {22} {23}

?

Setup on all IPFS repos

Merged, and renamed to aegir

`--testPath=`

Can we have an option to specify what is the root of the folder with the tests we want to run?

README: what it is, what it does

Since this module is going to be used so widely across IPFS, I expect many current & prospective contributors to be funneled to this repo at one point or another. As such, I'd be really interested in seeing the README be very clear about

a. what is dignified.js? and
b. what problems does it solve?

Right now it does a very good job of explaining its subcommands and setting it up, but having Background and Description sections that explain a bit more could save @dignifiedquire the work of explaining things many more times via IRC or elsewhere.

Naming

I'm not sure that dignified.js is the best name for this module, if it is to be accepted widely.

screenshot 2016-04-13 10 46 37

It comes off to me (as a native English speaker) that you're trying to give this tool respect by naming it something respectful. But you have to gain respect, not just name it, so it sounds a bit haughty. I think we should name it something else.

Ideally, the name would reflect the function. Naming is hard. But what does this actually do?

Automated JavaScript project management.

That's really broad. Can we have a more concise definition to work with?

Sauce Labs does not work from forks

Came across this problem in ipfs/js-ipfs#631 where I made a PR from my fork to the main repository. Since Travis would hide environment variables for forks (and rightly so), Sauce Labs could not authenticate, therefore failing the tests.

Not sure about the solution, but currently, any PR coming from a contributor not having write access to the main repository, would fail.

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.