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

WIP stop over-encoding files #853

Closed
wants to merge 14 commits into from
Closed
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = {
'lib/**/*.js',
'bin/*',
'server/**/*.js',
'prember-urls.js',
],
excludedFiles: ['config/deprecation-workflow.js'],
parserOptions: {
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ local.log
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try

/ember-api-docs-data/
6 changes: 3 additions & 3 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { pluralize } from 'ember-inflector';
import { isBlank } from '@ember/utils';

export default class Application extends JSONAPIAdapter {
host = ENV.API_HOST;
// host = ENV.API_HOST;
currentProject = '';
currentProjectVersion = '';

Expand Down Expand Up @@ -47,7 +47,7 @@ export default class Application extends JSONAPIAdapter {

async findRecord(store, { modelName }, id) {
let url;
let host = this.host;
// let host = this.host;
let projectName = this.currentProject;

if (['namespace', 'class', 'module'].indexOf(modelName) > -1) {
Expand Down Expand Up @@ -85,7 +85,7 @@ export default class Application extends JSONAPIAdapter {
throw new Error('Unexpected model lookup');
}

url = `${host}/${url}.json`;
url = `/${url}.json`;

let response = await fetch(url);
let json = await response.json();
Expand Down
35 changes: 35 additions & 0 deletions app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,39 @@ AppRouter.map(function () {
this.route('data-module', { path: '/data/modules/:module' });
});

/*
404
ember-cli
project

/:project/:project_version
/classes/:class
/methods, /properties, /events
/functions/:module (no sub routes)
/namespaces/:namespace
/methods, /properties, /events
/modules/:module
/methods, /properties, /events

SUB ROUTES

Instead of https://api.emberjs.com/ember/4.6/classes/Engine/methods/unregister?anchor=unregister
We can do https://api.emberjs.com/ember/4.6/classes/Engine/methods?anchor=unregister

/methods/:method
/properties/:property
/events/:event

OTHER STATES
private, deprecated, inherited, protected
inherited is not reflected in URL state but it's checked by default

MAYBE REDIRECTS

/data/modules/:module
/data/classes/:class
/modules/:module
/classes/:class
*/

export default AppRouter;
2 changes: 1 addition & 1 deletion app/services/meta-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class MetaStoreService extends Service {
}

getRevId(project, version, type, id) {
let encodedId = encodeURIComponent(id);
let encodedId = id;
return this.projectRevMap[`${project}-${version}`][type][encodedId];
}

Expand Down
5 changes: 5 additions & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const Funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
const envIsProduction = process.env.EMBER_ENV === 'production';
const premberUrls = require('./prember-urls');

module.exports = function (defaults) {
let app = new EmberApp(defaults, {
prember: {
urls: premberUrls(),
},
fingerprint: {
extensions: [
'js',
Expand Down Expand Up @@ -63,5 +67,6 @@ module.exports = function (defaults) {
include: ['mappings.json'],
destDir: '/assets/',
});

return mergeTrees([app.toTree(), mappingsTree]);
};
17 changes: 17 additions & 0 deletions lib/api-docs-data/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const Funnel = require('broccoli-funnel');

module.exports = {
name: require('./package').name,

isDevelopingAddon() {
return true;
},

treeForPublic() {
return new Funnel('ember-api-docs-data', {
include: ['**/json-docs/**', '**/rev-index/**'],
});
},
};
9 changes: 9 additions & 0 deletions lib/api-docs-data/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "api-docs-data",
"keywords": [
"ember-addon"
],
"peerDependencies": {
"broccoli-funnel": "*"
}
}
185 changes: 185 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"test": "tests"
},
"scripts": {
"clone": "rm -rf ember-api-docs-data && git clone --depth 1 https://github.com/ember-learn/ember-api-docs-data.git -b fix-files",
"build": "ember build --environment=production",
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel 'lint:!(fix)'",
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
Expand Down Expand Up @@ -125,6 +126,7 @@
"minimist": "^1.2.6",
"normalize.css": "^8.0.1",
"npm-run-all": "^4.1.5",
"prember": "^1.1.1",
"prettier": "^2.2.1",
"qunit": "^2.16.0",
"qunit-dom": "^1.6.0",
Expand Down Expand Up @@ -154,5 +156,10 @@
"volta": {
"node": "14.17.0",
"npm": "8.19.3"
},
"ember-addon": {
"paths": [
"lib/api-docs-data"
]
}
}
Loading