@ember/app-blueprint 0.8.1 → 6.6.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 (65) hide show
  1. package/.prettierignore +1 -2
  2. package/.release-plan.json +9 -5
  3. package/CHANGELOG.md +28 -0
  4. package/eslint.config.mjs +1 -5
  5. package/files/app/config/environment.ts +24 -9
  6. package/files/app/templates/_js_application.gjs +2 -2
  7. package/files/app/templates/_ts_application.gts +2 -2
  8. package/files/package.json +43 -43
  9. package/files/tsconfig.json +7 -22
  10. package/package.json +2 -2
  11. package/tests/arguments.test.mjs +155 -0
  12. package/tests/fixtures/tests-js-10/app/components/.gitkeep +0 -0
  13. package/tests/fixtures/tests-js-10/app/components/sweet.gjs +3 -0
  14. package/tests/{fixture → fixtures/tests-js-10}/app/router.js +2 -3
  15. package/tests/fixtures/tests-js-10/app/routes/.gitkeep +0 -0
  16. package/tests/{fixture/app/routes/styles.js → fixtures/tests-js-10/app/routes/fancy.js} +1 -1
  17. package/tests/fixtures/tests-js-10/app/styles/app.css +3 -0
  18. package/tests/fixtures/tests-js-10/app/templates/application.gjs +15 -0
  19. package/tests/fixtures/tests-js-10/app/templates/fancy.gjs +12 -0
  20. package/tests/fixtures/tests-js-10/tests/acceptance/index-test.js +26 -0
  21. package/tests/fixtures/tests-js-10/tests/integration/components/sweet-test.gjs +28 -0
  22. package/tests/fixtures/tests-js-10/tests/routes/fancy-test.js +11 -0
  23. package/tests/{fixture-ts/testem-proxy.js → fixtures/tests-js-20/testem-dev.js} +26 -2
  24. package/tests/fixtures/tests-ts-10/app/components/.gitkeep +0 -0
  25. package/tests/fixtures/tests-ts-10/app/components/sweet.gts +3 -0
  26. package/tests/{fixture-ts → fixtures/tests-ts-10}/app/router.ts +2 -3
  27. package/tests/fixtures/tests-ts-10/app/routes/.gitkeep +0 -0
  28. package/tests/{fixture-ts/app/routes/styles.ts → fixtures/tests-ts-10/app/routes/fancy.ts} +1 -1
  29. package/tests/fixtures/tests-ts-10/app/styles/app.css +3 -0
  30. package/tests/fixtures/tests-ts-10/app/templates/application.gts +15 -0
  31. package/tests/fixtures/tests-ts-10/app/templates/fancy.gts +12 -0
  32. package/tests/fixtures/tests-ts-10/tests/acceptance/index-test.ts +26 -0
  33. package/tests/fixtures/tests-ts-10/tests/integration/components/sweet-test.gjs +28 -0
  34. package/tests/fixtures/tests-ts-10/tests/routes/fancy-test.js +11 -0
  35. package/tests/generators.test.mjs +60 -0
  36. package/tests/helpers.mjs +26 -67
  37. package/tests/lint.test.mjs +44 -0
  38. package/tests/tests.test.mjs +218 -0
  39. package/vitest.config.ts +2 -2
  40. package/tests/default.test.mjs +0 -161
  41. package/tests/fixture/app/components/custom-component.hbs +0 -3
  42. package/tests/fixture/app/styles/app.css +0 -5
  43. package/tests/fixture/app/templates/application.hbs +0 -3
  44. package/tests/fixture/app/templates/custom-component.hbs +0 -1
  45. package/tests/fixture/app/templates/index.hbs +0 -1
  46. package/tests/fixture/app/templates/styles.hbs +0 -5
  47. package/tests/fixture/testem-proxy.js +0 -35
  48. package/tests/fixture/tests/acceptance/custom-component-test.js +0 -14
  49. package/tests/fixture/tests/acceptance/styles-test.js +0 -18
  50. package/tests/fixture-ts/app/styles/app.css +0 -5
  51. package/tests/fixture-ts/app/templates/components/custom.gts +0 -5
  52. package/tests/fixture-ts/app/templates/custom-component.gts +0 -5
  53. package/tests/fixture-ts/app/templates/index.gts +0 -5
  54. package/tests/fixture-ts/app/templates/styles.gts +0 -7
  55. package/tests/fixture-ts/tests/acceptance/custom-component-test.ts +0 -14
  56. package/tests/fixture-ts/tests/acceptance/styles-test.ts +0 -18
  57. package/tests/typescript.test.mjs +0 -24
  58. /package/tests/{fixture → fixtures/tests-js-10}/app/initializers/test-init.js +0 -0
  59. /package/tests/{fixture → fixtures/tests-js-10}/app/instance-initializers/test-instance-init.js +0 -0
  60. /package/tests/{fixture → fixtures/tests-js-10}/tests/acceptance/app-init-test.js +0 -0
  61. /package/tests/{fixture → fixtures/tests-js-10}/tests/acceptance/welcome-page-test.js +0 -0
  62. /package/tests/{fixture-ts → fixtures/tests-ts-10}/app/initializers/test-init.ts +0 -0
  63. /package/tests/{fixture-ts → fixtures/tests-ts-10}/app/instance-initializers/test-instance-init.ts +0 -0
  64. /package/tests/{fixture-ts → fixtures/tests-ts-10}/tests/acceptance/app-init-test.ts +0 -0
  65. /package/tests/{fixture-ts → fixtures/tests-ts-10}/tests/acceptance/welcome-page-test.ts +0 -0
@@ -1,161 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { join } from 'path';
3
- import { existsSync, writeFileSync } from 'fs';
4
- import stripAnsi from 'strip-ansi';
5
- import { newProjectWithFixtures } from './helpers.mjs';
6
-
7
- const SCENARIOS = [
8
- {
9
- name: 'defaults',
10
- flags: [],
11
- fixturePath: join(import.meta.dirname, 'fixture'),
12
- },
13
- {
14
- name: 'compat (v1 addon support)',
15
- // @glimmer/component >= 2.0.0 is a v2 addon, which we don't need when testing "compat mode"
16
- // this test is "compat mode"
17
- // compat mode forces us to use v1 addon infra, ember-cli, etc
18
- flags: [
19
- /* none, default */
20
- ],
21
- packageJson: {
22
- devDependencies: {
23
- '@glimmer/component': '^1.1.2',
24
- },
25
- },
26
- fixturePath: join(import.meta.dirname, 'fixture'),
27
- },
28
- {
29
- name: 'typescript',
30
- flags: ['--typescript'],
31
- fixturePath: join(import.meta.dirname, 'fixture-ts'),
32
- },
33
- ];
34
-
35
- describe('basic functionality', function () {
36
- for (let { name, flags, packageJson, fixturePath } of SCENARIOS) {
37
- describe(name, function () {
38
- let project = newProjectWithFixtures({
39
- fixturePath,
40
- flags,
41
- packageJson,
42
- });
43
-
44
- it('verify files', async function () {
45
- expect(
46
- !existsSync(join(project.dir(), 'app/index.html')),
47
- 'the app index.html has been removed',
48
- );
49
- expect(
50
- existsSync(join(project.dir(), 'index.html')),
51
- 'the root index.html has been added',
52
- );
53
- });
54
-
55
- it('successfully lints', async function () {
56
- let result = await project.execa('pnpm', ['lint']);
57
-
58
- console.log(result.stdout);
59
- });
60
-
61
- it('successfully builds', async function () {
62
- let result = await project.execa('pnpm', ['build']);
63
-
64
- console.log(result.stdout);
65
- });
66
-
67
- it('successfully runs tests', async function () {
68
- let result;
69
-
70
- try {
71
- result = await project.execa('pnpm', ['test']);
72
- } catch (err) {
73
- console.log(err.stdout, err.stderr);
74
- throw 'Failed to successfully run test';
75
- }
76
-
77
- // make sure that each of the tests that we expect actually show up
78
- // alternatively we can change this to search for `pass 3`
79
- expect(result.stdout).to.contain(
80
- 'Acceptance | welcome page: visiting /index shows the welcome page',
81
- );
82
- expect(result.stdout).to.contain(
83
- 'Acceptance | styles: visiting /styles',
84
- );
85
-
86
- console.log(result.stdout);
87
- });
88
-
89
- it('successfully runs tests in dev mode', async function () {
90
- await project.$`pnpm install --save-dev testem http-proxy`;
91
- let appURL;
92
-
93
- let server;
94
-
95
- try {
96
- server = project.execa('pnpm', ['start']);
97
-
98
- await new Promise((resolve) => {
99
- server.stdout.on('data', (line) => {
100
- let result = /Local:\s+(https?:\/\/.*)\//g.exec(
101
- stripAnsi(line.toString()),
102
- );
103
-
104
- if (result) {
105
- appURL = result[1];
106
- resolve();
107
- }
108
- });
109
- });
110
-
111
- writeFileSync(
112
- join(project.dir(), 'testem-dev.js'),
113
- `module.exports = {
114
- test_page: 'tests/index.html?hidepassed',
115
- disable_watching: true,
116
- launch_in_ci: ['Chrome'],
117
- launch_in_dev: ['Chrome'],
118
- browser_start_timeout: 120,
119
- browser_args: {
120
- Chrome: {
121
- ci: [
122
- // --no-sandbox is needed when running Chrome inside a container
123
- process.env.CI ? '--no-sandbox' : null,
124
- '--headless',
125
- '--disable-dev-shm-usage',
126
- '--disable-software-rasterizer',
127
- '--mute-audio',
128
- '--remote-debugging-port=0',
129
- '--window-size=1440,900',
130
- ].filter(Boolean),
131
- },
132
- },
133
- middleware: [
134
- require(__dirname + '/testem-proxy.js')('${appURL}')
135
- ],
136
- };
137
- `,
138
- );
139
-
140
- let testResult = await project.execa('pnpm', [
141
- 'testem',
142
- '--file',
143
- 'testem-dev.js',
144
- 'ci',
145
- ]);
146
- expect(testResult.exitCode).to.eq(0, testResult.output);
147
- } finally {
148
- server?.kill('SIGINT');
149
- }
150
- });
151
-
152
- it('successfully optimizes deps', function () {
153
- return project.execa('pnpm', ['vite', 'optimize', '--force']);
154
- });
155
-
156
- it('can run generators', function () {
157
- return project.execa('pnpm', ['ember', 'g', 'route', 'fancy']);
158
- });
159
- });
160
- }
161
- });
@@ -1,3 +0,0 @@
1
- <div id="custom-component">
2
- I am a custom component
3
- </div>
@@ -1,5 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- {{page-title "FancyApp"}}
2
-
3
- {{outlet}}
@@ -1 +0,0 @@
1
- <CustomComponent />
@@ -1 +0,0 @@
1
- <WelcomePage />
@@ -1,5 +0,0 @@
1
- <h1>Styles test</h1>
2
-
3
- <p class="styles-test">
4
- I expect to be blue
5
- </p>
@@ -1,35 +0,0 @@
1
- const httpProxy = require('http-proxy');
2
-
3
- /*
4
- This can be installed as a testem middleware to make testem run against an
5
- arbitrary real webserver at targetURL.
6
-
7
- It allows testem to handle the well-known testem-specific paths and proxies
8
- everything else, while rewriting the testem-added prefix out of your
9
- "/tests/index.html" URL.
10
- */
11
-
12
- module.exports = function testemProxy(targetURL) {
13
- return function testemProxyHandler(app) {
14
- const proxy = httpProxy.createProxyServer({
15
- changeOrigin: true,
16
- ignorePath: true,
17
- });
18
-
19
- proxy.on('error', (err, _req, res) => {
20
- res && res.status && res.status(500).json(err);
21
- });
22
-
23
- app.all('*', (req, res, next) => {
24
- let url = req.url;
25
- if (url === '/testem.js' || url.startsWith('/testem/')) {
26
- return next();
27
- }
28
- let m = /^(\/\d+)\/tests\/index.html/.exec(url);
29
- if (m) {
30
- url = url.slice(m[1].length);
31
- }
32
- proxy.web(req, res, { target: targetURL + url });
33
- });
34
- };
35
- }
@@ -1,14 +0,0 @@
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
- })
@@ -1,18 +0,0 @@
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
- });
@@ -1,5 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- <template>
2
- <div id="custom-component">
3
- I am a custom component
4
- </div>
5
- </template>
@@ -1,5 +0,0 @@
1
- import Custom from './components/custom';
2
-
3
- <template>
4
- <Custom />
5
- </template>
@@ -1,5 +0,0 @@
1
- import { WelcomePage } from 'ember-welcome-page';
2
-
3
- <template>
4
- <WelcomePage />
5
- </template>
@@ -1,7 +0,0 @@
1
- <template>
2
- <h1>Styles test</h1>
3
-
4
- <p class="styles-test">
5
- I expect to be blue
6
- </p>
7
- </template>
@@ -1,14 +0,0 @@
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
- })
@@ -1,18 +0,0 @@
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
- });
@@ -1,24 +0,0 @@
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
- });