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

embroider ready #1454

Merged
merged 1 commit into from
Jul 7, 2023
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
9 changes: 9 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const { buildEmberPlugins } = require('ember-cli-babel');

module.exports = {
globals: {
server: true,
Expand All @@ -9,6 +11,13 @@ module.exports = {
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
babelrc: false,
configFile: false,
// your babel options
plugins: buildEmberPlugins(),
},
ecmaFeatures: {
legacyDecorators: true,
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- 'ember-canary'
- 'ember-default-with-jquery'
- 'ember-classic'
# - 'embroider-safe'
- 'embroider-safe'
# - 'embroider-optimized'
timeout-minutes: 7
steps:
Expand Down
9 changes: 0 additions & 9 deletions babel.config.js

This file was deleted.

48 changes: 33 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,6 @@ module.exports = {
return new AddonDocsDeployPlugin(this._readUserConfig());
},

setupPreprocessorRegistry(type, registry) {
if (type === 'parent') {
let TemplateCompiler = require('./lib/preprocessors/markdown-template-compiler');
let ContentExtractor = require('./lib/preprocessors/hbs-content-extractor');
registry.add('template', new TemplateCompiler());
registry.add('template', new ContentExtractor(this.getBroccoliBridge()));
}
},

contentFor(type) {
if (type === 'body') {
return fs.readFileSync(
Expand Down Expand Up @@ -247,12 +238,36 @@ module.exports = {
return this._broccoliBridge;
},

postprocessTree(type, tree) {
treeForApp(tree) {
if (!this._appTree) {
let { app, templates } = this.app.trees;
let appTree = new MergeTrees([new Funnel(app), new Funnel(templates)], {
overwrite: true,
annotation: 'app md & templates',
});
let TemplateCompiler = require('./lib/preprocessors/markdown-template-compiler');
const templateCompiler = new TemplateCompiler();
appTree = templateCompiler.toTree(appTree);
appTree = new Funnel(appTree, {
include: [/.*\.hbs/],
annotation: 'app templates',
});
this._appTree = this._super(new MergeTrees([tree, appTree]));
}
return this._appTree;
},

treeForPublic(tree) {
let addonToDocument = this._documentingAddon();
if (!addonToDocument || type !== 'all') {
if (!addonToDocument) {
return tree;
}

let ContentExtractor = require('./lib/preprocessors/hbs-content-extractor');
let appTree = this._treeFor('app');
const contentExtractor = new ContentExtractor(this.getBroccoliBridge());
contentExtractor.toTree(appTree);

let PluginRegistry = require('./lib/models/plugin-registry');
let DocsCompiler = require('./lib/broccoli/docs-compiler');
let SearchIndexer = require('./lib/broccoli/search-indexer');
Expand Down Expand Up @@ -285,19 +300,22 @@ module.exports = {
);
}

let docsTree = new MergeTrees(docsTrees);
let docsTree = new MergeTrees(docsTrees, { annotation: 'docsTrees' });

let templateContentsTree =
this.getBroccoliBridge().placeholderFor('template-contents');
let searchIndexTree = new SearchIndexer(
new MergeTrees([docsTree, templateContentsTree]),
new MergeTrees([docsTree, templateContentsTree], {
annotation: 'SearchIndexer',
}),
{
outputFile: 'ember-cli-addon-docs/search-index.json',
config: this.project.config(EmberApp.env()),
}
);

return new MergeTrees([tree, docsTree, searchIndexTree]);
return new MergeTrees([this._super(tree), searchIndexTree, docsTree], {
annotation: 'this._super(tree), docsTree',
});
},

_lunrTree() {
Expand Down
5 changes: 1 addition & 4 deletions lib/broccoli/search-indexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,7 @@ module.exports = class SearchIndexCompiler extends Writer {
let modulePrefix = this.config.modulePrefix;

let routePath;
if (
relativePath.indexOf(modulePrefix) === 0 &&
/\.template-contents$/.test(relativePath)
) {
if (/\.template-contents$/.test(relativePath)) {
routePath = relativePath
.replace(`${modulePrefix}/templates/`, '')
.replace(/\.template-contents$/, '');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.0.1",
"@ember/test-helpers": "^2.8.1",
"@embroider/test-setup": "^2.0.2",
"@embroider/test-setup": "^3.0.1",
"@fullhuman/postcss-purgecss": "^4.0.3",
"broccoli-asset-rev": "^3.0.0",
"chai": "^4.2.0",
Expand Down
11 changes: 0 additions & 11 deletions tests/helpers/resolver.js

This file was deleted.

8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1402,10 +1402,10 @@
semver "^7.3.5"
typescript-memoize "^1.0.1"

"@embroider/test-setup@^2.0.2":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@embroider/test-setup/-/test-setup-2.1.1.tgz#1cf613f479ed120fdc5d71cb834c8fb71514cce1"
integrity sha512-t81a2z2OEFAOZVbV7wkgiDuCyZ3ajD7J7J+keaTfNSRiXoQgeFFASEECYq1TCsH8m/R+xHMRiY59apF2FIeFhw==
"@embroider/test-setup@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@embroider/test-setup/-/test-setup-3.0.1.tgz#603b21a809708ac928fe9f002905ee3711dc6864"
integrity sha512-t7R2f10iZDSNw3ovWAPM63GRQTu63uihpVh6CvHev5XkLt8B7tdxcxGyO6RbdF5Hu+pbsUu8sD0kAlR1gopmxg==
dependencies:
lodash "^4.17.21"
resolve "^1.20.0"
Expand Down