Skip to content

Commit c66a803

Browse files
authored
Merge pull request #1536 from typed-ember/release-it-config
Set up release-it for publishing
2 parents 6494637 + be20a49 commit c66a803

File tree

11 files changed

+4492
-2196
lines changed

11 files changed

+4492
-2196
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module.exports = {
7272

7373
// all TypeScript files
7474
{
75-
files: ['**/*.ts'],
75+
files: ['**/*.{ts,cts,mts}'],
7676
rules: {
7777
// These are covered by tsc
7878
'no-undef': 'off',

package.json

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"start": "ember serve",
3131
"test": "yarn test:app && yarn test:node",
3232
"test:app": "ember test",
33-
"test:node": "mocha -r register-ts-node ts/tests/**/*.ts",
33+
"test:node": "mocha --loader=ts-node/esm --extension ts ts/tests/**/*.ts",
3434
"ci:prepare": "yarn prepublishOnly && rimraf ts",
3535
"ci:log-version-info": "echo '---- Ember CLI ----' && ember -v && echo '---- TypeScript ----' && tsc -v",
3636
"ci:test": "yarn ci:log-version-info && yarn ci:test:app && yarn ci:test:node",
@@ -53,8 +53,9 @@
5353
},
5454
"devDependencies": {
5555
"@ember/optional-features": "2.0.0",
56-
"@glimmer/component": "^1.0.4",
57-
"@glimmer/tracking": "^1.0.4",
56+
"@glimmer/component": "^1.1.2",
57+
"@glimmer/tracking": "^1.1.2",
58+
"@release-it-plugins/lerna-changelog": "^5.0.0",
5859
"@tsconfig/ember": "^1.0.0",
5960
"@typed-ember/renovate-config": "1.2.1",
6061
"@types/capture-console": "1.0.1",
@@ -69,8 +70,8 @@
6970
"@types/express": "4.17.13",
7071
"@types/fs-extra": "9.0.13",
7172
"@types/got": "9.6.12",
72-
"@types/mocha": "9.1.0",
73-
"@types/node": "14.14.8",
73+
"@types/mocha": "10.0.0",
74+
"@types/node": "14.14.31",
7475
"@types/qunit": "2.19.3",
7576
"@types/resolve": "1.20.1",
7677
"@types/semver": "7.3.9",
@@ -97,28 +98,29 @@
9798
"ember-maybe-import-regenerator": "0.1.6",
9899
"ember-qunit": "4.6.0",
99100
"ember-resolver": "8.0.2",
100-
"ember-source": "3.23.0",
101+
"ember-source": "~3.28.0",
101102
"ember-try": "1.4.0",
102103
"eslint": "8.7.0",
103104
"eslint-config-prettier": "8.3.0",
104105
"eslint-plugin-ember": "10.5.8",
105106
"eslint-plugin-node": "11.1.0",
106107
"eslint-plugin-prettier": "4.0.0",
107108
"esprima": "4.0.1",
108-
"fixturify": "2.1.0",
109-
"got": "11.8.5",
109+
"fixturify": "^2.1.1",
110+
"got": "12.5.2",
110111
"handlebars": "4.7.7",
111112
"in-repo-a": "link:tests/dummy/lib/in-repo-a",
112113
"in-repo-b": "link:tests/dummy/lib/in-repo-b",
113114
"loader.js": "4.7.0",
114-
"mocha": "8.2.1",
115+
"mocha": "10.1.0",
115116
"prettier": "2.5.1",
116117
"prettier-eslint": "13.0.0",
117118
"qunit-dom": "1.6.0",
119+
"release-it": "^15.5.0",
118120
"rimraf": "3.0.2",
119121
"testdouble": "3.16.1",
120-
"ts-node": "9.0.0",
121-
"typescript": "4.5.5"
122+
"ts-node": "^10.9.1",
123+
"typescript": "4.8"
122124
},
123125
"resolutions": {
124126
"hawk": "7",
@@ -141,6 +143,29 @@
141143
"tabWidth": 2,
142144
"proseWrap": "never"
143145
},
146+
"changelog": {
147+
"labels": {
148+
"BREAKING": "Changed 💥",
149+
"enhancement": "Added ⭐️",
150+
"bug": "Fixed 🔧",
151+
"docs": "Documentation 📖",
152+
"internal": "Under the hood 🚗"
153+
}
154+
},
155+
"release-it": {
156+
"git": {
157+
"tagName": "v${version}"
158+
},
159+
"github": {
160+
"release": true
161+
},
162+
"plugins": {
163+
"@release-it-plugins/lerna-changelog": {
164+
"infile": "CHANGELOG.md",
165+
"launchEditor": true
166+
}
167+
}
168+
},
144169
"volta": {
145170
"node": "14.20.1",
146171
"yarn": "1.22.19"

test-fixtures/skeleton-app/tsconfig.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
{
22
"compilerOptions": {
3-
"target": "ES6",
3+
"target": "ES2021",
44
"allowJs": false,
5-
"moduleResolution": "node",
5+
"module": "Node16",
6+
"moduleResolution": "Node16",
67
"noEmitOnError": true,
78
"baseUrl": ".",
89
"paths": {
9-
"skeleton-app/*": ["app/*"]
10-
}
10+
"skeleton-app/*": [
11+
"app/*"
12+
]
13+
},
14+
// We *really* don't want this on, but our hand is forced somewhat at the
15+
// moment: the types for `console-ui` are correct for consuming `inquirer`
16+
// in the pre-Node16 world, but don't interoperate correctly when consumed
17+
// by a CJS-default package in the TS Node16+ world *and* consume an ESM
18+
// package. Our path forward there is to update `console-ui` to publish a
19+
// dual-mode package with types and runtime code to support it.
20+
//
21+
// NOTE TO READERS: this is *only* required because of a very specific bit
22+
// of weird wiring in our test harness; it will *not* affect normal apps.
23+
"skipLibCheck": true
1124
},
1225
"include": [
1326
"app"

ts/addon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default addon({
124124
let walkSync = require('walk-sync') as typeof import('walk-sync');
125125
let files = new Set(walkSync(directory, ['**/*.{js,ts}']));
126126

127-
let collisions = [];
127+
let collisions: string[] = [];
128128
for (let file of files) {
129129
if (file.endsWith('.js') && files.has(file.replace(/\.js$/, '.ts'))) {
130130
collisions.push(file.replace(/\.js$/, '.{js,ts}'));

ts/tests/acceptance/build-test.ts renamed to ts/tests/acceptance/build-test.mts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import SkeletonApp from '../helpers/skeleton-app';
2-
import chai from 'ember-cli-blueprint-test-helpers/chai';
1+
import SkeletonApp from '../helpers/skeleton-app.mjs';
2+
// @ts-ignore -- we're not going to iterate on this, so there's no point in
3+
// working on adding types for it.
4+
import chai from 'ember-cli-blueprint-test-helpers/chai.js';
35
import * as esprima from 'esprima';
46
import {
57
ExpressionStatement,

ts/tests/helpers/skeleton-app.ts renamed to ts/tests/helpers/skeleton-app.mts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
import fs from 'fs-extra';
2-
import path from 'path';
2+
import path from 'node:path';
3+
import got from 'got';
34
import execa from 'execa';
45
import { EventEmitter } from 'events';
5-
import got from 'got';
6+
67
import debugLib from 'debug';
78
import rimraf from 'rimraf';
89

910
const debug = debugLib('skeleton-app');
1011

12+
// Workaround for CSJ -> ESM transition.
13+
import { createRequire } from 'module';
14+
import { fileURLToPath } from 'url';
15+
16+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
17+
const require = createRequire(import.meta.url);
18+
1119
const getEmberPort = (() => {
1220
let lastPort = 4210;
1321
return () => lastPort++;
@@ -25,7 +33,7 @@ export default class SkeletonApp {
2533
root = path.join(process.cwd(), `test-skeleton-app-${Math.random().toString(36).slice(2)}`);
2634

2735
constructor() {
28-
fs.mkdirpSync(this.root);
36+
fs.mkdirSync(this.root);
2937
fs.copySync(`${__dirname}/../../../test-fixtures/skeleton-app`, this.root);
3038
process.on('beforeExit', this.cleanupTempDir);
3139
}

ts/tests/unit/copy-declarations-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import os from 'os';
44
import fs from 'fs-extra';
55
import path from 'path';
66
import copyDeclarations from '../../lib/utilities/copy-declarations';
7-
import * as fixturify from 'fixturify';
7+
import fixturify from 'fixturify';
88

99
describe('Unit: copyDeclarations', function () {
1010
it('copies generated declarations for the correct package', function () {
@@ -127,7 +127,7 @@ function runCopy(options: {
127127
packageName: string;
128128
pathRoots?: string[];
129129
paths: Record<string, string[]>;
130-
input: fixturify.Directory;
130+
input: fixturify.DirJSON;
131131
}) {
132132
let tmpdir = `${os.tmpdir()}/e-c-tests`;
133133
let inputBaseDir = `${tmpdir}/compiled`;

ts/tsconfig.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compilerOptions": {
3-
"target": "es2017",
4-
"module": "commonjs",
5-
"moduleResolution": "node",
3+
"target": "es2019",
4+
"module": "Node16",
5+
"moduleResolution": "node16",
66
"allowJs": true,
77
"noEmitOnError": true,
88
"noEmit": true,
@@ -14,7 +14,19 @@
1414
"noUnusedLocals": true,
1515
"noUnusedParameters": true,
1616
"outDir": "../js",
17-
"typeRoots": ["../node_modules/@types", "types"],
18-
"esModuleInterop": true
17+
"baseUrl": ".",
18+
"paths": {
19+
"*": [
20+
"./types/*"
21+
]
22+
},
23+
"esModuleInterop": true,
24+
// We *really* don't want this on, but our hand is forced somewhat at the
25+
// moment: the types for `console-ui` are correct for consuming `inquirer`
26+
// in the pre-Node16 world, but don't interoperate correctly when consumed
27+
// by a CJS-default package in the TS Node16+ world *and* consume an ESM
28+
// package. Our path forward there is to update `console-ui` to publish a
29+
// dual-mode package with types and runtime code to support it.
30+
"skipLibCheck": true
1931
}
2032
}

ts/types/fixturify/index.d.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

tsconfig.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"compilerOptions": {
3-
"target": "ES6",
3+
"target": "ES2019",
44
"allowJs": false,
5-
"moduleResolution": "node",
5+
"module": "Node16",
6+
"moduleResolution": "Node16",
67
"noEmitOnError": true,
78
"inlineSourceMap": true,
89
"inlineSources": true,
@@ -31,7 +32,14 @@
3132
"in-repo-b/*": [
3233
"tests/dummy/lib/in-repo-b/addon/*"
3334
]
34-
}
35+
},
36+
// We *really* don't want this on, but our hand is forced somewhat at the
37+
// moment: the types for `console-ui` are correct for consuming `inquirer`
38+
// in the pre-Node16 world, but don't interoperate correctly when consumed
39+
// by a CJS-default package in the TS Node16+ world *and* consume an ESM
40+
// package. Our path forward there is to update `console-ui` to publish a
41+
// dual-mode package with types and runtime code to support it.
42+
"skipLibCheck": true
3543
},
3644
"include": [
3745
"tests"

0 commit comments

Comments
 (0)