Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

How to do a build/compile-time check of API usage

$
0
0

@samselikoff wrote:

Is it possible to a build/compile-time check for usage of a particular API?

My use case is showing a deprecation message for Ember CLI Mirage. We currently expose faker as a named export from ember-cli-mirage:

// host apps can do this:
import { faker } from 'ember-cli-mirage';

I’m looking to deprecate this behavior by removing faker from Mirage entirely (and providing instructions on how host apps can install & use faker themselves).

I’m trying to figure out the best way to do this. I started by trying to get a deprecation message printed at import-time… but couldn’t figure out how to do that, as faker is a named export from ember-cli-mirage/addon/index.js.

My next thought was adding some build-time code that scans the host app for any usage of

import { faker } from 'ember-cli-mirage'

(or some variant thereof) and showing the deprecation message in the terminal. But I’m not sure if this is a good approach or how I would go about doing that.

Figured I’d post this up here before I go any further, in case anyone has some ideas here! Any help much appreciated.

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles