@ember/app-blueprint 6.10.0-alpha.7 → 6.10.0-alpha.9

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 (41) hide show
  1. package/.release-plan.json +6 -10
  2. package/CHANGELOG.md +23 -0
  3. package/README.md +43 -0
  4. package/conditional-files/minimal/app/app.ts +10 -0
  5. package/conditional-files/minimal/app/templates/application.gts +7 -0
  6. package/conditional-files/no-compat/_js_babel.config.mjs +47 -0
  7. package/conditional-files/no-compat/_ts_babel.config.mjs +55 -0
  8. package/conditional-files/no-compat/app/app.ts +18 -0
  9. package/conditional-files/no-compat/app/config/environment.ts +38 -0
  10. package/eslint.config.mjs +5 -0
  11. package/files/app/templates/application.gts +2 -2
  12. package/files/index.html +8 -5
  13. package/files/package.json +29 -30
  14. package/files/testem.cjs +2 -1
  15. package/files/tests/index.html +10 -3
  16. package/files/tests/test-helper.ts +3 -2
  17. package/files/vite.config.mjs +3 -3
  18. package/index.js +213 -3
  19. package/package.json +8 -3
  20. package/tests/fixtures/tests-js-no-compat-10/app/components/.gitkeep +0 -0
  21. package/tests/fixtures/tests-js-no-compat-10/app/components/sweet.gjs +3 -0
  22. package/tests/fixtures/tests-js-no-compat-10/app/router.js +11 -0
  23. package/tests/fixtures/tests-js-no-compat-10/app/routes/fancy.js +6 -0
  24. package/tests/fixtures/tests-js-no-compat-10/app/styles/app.css +3 -0
  25. package/tests/fixtures/tests-js-no-compat-10/app/templates/application.gjs +7 -0
  26. package/tests/fixtures/tests-js-no-compat-10/app/templates/fancy.gjs +9 -0
  27. package/tests/fixtures/tests-js-no-compat-10/tests/acceptance/index-test.js +26 -0
  28. package/tests/fixtures/tests-js-no-compat-10/tests/integration/components/sweet-test.gjs +28 -0
  29. package/tests/fixtures/tests-js-no-compat-10/tests/routes/fancy-test.js +11 -0
  30. package/tests/fixtures/tests-ts-no-compat-10/app/components/.gitkeep +0 -0
  31. package/tests/fixtures/tests-ts-no-compat-10/app/components/sweet.gts +3 -0
  32. package/tests/fixtures/tests-ts-no-compat-10/app/router.ts +11 -0
  33. package/tests/fixtures/tests-ts-no-compat-10/app/routes/fancy.ts +8 -0
  34. package/tests/fixtures/tests-ts-no-compat-10/app/styles/app.css +3 -0
  35. package/tests/fixtures/tests-ts-no-compat-10/app/templates/application.gts +7 -0
  36. package/tests/fixtures/tests-ts-no-compat-10/app/templates/fancy.gts +9 -0
  37. package/tests/fixtures/tests-ts-no-compat-10/tests/acceptance/index-test.ts +26 -0
  38. package/tests/fixtures/tests-ts-no-compat-10/tests/integration/components/sweet-test.gjs +28 -0
  39. package/tests/fixtures/tests-ts-no-compat-10/tests/routes/fancy-test.js +11 -0
  40. package/tests/minimal.test.mjs +120 -0
  41. package/tests/no-compat.test.mjs +181 -0
@@ -0,0 +1,120 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { join } from 'path';
3
+ import { existsSync, readFileSync } from 'fs';
4
+ import { generateApp } from './helpers.mjs';
5
+ import { beforeAll } from 'vitest';
6
+
7
+ describe('--minimal', function () {
8
+ describe('default', function () {
9
+ let flags = ['--minimal'];
10
+ let app;
11
+
12
+ beforeAll(async function () {
13
+ app = await generateApp({
14
+ flags,
15
+ skipNpm: false,
16
+ });
17
+ });
18
+
19
+ it('verify files', async function () {
20
+ expect(
21
+ !existsSync(join(app.dir, 'app/index.html')),
22
+ 'the app index.html has been removed',
23
+ );
24
+ expect(
25
+ existsSync(join(app.dir, 'index.html')),
26
+ 'the root index.html has been added',
27
+ );
28
+
29
+ expect(
30
+ !existsSync(join(app.dir, 'ember-cli-build.js')),
31
+ 'the ember-cli-build.js is no longer needed',
32
+ );
33
+
34
+ expect(
35
+ !existsSync(join(app.dir, 'eslint.config.mjs')),
36
+ 'the eslint config is not present',
37
+ );
38
+
39
+ let manifest = readFileSync(join(app.dir, 'package.json'));
40
+ let json = JSON.parse(manifest);
41
+
42
+ expect(json.devDependencies['@warp-drive/core']).toBeFalsy();
43
+ expect(json.devDependencies['eslint']).toBeFalsy();
44
+ expect(json.devDependencies['prettier']).toBeFalsy();
45
+ expect(json.devDependencies['ember-cli']).toBeFalsy();
46
+ expect(json.devDependencies['ember-cli-babel']).toBeFalsy();
47
+
48
+ expect(json.devDependencies['ember-load-initializers']).toBeFalsy();
49
+ expect(json.devDependencies['@ember/optional-features']).toBeFalsy();
50
+ expect(json.devDependencies['@embroider/compat']).toBeFalsy();
51
+ });
52
+
53
+ it('successfully builds', async function () {
54
+ let result = await app.execa('pnpm', ['build']);
55
+
56
+ expect(result.exitCode).to.equal(0);
57
+ });
58
+ });
59
+
60
+ describe('--warp-drive', function () {
61
+ let flags = ['--minimal', '--warp-drive'];
62
+ let app;
63
+
64
+ beforeAll(async function () {
65
+ app = await generateApp({
66
+ flags,
67
+ skipNpm: false,
68
+ });
69
+ });
70
+
71
+ it('verify files', async function () {
72
+ expect(
73
+ readFileSync(join(app.dir, 'babel.config.mjs')).toString(),
74
+ ).to.include(
75
+ 'setConfig',
76
+ 'Babel config contains the required warp-drive configuration',
77
+ );
78
+
79
+ let manifest = readFileSync(join(app.dir, 'package.json'));
80
+ let json = JSON.parse(manifest);
81
+
82
+ expect(json.devDependencies['@warp-drive/core']).toBeTruthy();
83
+ });
84
+
85
+ it('successfully builds', async function () {
86
+ let result = await app.execa('pnpm', ['build']);
87
+
88
+ expect(result.exitCode).to.equal(0);
89
+ });
90
+ });
91
+
92
+ describe('--typescript', function () {
93
+ let flags = ['--typescript', '--minimal'];
94
+ let app;
95
+
96
+ beforeAll(async function () {
97
+ app = await generateApp({
98
+ flags,
99
+ skipNpm: false,
100
+ });
101
+ });
102
+
103
+ it('verify files', async function () {
104
+ expect(
105
+ !existsSync(join(app.dir, 'app/index.html')),
106
+ 'the app index.html has been removed',
107
+ );
108
+ expect(
109
+ existsSync(join(app.dir, 'index.html')),
110
+ 'the root index.html has been added',
111
+ );
112
+ });
113
+
114
+ it('successfully builds', async function () {
115
+ let result = await app.execa('pnpm', ['build']);
116
+
117
+ expect(result.exitCode).to.equal(0);
118
+ });
119
+ });
120
+ });
@@ -0,0 +1,181 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { join } from 'path';
3
+ import { existsSync, readFileSync } from 'fs';
4
+ import { generateApp } from './helpers.mjs';
5
+ import fixturify from 'fixturify';
6
+ import { beforeAll } from 'vitest';
7
+
8
+ /**
9
+ * We use pnpm in these tests because npm can't handle peers and pre-releases
10
+ *
11
+ * The minimal tests don't need to use pnpm because we don't use ember-load-initializers
12
+ */
13
+ describe('--no-compat', function () {
14
+ describe('default', function () {
15
+ let flags = ['--no-compat', '--pnpm'];
16
+ let fixturePath = join(
17
+ import.meta.dirname,
18
+ 'fixtures/tests-js-no-compat-10',
19
+ );
20
+
21
+ describe('empty project', function () {
22
+ let app;
23
+ beforeAll(async function () {
24
+ app = await generateApp({
25
+ flags,
26
+ skipNpm: false,
27
+ });
28
+ });
29
+
30
+ it('verify files', async function () {
31
+ expect(
32
+ !existsSync(join(app.dir, 'app/index.html')),
33
+ 'the app index.html has been removed',
34
+ );
35
+ expect(
36
+ existsSync(join(app.dir, 'index.html')),
37
+ 'the root index.html has been added',
38
+ );
39
+
40
+ expect(
41
+ !existsSync(join(app.dir, 'ember-cli-build.js')),
42
+ 'the ember-cli-build.js is no longer needed',
43
+ );
44
+
45
+ let manifest = readFileSync(join(app.dir, 'package.json'));
46
+ let json = JSON.parse(manifest);
47
+
48
+ expect(json.devDependencies['ember-cli']).to.equal(undefined);
49
+ expect(json.devDependencies['ember-cli-babel']).to.equal(undefined);
50
+ expect(json.devDependencies['ember-load-initializers']).to.equal(
51
+ undefined,
52
+ );
53
+ expect(json.devDependencies['@ember/optional-features']).to.equal(
54
+ undefined,
55
+ );
56
+ expect(json.devDependencies['@embroider/compat']).to.equal(undefined);
57
+ });
58
+
59
+ it('successfully lints', async function (context) {
60
+ // Lint errors on windows machines - probably because of line-endings.
61
+ // TODO fix the config so that a newly generated app doens't fail lint on windows
62
+ if (process.platform === 'win32') {
63
+ context.skip();
64
+ }
65
+
66
+ let result = await app.execa('pnpm', ['lint']);
67
+
68
+ expect(result.exitCode).to.equal(0);
69
+ });
70
+
71
+ it('successfully builds', async function () {
72
+ let result = await app.execa('pnpm', ['build']);
73
+
74
+ expect(result.exitCode).to.equal(0);
75
+ });
76
+ });
77
+
78
+ describe('with fixture', function () {
79
+ let app;
80
+ beforeAll(async function () {
81
+ app = await generateApp({
82
+ flags,
83
+ skipNpm: false,
84
+ });
85
+ fixturify.writeSync(app.dir, fixturify.readSync(fixturePath));
86
+ });
87
+
88
+ it('successfully runs tests', async function () {
89
+ let result;
90
+
91
+ try {
92
+ result = await app.execa('pnpm', ['test']);
93
+ } catch (err) {
94
+ console.log(err.stdout, err.stderr);
95
+ throw 'Failed to successfully run test';
96
+ }
97
+
98
+ expect(result.stdout).to.contain(
99
+ 'Integration | Component | sweet: it renders',
100
+ );
101
+
102
+ console.log(result.stdout);
103
+ });
104
+ });
105
+ });
106
+
107
+ describe('--typescript', function () {
108
+ let flags = ['--typescript', '--no-compat', '--pnpm'];
109
+ let fixturePath = join(
110
+ import.meta.dirname,
111
+ 'fixtures/tests-ts-no-compat-10',
112
+ );
113
+
114
+ describe('empty project', function () {
115
+ let app;
116
+ beforeAll(async function () {
117
+ app = await generateApp({
118
+ flags,
119
+ skipNpm: false,
120
+ });
121
+ });
122
+
123
+ it('verify files', async function () {
124
+ expect(
125
+ !existsSync(join(app.dir, 'app/index.html')),
126
+ 'the app index.html has been removed',
127
+ );
128
+ expect(
129
+ existsSync(join(app.dir, 'index.html')),
130
+ 'the root index.html has been added',
131
+ );
132
+ });
133
+
134
+ it('successfully lints', async function (context) {
135
+ // Lint errors on windows machines - probably because of line-endings.
136
+ // TODO fix the config so that a newly generated app doens't fail lint on windows
137
+ if (process.platform === 'win32') {
138
+ context.skip();
139
+ }
140
+
141
+ let result = await app.execa('pnpm', ['lint']);
142
+
143
+ expect(result.exitCode).to.equal(0);
144
+ });
145
+
146
+ it('successfully builds', async function () {
147
+ let result = await app.execa('pnpm', ['build']);
148
+
149
+ expect(result.exitCode).to.equal(0);
150
+ });
151
+ });
152
+
153
+ describe('with fixture', function () {
154
+ let app;
155
+ beforeAll(async function () {
156
+ app = await generateApp({
157
+ flags,
158
+ skipNpm: false,
159
+ });
160
+ fixturify.writeSync(app.dir, fixturify.readSync(fixturePath));
161
+ });
162
+
163
+ it('successfully runs tests', async function () {
164
+ let result;
165
+
166
+ try {
167
+ result = await app.execa('pnpm', ['test']);
168
+ } catch (err) {
169
+ console.log(err.stdout, err.stderr);
170
+ throw 'Failed to successfully run test';
171
+ }
172
+
173
+ expect(result.stdout).to.contain(
174
+ 'Integration | Component | sweet: it renders',
175
+ );
176
+
177
+ console.log(result.stdout);
178
+ });
179
+ });
180
+ });
181
+ });