Skip to content

Commit

Permalink
ship, increment, ship again
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Dec 27, 2023
1 parent 2090349 commit 815a04b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
17 changes: 16 additions & 1 deletion packages/ember/typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import assert from 'node:assert';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';

import { ember, packageJson } from 'ember-apply';
import { ember, packageJson, project } from 'ember-apply';

import { createConfigDTS } from './src/config-directory.js';
import {
Expand Down Expand Up @@ -73,6 +73,21 @@ async function appToTypeScript() {
await adjustAppScripts();
await setupESLint();
await configureDependencies();

let manager = await project.getPackageManager();

console.info(`
✨✨✨
🥳 Your JavaScript app is now a TypeScript app 🥳
Tasks to manually do
- run '${manager} install'
- make sure '${manager} run lint:types' succeeds
- commit!
✨✨✨
`);
}

async function addonToTypeScript() {
Expand Down
5 changes: 4 additions & 1 deletion packages/ember/typescript/src/package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export async function adjustAppScripts() {

import { canUseBuiltInTypes, isEmberDataPresent } from './queries.js';

export async function adjustAddonScripts() {}
export async function adjustAddonScripts() {
throw new Error(`Addons are not yet supported. PR's welcome!`);
}

const standardDeps = [
'@tsconfig/ember',
Expand All @@ -29,6 +31,7 @@ export async function configureDependencies() {
return;
} else {
if (await isEmberDataPresent()) {
throw new Error(`Ember data isn't yet supported. PR's welcome!`);
}
}
}
9 changes: 8 additions & 1 deletion packages/ember/typescript/src/types-directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ export async function createAppTypesDirectory() {

export async function createAddonTypesDirectory() {
if (await canUseBuiltInTypes()) {
await fse.writeFile(
'types/global.d.ts',
stripIndent`
// Declare the @ember/* packages brought in from ember-source
import 'ember-source/types';
`,
);
}

await fse.writeFile(
`unpublished-development-types/index.d.ts`,
`unpublished-development-types/glint.d.ts`,
stripIndent`
// Add any types here that you need for local development only.
// These will *not* be published as part of your addon, so be careful that your published code does not rely on them!
Expand Down

0 comments on commit 815a04b

Please sign in to comment.