Skip to content

Commit

Permalink
Merge branch 'beta' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Selden committed Apr 15, 2024
2 parents 2151776 + 93ff0a1 commit 117f21c
Show file tree
Hide file tree
Showing 43 changed files with 352 additions and 254 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# ember-cli Changelog

## v5.8.0-beta.0

#### Blueprint Changes

- [`ember new` diff](https://github.com/ember-cli/ember-new-output/compare/v5.7.0...v5.8.0-beta.0)
- [`ember addon` diff](https://github.com/ember-cli/ember-addon-output/compare/v5.7.0...v5.8.0-beta.0)

#### Changelog

- [#10418](https://github.com/ember-cli/ember-cli/pull/10418) [ENHANCEMENT] Use `content-tag` to parse GTS in blueprints [@IgnaceMaes](https://github.com/IgnaceMaes)
- [#10432](https://github.com/ember-cli/ember-cli/pull/10432) Filter out tsconfig.declarations.json correctly [@bendemboski](https://github.com/bendemboski)
- [#10436](https://github.com/ember-cli/ember-cli/pull/10436) stop using wyvox/action-setup-pnpm [@mansona](https://github.com/mansona)
- [#10437](https://github.com/ember-cli/ember-cli/pull/10437) [ENHANCEMENT] Update LTS scenarios in `addon` blueprint [@bertdeblock](https://github.com/bertdeblock)
- [#10438](https://github.com/ember-cli/ember-cli/pull/10438) [ENHANCEMENT] Add `declarations` folder to `.eslintignore` file in `app` blueprint [@bertdeblock](https://github.com/bertdeblock)
- [#10439](https://github.com/ember-cli/ember-cli/pull/10439) [ENHANCEMENT] Add tsconfig files to `.npmignore` file in `addon` blueprint [@bertdeblock](https://github.com/bertdeblock)

Thank you to all who took the time to contribute!

## v5.7.0

#### Blueprint Changes
Expand Down
27 changes: 13 additions & 14 deletions blueprints/addon/files/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:

steps:
- uses: actions/checkout@v3<% if (pnpm) { %>
- uses: wyvox/action-setup-pnpm@v2
- uses: pnpm/action-setup@v2
with:
node-version: 18<% } else { %>
version: 8<% } %>
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: <%= yarn ? 'yarn' : 'npm' %>
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
- name: Install Dependencies
run: <%= yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %><% } %>
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
- name: Lint
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> lint
- name: Run Tests
Expand All @@ -41,16 +41,15 @@ jobs:

steps:
- uses: actions/checkout@v3<% if (pnpm) { %>
- uses: wyvox/action-setup-pnpm@v2
- uses: pnpm/action-setup@v2
with:
node-version: 18
args: '--no-lockfile'<% } else { %>
version: 8<% } %>
- uses: actions/setup-node@v3
with:
node-version: 18
cache: <%= yarn ? 'yarn' : 'npm' %>
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
- name: Install Dependencies
run: <%= yarn ? 'yarn install --no-lockfile' : 'npm install --no-shrinkwrap' %><% } %>
run: <%= pnpm ? 'pnpm install --no-lockfile' : yarn ? 'yarn install --no-lockfile' : 'npm install --no-shrinkwrap' %>
- name: Run Tests
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> test:ember

Expand All @@ -64,8 +63,8 @@ jobs:
fail-fast: false
matrix:
try-scenario:
- ember-lts-4.8
- ember-lts-4.12
- ember-lts-5.4
- ember-release
- ember-beta
- ember-canary
Expand All @@ -74,15 +73,15 @@ jobs:

steps:
- uses: actions/checkout@v3<% if (pnpm) { %>
- uses: wyvox/action-setup-pnpm@v2
- uses: pnpm/action-setup@v2
with:
node-version: 18<% } else { %>
version: 8<% } %>
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: <%= yarn ? 'yarn' : 'npm' %>
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
- name: Install Dependencies
run: <%= yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %><% } %>
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
- name: Run Tests
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
2 changes: 1 addition & 1 deletion blueprints/addon/files/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:

# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- env: EMBER_TRY_SCENARIO=ember-lts-4.8
- env: EMBER_TRY_SCENARIO=ember-lts-4.12
- env: EMBER_TRY_SCENARIO=ember-lts-5.4
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
Expand Down
4 changes: 2 additions & 2 deletions blueprints/addon/files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

## Compatibility

* Ember.js v4.8 or above
* Ember CLI v4.8 or above
* Ember.js v4.12 or above
* Ember CLI v4.12 or above
* Node.js v18 or above


Expand Down
8 changes: 4 additions & 4 deletions blueprints/addon/files/addon-config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ module.exports = async function () {
<% } else if (yarn) { %>useYarn: true,
<% } %>scenarios: [
{
name: 'ember-lts-4.8',
name: 'ember-lts-4.12',
npm: {
devDependencies: {
'ember-source': '~4.8.0',
'ember-source': '~4.12.0',
},
},
},
{
name: 'ember-lts-4.12',
name: 'ember-lts-5.4',
npm: {
devDependencies: {
'ember-source': '~4.12.0',
'ember-source': '~5.4.0',
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions blueprints/addon/files/npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
/ember-cli-build.js
/testem.js
/tests/
/tsconfig.declarations.json
/tsconfig.json
/yarn-error.log
/yarn.lock
.gitkeep
Expand Down
2 changes: 1 addition & 1 deletion blueprints/addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ module.exports = {
}

if (!options.typescript) {
addonFiles = addonFiles.filter((file) => file !== 'tsconfig.json' && !file.endsWith('.d.ts'));
addonFiles = addonFiles.filter((file) => !file.startsWith('tsconfig.') && !file.endsWith('.d.ts'));
}

return uniq(appFiles.concat(addonFiles));
Expand Down
1 change: 1 addition & 0 deletions blueprints/app/files/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/blueprints/*/files/

# compiled output
/declarations/
/dist/

# misc
Expand Down
16 changes: 10 additions & 6 deletions blueprints/app/files/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ jobs:

steps:
- uses: actions/checkout@v3<% if (pnpm) { %>
- uses: wyvox/action-setup-pnpm@v2<% } else { %>
- uses: pnpm/action-setup@v2
with:
version: 8<% } %>
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: <%= yarn ? 'yarn' : 'npm' %>
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
- name: Install Dependencies
run: <%= yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %><% } %>
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
- name: Lint
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm run' %> lint

Expand All @@ -37,13 +39,15 @@ jobs:

steps:
- uses: actions/checkout@v3<% if (pnpm) { %>
- uses: wyvox/action-setup-pnpm@v2<% } else { %>
- uses: pnpm/action-setup@v2
with:
version: 8<% } %>
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: <%= yarn ? 'yarn' : 'npm' %>
cache: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %>
- name: Install Dependencies
run: <%= yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %><% } %>
run: <%= pnpm ? 'pnpm install --frozen-lockfile' : yarn ? 'yarn install --frozen-lockfile' : 'npm ci' %>
- name: Run Tests
run: <%= pnpm ? 'pnpm' : yarn ? 'yarn' : 'npm' %> test
26 changes: 13 additions & 13 deletions blueprints/app/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
"test:ember": "ember test"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"<% if (!typescript) { %>@babel/eslint-parser": "^7.23.10",
"@babel/plugin-proposal-decorators": "^7.24.0",
"@babel/core": "^7.24.4",
"<% if (!typescript) { %>@babel/eslint-parser": "^7.24.1",
"@babel/plugin-proposal-decorators": "^7.24.1",
"<% } %>@ember/optional-features": "^2.1.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.3.0<% if (embroider) { %>",
"@embroider/compat": "^3.4.5",
"@embroider/core": "^3.4.5",
"@embroider/webpack": "^3.2.2<% } %>",
"@embroider/compat": "^3.4.7",
"@embroider/core": "^3.4.7",
"@embroider/webpack": "^3.2.3<% } %>",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2<% if (typescript) { %>",
"@glint/environment-ember-loose": "^1.3.0",
"@glint/template": "^1.3.0",
"@tsconfig/ember": "^3.0.4",
"@glint/environment-ember-loose": "^1.4.0",
"@glint/template": "^1.4.0",
"@tsconfig/ember": "^3.0.6",
"@types/ember": "^4.0.11",
"@types/ember-data": "^4.4.16",
"@types/ember-data__adapter": "^4.0.6",
Expand Down Expand Up @@ -86,10 +86,10 @@
"ember-fetch": "^8.1.2",
"ember-load-initializers": "^2.1.2",
"ember-modifier": "^4.1.0",
"ember-page-title": "^8.2.2",
"ember-page-title": "^8.2.3",
"ember-qunit": "^8.0.2",
"ember-resolver": "^11.0.1",
"ember-source": "~5.7.0",
"ember-source": "~5.8.0",
"ember-template-lint": "^5.13.0<% if (welcome) { %>",
"ember-welcome-page": "^7.0.2<% } %>",
"eslint": "^8.57.0",
Expand All @@ -106,8 +106,8 @@
"stylelint-config-standard": "^34.0.0",
"stylelint-prettier": "^4.1.0",
"tracked-built-ins": "^3.3.0<% if (typescript) { %>",
"typescript": "^5.3.3<% } %>",
"webpack": "^5.90.3"
"typescript": "^5.4.5<% } %>",
"webpack": "^5.91.0"
},
"engines": {
"node": ">= 18"
Expand Down
25 changes: 19 additions & 6 deletions lib/models/blueprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,16 +547,16 @@ let Blueprint = CoreObject.extend({
const { removeTypes } = require('remove-types');

if (extension === '.gts') {
const { parseTemplates } = require('ember-template-tag');
const { Preprocessor } = require('content-tag');
const preprocessor = new Preprocessor();
// Strip template tags
const templateTagIdentifier = (index) => `template = __TEMPLATE_TAG_${index}__;`;
const templateTagIdentifierBraces = (index) => `(template = __TEMPLATE_TAG_${index}__);`;
const templateTagMatches = parseTemplates(code).filter((match) => match.type === 'template-tag');
const templateTagMatches = preprocessor.parse(code);
let strippedCode = code;
for (let i = 0; i < templateTagMatches.length; i++) {
const match = templateTagMatches[i];
const [matchStart, matchEnd] = match.range;
const templateTag = code.substring(matchStart, matchEnd);
const templateTag = substringBytes(code, match.range.start, match.range.end);
strippedCode = strippedCode.replace(templateTag, templateTagIdentifier(i));
}

Expand All @@ -567,8 +567,7 @@ let Blueprint = CoreObject.extend({
let transformedWithTemplateTag = transformed;
for (let i = 0; i < templateTagMatches.length; i++) {
const match = templateTagMatches[i];
const [matchStart, matchEnd] = match.range;
const templateTag = code.substring(matchStart, matchEnd);
const templateTag = substringBytes(code, match.range.start, match.range.end);
transformedWithTemplateTag = transformedWithTemplateTag.replace(templateTagIdentifier(i), templateTag);
transformedWithTemplateTag = transformedWithTemplateTag.replace(templateTagIdentifierBraces(i), templateTag);
}
Expand Down Expand Up @@ -1772,4 +1771,18 @@ function isJavaScriptFile(filePath) {
return path.extname(filePath) === '.js' || path.extname(filePath) === '.gjs';
}

/**
* Takes a substring of a string based on byte offsets.
* @private
* @method substringBytes
* @param {string} value : The input string.
* @param {number} start : The byte index of the substring start.
* @param {number} end : The byte index of the substring end.
* @return {string} : The substring.
*/
function substringBytes(value, start, end) {
let buf = Buffer.from(value);
return buf.subarray(start, end).toString();
}

module.exports = Blueprint;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-cli",
"version": "5.7.0",
"version": "5.8.0-beta.0",
"description": "Command line tool for developing ambitious ember.js apps",
"keywords": [
"app",
Expand Down Expand Up @@ -59,6 +59,7 @@
"compression": "^1.7.4",
"configstore": "^5.0.1",
"console-ui": "^3.1.2",
"content-tag": "^1.2.2",
"core-object": "^3.1.5",
"dag-map": "^2.0.2",
"diff": "^5.1.0",
Expand All @@ -67,7 +68,6 @@
"ember-cli-normalize-entity-name": "^1.0.0",
"ember-cli-preprocess-registry": "^5.0.1",
"ember-cli-string-utils": "^1.1.0",
"ember-template-tag": "^2.3.8",
"ensure-posix-path": "^1.1.1",
"execa": "^5.1.1",
"exit": "^0.1.2",
Expand Down
8 changes: 7 additions & 1 deletion tests/acceptance/new-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ describe('Acceptance: ember new', function () {
// no TypeScript files
[
'tsconfig.json',
'tsconfig.declarations.json',
'app/config/environment.d.ts',
'types/global.d.ts',
'types/foo/index.d.ts',
Expand Down Expand Up @@ -511,7 +512,12 @@ describe('Acceptance: ember new', function () {
expect(file('tests/dummy/app/index.html')).to.contain('<html>');

// no TypeScript files
['tsconfig.json', 'tests/dummy/app/config/environment.d.ts', 'types/global.d.ts'].forEach((filePath) => {
[
'tsconfig.json',
'tsconfig.declarations.json',
'tests/dummy/app/config/environment.d.ts',
'types/global.d.ts',
].forEach((filePath) => {
expect(file(filePath)).to.not.exist;
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/addon/defaults-travis/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:

# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- env: EMBER_TRY_SCENARIO=ember-lts-4.8
- env: EMBER_TRY_SCENARIO=ember-lts-4.12
- env: EMBER_TRY_SCENARIO=ember-lts-5.4
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/addon/defaults-travis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ foo
Compatibility
------------------------------------------------------------------------------

* Ember.js v4.8 or above
* Ember CLI v4.8 or above
* Ember.js v4.12 or above
* Ember CLI v4.12 or above
* Node.js v18 or above


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ module.exports = async function () {
return {
scenarios: [
{
name: 'ember-lts-4.8',
name: 'ember-lts-4.12',
npm: {
devDependencies: {
'ember-source': '~4.8.0',
'ember-source': '~4.12.0',
},
},
},
{
name: 'ember-lts-4.12',
name: 'ember-lts-5.4',
npm: {
devDependencies: {
'ember-source': '~4.12.0',
'ember-source': '~5.4.0',
},
},
},
Expand Down

0 comments on commit 117f21c

Please sign in to comment.