Giter Site home page Giter Site logo

rfcs's Introduction

πŸ’₯ Ember CLI RFCs should now be submitted through the Ember RFCs repo

This repo is archived. The Ember CLI RFC process has merged into emberjs/rfcs. To read more about the move, see Ember RFC #300.

rfcs's People

Contributors

abuiles avatar acorncom avatar bcardarella avatar chadhietala avatar cibernox avatar dschmidt avatar e00dan avatar ef4 avatar gavinjoyce avatar hjdivad avatar jenweber avatar jish avatar jonathankingston avatar kategengler avatar knownasilya avatar kratiahuja avatar lazybensch avatar locks avatar nathanhammond avatar rwjblue avatar sharavanaprasad avatar shellandbull avatar stefanpenner avatar thomassnielsen avatar turbo87 avatar twokul avatar zackmattor 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

Watchers

 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

rfcs's Issues

Should auto-generated test cases fail by default?

The suggestion is to change the auto-generated unit-test cases from something like this...

// Replace this with your real tests.
test('it exists', function(assert) {
    var service = this.subject();
    assert.ok(service);
});

...to this...

test('it exists', function(assert) {
    var service = this.subject();
    assert.ok(false,'The service "my-service" has not yet been tested. It is highly recommended that you test your code for reasons X,Y,Z...');
});

I originally posted this as an ember-cli issue. It was promptly closed. The comment was "generators producing failing tests by default is not something we will do, this will great excess pain/noise, with little rewards."

Although the issue was closed on ember-cli because it apparently didn't belong there (it rather belongs here), I found the comment above interesting. Particularly, I have to say that it didn't convince me because it wasn't clear. In what circumstances would such a change cause great excess pain/noise? Are the benefits I mentioned in the original post not rewarding enough in comparison?

Some factors I can think of that might have played a part in the decision:

  • "Such behaviour might annoy newbies and people just making prototypes (non-production code).": Here I'd argue that such people wouldn't ever run the test suite anyway, so I can't see much pain being caused here.
  • "People might not be using ember-qunit": If that's the case I'm guessing that these scaffolded test cases wouldn't be relevant anyway.
  • "People can just opt-in to a plugin for generating such tests if they want". Here I could equally argue the flip side: why not make the current behavior an opt-in, changing the default behavior to one which forces the developer to at least think about and question how they're testing their app?

I'm hoping for an elaboration or discussion of the above comment, because my personal experience tells me that the weighting is in the other direction (i.e. having failing tests by default would do more good than harm for the end quality of an app).

Sure, testing is one of those "delayed gratification" things that is painful at the start, and sure, the ignorant may be vociferous, but: Ember's supposed to be an opinionated framework, so here I am offering an opinion: such behavior is for me a clear fit to the "convention over configuration" mantra that makes us all love Ember. Convince me (and yourselves) otherwise.

Add flag to determine if addon is installed to devDependencies or dependencies

npm allows the developer to determine whether to save a dependency in package.json under devDependencies or dependencies.

The difference between the two is that dependencies are required to run, while devDependencies are required to develop.

Examples of dependencies required to run: ember-cli, ember-resolver, and ember-core.
Examples of devDependencies required to develop: ember-cli, ember-resolver, ember-core, ember-cli-template-lint, ember-cli-jshint, and ember-cli-qunit.

In an Ember app, a user would have to manually maintain dependencies in package.json when running ember install <addon>.

I propose a --dev flag to ember install to allow developers to decide when the addon is not for development, like ember-route-action-helper, which would be used in-app. The flag would be true by default.

A benefit to this is that addons that are truly devDependencies would be excluded when the repo is being built and deployed in a CI environment, thus speeding up the process.

Access to `app.options` is inconsistent

Access to the build-time configuration (app.options) is inconsistent between the public hooks in an addon. For instance, this.app is undefined inside of setupPreprocessorRegistry but not inside of included.

This inconsistency makes things that should be straightforward more difficult. To illustrate:

included: function (app) {
  console.log('included', !!this.app);
}

setupPreprocessorRegistry: function(type, registry) {
  console.log('setupPreprocessorRegistry', !!this.app);
}

Logs the following:

setupPreprocessorRegistry false
setupPreprocessorRegistry false
included true

However, the app is actually available if you look in the "right" place:

setupPreprocessorRegistry: function(type, registry) {
    console.log('setupPreprocessorRegistry', type, !!registry.app);
}

Logs:

setupPreprocessorRegistry self true
setupPreprocessorRegistry parent true

So it is clear that the information is available before included is called, it just isn't exposed to the addon directly. There are ways to work around it -- for instance by stashing the parent's registry and then using it inside of included to add preprocessors -- but then what is the point of having a separate hook?

Another workaround is to put all this configuration inside of environment.js and then accessing it via the project config. This is even worse because all of that stuff ends up in the client when it is only needed at build time. This is just terrible, but many people do it.

There are definitely valid use cases for reading the build configuration from within setupPreprocessorRegistry, namely:

  • compilation settings for CSS preprocessors
  • settings for things that have template transforms

Ultimately, this particular flaw causes developers to introduce temporal coupling into their addon by ensuring that parts of their code only run after included in order to assure this.app is a thing. This is bad, and unnecessary since it can be proven that the information is already there to begin with.

Making addon dummy apps less special

I would like to make dummy apps less of a special case. Right now they have some weird behaviors, like:

  • ember-cli-build.js only really applies to the dummy app, but it appears at the root of the addon. This misleads people into thinking they can influence the addon's behavior by putting things in there.
  • when building a dummy app, the project.root directory points at the true root of the addon repo, which is not the root of the dummy app itself. There is a Known Hackℒ️ for reliably getting the real app root like path.join(project.configPath(), '../..'), since configPath does point at the right place for dummy apps. Due to this special case, many addons don't work correctly when you try to consume them inside a dummy app.
  • acceptance tests in tests/acceptance implicitly run against the dummy app, which makes them different from what an app developer has come to expect. Now, obviously there is no other place for them to run against, but this is still a bit jarring when first encountered.
  • ember-cli/lib/broccoli/ember-addon exists to build dummy apps, not addons (which makes its name confusing), and the only reason it needs to exist at all is that dummy apps are doing all these weird things.
  • I would argue dummy is not a great name and we can come up with something more descriptive. Candidates include sample-app or test-harness-app.
  • Because the dummy app and the addon share a package.json, it's not possible to test what happens when an app depends on your addon but does not directly depend on your addon's own addon dependencies. In a dummy app, all the addon's dependencies are forced to be direct dependencies of the app too. For example, if you addon uses ember-cli-sass, you can't test what happens when your addon is used in an app that doesn't happen to also use ember-cli-sass.

The general shape of my proposal is:

  • move ./tests/dummy to ./sample-app or whatever other name we bikeshed as a good default one.

  • the root ember-cli-build.js would change to mostly delegating to ./sample-app/ember-cli-build.js, in order to make it clear that there's no app config that lives at the root level.

  • ./sample-app/ember-cli-build.js would import ember-cli/lib/broccoli/ember-app, not ember-cli/lib/broccoli/ember-addon (which would get deprecated)

  • dummy apps would become 100% normal ember apps. They should have their own package.json (like ./sample-app/package.json), and you should be able to cd ./sample-app && ember s and everything works exactly as it would if you were in a normal standalone app. They can have the stock app .eslintrc.js in their own directory, meaning no special lint rules are required.

  • our previous work on fixing node_modules resolution means that a normal ember app located in ./sample-app is still able to access all the dependencies in ./node_modules, so no special casing is required there. This also allows multiple dummy apps to choose to include only subsets of their parent addon's devDependencies just by not including them in the dummy app's package.json (this is already how ember-cli works -- no special cases for dummy apps).

  • acceptance tests should live inside the app that they are testing. So today's ./tests/acceptance would move to ./sample-app/tests/acceptance. This makes them conform exactly to what app developers already know about acceptance tests.

  • ./tests/unit and ./tests/integration can stay where they are, those test suites can (in principle) run even if you choose to have no dummy app at all.

The only chunk of API design that I see missing from the above is deciding in detail what to put into the top-level ember-cli-build such that you can conveniently

  • run one or more dummy app's automatically in a single ember s process.
  • run a test suite composed of the addon's own integration & unit tests
  • run the above test suite and also run the tests in each of any number of dummy apps

A totally strawman example of the new top-level ember-cli-build.js would look like:

const AddonDevSetup = require('ember-cli/addon-dev-setup');
module.exports = new AddonDevSetup({
  sampleApps: [
    {
      // the app we're loading
      app: require('./sample-app/ember-cli-build.js'),

      // where to mount the app in the ember development server. Could 
      // potentially allow seting to `null` if you don't want the app to start 
      // automatically when you do a top-level `ember s`.
      rootURL: '/'

      // whether to run this app's `ember test` when we do a top-level `ember test`
      includeTests: true
    }
  ]
});

Public API to examine app dependencies from an addon

In an addon I can look in project.packageInfoCache.entries and see all of the installed packages at app build time, but as @Turbo87 mentions in ivanvanderbyl/ember-d3#69 (review) this doesn't appear to be public.

In addons like ember-d3 or @fortawesome/ember-fontawesome where it is important to validate or transform packages at build time this is needed functionality.

The private method https://ember-cli.com/api/classes/Project.html#method_dependencies exposes this, but only at the level of the application not the deep tree present in project.packageInfoCache.entries.

Daemon process for faster startup

Ember CLI currently has a quite high startup time due to the over 2000 require() calls and potentially more in every addon and blueprint in the projects. Gradle in the Java world had roughly similar problems and solved them by using a long-lived daemon process that is controlled by their gradle CLI tool.

Speeding up the startup time is required for things like #23 but I admit that I'm not sure yet if the added complexity is worth it. It would likely need to have a few more advantages to justify it. #4 might also be related to this idea.

addon entry-point other than index.js

Summary

I would like to create a library that is pure JS at its core, but is consumable as an Ember addon. I can use the main option in package.json to specify an entry point other than index.js, but that entry-point is both for pure-JS (e.g. node) consumption and Ember-CLI consumption.

Use-Case

As teams grow, it is often helpful to extract code from one application into a shared library. It's easy to do that as an Ember addon. But not all teams and projects use Ember.

Currently, the "standard" solution is to have two packages: @my-org/foo and @my-org/ember-foo. The former contains the business logic of the addon. The latter contains little more than an index.js with some Broccoli tree management to support import foo from '@my-org/foo' in an Ember application. The extra package means more time managing dependencies.

It would be much easier to maintain a single package that is usable without ember, but which knows how to package itself for ember.

Implementation Idea

// package.json
"ember-addon": {
  "main": "lib/ember-addon.js"
},
"optionalDependencies": {
  // things lib/ember-addon.js uses directly:
  "broccoli-merge-trees": "^2.0.0 || ^3.0.0",
  "ember-cli-babel": ">= 6.0.0",

  // ember compatibility:
  "ember-source": "^2.8.0 || ^3.0.0"
}

References

RFC wanted: Migration plan off of bower.

We need an RFC for the migration plan off of bower. This RFC should address:

  • The transition story for the community.
  • Ability to continue installing packages via bower.
  • How to support the existing workflow so as not to require a major version bump.

Possible approaches:

  • Compatibility addon?
  • Just in time installation of supporting packages during the workflow?

Notes:

  • Likely want to install our own local version of bower so we can control it.
  • Can probably detect known likely failures:
    • ember init and blueprint depends on bower.
    • ember install and a dep has bower.

lib/broccoli/ember-modules-app

The existing lib/broccoli/ember-app has a lot of organically grown behavior which supports our needs at present but doesn't give us as many opportunities to grow for the future. We're going to need to do some work in this area to support the new module unification RFC and this gives us as good a reason as any to ensure that we start this process off on a good footing.

A lot of these pain points have been discovered in the development efforts for FastBoot and Ember Engines and last year's efforts toward a linker/packager.

Goals

  • Have a specification for the inputs and outputs at each step of the build.
  • Support the Module Unification RFC.
  • Allow for parallelization of Babel, Uglify, other pre- and post-processors.
  • Support Babel external helpers.
  • Stable output per module if it doesn't change. (Minify on a per-module basis.)
  • Support inclusion (or fail gracefully) when encountering addons at different version numbers.
  • Don't merge things down until as late as possible to reduce unnecessary rework.
  • Support multiple "root" entry points (host application, lazy engines, ___).
  • Build a foundation for linker/packager and "graph" shaking.
  • Have a built in story for Browserify/ES6 node module inclusion.
  • Provide hook which allows for "preparse" and rollup behavior.
  • Recursively inline leaf node dependencies which are only required by a single module.
  • Support building ember.js as an addon in a "fast" way.
  • Support multiple build targets (e.g. fastboot).
  • Define a noConflict story for globals code included in nested addons.
  • Add backwards compatibility in as a last step (focus on the future use case).
  • Capture asset size at a different place before concat.
  • Provide reasonable "affect the parent" hooks.
  • Extract most processing into addons.

Is this a complete enumeration of our goals? What else do we need to address in this effort?

/cc @chadhietala @danmcclain @dgeb @lukemelia @rwjblue @stefanpenner @tomdale @Turbo87 @twokul

Support in-repo commands by default.

Today, if you would like to add a command you must add an in-repo addon that implements the includedCommands method.

Contrast this with the ease of making a built-in blueprint: simply place a file in blueprints/some-name/index.js and πŸ’₯ everything works.

This issue is mostly to gauge interest in supporting auto-detection of project and addon commands by way of a specific location on disk (e.g. <project-root>/commands or <project-root>/lib/commands)...

πŸ‘ / πŸ‘Ž ?

Blueprint Hooks

We should make it possible for blueprints to support introspecting state and application, and investigate something similar to lifecycle hooks.

This would support things like:

  • Conditional addition/deletion/modification of files on ember init.
  • Leveraging of custom patching functions during generation.
  • Smarter _re_generation.
  • Proper generation with different test frameworks as peer dependencies.

...and more.

Expose API to customize and/or disable colors used in terminal output.

This has a number of use cases, but I'll list just a couple:

  • Users with various visual impairments may not be able to see all colors (e.g. folks with red/green color blindness may not be able to see or differentiate the chalk.red colored output).
  • Colors that we use by default may conflict with terminal settings (e.g. mocha's default colors conflicted with solarized dark theme such that the test name output was completely invisible).
  • Some terminals / CI systems / etc do not properly force chalk to opt out of colored output (resulting in bizarro text output).

Suggestions:

  • Allow customization of specific colors in .ember-cli file. I believe this is possible but it needs research.
  • Document support for --no-color command line flag on all commands (this is already supported by way of https://github.com/chalk/supports-color, but isn't documented at all)

Breaking "bugfixes" for an eventual 3.0

These are things that are very much broken but we can't change for reasons of backwards compatibility. This list is for a very specific category of issue. These should tend toward mechanical changes.

When you comment on this thread please identify why your issue fits this category. The canonical list will be hoisted here. Comments will only be used to identify which things should be promoted to this top post.

ember-service-worker

We should come up with a default story for a ServiceWorker, beyond just a simple application shell and the toolbox strategies. We need to draft an RFC that describes a complete implementation inside of ember-cli, specified well enough that it can be implemented by anybody.

This issue will be updated after the face-to-face and exists for collecting thoughts. @nathanhammond will serialize earlier conversations into this thread, no need to try and reproduce that information.

/cc @jkleinsc @runspired @stefanpenner

I'd like to discuss Webpack

With all the new modularization happening I'd like to champion swapping Broccoli out for Webpack in Ember CLI.

Without writing a big wall of text, here's my short outline of why:

  • Broccoli is (pretty much) exclusive to Ember.
  • Vue, Angular, React and a good few independant projects use Webpack, I've tried some of these in the past week and it's suprisingly easy to add dependencies.
  • Webpack will give Ember CLI better support for generic packages. I think this will become the key pain point of keeping Broccoli around.
  • Webpack has better documentation on writing plugins for webpack, this is pretty much undocumented in Broccoli's case.
  • I'm sure we can make it work for existing pure ember (non-'cli') addons, without breaking much. I guess we'll need a transition period for the addons that do, although some will become obsolete too.

TL;DR I think it is time to admit Broccoli is a dead end street and that Webpack will bring more benefits to Ember.

configurable tmp directory [Docker]

We run ember-cli within a Docker container for development. (This issue is less meaningful for Dockerized Ember FastBoot running in production.)

Standard Docker practice is to have a container that

  1. has libraries like node and watchman installed
  2. has a checkout of the application code at a certain git SHA
  3. shadows the host file system atop (2) so the developer can edit files on their OS (e.g. using the text editor of their choice), then sync those to the container

Normally, this might look something like

$ docker run -v "/Users/me/code/my-app:/www/my-app"

The problem with that mount is that it also syncs /Users/me/code/my-app/tmp/**/*.*, which can be very expensive. That's because Docker waits for all syncs to happen before triggering the file-system event(s). In our tests, the time between saving a single file and ember-cli starting a rebuild is 30 seconds, up from less than a second when we exclude my-app/tmp.

Unfortunately, there's no syntax in Docker for excluding a particular subdirectory, so we end up mounting parts of the app individually:

$ docker run \
  -v "/Users/me/code/my-app/app:/www/my-app/app" \
  -v "/Users/me/code/my-app/config:/www/my-app/config" \
  -v "/Users/me/code/my-app/package.json:/www/my-app/package.json" \
  -v "/Users/me/code/my-app/tests:/www/my-app/tests"
  ...

It would be lovely if we could configure ember-cli's tmp directory to be e.g. /tmp so that it's not part of the mount.

We can do this for broccoli addons that extend broccoli-persistent-filter by setting BROCCOLI_PERSISTENT_FILTER_CACHE_ROOT, but that's far from everything that an ember-cli application puts in ./tmp.

Provide a way to skip import of add-on assets

There is currently no clean way to skip the import of assets triggered by an ember-cli addon from inside the ember app.

In some cases files can be removed by passing a broccoli Funnel to app.toTree() or post-processing the generated tree using a funnel.

However this doesn't work for the very common case, where an ember-cli addon adds a default style, for example from a wrapped bower package, because all css is already concatenated into addons.css when we get the change to process the tree.

It would be great if ember-cli provided a funnel that gets executed before any concatenation or preprocessing of imported trees is done, which could then be used to exclude (or include) additional files using the patterns provided by broccoli-funnel.

Example:

The addon ember-foo wraps the bower package foo and imports its assets in the included() hook:

module.exports = {
  name: 'ember-foo',

  included: function(app) {
    app.import(app.bowerDirectory + '/foo/foo.js');
    app.import(app.bowerDirectory + '/foo/foo.css');
  }
};

We do not need the file foo.cssbecause we have provided our own styles and overriding the existing styles would be cumbersome, so it would be great if we could exclude it in ember-cli-build.js:

var app = new EmberApp(defaults, {
  filterAddonTree: {
    exclude: ['bower_components/foo/foo.css']
  }
});

In a similar fashion it is also possible, that a bower component has multiple variants and we want to exclude: ['bower_components/foo/foo-deluxe.js'] and include: ['bower_components/foo/foo-light.js'] because it is sufficient for our needs.

Both of the above mentioned examples could be solved by adding additional configuration to the ember-foo addon, but it would be great if there was a simple way to solve such a common issue without having to modify the addon to provide every possible permutation of assets.

convention for specifying browser support

Currently both autoprefixer and babel can take a browser support params which determine what kind of polyfills need to be included.

I think it could be useful to have browserSupport property by default in config.js which could then be read both by babel and autoprefixer.

Potentionally even Ember-CLI could then filter out certain code based on the browser support (Ember.RSVP ?).

Problems with standardized targets RFC #95 and javascript

While RFC #95 allows efficient transpilation and targeting modern JS engines, flaws appear when actually applying this.

I have 2 concrete issues, which both occurs when targeting modern browsers that allow ES6 features.

The first major issue is minification: The currently used UglifyJS does not support ES6 syntax and throws arcane errors when trying to produce a minified build. This can be somewhat alleviated by using ember-cli-babili, which supports such syntax. However, there are 2 specific reasons why this works: First, it only applies ES5-safe transforms. To do anything else, it would need to take into account the full browser matrix. Secondly, it uses the babel engine, ensuring syntax compatibility. Without this, it will break when new syntax elements are introduced to the language.

The second issue is testing: Currently PhantomJS is used, which again does not support ES6 syntax. This has a quick fix (add a PhantomJS compatible browser to the targets when testing), but this somewhat undermines the actual testing.
Even if this was replaced with a more compatible JS engine, there is no guarantee that it would match the targets that the user has specified, and will thus always require a test-specific transpilation target (which again undermines the validity).

With these 2 issues I think that the targets RFC actually ends up doing more harm than good. It is great to leverage the tremendous effort that has been put into creating these browser targets, but not so great when the supporting eco-system has to do a comparable effort to support this, and we have a deep vendor lock-in.

TDLR: The targets needs to respected at 3 tiers of JS, rather than just the one that was intended, which greatly complicates the eco-system.

We need a better teaching & learning story.

I've been thinking a lot about what differentiates us (good and bad) from the rest of the JS ecosystem lately, and I think I've come to a conclusion that should perhaps be turned into a point of action.

It's been stated by others (and I agree) that much of the future of Ember is in ember-cli.

But as good as ember-cli and broccoli are, I feel we are losing pace against the rest of the ecosystem on features we've wanted to have.

For some, this manifests as the pestering question of "why not WebPack", such as in #79

So I set out to explore a bit of WebPack, and found (unsurprisingly) that it doesn't offer us much, but would be nice if they pivot to being a more generic bundler (which they seem willing to do based on discussions with @TheLarkInn), in which case it may offer us an easier bundle optimization story.

My conclusion though is that where we are losing pace is in the bundle integration and configuration story. Things like webworker/service worker integration, apps shell, PWAs/IWAs, code splitting, tree shaking etc.

Basically, we ignored the bundle step while focusing on other major ticket items that also matter. The problem with this is that there are many in our ecosystem willing to make stabs at this story, explore it, and maybe even land it either as an RFC or as an addon, but they haven't been empowered.

WebPack is empowering because despite limitations on APIs, and a terrible (imao) configuration story and dependency model, it is well documented, provides clear examples, and its core team actively and aggressively helps anyone and everyone learn how to use it better.

I think this underscores the importance of documentation, examples and hands on experience/tutorials, which are almost entirely missing for broccoli and ember-cli.

We have a great community, let's use it. To use it, we need to empower them, and all it would take to do so I think is giving a little time each day or week to teach, document, or write an example of something you can do with ember-cli, broccoli, handlebars/babel ASTs, babel configuration and plugins, ember-rollup and the like.

I often find that when I feel I need to do it all, I've simply failed to communicate the problem space adequately to others. I feel many of us feel that "we've got to do it all". If we teach our stack, and offload our domain knowledge of what we are looking for in a bundler / static build time tools etc, better things may arise without us needing to do it all, and everyone will be happier and our involved community will grow even more.

This doesn't mean we brain dump in more RFCs (although we should), because I suspect the RFC audience is a bit too narrow. It probably means we brain dump in RFCs + a blog post + push those materials out as "help wanted". I see @gaearon and others doing this often to great success. I feel we usually just ask for comments, not help, and that gives the wrong impression that we have all the needed man power to accomplish all the things we want quickly.

Even where we have documented ember-cli, that documentation is often hard to find, surface, or relate to the problem attempting to be solved by the end user. Documentation isn’t real unless its easy to surface and understand. "Help Wanted" labels on Github are useful, but often fall silent if we don't also publicize the desire for help.

[Proposal] ic-ajax -> ember-fetch

Lets begin this discussion.

What is ember-fetch?

Why is this discussion happening now and not earlier?

  • ember 2 no longer supports IE8, and github/fetch is IE9+
  • fetch is a spec primitive of the DOM, it stands to reason we should prefer that over $.ajax
  • maybe we can catch issues to help adapt/improve/add to the spec
  • $.ajax is crazy quirky
  • uploads have progress in the request object (unsure if the polifill does this or not actually, need to verify)

Cons:

  • its not $.ajax which, although not a spec thing, is basically a primitive many devs are used to
  • features like $.ajaxPrefilter are not obviously a thing in fetch (maybe some other approach ?)
  • .... ?

Noop:

  • still no formal cancelation

things to check:

  • polyfill support upload progress?

don't gitignore the dist-folder

Hi,

when generating a new ember-app the cli will create a reasonable starting-structure and default .gitignore.

There are pre-populated and empty folders in that structure, depending on how much sense it makes for those folders.

One folder that is not currently created by default and also ignored, is the distfolder. Although it makes sense to ignore the contents of the dist-folder, I would like to argue for the idea that the folder itself belongs to an ember-project:

  1. You are very very likely to create it anyway while developing. Having that empty folder in place when cloning a repo makes sure that it's name is reserved. If you happen to create a dist-folder yourself and add files to it, ember build will erase all your contents. This might be an obvious fact for ember-devs buuut, in my point of view, speaks for reserving that special folder right from the beginning.
  2. Projects like ember-cli-cordova or ember-electron rely on that folder being present. Cordova, for example, will contain a symlink www to the dist-folder. If the distfolder does not exist, the symlink is broken which results in cordova not recognizing the cordova-subdir as a valid cordova-project. The common workaround for this is to mkdir dist either by hand or from within the build-chain. To prevent having the contributors creating the dir before they can run things like 'cordova prepare', one might have the idea to checkin the dist-folder into git and then ignore just it's contents via a .gitignore inside it. But since ember build will delete the contents of dist, that gitignore will also be deleted.

Generate Babel Helpers

Babel knows about the runtime helpers that are required and we should generate an optimal set of helpers for Ember apps.

Convo With Stef

CH - We should generate babel helpers at build time and externalize them
SP - Seems good, but we should create a whitelist of helpers used today so that we can some idea of the runtime costs. It should throw when it encounters a runtime helper not listed and we can just provide our own helpers.
CH - Will work on that today (See babel/broccoli-babel-transpiler#96 and babel/broccoli-babel-transpiler#95)
SP - Please write an issue on the ember-cli/rfcs repo so we can come back to this.

Better server watchers

Start Date: 2016-11-23
RFC PR: (leave this empty)
Ember CLI Issue: (leave this empty)

Summary

Add the ability for ember serve and ember test --server to watch additional files that are not necessarily parsed by broccoli, but potentially used in the build. Originally requested here: #25, but not fully flushed out. Primary use would be to allow files in server and test to trigger full restart, and trigger either a rebuild or provide a hook to re-run node tests when these files change.

Motivation

I use the server directory in both dev and prod (via a prod express server located in the root), and as such, have some application-server logic that I test with tests in the test folder.

As per detailed in ember-cli-code-coverage/ember-cli-code-coverage#79, I run pre and post build tests & coverage for my server code when running tests, but according to ember-cli/ember-cli#4717, currently ember-cli does not support adding arbitrary paths to the watcher, which means that when I run ember test --server, the tests will not re-run when editing server tests or files.

In addition, I've noticed some idiosyncrasies when using the server folder as a first-class citizen in this build setup, namely that the server does not perform a full restart when changing files (which can lead to cached server modules). This may be an unrelated RFC candidate, but it seems like they are in the same ballpark so may be worth looking at during this work.

Detailed design

The following changes would be required:

  • Add a config option and/or sensible defaults for the above setup (application server files in server, application server tests in test)
  • Perform a full restart of the application server when changes are detected on server files

At it's most basic, this feature would simply add a new config key to .ember-cli, that would enable rebuild/restart on paths outside of the broccoli tree.

At it's most complicated, this feature would modify ember-cli to:

  • Allow inclusion of files outside of the broccoli tree to the watchers
  • Restart the node server whenever rebuilding the app

How We Teach This

Ember already supports a fairly robust application server setup, which I've been working on taking advantage of for automatic API generation over at https://github.com/jesseditson/ember-jsonapi.

This change would primarily be a functional change, but would also open up the possibility of bringing the server folder in to the docs a bit more, primarily around how to properly test the files in that folder, and clarification around expected rebuild functionality for files outside of the broccoli tree.

I believe this RFC is in the spirit of existing ember-cli conventions, and as such proposes no changes to terminology or patterns, save for potentially defining a standard path to testing server code.

Drawbacks

This could potentially broaden the scope of ember-cli, which seems worth taking very seriously from a support perspective. The server folder seems like an afterthought, and this could potentially legitimize it's use, which may not be in the interests of the maintainers.

Alternatives

As far as I can tell, this isn't currently directly achievable using the ember-cli watchers as they are set up today, otherwise I'd be exploring an addon solution for this.

Currently I solve for half of this issue this by running a docker-compose setup which runs a proxy back to my host machine's port 4200 and maintains a separate watcher process for server code. This means the server could get out of sync when restarting (as changing shared files would cause both a server and ember restart/rebuild), so I put a default nginx page that polls the host machine for the ember server, and reloads when it comes online. I think this could be greatly simplified by giving the ember server folder some love.

I don't currently have a solution for reloading the server tests when they are modified (or when the server files are modified), but I suspect a workaround would require adding an additional watcher process (I could see something like parallelizing a subprocess running watchman using an addon hook, but this has plenty of drawbacks).

Unresolved questions

Mainly I'd like to get the temperature of the room on the intended use of server. Am I opening a pandora's box of support issues if ember starts supporting an application server? On the flip side, I think minimal support on ember-cli's part would open up a good ecosystem of addons that leverage the node layer, which would allow us to share config across the client and application server (this has been very useful for me when sharing models across the stack).

Clarity necessary before action: Is this RFC best suited for a deep-dive on the server process and how it is watched, or is this RFC "simply" a modification to the available options and/or defaults of the ember-cli test watcher?

Configurable paths for Tree Paths

Currently, all tree paths (app, tests, vendor, etc.) are static and cannot be configured.

I'd like to propose adding inputPaths to the EmberApp options hash allowing them to be optionally configured.

const app = new EmberApp(defaults, {
  inputPaths: {
    vendor: 'statics/vendor',
    public: 'statics/public',
    // etc..
  }
});

Unsure if this is a large enough change to warrant an RFC or not. Happy to PR this if it's something that has buy in.

Dropping ember data from the default blueprint

Hey, first of all if this has been discussed anywhere before just point me to it, I didn't find any topic like this anywhere.

So this is just a thought I've been having for some time now, but what would the general consensus be with regards to removing ember data from the default ember-cli blueprints?
It seems to me that this would give us a big benefit in terms of significantly less overhead for newcomers (if we also move ED out of the tutorial/guides and into a separate "advanced" or "managing data" section) while practically speaking being a non-issue for advanced people (one ember install away from adding it).

Are there some big issues I'm missing? It seems to me like removing it would be of more value then leaving it in. I would like to see more people adopting Ember, but I feel like our onboarding process has much room for improvement. This way would be a quick (and unless I'm missing something pretty painless) way to shed much of the perceived weight of Ember without impacting experienced users.

πŸ‘ / πŸ‘Ž / :rage4: ?

build target + type

some thoughts, leaving them here for future travelers


There is a constant request to expand the number of environment one can use. Although this is perfectly reasonable and internals should (and will support this). I have noticed another similar trend, build targets

  • cordova
  • nw.js
  • electron
  • full page web
  • embedded web etc)
  • etc.
  • some custom mode

Ideally, I would like to not see dev_cordova prod_cordova test_corvoda, dev_electron,prod_electron etc.etc. As this quickly becomes entirely unmanageable and the cost of adding a new target becomes quite large. It also becomes tricky when dealing with addons, that maybe only need to do something in testing of Cordova.

One thought I had, was to split the concept into target and type.

  • target: destined platform/mode : defaults to web
  • type: more similar to todays environment – in-fact it may make sense just to call it environment. : defaults to dev
ember build --target electron --type test
ember server --target electron --type test
ember test --target electron
ember test --target electron --server

This could allow us to provide stable public CLI interface, addon hooks, and should help become a good foundation for future innovation.


stuff to explore

  • how does one define a target
  • how are commands made aware of the target goals
  • how do addons work with this.
  • how do we merge "goals" of env + target at runtime.

cc people who have been doing related work (based on emberaddons.com search): @mike-north @poteto @rwjblue @jakecraige @juanazam @theodorton @brzpegasus @rmachielse

Don't set license in app's package.json

ember g license <license-type=MIT>? Makes it relatively straightforward to toggle off and on, simple to chain to a previous blueprint, provides a choke point for the configuration. And then we can start to make it configurable.

Slightly odd ember d license invocation: it doesn't matter what the type so it doesn't have to be parallel with the generate command.

That we assume a license at all is probably bad.

Automatically fill repository field

When generating a new package.json using npm init, the "repository" field automatically gets filled if the destination directory is a git repository and has a remote configured.

However, when runing ember init within a repo's directory, the "repository" field currently simply stays empty. Wouldn't it be great if ember-cli did the same thing?

Suggestion

Currently, npm isn't really doing a great job because it fills the field with an object containing several things like the type of the repo and the url:

"repository": {
  "type": "git",
  "url": "https://github.com/ember-cli/rfcs.git"
}

However, the upper code isn't needed when it comes to GitHub repositories. Instead of that, ember-cli should do it like this (here are other shorthand examples for different providers):

"repository": "ember-cli/rfcs"

Run tests from pods

In the spirit of independent components and the better organization of pods, I think that being able to save and run tests frompods will help to keep the file structure more organized.

Deploy existing build to different target.

One of our project goals is to separate build types (e.g. debug, production) from deployment targets (e.g. development, alpha, production). Ideally in our build phase we run all build types, then reuse those built artifacts for any given deployment target. Here are some benefits of this approach:

  • We have confidence that the artifact we build and test is the same as the artifact we deploy. We have seen irresponsible NPM dependency changes break deploys after a successful build.
  • When we promote a build to prod, we know the build and test was as close as possible to the build we have validated in an earlier stage.
  • We can deploy old artifacts to a new target. For example, I may want to bring up a new server to test a particular feature branch or run a demo, or we may add another stage in our CI pipeline.
  • We can quickly deploy without requiring a build/test phase. This is very important for things like rollback or deploying hotfixes.

Here is a rough description of the build / deploy flow we want to implement:

Build:

  1. For each build type, create the artifact using ember build --environment $type.
  2. After each build, bundle the dist folder as a tar artifact.
  3. Upload each of those artifacts to s3, e.g. aws s3 cp $type.tar s3://my-app-builds/$commit/$type.tar

Deploy:

  1. Download the desired artifact from s3 and untar.
  2. Add target-specific config, possibly using an Ember CLI command: ember target --folder dist --config production.json
  3. Deploy the ember application to a web server, or as an s3 static website.

I was going to add this use case as a comment on #26, but it seemed different enough to warrant its own issue. The important difference is that this very deliberately doesn't require any changes in the build for a different target.

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.