Skip to content

Adding an untyped GlimmerX project to develop the GlimmerX language server against #68

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

Merged
merged 5 commits into from
Mar 18, 2021
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
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.js text eol=lf
*.ts text eol=lf
*.css text eol=lf
*.hbs text eol=lf
*.json text eol=lf
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode",
"${workspaceFolder}/test-packages/demo-ember-app",
"${workspaceFolder}/test-packages/demo-glimmerx-app"
"${workspaceFolder}/test-packages/demo-glimmerx-app",
"${workspaceFolder}/test-packages/demo-untyped-glimmerx-app"
]
}
]
Expand Down
11 changes: 11 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/.babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = function (api) {
return {
plugins: [
['@glimmer/babel-plugin-glimmer-env', { DEBUG: !api.env('production') }],
'@glimmerx/babel-plugin-component-templates',
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-class-properties',
],
presets: ['@babel/preset-env'],
};
};
20 changes: 20 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
max_line_length = 100

[*.hbs]
insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
tmp/*
dist

glint.log
yarn-error.log
.eslintcache
1 change: 1 addition & 0 deletions test-packages/demo-untyped-glimmerx-app/.glintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
environment: glimmerx
5 changes: 5 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# demo-untyped-glimmerx-app

This application is used for development of the Glint language server in an untyped GlimmerX project.

This README will be updated as functionality is added.
17 changes: 17 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<title>demo-untyped-glimmerx-app</title>

<link rel="icon" href="./public/favicon.png" />
<link rel="apple-touch-icon" href="./public/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="./public/manifest.json" />
</head>
<body>
<div id="app"></div>
</body>
</html>
18 changes: 18 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "es6",
"module": "es2015",
"inlineSourceMap": true,
"inlineSources": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"types": [
"qunit"
]
},
"exclude": [
"node_modules",
"tmp",
"dist"
]
}
113 changes: 113 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"name": "demo-untyped-glimmerx-app",
"version": "0.0.0",
"description": "A brand new Glimmer app.",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "NODE_ENV=production webpack",
"lint": "eslint . --ext=js --cache",
"start": "webpack-dev-server",
"test": "npm-run-all lint test:browsers",
"test:browsers": "testem ci",
"test:watch": "testem"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@glimmer/babel-plugin-glimmer-env": "~2.0.0-beta.12",
"@glimmer/env": "^0.1.7",
"@glimmerx/babel-plugin-component-templates": "^0.4.2",
"@glimmerx/component": "^0.4.2",
"@glimmerx/core": "^0.4.2",
"@glimmerx/eslint-plugin": "^0.4.2",
"@glimmerx/helper": "^0.4.2",
"@glimmerx/modifier": "^0.4.2",
"@glint/core": "^0.3.0",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"file-loader": "^6.0.0",
"glob": "7.1.6",
"html-webpack-plugin": "^4.0.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.2",
"qunit": "^2.9.3",
"qunit-dom": "^1.1.0",
"style-loader": "^1.1.3",
"testem": "^3.0.3",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"eslintConfig": {
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true
}
},
"env": {
"browser": true
},
"plugins": [
"@glimmerx",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:prettier/recommended"
],
"ignorePatterns": [
"dist/",
"node_modules/",
"!.*"
],
"rules": {
"@glimmerx/template-vars": "error"
},
"overrides": [
{
"files": [
".babelrc.js",
"testem.js",
"webpack.config.js"
],
"env": {
"node": true
}
}
]
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5"
},
"browserslist": {
"production": [
"last 2 Edge versions",
"last 2 Chrome versions",
"last 2 Firefox versions",
"last 2 Safari versions"
],
"development": [
"last 1 Chrome version",
"last 1 Firefox version",
"last 1 Safari version"
]
},
"engines": {
"node": ">= 12.0"
},
"private": true
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "demo-untyped-glimmerx-app",
"name": "A brand new Glimmer app.",
"icons": [
{
"src": "favicon.png",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# http://www.robotstxt.org
User-agent: *
Disallow:
10 changes: 10 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
body {
margin: 0;
font-family: Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

#app {
min-height: 100vh;
width: 800px;
margin: auto;
}
45 changes: 45 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import Component, { hbs, tracked } from '@glimmerx/component';
import { on, action } from '@glimmerx/modifier';

import './App.css';
import GreetingHeader from './GreetingHeader';

function formatName(name) {
return `${name} the Great and Powerful`;
}

class FormattedName extends Component {
static template = hbs`
{{formatName this.args.name}}!
`;

get name() {
return this.args.name || 'glimmerx';
}
}

const I_AM_CONSTANT = 'and I am a constant';
const ComponentAsArg = hbs`
<h1>I am {{@title}}</h1>
{{I_AM_CONSTANT}}
`;
export default class HelloWorld extends Component {
static template = hbs`
<ComponentAsArg @title={{component FormattedName name="Oz"}}/>
<GreetingHeader @greeting="hello"/>
<IncrementableButton @startCount={{100}}/>
`;
}

class IncrementableButton extends Component {
@tracked count = this.args.startCount;

@action increment() {
this.count++;
}

static template = hbs`
<p>You have clicked the button {{this.count}} times.</p>
<button {{on "click" this.increment}}>Click</button>
`;
}
16 changes: 16 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/src/GreetingHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Component from '@glimmerx/component';
import { hbs } from '@glimmerx/component';
import { helper } from '@glimmerx/helper';

const or = helper(([a, b]) => a || b);

export default class GreetingHeader extends Component {
static template = hbs`
<h1>{{@greeting}}, {{or @target 'glimmerx'}}</h1>
<img src={{this.src}}/>
`;

get src() {
return this.args.src || 'https://picsum.photos/250';
}
}
6 changes: 6 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { renderComponent } from '@glimmerx/core';
import App from './App';

const containerElement = document.getElementById('app');

renderComponent(App, containerElement);
29 changes: 29 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/testem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"framework": "qunit",
"test_page": "dist/tests/index.html",
"routes": {
"/tests.bundle.js": "dist/tests.bundle.js",
"/public": "dist/public",
"/images": "dist/images"
},
"on_start": {
"command": "webpack",
"wait_for_text": "Built at:"
},
"watch_files": [
"dist/tests.bundle.js"
],
"browser_args": {
"mode": "ci",
"Chrome": [
"--headless",
"--remote-debugging-port=9222"
]
},
"launch_in_ci": [
"Chrome"
],
"launch_in_dev": [
"Chrome"
]
}
15 changes: 15 additions & 0 deletions test-packages/demo-untyped-glimmerx-app/tests/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>demo-untyped-glimmerx-app Tests</title>
<link rel="icon" href="../public/favicon.png" />
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="/testem.js"></script>
</body>
</html>

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { module, test, renderComponent } from '../util';

import App from '../../src/App';

module('App test', () => {
test('it works', async (assert) => {
await renderComponent(App);

assert.dom('h1').containsText('I am Oz the Great and Powerful!');
});
});
Loading