Skip to content

Set up release-it for publishing #1536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports = {

// all TypeScript files
{
files: ['**/*.ts'],
files: ['**/*.{ts,cts,mts}'],
rules: {
// These are covered by tsc
'no-undef': 'off',
Expand Down
47 changes: 36 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"start": "ember serve",
"test": "yarn test:app && yarn test:node",
"test:app": "ember test",
"test:node": "mocha -r register-ts-node ts/tests/**/*.ts",
"test:node": "mocha --loader=ts-node/esm --extension ts ts/tests/**/*.ts",
"ci:prepare": "yarn prepublishOnly && rimraf ts",
"ci:log-version-info": "echo '---- Ember CLI ----' && ember -v && echo '---- TypeScript ----' && tsc -v",
"ci:test": "yarn ci:log-version-info && yarn ci:test:app && yarn ci:test:node",
Expand All @@ -53,8 +53,9 @@
},
"devDependencies": {
"@ember/optional-features": "2.0.0",
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@release-it-plugins/lerna-changelog": "^5.0.0",
"@tsconfig/ember": "^1.0.0",
"@typed-ember/renovate-config": "1.2.1",
"@types/capture-console": "1.0.1",
Expand All @@ -69,8 +70,8 @@
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/got": "9.6.12",
"@types/mocha": "9.1.0",
"@types/node": "14.14.8",
"@types/mocha": "10.0.0",
"@types/node": "14.14.31",
"@types/qunit": "2.19.3",
"@types/resolve": "1.20.1",
"@types/semver": "7.3.9",
Expand All @@ -97,28 +98,29 @@
"ember-maybe-import-regenerator": "0.1.6",
"ember-qunit": "4.6.0",
"ember-resolver": "8.0.2",
"ember-source": "3.23.0",
"ember-source": "~3.28.0",
"ember-try": "1.4.0",
"eslint": "8.7.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-ember": "10.5.8",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "4.0.0",
"esprima": "4.0.1",
"fixturify": "2.1.0",
"got": "11.8.5",
"fixturify": "^2.1.1",
"got": "12.5.2",
"handlebars": "4.7.7",
"in-repo-a": "link:tests/dummy/lib/in-repo-a",
"in-repo-b": "link:tests/dummy/lib/in-repo-b",
"loader.js": "4.7.0",
"mocha": "8.2.1",
"mocha": "10.1.0",
"prettier": "2.5.1",
"prettier-eslint": "13.0.0",
"qunit-dom": "1.6.0",
"release-it": "^15.5.0",
"rimraf": "3.0.2",
"testdouble": "3.16.1",
"ts-node": "9.0.0",
"typescript": "4.5.5"
"ts-node": "^10.9.1",
"typescript": "4.8"
},
"resolutions": {
"hawk": "7",
Expand All @@ -141,6 +143,29 @@
"tabWidth": 2,
"proseWrap": "never"
},
"changelog": {
"labels": {
"BREAKING": "Changed 💥",
"enhancement": "Added ⭐️",
"bug": "Fixed 🔧",
"docs": "Documentation 📖",
"internal": "Under the hood 🚗"
}
},
"release-it": {
"git": {
"tagName": "v${version}"
},
"github": {
"release": true
},
"plugins": {
"@release-it-plugins/lerna-changelog": {
"infile": "CHANGELOG.md",
"launchEditor": true
}
}
},
"volta": {
"node": "14.20.1",
"yarn": "1.22.19"
Expand Down
21 changes: 17 additions & 4 deletions test-fixtures/skeleton-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
{
"compilerOptions": {
"target": "ES6",
"target": "ES2021",
"allowJs": false,
"moduleResolution": "node",
"module": "Node16",
"moduleResolution": "Node16",
"noEmitOnError": true,
"baseUrl": ".",
"paths": {
"skeleton-app/*": ["app/*"]
}
"skeleton-app/*": [
"app/*"
]
},
// We *really* don't want this on, but our hand is forced somewhat at the
// moment: the types for `console-ui` are correct for consuming `inquirer`
// in the pre-Node16 world, but don't interoperate correctly when consumed
// by a CJS-default package in the TS Node16+ world *and* consume an ESM
// package. Our path forward there is to update `console-ui` to publish a
// dual-mode package with types and runtime code to support it.
//
// NOTE TO READERS: this is *only* required because of a very specific bit
// of weird wiring in our test harness; it will *not* affect normal apps.
"skipLibCheck": true
},
"include": [
"app"
Expand Down
2 changes: 1 addition & 1 deletion ts/addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default addon({
let walkSync = require('walk-sync') as typeof import('walk-sync');
let files = new Set(walkSync(directory, ['**/*.{js,ts}']));

let collisions = [];
let collisions: string[] = [];
for (let file of files) {
if (file.endsWith('.js') && files.has(file.replace(/\.js$/, '.ts'))) {
collisions.push(file.replace(/\.js$/, '.{js,ts}'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import SkeletonApp from '../helpers/skeleton-app';
import chai from 'ember-cli-blueprint-test-helpers/chai';
import SkeletonApp from '../helpers/skeleton-app.mjs';
// @ts-ignore -- we're not going to iterate on this, so there's no point in
// working on adding types for it.
import chai from 'ember-cli-blueprint-test-helpers/chai.js';
import * as esprima from 'esprima';
import {
ExpressionStatement,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import fs from 'fs-extra';
import path from 'path';
import path from 'node:path';
import got from 'got';
import execa from 'execa';
import { EventEmitter } from 'events';
import got from 'got';

import debugLib from 'debug';
import rimraf from 'rimraf';

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

// Workaround for CSJ -> ESM transition.
import { createRequire } from 'module';
import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const require = createRequire(import.meta.url);

const getEmberPort = (() => {
let lastPort = 4210;
return () => lastPort++;
Expand All @@ -25,7 +33,7 @@ export default class SkeletonApp {
root = path.join(process.cwd(), `test-skeleton-app-${Math.random().toString(36).slice(2)}`);

constructor() {
fs.mkdirpSync(this.root);
fs.mkdirSync(this.root);
fs.copySync(`${__dirname}/../../../test-fixtures/skeleton-app`, this.root);
process.on('beforeExit', this.cleanupTempDir);
}
Expand Down
4 changes: 2 additions & 2 deletions ts/tests/unit/copy-declarations-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import os from 'os';
import fs from 'fs-extra';
import path from 'path';
import copyDeclarations from '../../lib/utilities/copy-declarations';
import * as fixturify from 'fixturify';
import fixturify from 'fixturify';

describe('Unit: copyDeclarations', function () {
it('copies generated declarations for the correct package', function () {
Expand Down Expand Up @@ -127,7 +127,7 @@ function runCopy(options: {
packageName: string;
pathRoots?: string[];
paths: Record<string, string[]>;
input: fixturify.Directory;
input: fixturify.DirJSON;
}) {
let tmpdir = `${os.tmpdir()}/e-c-tests`;
let inputBaseDir = `${tmpdir}/compiled`;
Expand Down
22 changes: 17 additions & 5 deletions ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"moduleResolution": "node",
"target": "es2019",
"module": "Node16",
"moduleResolution": "node16",
"allowJs": true,
"noEmitOnError": true,
"noEmit": true,
Expand All @@ -14,7 +14,19 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "../js",
"typeRoots": ["../node_modules/@types", "types"],
"esModuleInterop": true
"baseUrl": ".",
"paths": {
"*": [
"./types/*"
]
},
"esModuleInterop": true,
// We *really* don't want this on, but our hand is forced somewhat at the
// moment: the types for `console-ui` are correct for consuming `inquirer`
// in the pre-Node16 world, but don't interoperate correctly when consumed
// by a CJS-default package in the TS Node16+ world *and* consume an ESM
// package. Our path forward there is to update `console-ui` to publish a
// dual-mode package with types and runtime code to support it.
"skipLibCheck": true
}
}
8 changes: 0 additions & 8 deletions ts/types/fixturify/index.d.ts

This file was deleted.

14 changes: 11 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"compilerOptions": {
"target": "ES6",
"target": "ES2019",
"allowJs": false,
"moduleResolution": "node",
"module": "Node16",
"moduleResolution": "Node16",
"noEmitOnError": true,
"inlineSourceMap": true,
"inlineSources": true,
Expand Down Expand Up @@ -31,7 +32,14 @@
"in-repo-b/*": [
"tests/dummy/lib/in-repo-b/addon/*"
]
}
},
// We *really* don't want this on, but our hand is forced somewhat at the
// moment: the types for `console-ui` are correct for consuming `inquirer`
// in the pre-Node16 world, but don't interoperate correctly when consumed
// by a CJS-default package in the TS Node16+ world *and* consume an ESM
// package. Our path forward there is to update `console-ui` to publish a
// dual-mode package with types and runtime code to support it.
"skipLibCheck": true
},
"include": [
"tests"
Expand Down
Loading