-
Notifications
You must be signed in to change notification settings - Fork 10
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
Docs/issue 1004 document latest status for non standard import formats #1166
Merged
thescientist13
merged 4 commits into
release/0.29.0
from
docs/issue-1004-document-non-standard-import-formats
Oct 27, 2023
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
dbf8223
update documentation around custom imports
thescientist13 3b15f33
update test case descriptions and add placeholder prerender typescrip…
thescientist13 d66c775
update test case descriptions
thescientist13 b227df5
Merge branch 'release/0.29.0' into docs/issue-1004-document-non-stand…
thescientist13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
...ages/plugin-typescript/test/cases/exp-prerender.serve.ssr/exp-prerender.serve.ssr.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Use Case | ||
* Run Greenwood with a prerender HTML page that imports TypeScript. | ||
* | ||
* User Result | ||
* Should generate a Greenwood build that correctly builds and bundles all assets. | ||
* | ||
* User Command | ||
* greenwood build | ||
* | ||
* User Config | ||
* { | ||
* prerender: true, | ||
* plugins: [ | ||
* greenwoodPluginTypeScript() | ||
* ] | ||
* } | ||
* | ||
* User Workspace | ||
* src/ | ||
* components/ | ||
* card.ts | ||
* pages/ | ||
* index.html | ||
*/ | ||
import chai from 'chai'; | ||
import { JSDOM } from 'jsdom'; | ||
import path from 'path'; | ||
import { getSetupFiles, getOutputTeardownFiles } from '../../../../../test/utils.js'; | ||
import request from 'request'; | ||
import { Runner } from 'gallinago'; | ||
import { fileURLToPath } from 'url'; | ||
|
||
const expect = chai.expect; | ||
|
||
// TODO - this should work after this issue is resolved | ||
// https://github.com/ProjectEvergreen/wcc/issues/122 | ||
xdescribe('Serve Greenwood With: ', function() { | ||
const LABEL = 'A Prerendered Application (SSR) with an HTML page importing a TypeScript component'; | ||
const cliPath = path.join(process.cwd(), 'packages/cli/src/index.js'); | ||
const outputPath = fileURLToPath(new URL('.', import.meta.url)); | ||
const hostname = 'http://127.0.0.1:8080'; | ||
let runner; | ||
|
||
before(async function() { | ||
this.context = { | ||
publicDir: path.join(outputPath, 'public'), | ||
hostname | ||
}; | ||
runner = new Runner(false, true); | ||
}); | ||
|
||
describe(LABEL, function() { | ||
|
||
before(async function() { | ||
await runner.setup(outputPath, getSetupFiles(outputPath)); | ||
await runner.runCommand(cliPath, 'build'); | ||
|
||
return new Promise(async (resolve) => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, 10000); | ||
|
||
await runner.runCommand(cliPath, 'serve'); | ||
}); | ||
}); | ||
|
||
describe('Serve command with SSR prerender specific behaviors for an HTML page', function() { | ||
let response = {}; | ||
|
||
before(async function() { | ||
return new Promise((resolve, reject) => { | ||
request.get(`${hostname}/`, (err, res, body) => { | ||
if (err) { | ||
reject(); | ||
} | ||
|
||
response = res; | ||
response.body = body; | ||
fragmentsApiDom = new JSDOM(body); | ||
|
||
resolve(); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should return a 200 status', function(done) { | ||
expect(response.statusCode).to.equal(200); | ||
done(); | ||
}); | ||
|
||
it('should return a custom status message', function(done) { | ||
expect(response.statusMessage).to.equal('OK'); | ||
done(); | ||
}); | ||
|
||
// it should return the correct h1 contents | ||
// it should return the correct app-card contents | ||
}); | ||
}); | ||
|
||
after(function() { | ||
runner.teardown(getOutputTeardownFiles(outputPath)); | ||
runner.stopCommand(); | ||
}); | ||
|
||
}); |
8 changes: 8 additions & 0 deletions
8
packages/plugin-typescript/test/cases/exp-prerender.serve.ssr/greenwood.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { greenwoodPluginTypeScript } from '../../../src/index.js'; | ||
|
||
export default { | ||
prerender: true, | ||
plugins: [ | ||
greenwoodPluginTypeScript() | ||
] | ||
}; |
4 changes: 4 additions & 0 deletions
4
packages/plugin-typescript/test/cases/exp-prerender.serve.ssr/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "test-plugin-exp-prerender-ts", | ||
"type": "module" | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/plugin-typescript/test/cases/exp-prerender.serve.ssr/src/components/card/card.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export default class Card extends HTMLElement { | ||
|
||
selectItem() { | ||
alert(`selected item is => ${this.getAttribute('title')}!`); | ||
} | ||
|
||
connectedCallback() { | ||
if (!this.shadowRoot) { | ||
const thumbnail: String = this.getAttribute('thumbnail'); | ||
const title: String = this.getAttribute('title'); | ||
const template: any = document.createElement('template'); | ||
|
||
template.innerHTML = ` | ||
<div> | ||
<h3>${title}</h3> | ||
<img src="${thumbnail}" alt="${title}" loading="lazy" width="100%"> | ||
<button onclick="this.parentNode.parentNode.host.selectItem()">View Item Details</button> | ||
</div> | ||
`; | ||
this.attachShadow({ mode: 'open' }); | ||
this.shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
} | ||
} | ||
|
||
customElements.define('app-card', Card); |
16 changes: 16 additions & 0 deletions
16
packages/plugin-typescript/test/cases/exp-prerender.serve.ssr/src/pages/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" prefix="og:http://ogp.me/ns#"> | ||
|
||
<head> | ||
<script type="module" src="../components/card/card.ts"></script> | ||
</head> | ||
|
||
<body> | ||
<h1>Hello World!</h1> | ||
<app-card | ||
title="foo" | ||
thumbnail="bar.png" | ||
></app-card> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually,
18.12.1
I think still works? So maybe this doesn't need to specifically called out 🤷