Skip to content

Commit

Permalink
Updated latestVersions and blueprints (#116)
Browse files Browse the repository at this point in the history
* chore: Updated latestVersions

* chore: Ignored n/hashbang (false positive as of eslint-plugin-n@17.2.1)

* feature: Updated format-changelog to generate release lines for dependent packages

* chore: Updated fixtures

* chore: Added lockfile

---------

Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
  • Loading branch information
ijlee2 and ijlee2 authored Apr 22, 2024
1 parent f8011b6 commit 94f2fc2
Show file tree
Hide file tree
Showing 46 changed files with 335 additions and 172 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-trees-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codemod-utils/cli": minor
---

Updated latestVersions and blueprints
2 changes: 1 addition & 1 deletion packages/cli/src/blueprints/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "./formatter.cjs",
"changelog": "./format-changelogs.cjs",
"commit": false,
"fixed": [],
"linked": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { getInfo } = require('@changesets/get-github-info');

const repo = '<your-github-handle>/<%= options.codemod.name %>';

async function extractInformation(changeset) {
async function analyze(changeset) {
const { links: info } = await getInfo({
commit: changeset.commit,
repo,
Expand All @@ -19,17 +19,29 @@ async function extractInformation(changeset) {
};
}

function getDependencyReleaseLine() {
return '';
async function summarize(changeset) {
const { contributor, link, summary } = await analyze(changeset);

const line = [link, summary, contributor].filter(Boolean).join(' ');

return `- ${line}`;
}

async function getReleaseLine(changeset) {
async function getDependencyReleaseLine(changesets) {
try {
const { contributor, link, summary } = await extractInformation(changeset);
const lines = await Promise.all(changesets.map(summarize));

return lines.join('\n');
} catch (error) {
console.error(`ERROR: getDependencyReleaseLine (${error.message})`);

const line = [link, summary, contributor].filter(Boolean).join(' ');
return '';
}
}

return `- ${line}`;
async function getReleaseLine(changeset) {
try {
return summarize(changeset);
} catch (error) {
console.error(`ERROR: getReleaseLine (${error.message})`);

Expand Down
12 changes: 12 additions & 0 deletions packages/cli/src/blueprints/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
},
extends: ['plugin:n/recommended'],
},
{
files: ['bin/**/*.{js,ts}'],
rules: {
'n/hashbang': 'off',
},
},
],
};<% } else { %>module.exports = {
root: true,
Expand Down Expand Up @@ -93,5 +99,11 @@
},
extends: ['plugin:n/recommended'],
},
{
files: ['bin/**/*.{js,ts}'],
rules: {
'n/hashbang': 'off',
},
},
],
};<% } %>
2 changes: 0 additions & 2 deletions packages/cli/src/blueprints/bin/__codemod-name__.__js__
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<% if (options.codemod.hasTypeScript) { %>#!/usr/bin/env node
// eslint-disable-next-line n/shebang
'use strict';

import yargs from 'yargs';
Expand All @@ -24,7 +23,6 @@ const codemodOptions: CodemodOptions = {
};

runCodemod(codemodOptions);<% } else { %>#!/usr/bin/env node
// eslint-disable-next-line n/shebang
'use strict';

import yargs from 'yargs';
Expand Down
28 changes: 14 additions & 14 deletions packages/cli/src/utils/blueprints/get-version.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import { decideVersion } from '@codemod-utils/blueprints';

const latestVersions = new Map([
['@babel/core', '7.24.0'],
['@babel/eslint-parser', '7.23.10'],
['@babel/core', '7.24.4'],
['@babel/eslint-parser', '7.24.1'],
['@changesets/cli', '2.27.1'],
['@changesets/get-github-info', '0.6.0'],
['@codemod-utils/ast-javascript', '1.2.4'],
['@codemod-utils/ast-javascript', '1.2.5'],
['@codemod-utils/ast-template', '1.1.2'],
['@codemod-utils/blueprints', '1.1.2'],
['@codemod-utils/ember-cli-string', '1.1.2'],
['@codemod-utils/files', '2.0.0'],
['@codemod-utils/json', '1.1.5'],
['@codemod-utils/tests', '1.1.3'],
['@codemod-utils/files', '2.0.1'],
['@codemod-utils/json', '1.1.6'],
['@codemod-utils/tests', '1.1.4'],
['@sondr3/minitest', '0.1.2'],
['@tsconfig/node18', '18.2.2'],
['@tsconfig/strictest', '2.0.3'],
['@types/node', '18.19.24'],
['@tsconfig/node18', '18.2.4'],
['@tsconfig/strictest', '2.0.5'],
['@types/node', '18.19.31'],
['@types/yargs', '17.0.32'],
['@typescript-eslint/eslint-plugin', '7.2.0'],
['@typescript-eslint/parser', '7.2.0'],
['@typescript-eslint/eslint-plugin', '7.7.0'],
['@typescript-eslint/parser', '7.7.0'],
['concurrently', '8.2.2'],
['eslint', '8.57.0'],
['eslint-config-prettier', '9.1.0'],
['eslint-import-resolver-typescript', '3.6.1'],
['eslint-plugin-import', '2.29.1'],
['eslint-plugin-n', '16.6.2'],
['eslint-plugin-n', '17.2.1'],
['eslint-plugin-prettier', '5.1.3'],
['eslint-plugin-simple-import-sort', '12.0.0'],
['eslint-plugin-simple-import-sort', '12.1.0'],
['eslint-plugin-typescript-sort-keys', '3.2.0'],
['prettier', '3.2.5'],
['typescript', '5.4.2'],
['typescript', '5.4.5'],
['yargs', '17.7.2'],
]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "./formatter.cjs",
"changelog": "./format-changelogs.cjs",
"commit": false,
"fixed": [],
"linked": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { getInfo } = require('@changesets/get-github-info');

const repo = '<your-github-handle>/ember-codemod-args-to-signature';

async function extractInformation(changeset) {
async function analyze(changeset) {
const { links: info } = await getInfo({
commit: changeset.commit,
repo,
Expand All @@ -19,17 +19,29 @@ async function extractInformation(changeset) {
};
}

function getDependencyReleaseLine() {
return '';
async function summarize(changeset) {
const { contributor, link, summary } = await analyze(changeset);

const line = [link, summary, contributor].filter(Boolean).join(' ');

return `- ${line}`;
}

async function getReleaseLine(changeset) {
async function getDependencyReleaseLine(changesets) {
try {
const { contributor, link, summary } = await extractInformation(changeset);
const lines = await Promise.all(changesets.map(summarize));

return lines.join('\n');
} catch (error) {
console.error(`ERROR: getDependencyReleaseLine (${error.message})`);

const line = [link, summary, contributor].filter(Boolean).join(' ');
return '';
}
}

return `- ${line}`;
async function getReleaseLine(changeset) {
try {
return summarize(changeset);
} catch (error) {
console.error(`ERROR: getReleaseLine (${error.message})`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,11 @@ module.exports = {
},
extends: ['plugin:n/recommended'],
},
{
files: ['bin/**/*.{js,ts}'],
rules: {
'n/hashbang': 'off',
},
},
],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env node
// eslint-disable-next-line n/shebang
'use strict';

import yargs from 'yargs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@
"test": "mt tests --quiet"
},
"dependencies": {
"@codemod-utils/ast-javascript": "^1.2.4",
"@codemod-utils/ast-javascript": "^1.2.5",
"@codemod-utils/ast-template": "^1.1.2",
"@codemod-utils/blueprints": "^1.1.2",
"@codemod-utils/ember-cli-string": "^1.1.2",
"@codemod-utils/files": "^2.0.0",
"@codemod-utils/json": "^1.1.5",
"@codemod-utils/files": "^2.0.1",
"@codemod-utils/json": "^1.1.6",
"yargs": "^17.7.2"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/eslint-parser": "^7.23.10",
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@changesets/cli": "^2.27.1",
"@changesets/get-github-info": "^0.6.0",
"@codemod-utils/tests": "^1.1.3",
"@codemod-utils/tests": "^1.1.4",
"@sondr3/minitest": "^0.1.2",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-n": "^17.2.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-simple-import-sort": "^12.1.0",
"prettier": "^3.2.5"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "./formatter.cjs",
"changelog": "./format-changelogs.cjs",
"commit": false,
"fixed": [],
"linked": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { getInfo } = require('@changesets/get-github-info');

const repo = '<your-github-handle>/ember-codemod-pod-to-octane';

async function extractInformation(changeset) {
async function analyze(changeset) {
const { links: info } = await getInfo({
commit: changeset.commit,
repo,
Expand All @@ -19,17 +19,29 @@ async function extractInformation(changeset) {
};
}

function getDependencyReleaseLine() {
return '';
async function summarize(changeset) {
const { contributor, link, summary } = await analyze(changeset);

const line = [link, summary, contributor].filter(Boolean).join(' ');

return `- ${line}`;
}

async function getReleaseLine(changeset) {
async function getDependencyReleaseLine(changesets) {
try {
const { contributor, link, summary } = await extractInformation(changeset);
const lines = await Promise.all(changesets.map(summarize));

return lines.join('\n');
} catch (error) {
console.error(`ERROR: getDependencyReleaseLine (${error.message})`);

const line = [link, summary, contributor].filter(Boolean).join(' ');
return '';
}
}

return `- ${line}`;
async function getReleaseLine(changeset) {
try {
return summarize(changeset);
} catch (error) {
console.error(`ERROR: getReleaseLine (${error.message})`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,11 @@ module.exports = {
},
extends: ['plugin:n/recommended'],
},
{
files: ['bin/**/*.{js,ts}'],
rules: {
'n/hashbang': 'off',
},
},
],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env node
// eslint-disable-next-line n/shebang
'use strict';

import yargs from 'yargs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@
"test": "mt tests --quiet"
},
"dependencies": {
"@codemod-utils/files": "^2.0.0",
"@codemod-utils/files": "^2.0.1",
"yargs": "^17.7.2"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/eslint-parser": "^7.23.10",
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@changesets/cli": "^2.27.1",
"@changesets/get-github-info": "^0.6.0",
"@codemod-utils/tests": "^1.1.3",
"@codemod-utils/tests": "^1.1.4",
"@sondr3/minitest": "^0.1.2",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-n": "^17.2.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-simple-import-sort": "^12.1.0",
"prettier": "^3.2.5"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": "./formatter.cjs",
"changelog": "./format-changelogs.cjs",
"commit": false,
"fixed": [],
"linked": [],
Expand Down
Loading

0 comments on commit 94f2fc2

Please sign in to comment.