diff --git a/docs/configuration.md b/docs/configuration.md index 4376f7130..2eb1fad34 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,23 +1,5 @@ # Configuration -## Blueprints - -By default, ember-cli-typescript installs the [ember-cli-typescript-blueprints](https://github.com/typed-ember/ember-cli-typescript-blueprints) package so that you can use Ember's generators like normal, but with all the special sauce you need for things to work nicely throughout your system with TypeScript. - -If you want to stick with the normal JavaScript blueprints—say, because your team isn't ready to dive into the deep end with making _everything_ TypeScript yet—you can simply uninstall the blueprints package. - -With yarn: - -```bash -yarn remove ember-cli-typescript-blueprints -``` - -With npm: - -```bash -npm uninstall ember-cli-typescript-blueprints -``` - ## `tsconfig.json` We generate a good default [`tsconfig.json`](https://github.com/typed-ember/ember-cli-typescript/blob/master/blueprint-files/ember-cli-typescript/tsconfig.json), which will usually make everything _Just Work™_. In general, you may customize your TypeScript build process as usual using the `tsconfig.json` file. diff --git a/docs/ts/with-addons.md b/docs/ts/with-addons.md index 0ca46b574..c9f5e14e5 100644 --- a/docs/ts/with-addons.md +++ b/docs/ts/with-addons.md @@ -54,8 +54,6 @@ compilerOptions: { [In-repo addons](https://ember-cli.com/extending/#detailed-list-of-blueprints-and-their-use) work in much the same way as linked ones. Their `.ts` files are managed automatically by `ember-cli-typescript` in their `dependencies`, and you can ensure imports resolve correctly from the host by adding entries in `paths` in the base `tsconfig.json` file. -Note that the `in-repo-addon` blueprint should automatically add these entries if you have `ember-cli-typescript-blueprints` installed when you run it. - ```javascript compilerOptions: { // ...other options diff --git a/package.json b/package.json index 848c4ae82..ba640e2af 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,6 @@ "ember-cli-htmlbars": "5.3.1", "ember-cli-inject-live-reload": "2.0.2", "ember-cli-sri": "2.1.1", - "ember-cli-typescript-blueprints": "3.0.0", "ember-cli-uglify": "3.0.0", "ember-cli-update": "0.54.6", "ember-disable-prototype-extensions": "1.1.3", @@ -122,7 +121,8 @@ "typescript": "4.5.5" }, "resolutions": { - "hawk": "7" + "hawk": "7", + "ember-cli-typescript": "link:." }, "engines": { "node": ">= 12.*" diff --git a/ts/blueprints/ember-cli-typescript/index.js b/ts/blueprints/ember-cli-typescript/index.js index b9540f980..6ffb531f9 100644 --- a/ts/blueprints/ember-cli-typescript/index.js +++ b/ts/blueprints/ember-cli-typescript/index.js @@ -78,8 +78,7 @@ module.exports = { 2 ).replace(/\n/g, '\n '), pathsFor: (dasherizedName) => { - // We need to wait to use this module until `ember-cli-typescript-blueprints` has been installed - let updatePathsForAddon = require('ember-cli-typescript-blueprints/lib/utilities/update-paths-for-addon'); + let updatePathsForAddon = require('./update-paths-for-addon'); let appName = isAddon ? 'dummy' : dasherizedName; let paths = { [`${appName}/tests/*`]: ['tests/*'], diff --git a/ts/blueprints/ember-cli-typescript/update-paths-for-addon.js b/ts/blueprints/ember-cli-typescript/update-paths-for-addon.js new file mode 100644 index 000000000..90f46e8d6 --- /dev/null +++ b/ts/blueprints/ember-cli-typescript/update-paths-for-addon.js @@ -0,0 +1,46 @@ +/* eslint-disable no-prototype-builtins */ + +module.exports = function (paths, addonName, appName, options) { + options = options || {}; + const addonNameStar = [addonName, '*'].join('/'); + const addonPath = [options.isLinked ? 'node_modules' : 'lib', addonName].join('/'); + const addonAddonPath = [addonPath, 'addon'].join('/'); + const addonAppPath = [addonPath, 'app'].join('/'); + const appNameStar = [appName, '*'].join('/'); + const addonTestSupportPath = [addonName, 'test-support'].join('/'); + const addonTestSupportStarPath = `${addonTestSupportPath}/*`; + let appStarPaths; + paths = paths || {}; + appStarPaths = paths[appNameStar] = paths[appNameStar] || []; + + if (options.removePaths) { + if (paths.hasOwnProperty(addonName)) { + delete paths[addonName]; + } + if (paths.hasOwnProperty(addonNameStar)) { + delete paths[addonNameStar]; + } + let addonAppPathIndex = appStarPaths.indexOf([addonAppPath, '*'].join('/')); + if (addonAppPathIndex > -1) { + appStarPaths.splice(addonAppPathIndex, 1); + paths[appNameStar] = appStarPaths; + } + } else { + if (!paths.hasOwnProperty(addonName)) { + paths[addonName] = [addonAddonPath]; + } + if (!paths.hasOwnProperty(addonNameStar)) { + paths[addonNameStar] = [[addonAddonPath, '*'].join('/')]; + } + if (!paths.hasOwnProperty(addonTestSupportPath)) { + paths[addonTestSupportPath] = [[addonPath, 'addon-test-support'].join('/')]; + } + if (!paths.hasOwnProperty(addonTestSupportStarPath)) { + paths[addonTestSupportStarPath] = [[addonPath, 'addon-test-support', '*'].join('/')]; + } + if (appStarPaths.indexOf(addonAppPath) === -1) { + appStarPaths.push([addonAppPath, '*'].join('/')); + paths[appNameStar] = appStarPaths; + } + } +}; diff --git a/yarn.lock b/yarn.lock index 040a67f1b..412749aea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -84,7 +84,7 @@ browserslist "^4.21.3" semver "^6.3.0" -"@babel/helper-create-class-features-plugin@^7.10.5", "@babel/helper-create-class-features-plugin@^7.12.1", "@babel/helper-create-class-features-plugin@^7.19.0", "@babel/helper-create-class-features-plugin@^7.5.5": +"@babel/helper-create-class-features-plugin@^7.10.5", "@babel/helper-create-class-features-plugin@^7.12.1", "@babel/helper-create-class-features-plugin@^7.19.0": version "7.19.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.19.0.tgz#bfd6904620df4e46470bae4850d66be1054c404b" integrity sha512-NRz8DwF4jT3UfrmUoZjd0Uph9HQnP30t7Ash+weACcyNkiYTywpIjDBgReJMKgr+n86sn2nPVVmJ28Dm053Kqw== @@ -288,7 +288,7 @@ "@babel/helper-remap-async-to-generator" "^7.12.1" "@babel/plugin-syntax-async-generators" "^7.8.0" -"@babel/plugin-proposal-class-properties@^7.1.0", "@babel/plugin-proposal-class-properties@^7.10.4", "@babel/plugin-proposal-class-properties@^7.12.1": +"@babel/plugin-proposal-class-properties@^7.10.4", "@babel/plugin-proposal-class-properties@^7.12.1": version "7.12.1" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.1.tgz#a082ff541f2a29a4821065b8add9346c0c16e5de" integrity sha512-cKp3dlQsFsEs5CWKnN7BnSHOd0EOW8EKpEjkoz1pO2E5KzIDNV9Ros1b0CnmbVgAGXJubOYVBOGCT1OmJwOI7w== @@ -486,7 +486,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-syntax-typescript@^7.18.6", "@babel/plugin-syntax-typescript@^7.2.0": +"@babel/plugin-syntax-typescript@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz#1c09cd25795c7c2b8a4ba9ae49394576d4133285" integrity sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA== @@ -753,23 +753,6 @@ "@babel/helper-plugin-utils" "^7.19.0" "@babel/plugin-syntax-typescript" "^7.18.6" -"@babel/plugin-transform-typescript@~7.4.0": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.4.5.tgz#ab3351ba35307b79981993536c93ff8be050ba28" - integrity sha512-RPB/YeGr4ZrFKNwfuQRlMf2lxoCUaU01MTw39/OFE/RiL8HDjtn68BwEPft1P7JN4akyEmjGWAMNldOV7o9V2g== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-typescript" "^7.2.0" - -"@babel/plugin-transform-typescript@~7.5.0": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.5.5.tgz#6d862766f09b2da1cb1f7d505fe2aedab6b7d4b8" - integrity sha512-pehKf4m640myZu5B2ZviLaiBlxMCjSZ1qTEO459AXKX5GnPueyulJeCqZFs1nz/Ya2dDzXQ1NxZ/kKNWyD4h6w== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.5.5" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-typescript" "^7.2.0" - "@babel/plugin-transform-unicode-escapes@^7.12.1": version "7.12.1" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.12.1.tgz#5232b9f81ccb07070b7c3c36c67a1b78f1845709" @@ -1964,7 +1947,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: "@types/color-name" "^1.1.1" color-convert "^2.0.1" -ansi-to-html@^0.6.15, ansi-to-html@^0.6.6: +ansi-to-html@^0.6.15: version "0.6.15" resolved "https://registry.yarnpkg.com/ansi-to-html/-/ansi-to-html-0.6.15.tgz#ac6ad4798a00f6aa045535d7f6a9cb9294eebea7" integrity sha512-28ijx2aHJGdzbs+O5SNQF65r6rrKYnkuwTYm8lZlChuoJ9P1vVzIpWO20sQTqTPDXYp6NFwk326vApTtLVFXpQ== @@ -4927,12 +4910,12 @@ ember-cli-app-version@4.0.0: ember-cli-babel "^7.22.1" git-repo-info "^2.1.1" -ember-cli-babel-plugin-helpers@^1.0.0, ember-cli-babel-plugin-helpers@^1.1.0, ember-cli-babel-plugin-helpers@^1.1.1: +ember-cli-babel-plugin-helpers@^1.1.0, ember-cli-babel-plugin-helpers@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ember-cli-babel-plugin-helpers/-/ember-cli-babel-plugin-helpers-1.1.1.tgz#5016b80cdef37036c4282eef2d863e1d73576879" integrity sha512-sKvOiPNHr5F/60NLd7SFzMpYPte/nnGkq/tMIfXejfKHIhaiIkYFqX8Z9UFTKWLLn+V7NOaby6niNPZUdvKCRw== -ember-cli-babel@7.23.0, ember-cli-babel@^7.0.0, ember-cli-babel@^7.11.0, ember-cli-babel@^7.12.0, ember-cli-babel@^7.13.0, ember-cli-babel@^7.19.0, ember-cli-babel@^7.22.1, ember-cli-babel@^7.23.0, ember-cli-babel@^7.7.3: +ember-cli-babel@7.23.0, ember-cli-babel@^7.11.0, ember-cli-babel@^7.12.0, ember-cli-babel@^7.13.0, ember-cli-babel@^7.19.0, ember-cli-babel@^7.22.1, ember-cli-babel@^7.23.0, ember-cli-babel@^7.7.3: version "7.23.0" resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-7.23.0.tgz#ec580aa2c115d0810e454dd5c2fffce238284b92" integrity sha512-ix58DlRDAbGITtdJoRUPcAoQwKLYr/x/kIXjU9u1ATyhmuUjqb+0FDXghOWbkNihGiNOqBBR49+LBgK9AeBcNw== @@ -5110,18 +5093,11 @@ ember-cli-sri@2.1.1: dependencies: broccoli-sri-hash "^2.1.0" -ember-cli-string-utils@^1.0.0, ember-cli-string-utils@^1.1.0: +ember-cli-string-utils@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ember-cli-string-utils/-/ember-cli-string-utils-1.1.0.tgz#39b677fc2805f55173735376fcef278eaa4452a1" integrity sha1-ObZ3/CgF9VFzc1N2/O8njqpEUqE= -ember-cli-test-info@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ember-cli-test-info/-/ember-cli-test-info-1.0.0.tgz#ed4e960f249e97523cf891e4aed2072ce84577b4" - integrity sha1-7U6WDySel1I8+JHkrtIHLOhFd7Q= - dependencies: - ember-cli-string-utils "^1.0.0" - ember-cli-test-loader@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/ember-cli-test-loader/-/ember-cli-test-loader-2.2.0.tgz#3fb8d5d1357e4460d3f0a092f5375e71b6f7c243" @@ -5129,61 +5105,17 @@ ember-cli-test-loader@^2.2.0: dependencies: ember-cli-babel "^6.8.1" -ember-cli-typescript-blueprints@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ember-cli-typescript-blueprints/-/ember-cli-typescript-blueprints-3.0.0.tgz#88595df71ddca9a7cb3ef1fb1626a1c2528da1b6" - integrity sha512-nJScjIjwDY96q9eiIBse9npLht/1FNmDRMpoTLJUrgSTzmx7/S6JhlH4BrMELkLCvtPkWoduDNBGiGBdCqf9FA== - dependencies: - chalk "^2.4.1" - ember-cli-babel "^7.0.0" - ember-cli-get-component-path-option "^1.0.0" - ember-cli-is-package-missing "^1.0.0" - ember-cli-normalize-entity-name "^1.0.0" - ember-cli-path-utils "^1.0.0" - ember-cli-string-utils "^1.1.0" - ember-cli-test-info "^1.0.0" - ember-cli-valid-component-name "^1.0.0" - ember-cli-version-checker "^3.0.0" - ember-router-generator "^2.0.0" - exists-sync "^0.1.0" - fs-extra "^8.0.0" - inflection "^1.12.0" - silent-error "^1.1.0" - ember-cli-typescript@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ember-cli-typescript/-/ember-cli-typescript-3.0.0.tgz#3b838d1ce9e4d22a98e68da22ceac6dc0cfd9bfc" - integrity sha512-lo5YArbJzJi5ssvaGqTt6+FnhTALnSvYVuxM7lfyL1UCMudyNJ94ovH5C7n5il7ATd6WsNiAPRUO/v+s5Jq/aA== - dependencies: - "@babel/plugin-transform-typescript" "~7.5.0" - ansi-to-html "^0.6.6" - debug "^4.0.0" - ember-cli-babel-plugin-helpers "^1.0.0" - execa "^2.0.0" - fs-extra "^8.0.0" - resolve "^1.5.0" - rsvp "^4.8.1" - semver "^6.0.0" - stagehand "^1.0.0" - walk-sync "^2.0.0" + version "0.0.0" + uid "" ember-cli-typescript@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ember-cli-typescript/-/ember-cli-typescript-2.0.2.tgz#464984131fbdc05655eb61d1c3cdd911d3137f0d" - integrity sha512-7I5azCTxOgRDN8aSSnJZIKSqr+MGnT+jLTUbBYqF8wu6ojs2DUnTePxUcQMcvNh3Q3B1ySv7Q/uZFSjdU9gSjA== - dependencies: - "@babel/plugin-proposal-class-properties" "^7.1.0" - "@babel/plugin-transform-typescript" "~7.4.0" - ansi-to-html "^0.6.6" - debug "^4.0.0" - ember-cli-babel-plugin-helpers "^1.0.0" - execa "^1.0.0" - fs-extra "^7.0.0" - resolve "^1.5.0" - rsvp "^4.8.1" - semver "^6.0.0" - stagehand "^1.0.0" - walk-sync "^1.0.0" + version "0.0.0" + uid "" + +"ember-cli-typescript@link:.": + version "0.0.0" + uid "" ember-cli-uglify@3.0.0: version "3.0.0" @@ -5210,13 +5142,6 @@ ember-cli-update@0.54.6: update-notifier "^4.0.0" yargs "^15.1.0" -ember-cli-valid-component-name@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ember-cli-valid-component-name/-/ember-cli-valid-component-name-1.0.0.tgz#71550ce387e0233065f30b30b1510aa2dfbe87ef" - integrity sha1-cVUM44fgIzBl8wswsVEKot++h+8= - dependencies: - silent-error "^1.0.0" - ember-cli-version-checker@^2.0.0, ember-cli-version-checker@^2.1.1, ember-cli-version-checker@^2.1.2: version "2.2.0" resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-2.2.0.tgz#47771b731fe0962705e27c8199a9e3825709f3b3" @@ -5225,7 +5150,7 @@ ember-cli-version-checker@^2.0.0, ember-cli-version-checker@^2.1.1, ember-cli-ve resolve "^1.3.3" semver "^5.3.0" -ember-cli-version-checker@^3.0.0, ember-cli-version-checker@^3.1.3: +ember-cli-version-checker@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-3.1.3.tgz#7c9b4f5ff30fdebcd480b1c06c4de43bb51c522c" integrity sha512-PZNSvpzwWgv68hcXxyjREpj3WWb81A7rtYNQq1lLEgrWIchF8ApKJjWP3NBpHjaatwILkZAV8klair5WFlXAKg== @@ -5946,21 +5871,6 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-2.1.0.tgz#e5d3ecd837d2a60ec50f3da78fd39767747bbe99" - integrity sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw== - dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^3.0.0" - onetime "^5.1.0" - p-finally "^2.0.0" - signal-exit "^3.0.2" - strip-final-newline "^2.0.0" - execa@^3.0.0, execa@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/execa/-/execa-3.4.0.tgz#c08ed4550ef65d858fac269ffc8572446f37eb89" @@ -6017,11 +5927,6 @@ exists-sync@0.0.4: resolved "https://registry.yarnpkg.com/exists-sync/-/exists-sync-0.0.4.tgz#9744c2c428cc03b01060db454d4b12f0ef3c8879" integrity sha1-l0TCxCjMA7AQYNtFTUsS8O88iHk= -exists-sync@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/exists-sync/-/exists-sync-0.1.0.tgz#318d545213d2b2a31499e92c35f74c94196a22f7" - integrity sha512-qEfFekfBVid4b14FNug/RNY1nv+BADnlzKGHulc+t6ZLqGY4kdHGh1iFha8lnE3sJU/1WzMzKRNxS6EvSakJUg== - exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" @@ -7507,10 +7412,12 @@ imurmurhash@^0.1.4: integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= "in-repo-a@link:tests/dummy/lib/in-repo-a": - version "1.0.0" + version "0.0.0" + uid "" "in-repo-b@link:tests/dummy/lib/in-repo-b": - version "1.0.0" + version "0.0.0" + uid "" indent-string@^4.0.0: version "4.0.0" @@ -9467,13 +9374,6 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npm-run-path@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-3.1.0.tgz#7f91be317f6a466efed3c9f2980ad8a4ee8b0fa5" - integrity sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg== - dependencies: - path-key "^3.0.0" - npm-run-path@^4.0.0, npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -12677,7 +12577,7 @@ walk-sync@^1.0.0, walk-sync@^1.1.3: ensure-posix-path "^1.1.0" matcher-collection "^1.1.1" -walk-sync@^2.0.0, walk-sync@^2.0.2, walk-sync@^2.2.0: +walk-sync@^2.0.2, walk-sync@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/walk-sync/-/walk-sync-2.2.0.tgz#80786b0657fcc8c0e1c0b1a042a09eae2966387a" integrity sha512-IC8sL7aB4/ZgFcGI2T1LczZeFWZ06b3zoHH7jBPyHxOtIIz1jppWHjjEXkOFvFojBVAK9pV7g47xOZ4LW3QLfg==