@ember/app-blueprint 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/.editorconfig +19 -0
  2. package/.github/workflows/ci.yml +35 -0
  3. package/.github/workflows/plan-release.yml +94 -0
  4. package/.github/workflows/publish.yml +43 -0
  5. package/.prettierrc.cjs +13 -0
  6. package/.release-plan.json +22 -0
  7. package/CHANGELOG.md +17 -0
  8. package/RELEASE.md +27 -0
  9. package/eslint.config.mjs +30 -0
  10. package/files/.editorconfig +19 -0
  11. package/files/.ember-cli +7 -0
  12. package/files/.github/workflows/ci.yml +53 -0
  13. package/files/.prettierignore +13 -0
  14. package/files/.prettierrc.js +39 -0
  15. package/files/.stylelintignore +5 -0
  16. package/files/.stylelintrc.js +5 -0
  17. package/files/.template-lintrc.js +5 -0
  18. package/files/.watchmanconfig +3 -0
  19. package/files/README.md +58 -0
  20. package/files/_js_babel.config.cjs +42 -0
  21. package/files/_js_eslint.config.mjs +115 -0
  22. package/files/_ts_babel.config.cjs +50 -0
  23. package/files/_ts_eslint.config.mjs +135 -0
  24. package/files/app/app.ts +18 -0
  25. package/files/app/components/.gitkeep +0 -0
  26. package/files/app/config/environment.ts +17 -0
  27. package/files/app/controllers/.gitkeep +0 -0
  28. package/files/app/deprecation-workflow.ts +24 -0
  29. package/files/app/helpers/.gitkeep +0 -0
  30. package/files/app/models/.gitkeep +0 -0
  31. package/files/app/router.ts +11 -0
  32. package/files/app/routes/.gitkeep +0 -0
  33. package/files/app/styles/app.css +1 -0
  34. package/files/app/templates/_js_application.hbs +10 -0
  35. package/files/app/templates/_ts_application.gts +15 -0
  36. package/files/config/ember-cli-update.json +16 -0
  37. package/files/config/environment.js +48 -0
  38. package/files/config/optional-features.json +7 -0
  39. package/files/config/targets.js +11 -0
  40. package/files/ember-cli-build.js +22 -0
  41. package/files/gitignore +26 -0
  42. package/files/index.html +29 -0
  43. package/files/package.json +112 -0
  44. package/files/public/robots.txt +3 -0
  45. package/files/testem.js +25 -0
  46. package/files/tests/helpers/index.ts +43 -0
  47. package/files/tests/index.html +43 -0
  48. package/files/tests/integration/.gitkeep +0 -0
  49. package/files/tests/test-helper.ts +15 -0
  50. package/files/tests/unit/.gitkeep +0 -0
  51. package/files/tsconfig.json +31 -0
  52. package/files/vite.config.mjs +15 -0
  53. package/index.js +158 -0
  54. package/lib/directory-for-package-name.js +31 -0
  55. package/lib/prepend-emoji.js +12 -0
  56. package/package.json +33 -6
  57. package/tests/default.test.mjs +145 -0
  58. package/tests/fixture/app/components/custom-component.hbs +3 -0
  59. package/tests/fixture/app/initializers/test-init.js +6 -0
  60. package/tests/fixture/app/instance-initializers/test-instance-init.js +6 -0
  61. package/tests/fixture/app/router.js +12 -0
  62. package/tests/fixture/app/routes/styles.js +6 -0
  63. package/tests/fixture/app/styles/app.css +5 -0
  64. package/tests/fixture/app/templates/application.hbs +3 -0
  65. package/tests/fixture/app/templates/custom-component.hbs +1 -0
  66. package/tests/fixture/app/templates/index.hbs +1 -0
  67. package/tests/fixture/app/templates/styles.hbs +5 -0
  68. package/tests/fixture/testem-proxy.js +35 -0
  69. package/tests/fixture/tests/acceptance/app-init-test.js +13 -0
  70. package/tests/fixture/tests/acceptance/custom-component-test.js +14 -0
  71. package/tests/fixture/tests/acceptance/styles-test.js +18 -0
  72. package/tests/fixture/tests/acceptance/welcome-page-test.js +14 -0
  73. package/tests/fixture-ts/app/initializers/test-init.ts +10 -0
  74. package/tests/fixture-ts/app/instance-initializers/test-instance-init.ts +10 -0
  75. package/tests/fixture-ts/app/router.ts +12 -0
  76. package/tests/fixture-ts/app/routes/styles.ts +8 -0
  77. package/tests/fixture-ts/app/styles/app.css +5 -0
  78. package/tests/fixture-ts/app/templates/components/custom.gts +5 -0
  79. package/tests/fixture-ts/app/templates/custom-component.gts +5 -0
  80. package/tests/fixture-ts/app/templates/index.gts +5 -0
  81. package/tests/fixture-ts/app/templates/styles.gts +7 -0
  82. package/tests/fixture-ts/testem-proxy.js +36 -0
  83. package/tests/fixture-ts/tests/acceptance/app-init-test.ts +22 -0
  84. package/tests/fixture-ts/tests/acceptance/custom-component-test.ts +14 -0
  85. package/tests/fixture-ts/tests/acceptance/styles-test.ts +18 -0
  86. package/tests/fixture-ts/tests/acceptance/welcome-page-test.ts +14 -0
  87. package/tests/helpers.mjs +57 -0
  88. package/tests/typescript.test.mjs +24 -0
  89. package/vitest.config.ts +10 -0
@@ -0,0 +1,10 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import type Application from '@ember/application';
4
+
5
+ export default {
6
+ name: 'test-init',
7
+ initialize(application: Application) {
8
+ (application as any).__test_init = 'coming from the initializer';
9
+ },
10
+ };
@@ -0,0 +1,10 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import type ApplicationInstance from '@ember/application/instance';
4
+
5
+ export default {
6
+ name: 'test-instance-initializers',
7
+ initialize(instance: ApplicationInstance) {
8
+ (instance as any).__instance_test_init = 'set in the instance initializer';
9
+ },
10
+ };
@@ -0,0 +1,12 @@
1
+ import EmberRouter from '@ember/routing/router';
2
+ import config from 'test-app/config/environment';
3
+
4
+ export default class Router extends EmberRouter {
5
+ location = config.locationType;
6
+ rootURL = config.rootURL;
7
+ }
8
+
9
+ Router.map(function () {
10
+ this.route('styles');
11
+ this.route('custom-component');
12
+ });
@@ -0,0 +1,8 @@
1
+ import Route from '@ember/routing/route';
2
+ import { service } from '@ember/service';
3
+
4
+ import type RouterService from '@ember/routing/router-service';
5
+
6
+ export default class StylesRoute extends Route {
7
+ @service declare router: RouterService;
8
+ }
@@ -0,0 +1,5 @@
1
+ /* Ember supports plain CSS out of the box. More info: https://cli.emberjs.com/release/advanced-use/stylesheets/ */
2
+
3
+ .styles-test {
4
+ background-color: blue;
5
+ }
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div id="custom-component">
3
+ I am a custom component
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ import Custom from './components/custom';
2
+
3
+ <template>
4
+ <Custom />
5
+ </template>
@@ -0,0 +1,5 @@
1
+ import { WelcomePage } from 'ember-welcome-page';
2
+
3
+ <template>
4
+ <WelcomePage />
5
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <h1>Styles test</h1>
3
+
4
+ <p class="styles-test">
5
+ I expect to be blue
6
+ </p>
7
+ </template>
@@ -0,0 +1,36 @@
1
+ /* eslint-disable */
2
+ const httpProxy = require('http-proxy');
3
+
4
+ /*
5
+ This can be installed as a testem middleware to make testem run against an
6
+ arbitrary real webserver at targetURL.
7
+
8
+ It allows testem to handle the well-known testem-specific paths and proxies
9
+ everything else, while rewriting the testem-added prefix out of your
10
+ "/tests/index.html" URL.
11
+ */
12
+
13
+ module.exports = function testemProxy(targetURL) {
14
+ return function testemProxyHandler(app) {
15
+ const proxy = httpProxy.createProxyServer({
16
+ changeOrigin: true,
17
+ ignorePath: true,
18
+ });
19
+
20
+ proxy.on('error', (err, _req, res) => {
21
+ res && res.status && res.status(500).json(err);
22
+ });
23
+
24
+ app.all('*', (req, res, next) => {
25
+ let url = req.url;
26
+ if (url === '/testem.js' || url.startsWith('/testem/')) {
27
+ return next();
28
+ }
29
+ let m = /^(\/\d+)\/tests\/index.html/.exec(url);
30
+ if (m) {
31
+ url = url.slice(m[1].length);
32
+ }
33
+ proxy.web(req, res, { target: targetURL + url });
34
+ });
35
+ };
36
+ };
@@ -0,0 +1,22 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import { module, test } from 'qunit';
4
+ import { getApplication } from '@ember/test-helpers';
5
+ import { assert as debugAssert } from '@ember/debug';
6
+ import { setupApplicationTest } from 'test-app/tests/helpers';
7
+
8
+ module('Acceptance | app route', function (hooks) {
9
+ setupApplicationTest(hooks);
10
+
11
+ test('loaded initializers /', function (assert) {
12
+ const app = getApplication();
13
+
14
+ debugAssert(`App failed to initialize`, app);
15
+
16
+ assert.strictEqual(
17
+ ([...app._applicationInstances][0] as any).__instance_test_init,
18
+ 'set in the instance initializer',
19
+ );
20
+ assert.strictEqual((app as any).__test_init, 'coming from the initializer');
21
+ });
22
+ });
@@ -0,0 +1,14 @@
1
+ import { module, test } from 'qunit';
2
+ import { visit, currentURL } from '@ember/test-helpers';
3
+ import { setupApplicationTest } from 'test-app/tests/helpers';
4
+
5
+ module('Acceptance | custom-component page', function (hooks) {
6
+ setupApplicationTest(hooks);
7
+
8
+ test('visiting /custom-component', async function (assert) {
9
+ await visit('/custom-component');
10
+
11
+ assert.strictEqual(currentURL(), '/custom-component');
12
+ assert.dom('#custom-component').containsText('I am a custom component');
13
+ });
14
+ })
@@ -0,0 +1,18 @@
1
+ import { module, test } from 'qunit';
2
+ import { visit } from '@ember/test-helpers';
3
+ import { setupApplicationTest } from 'test-app/tests/helpers';
4
+
5
+ module('Acceptance | styles', function (hooks) {
6
+ setupApplicationTest(hooks);
7
+
8
+ test('visiting /styles', async function (assert) {
9
+ await visit('/styles');
10
+
11
+ assert.dom('.styles-test').hasStyle(
12
+ {
13
+ 'background-color': 'rgb(0, 0, 255)',
14
+ },
15
+ 'The background should be blue if the app styles are working correctly',
16
+ );
17
+ });
18
+ });
@@ -0,0 +1,14 @@
1
+ import { module, test } from 'qunit';
2
+ import { visit, currentURL } from '@ember/test-helpers';
3
+ import { setupApplicationTest } from 'test-app/tests/helpers';
4
+
5
+ module('Acceptance | welcome page', function (hooks) {
6
+ setupApplicationTest(hooks);
7
+
8
+ test('visiting /index shows the welcome page', async function (assert) {
9
+ await visit('/');
10
+
11
+ assert.strictEqual(currentURL(), '/');
12
+ assert.dom('h1').containsText('Congratulations, you made it!');
13
+ });
14
+ });
@@ -0,0 +1,57 @@
1
+ import assert from 'node:assert';
2
+
3
+ import { beforeAll } from 'vitest';
4
+ import { sync as resolveBinSync } from 'resolve-bin';
5
+ import { execa } from 'execa';
6
+ import tmp from 'tmp-promise';
7
+ import { join } from 'path';
8
+ import fixturify from 'fixturify';
9
+
10
+ let localEmberCli = require.resolve('ember-cli/bin/ember');
11
+ const blueprintPath = join(__dirname, '..');
12
+
13
+ function findEmber() {
14
+ return resolveBinSync('ember-cli', { executable: 'ember' });
15
+ }
16
+
17
+ export const emberCli = findEmber();
18
+
19
+ const appName = 'test-app';
20
+
21
+ export function newProjectWithFixtures({
22
+ flags = [],
23
+ fixturePath,
24
+ name = appName,
25
+ } = {}) {
26
+ let dir;
27
+
28
+ assert(fixturePath, `a fixturePath is required`);
29
+
30
+ beforeAll(async () => {
31
+ const tmpDir = (await tmp.dir()).path;
32
+ dir = join(tmpDir, name);
33
+ await execa({cwd: tmpDir})`${localEmberCli} new ${name} -b ${blueprintPath} --skip-git --pnpm ${flags}`;
34
+
35
+ let addonFixture = fixturify.readSync(fixturePath);
36
+ fixturify.writeSync(dir, addonFixture);
37
+
38
+ // Sync the lints for the fixtures with the project's config
39
+ await execa(`pnpm`, ['lint:fix'], {
40
+ cwd: dir,
41
+ });
42
+ });
43
+
44
+
45
+
46
+ return {
47
+ appName: () => name,
48
+ dir: () => dir,
49
+ $: (...args) => execa({ cwd: dir })(...args),
50
+ execa: (program, args, options = {}) => {
51
+ return execa(program, args, {
52
+ cwd: dir,
53
+ ...options,
54
+ });
55
+ },
56
+ };
57
+ }
@@ -0,0 +1,24 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { join } from 'path';
3
+ import { existsSync } from 'fs';
4
+ import { newProjectWithFixtures } from './helpers.mjs';
5
+
6
+ describe('typescript', function () {
7
+ let project = newProjectWithFixtures({
8
+ fixturePath: join(__dirname, 'fixture-ts'),
9
+ flags: ['--typescript'],
10
+ });
11
+
12
+ it('verify files', async function () {
13
+ expect(
14
+ existsSync(join(project.dir(), 'tsconfig.json')),
15
+ 'the root tsconfig.json has been added',
16
+ );
17
+ });
18
+
19
+ it('glint passes', async function () {
20
+ let result = await project.execa('pnpm', ['glint']);
21
+
22
+ console.log(result.stdout);
23
+ });
24
+ });
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ const ONE_SECOND = 1_000;
4
+
5
+ export default defineConfig({
6
+ test: {
7
+ testTimeout: 100 * ONE_SECOND,
8
+ hookTimeout: 150 * ONE_SECOND,
9
+ },
10
+ });