Skip to content

Commit

Permalink
Merge pull request #112 from IgnaceMaes/use-ember-shiki
Browse files Browse the repository at this point in the history
feat: remove ember-prism in favour of ember-shiki
  • Loading branch information
jenweber authored Sep 1, 2023
2 parents 3613b79 + 2698c2e commit 9f04032
Show file tree
Hide file tree
Showing 12 changed files with 298 additions and 186 deletions.
2 changes: 1 addition & 1 deletion app/components/code-snippet.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<CodeBlock
data-test-code-snippet
@code={{snippet.source}}
@language={{get-prism-language snippet.language}}
@language={{snippet.language}}
@showLineNumbers={{true}}
/>
{{/let}}
4 changes: 4 additions & 0 deletions app/components/guide-section/subsection.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@
justify-content: flex-end;
margin-top: 1rem;
}

.code-snippet {
margin-top: 0.5rem;
}
18 changes: 11 additions & 7 deletions app/components/guide-section/subsection.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<ContainerQuery
@features={{hash
wide=(cq-width min=900)
wide=(width min=900)
}}
local-class="code-examples-container"
>
Expand All @@ -48,9 +48,11 @@
</h4>

{{#each @subsection.classicFiles as |file|}}
<CodeSnippet
@fileName="{{@sectionId}}/{{subsectionId}}/{{file}}"
/>
<div local-class="code-snippet">
<CodeSnippet
@fileName="{{@sectionId}}/{{subsectionId}}/{{file}}"
/>
</div>
{{/each}}

{{#if @subsection.classicDescriptionKey}}
Expand All @@ -69,9 +71,11 @@
</h4>

{{#each @subsection.octaneFiles as |file|}}
<CodeSnippet
@fileName="{{@sectionId}}/{{subsectionId}}/{{file}}"
/>
<div local-class="code-snippet">
<CodeSnippet
@fileName="{{@sectionId}}/{{subsectionId}}/{{file}}"
/>
</div>
{{/each}}

{{#if @subsection.octaneDescriptionKey}}
Expand Down
2 changes: 1 addition & 1 deletion app/components/locale-menu.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ContainerQuery
@features={{hash
wide=(cq-width min=480)
wide=(width min=480)
}}
local-class="container"
>
Expand Down
19 changes: 0 additions & 19 deletions app/helpers/get-prism-language.js

This file was deleted.

3 changes: 3 additions & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module.exports = function (environment) {
// Here you can pass flags/options to your application instance
// when it is created
},
'ember-shiki': {
defaultThemes: ['dark-plus'],
},
};

if (environment === 'development') {
Expand Down
25 changes: 25 additions & 0 deletions config/fastboot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* eslint-disable no-redeclare */
/* global ReadableStream, WritableStream, TransformStream, Headers */
module.exports = function () {
return {
buildSandboxGlobals(defaultGlobals) {
return Object.assign({}, defaultGlobals, {
fetch: require('node-fetch'),
AbortController,
ReadableStream:
typeof ReadableStream !== 'undefined'
? ReadableStream
: require('node:stream/web').ReadableStream,
WritableStream:
typeof WritableStream !== 'undefined'
? WritableStream
: require('node:stream/web').WritableStream,
TransformStream:
typeof TransformStream !== 'undefined'
? TransformStream
: require('node:stream/web').TransformStream,
Headers: typeof Headers !== 'undefined' ? Headers : undefined,
});
},
};
};
12 changes: 0 additions & 12 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function (defaults) {
let app = new EmberApp(defaults, {
// Theme options are coy, dark, funky, okaidia, solarizedlight, tomorrow,
// and twilight. Remove the `theme` attribute to use the default theme.
'ember-prism': {
theme: 'tomorrow',
components: [
'handlebars',
'markup-templating', // handlebars
'bash', // shell
],
plugins: ['line-numbers'],
},

prember: {
urls: ['/'],
},
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-code-snippet": "^3.0.0",
"ember-container-query": "^2.1.0",
"ember-container-query": "^4.0.5",
"ember-css-modules": "^2.0.1",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^8.1.1",
"ember-intl": "^5.7.2",
"ember-load-initializers": "^2.1.2",
"ember-page-title": "^7.0.0",
"ember-prism": "^0.12.0",
"ember-qunit": "^5.1.5",
"ember-resolver": "^8.0.3",
"ember-shiki": "^0.1.5",
"ember-source": "~4.4.0",
"ember-template-lint": "^4.10.0",
"ember-test-selectors": "^6.0.0",
Expand All @@ -72,6 +72,7 @@
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-qunit": "^7.3.0",
"loader.js": "^4.7.0",
"node-fetch": "^2.7.0",
"npm-run-all": "^4.1.5",
"prember": "^1.1.0",
"prettier": "^2.7.1",
Expand Down
8 changes: 7 additions & 1 deletion tests/acceptance/homepage/en-us-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ module('Acceptance | Homepage | en-US', function (hooks) {

test('Accessibility audit', async function (assert) {
await visit('/');
await a11yAudit();
await a11yAudit({
rules: {
'scrollable-region-focusable': {
enabled: false,
},
},
});

assert.ok(true);
});
Expand Down
26 changes: 0 additions & 26 deletions tests/integration/helpers/get-prism-language-test.js

This file was deleted.

Loading

0 comments on commit 9f04032

Please sign in to comment.