Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHORE] build speed improvements & docs path fix #6734

Merged
merged 6 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/-ember-data/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = function(defaults) {
'ember-cli-babel': {
throwUnlessParallelizable: true,
},
'ember-cli-uglify': {
exclude: ['assets/dummy.js', 'assets/tests.js', 'assets/test-support.js', 'dist/docs/*', 'docs/*'],
},
});

/*
Expand Down
2 changes: 1 addition & 1 deletion packages/-ember-data/node-tests/docs/test-coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ QUnit.module('Docs coverage', function(hooks) {
if (!process.env.REUSE_DOCS) {
buildDocs();
}
docs = require(path.join(__dirname, '../../docs/data.json'));
docs = require(path.join(__dirname, '../../dist/docs/data.json'));
expected = require('../fixtures/expected');
});

Expand Down
10 changes: 10 additions & 0 deletions packages/-ember-data/node-tests/fixtures/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,15 @@ module.exports = {
'pushPayload [OPTIONAL]',
'serializeIntoHash [OPTIONAL]',
'normalize [OPTIONAL]',
'columnNameToDesc',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What caused this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing the inclusion of the debug package, there is a follow up PR to this on that will make our tests and fixtures show the module, class, package and public/private status of each piece of API documentation so that "why" something changes is more clear.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add that to the PR description please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

'columnsForType',
'getFilters',
'getRecordColor',
'getRecordColumnValues',
'getRecordFilterValues',
'getRecordKeywords',
'getRecords',
'watchModelTypes',
'observeRecord',
],
};
6 changes: 3 additions & 3 deletions packages/-ember-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"build": "ember build",
"build:production": "ember build --environment=production",
"start": "ember server",
"docs": "ember ember-cli-yuidoc",
"docs": "mkdir -p dist && ember ember-cli-yuidoc",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work correctly if you already have stuff in dist?

Copy link
Contributor Author

@runspired runspired Nov 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the -p flag does this:

The -p will create the directory(along with the directories that lead to the directory you want to create) and would ignore any errors if the directory already exists.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant more from there being existing code inside the folder, vs just the folder itself

"test": "ember test",
"test:all": "ember try:each",
"test:production": "ember test -e production",
"test:optional-features": "ember test",
"test:try-one": "ember try:one",
"test:docs": "qunit node-tests/docs/test-coverage.js",
"prepublishOnly": "ember build --environment=production"
"test:docs": "mkdir -p dist && qunit node-tests/docs/test-coverage.js",
"prepublishOnly": "mkdir -p dist && ember ember-cli-yuidoc"
},
"author": "",
"license": "MIT",
Expand Down
7 changes: 4 additions & 3 deletions packages/-ember-data/yuidoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "The ember-data API: a data persistence library for Ember.js",
"url": "https://github.com/emberjs/data",
"options": {
"enabledEnvironments": ["production"],
"enabledEnvironments": [],
runspired marked this conversation as resolved.
Show resolved Hide resolved
"extension": ".js,.ts",
"paths": [
"addon",
Expand All @@ -12,9 +12,10 @@
"../model/addon",
"../serializer/addon",
"../store/addon",
"../store/addon/-private/system"
"../record-data/addon",
runspired marked this conversation as resolved.
Show resolved Hide resolved
"../debug/addon"
],
"exclude": "vendor",
"outdir": "docs"
"outdir": "dist/docs"
}
}
35 changes: 23 additions & 12 deletions packages/debug/addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ export default DataAdapter.extend({
Specifies how records can be filtered based on the state of the record
Records returned will need to have a `filterValues`
property with a key for every name in the returned array
@private

@method getFilters
@private
@return {Array} List of objects defining filters
The object should have a `name` and `desc` property
*/
Expand All @@ -68,8 +69,9 @@ export default DataAdapter.extend({
/**
Fetch the model types and observe them for changes.
Maintains the list of model types without needing the Model package for detection.
@public

@method watchModelTypes
@public
@param {Function} typesAdded Callback to call to add types.
Takes an array of objects containing wrapped types (returned from `wrapModelType`).
@param {Function} typesUpdated Callback to call when a type has changed.
Expand Down Expand Up @@ -113,6 +115,7 @@ export default DataAdapter.extend({
* the consumer of this adapter about the mdoels.
*
* @param {store} store
* @internal
* @param {Map} discoveredTypes
* @param {String} type
* @param {Function} typesAdded
Expand All @@ -131,8 +134,9 @@ export default DataAdapter.extend({

/**
Creates a human readable string used for column headers
@private

@method columnNameToDesc
@private
@param {String} name The attribute name
@return {String} Human readable string based on the attribute name
*/
Expand All @@ -146,8 +150,9 @@ export default DataAdapter.extend({

/**
Get the columns for a given model type
@private

@method columnsForType
@private
@param {Model} typeClass
@return {Array} An array of columns of the following format:
name: {String} The name of the column
Expand All @@ -174,8 +179,9 @@ export default DataAdapter.extend({

/**
Fetches all loaded records for a given type
@private

@method getRecords
@internal
@param {Model} modelClass of the record
@param {String} modelName of the record
@return {Array} An array of Model records
Expand All @@ -200,8 +206,9 @@ export default DataAdapter.extend({
/**
Gets the values for each column
This is the attribute values for a given record
@private

@method getRecordColumnValues
@private
@param {Model} record to get values from
@return {Object} Keys should match column names defined by the model type
*/
Expand All @@ -220,8 +227,9 @@ export default DataAdapter.extend({

/**
Returns keywords to match when searching records
@private

@method getRecordKeywords
@private
@param {Model} record
@return {Array} Relevant keywords for search based on the record's attribute values
*/
Expand All @@ -236,8 +244,9 @@ export default DataAdapter.extend({
/**
Returns the values of filters defined by `getFilters`
These reflect the state of the record
@private

@method getRecordFilterValues
@private
@param {Model} record
@return {Object} The record state filter values
*/
Expand All @@ -251,11 +260,12 @@ export default DataAdapter.extend({

/**
Returns a color that represents the record's state
@private
Possible colors: black, blue, green

@method getRecordColor
@private
@param {Model} record
@return {String} The record color
Possible options: black, blue, green
*/
getRecordColor(record) {
let color = 'black';
Expand All @@ -270,8 +280,9 @@ export default DataAdapter.extend({
/**
Observes all relevant properties and re-sends the wrapped record
when a change occurs
@private
@method observerRecord

@method observeRecord
@internal
@param {Model} record
@param {Function} recordUpdated Callback used to notify changes
@return {Function} The function to call to remove all observers
Expand Down