From 2d192d949b0fa50df610ce01d744cdc9d31c2451 Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Mon, 8 Apr 2024 15:26:35 +0200 Subject: [PATCH 1/4] chore: Ran ember-codemod-v1-to-v2 --- .gitignore | 34 +----- app/helpers/did-insert-helper.js | 1 - app/helpers/did-update-helper.js | 1 - app/helpers/will-destroy-helper.js | 1 - ember-cli-build.js | 25 ----- ember-render-helpers/.eslintignore | 9 ++ .../.eslintrc.js | 0 ember-render-helpers/.gitignore | 12 ++ ember-render-helpers/.prettierignore | 9 ++ .../.prettierrc.js | 0 .../.template-lintrc.js | 0 ember-render-helpers/addon-main.cjs | 5 + ember-render-helpers/babel.config.json | 28 +++++ ember-render-helpers/package.json | 94 ++++++++++++++++ ember-render-helpers/rollup.config.mjs | 72 ++++++++++++ {addon => ember-render-helpers/src}/.gitkeep | 0 .../src}/helpers/did-insert-helper.ts | 0 .../src}/helpers/did-update-helper.ts | 0 .../src}/helpers/will-destroy-helper.ts | 0 {addon => ember-render-helpers/src}/index.ts | 0 .../src}/template-registry.ts | 0 {addon => ember-render-helpers/src}/types.ts | 0 ember-render-helpers/tsconfig.json | 19 ++++ .../unpublished-development-types/index.d.ts | 14 +++ index.js | 5 - package.json | 104 +++--------------- pnpm-workspace.yaml | 3 + .ember-cli => test-app/.ember-cli | 0 .eslintignore => test-app/.eslintignore | 0 test-app/.eslintrc.js | 85 ++++++++++++++ .npmignore => test-app/.gitignore | 37 +++---- .prettierignore => test-app/.prettierignore | 0 test-app/.prettierrc.js | 20 ++++ test-app/.template-lintrc.js | 14 +++ .watchmanconfig => test-app/.watchmanconfig | 0 {tests/dummy => test-app}/app/app.ts | 0 {app => test-app/app/components}/.gitkeep | 0 .../app/config/environment.d.ts | 2 +- {tests/dummy => test-app}/app/index.html | 4 +- {tests/dummy => test-app}/app/router.ts | 0 .../app/routes}/.gitkeep | 0 {tests/dummy => test-app}/app/styles/app.css | 0 .../app/templates/application.hbs | 0 .../config/ember-cli-update.json | 0 {tests/dummy => test-app}/config/ember-try.js | 0 .../dummy => test-app}/config/environment.js | 2 +- .../config/optional-features.json | 0 {tests/dummy => test-app}/config/targets.js | 0 test-app/ember-cli-build.js | 19 ++++ test-app/package.json | 95 ++++++++++++++++ {tests/dummy => test-app}/public/robots.txt | 0 testem.js => test-app/testem.js | 0 .../tests/helpers}/.gitkeep | 0 {tests => test-app/tests}/helpers/index.ts | 0 {tests => test-app/tests}/index.html | 4 +- .../tests/integration}/.gitkeep | 0 .../helpers/did-insert-helper-test.ts | 2 +- .../helpers/did-update-helper-test.ts | 2 +- .../helpers/will-destroy-helper-test.ts | 2 +- {tests => test-app/tests}/test-helper.ts | 4 +- .../tests/unit}/.gitkeep | 0 test-app/tsconfig.json | 24 ++++ test-app/types/global.d.ts | 7 ++ .../types/test-app}/index.d.ts | 0 tests/unit/.gitkeep | 0 tsconfig.json | 50 --------- types/global.d.ts | 6 - 67 files changed, 575 insertions(+), 240 deletions(-) delete mode 100644 app/helpers/did-insert-helper.js delete mode 100644 app/helpers/did-update-helper.js delete mode 100644 app/helpers/will-destroy-helper.js delete mode 100644 ember-cli-build.js create mode 100644 ember-render-helpers/.eslintignore rename .eslintrc.js => ember-render-helpers/.eslintrc.js (100%) create mode 100644 ember-render-helpers/.gitignore create mode 100644 ember-render-helpers/.prettierignore rename .prettierrc.js => ember-render-helpers/.prettierrc.js (100%) rename .template-lintrc.js => ember-render-helpers/.template-lintrc.js (100%) create mode 100644 ember-render-helpers/addon-main.cjs create mode 100644 ember-render-helpers/babel.config.json create mode 100644 ember-render-helpers/package.json create mode 100644 ember-render-helpers/rollup.config.mjs rename {addon => ember-render-helpers/src}/.gitkeep (100%) rename {addon => ember-render-helpers/src}/helpers/did-insert-helper.ts (100%) rename {addon => ember-render-helpers/src}/helpers/did-update-helper.ts (100%) rename {addon => ember-render-helpers/src}/helpers/will-destroy-helper.ts (100%) rename {addon => ember-render-helpers/src}/index.ts (100%) rename {addon => ember-render-helpers/src}/template-registry.ts (100%) rename {addon => ember-render-helpers/src}/types.ts (100%) create mode 100644 ember-render-helpers/tsconfig.json create mode 100644 ember-render-helpers/unpublished-development-types/index.d.ts delete mode 100644 index.js create mode 100644 pnpm-workspace.yaml rename .ember-cli => test-app/.ember-cli (100%) rename .eslintignore => test-app/.eslintignore (100%) create mode 100644 test-app/.eslintrc.js rename .npmignore => test-app/.gitignore (50%) rename .prettierignore => test-app/.prettierignore (100%) create mode 100644 test-app/.prettierrc.js create mode 100644 test-app/.template-lintrc.js rename .watchmanconfig => test-app/.watchmanconfig (100%) rename {tests/dummy => test-app}/app/app.ts (100%) rename {app => test-app/app/components}/.gitkeep (100%) rename {tests/dummy => test-app}/app/config/environment.d.ts (82%) rename {tests/dummy => test-app}/app/index.html (89%) rename {tests/dummy => test-app}/app/router.ts (100%) rename {tests/dummy/app/components => test-app/app/routes}/.gitkeep (100%) rename {tests/dummy => test-app}/app/styles/app.css (100%) rename {tests/dummy => test-app}/app/templates/application.hbs (100%) rename {tests/dummy => test-app}/config/ember-cli-update.json (100%) rename {tests/dummy => test-app}/config/ember-try.js (100%) rename {tests/dummy => test-app}/config/environment.js (97%) rename {tests/dummy => test-app}/config/optional-features.json (100%) rename {tests/dummy => test-app}/config/targets.js (100%) create mode 100644 test-app/ember-cli-build.js create mode 100644 test-app/package.json rename {tests/dummy => test-app}/public/robots.txt (100%) rename testem.js => test-app/testem.js (100%) rename {tests/dummy/app/routes => test-app/tests/helpers}/.gitkeep (100%) rename {tests => test-app/tests}/helpers/index.ts (100%) rename {tests => test-app/tests}/index.html (89%) rename {tests/helpers => test-app/tests/integration}/.gitkeep (100%) rename {tests => test-app/tests}/integration/helpers/did-insert-helper-test.ts (98%) rename {tests => test-app/tests}/integration/helpers/did-update-helper-test.ts (98%) rename {tests => test-app/tests}/integration/helpers/will-destroy-helper-test.ts (98%) rename {tests => test-app/tests}/test-helper.ts (75%) rename {tests/integration => test-app/tests/unit}/.gitkeep (100%) create mode 100644 test-app/tsconfig.json create mode 100644 test-app/types/global.d.ts rename {types/dummy => test-app/types/test-app}/index.d.ts (100%) delete mode 100644 tests/unit/.gitkeep delete mode 100644 tsconfig.json delete mode 100644 types/global.d.ts diff --git a/.gitignore b/.gitignore index 66712ac..be29758 100644 --- a/.gitignore +++ b/.gitignore @@ -1,34 +1,10 @@ # See https://help.github.com/ignore-files/ for more about ignoring files. -# compiled output -/dist/ -/tmp/ - # dependencies -/node_modules/ +node_modules/ # misc -/.env* -/.pnp* -/.DS_Store -/.sass-cache -/.eslintcache -/.stylelintcache -/connect.lock -/coverage/ -/libpeerconnection.log -/npm-debug.log* -/testem.log -/yarn-error.log - -# ember-try -/.node_modules.ember-try/ -/bower.json.ember-try -/npm-shrinkwrap.json.ember-try -/package.json.ember-try -/package-lock.json.ember-try -/pnpm-lock.yaml.ember-try -/yarn.lock.ember-try - -# broccoli-debug -/DEBUG/ +.env* +.pnpm-debug.log +npm-debug.log* +yarn-error.log diff --git a/app/helpers/did-insert-helper.js b/app/helpers/did-insert-helper.js deleted file mode 100644 index c889502..0000000 --- a/app/helpers/did-insert-helper.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'ember-render-helpers/helpers/did-insert-helper'; diff --git a/app/helpers/did-update-helper.js b/app/helpers/did-update-helper.js deleted file mode 100644 index bb2ab6a..0000000 --- a/app/helpers/did-update-helper.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'ember-render-helpers/helpers/did-update-helper'; diff --git a/app/helpers/will-destroy-helper.js b/app/helpers/will-destroy-helper.js deleted file mode 100644 index 0812958..0000000 --- a/app/helpers/will-destroy-helper.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'ember-render-helpers/helpers/will-destroy-helper'; diff --git a/ember-cli-build.js b/ember-cli-build.js deleted file mode 100644 index f925770..0000000 --- a/ember-cli-build.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -const { maybeEmbroider } = require('@embroider/test-setup'); -const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); - -module.exports = function (defaults) { - const app = new EmberAddon(defaults, { - // Add options here - }); - - /* - This build file specifies the options for the dummy test app of this - addon, located in `/tests/dummy` - This build file does *not* influence how the addon or the app using it - behave. You most likely want to be modifying `./index.js` or app's build file - */ - - return maybeEmbroider(app, { - skipBabel: [ - { - package: 'qunit', - }, - ], - }); -}; diff --git a/ember-render-helpers/.eslintignore b/ember-render-helpers/.eslintignore new file mode 100644 index 0000000..b0381f9 --- /dev/null +++ b/ember-render-helpers/.eslintignore @@ -0,0 +1,9 @@ +# unconventional js +/blueprints/*/files/ + +# compiled output +/declarations/ +/dist/ + +# misc +/coverage/ diff --git a/.eslintrc.js b/ember-render-helpers/.eslintrc.js similarity index 100% rename from .eslintrc.js rename to ember-render-helpers/.eslintrc.js diff --git a/ember-render-helpers/.gitignore b/ember-render-helpers/.gitignore new file mode 100644 index 0000000..0f93238 --- /dev/null +++ b/ember-render-helpers/.gitignore @@ -0,0 +1,12 @@ +# The authoritative copies of these live in the monorepo root (because they're +# more useful on github that way), but the build copies them into here so they +# will also appear in published NPM packages. +/LICENSE.md +/README.md + +# compiled output +/declarations +/dist + +# npm/pnpm/yarn pack output +*.tgz diff --git a/ember-render-helpers/.prettierignore b/ember-render-helpers/.prettierignore new file mode 100644 index 0000000..b0381f9 --- /dev/null +++ b/ember-render-helpers/.prettierignore @@ -0,0 +1,9 @@ +# unconventional js +/blueprints/*/files/ + +# compiled output +/declarations/ +/dist/ + +# misc +/coverage/ diff --git a/.prettierrc.js b/ember-render-helpers/.prettierrc.js similarity index 100% rename from .prettierrc.js rename to ember-render-helpers/.prettierrc.js diff --git a/.template-lintrc.js b/ember-render-helpers/.template-lintrc.js similarity index 100% rename from .template-lintrc.js rename to ember-render-helpers/.template-lintrc.js diff --git a/ember-render-helpers/addon-main.cjs b/ember-render-helpers/addon-main.cjs new file mode 100644 index 0000000..d36b0c8 --- /dev/null +++ b/ember-render-helpers/addon-main.cjs @@ -0,0 +1,5 @@ +'use strict'; + +const { addonV1Shim } = require('@embroider/addon-shim'); + +module.exports = addonV1Shim(__dirname); diff --git a/ember-render-helpers/babel.config.json b/ember-render-helpers/babel.config.json new file mode 100644 index 0000000..f6cb36b --- /dev/null +++ b/ember-render-helpers/babel.config.json @@ -0,0 +1,28 @@ +{ + "plugins": [ + [ + "@babel/plugin-transform-typescript", + { + "allExtensions": true, + "allowDeclareFields": true, + "onlyRemoveTypeImports": true + } + ], + "@embroider/addon-dev/template-colocation-plugin", + [ + "babel-plugin-ember-template-compilation", + { + "targetFormat": "hbs", + "transforms": [] + } + ], + [ + "module:decorator-transforms", + { + "runtime": { + "import": "decorator-transforms/runtime" + } + } + ] + ] +} diff --git a/ember-render-helpers/package.json b/ember-render-helpers/package.json new file mode 100644 index 0000000..d09e334 --- /dev/null +++ b/ember-render-helpers/package.json @@ -0,0 +1,94 @@ +{ + "name": "ember-render-helpers", + "version": "0.2.0", + "description": "Complimentary render template helpers to the render modifiers", + "keywords": [ + "ember-addon", + "ember-helper", + "ember-template-helper", + "template-helper", + "helper", + "render", + "@ember/render-modifiers", + "did-insert", + "did-update", + "will-destroy" + ], + "repository": "buschtoens/ember-render-helpers", + "license": "MIT", + "author": "Jan Buschtöns (https://jan.buschtoens.me)", + "directories": { + "doc": "doc", + "test": "tests" + }, + "scripts": { + "build": "concurrently \"npm:build:*\" --names \"build:\"", + "build:js": "rollup --config", + "build:types": "glint --declaration", + "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", + "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", + "lint:hbs": "ember-template-lint .", + "lint:hbs:fix": "ember-template-lint . --fix", + "lint:js": "eslint . --cache", + "lint:js:fix": "eslint . --fix", + "lint:types": "glint", + "prepack": "rollup --config", + "start": "concurrently \"npm:start:*\" --names \"start:\"", + "start:js": "rollup --config --watch --no-watch.clearScreen", + "start:types": "glint --declaration --watch", + "test": "echo 'A v2 addon does not have tests, run tests in test-app'", + "test:ember-compatibility": "./node_modules/.bin/ember try:one" + }, + "dependencies": { + "@embroider/addon-shim": "^1.8.7", + "decorator-transforms": "^1.1.0" + }, + "devDependencies": { + "@babel/core": "^7.24.0", + "@babel/plugin-transform-typescript": "^7.23.6", + "@babel/runtime": "^7.24.0", + "@embroider/addon-dev": "^4.2.1", + "@rollup/plugin-babel": "^6.0.4", + "@tsconfig/ember": "^3.0.6", + "babel-plugin-ember-template-compilation": "^2.2.1", + "concurrently": "^8.2.2", + "rollup": "^4.13.0", + "rollup-plugin-copy": "^3.5.0", + "typescript": "^5.4.4" + }, + "engines": { + "node": "18.* || >= 20" + }, + "ember": { + "edition": "octane" + }, + "ember-addon": { + "app-js": {}, + "main": "addon-main.cjs", + "type": "addon", + "version": 2 + }, + "exports": { + ".": { + "types": "./declarations/index.d.ts", + "default": "./dist/index.js" + }, + "./*": { + "types": "./declarations/*.d.ts", + "default": "./dist/*.js" + }, + "./addon-main.js": "./addon-main.cjs" + }, + "files": [ + "addon-main.cjs", + "declarations", + "dist" + ], + "typesVersions": { + "*": { + "*": [ + "declarations/*" + ] + } + } +} diff --git a/ember-render-helpers/rollup.config.mjs b/ember-render-helpers/rollup.config.mjs new file mode 100644 index 0000000..4472e2d --- /dev/null +++ b/ember-render-helpers/rollup.config.mjs @@ -0,0 +1,72 @@ +import { Addon } from '@embroider/addon-dev/rollup'; +import { babel } from '@rollup/plugin-babel'; +import copy from 'rollup-plugin-copy'; + +const addon = new Addon({ + srcDir: 'src', + destDir: 'dist', +}); + +export default { + // This provides defaults that work well alongside `publicEntrypoints` below. + // You can augment this if you need to. + output: addon.output(), + + plugins: [ + // These are the modules that users should be able to import from your + // addon. Anything not listed here may get optimized away. + // By default all your JavaScript modules (**/*.js) will be importable. + // But you are encouraged to tweak this to only cover the modules that make + // up your addon's public API. Also make sure your package.json#exports + // is aligned to the config here. + // See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon + addon.publicEntrypoints(['**/*.js', 'index.js', 'template-registry.js']), + + // These are the modules that should get reexported into the traditional + // "app" tree. Things in here should also be in publicEntrypoints above, but + // not everything in publicEntrypoints necessarily needs to go here. + addon.appReexports([ + 'components/**/*.js', + 'helpers/**/*.js', + 'modifiers/**/*.js', + 'services/**/*.js', + ]), + + // Follow the V2 Addon rules about dependencies. Your code can import from + // `dependencies` and `peerDependencies` as well as standard Ember-provided + // package names. + addon.dependencies(), + + // This babel config should *not* apply presets or compile away ES modules. + // It exists only to provide development niceties for you, like automatic + // template colocation. + // + // By default, this will load the actual babel config from the file + // babel.config.json. + babel({ + babelHelpers: 'bundled', + extensions: ['.js', '.gjs', '.ts', '.gts'], + }), + + // Ensure that standalone .hbs files are properly integrated as Javascript. + addon.hbs(), + + // Ensure that .gjs files are properly integrated as Javascript + addon.gjs(), + + // addons are allowed to contain imports of .css files, which we want rollup + // to leave alone and keep in the published output. + addon.keepAssets(['**/*.css']), + + // Remove leftover build artifacts when starting a new build. + addon.clean(), + + // Copy Readme and License into published package + copy({ + targets: [ + { src: '../README.md', dest: '.' }, + { src: '../LICENSE.md', dest: '.' }, + ], + }), + ], +}; diff --git a/addon/.gitkeep b/ember-render-helpers/src/.gitkeep similarity index 100% rename from addon/.gitkeep rename to ember-render-helpers/src/.gitkeep diff --git a/addon/helpers/did-insert-helper.ts b/ember-render-helpers/src/helpers/did-insert-helper.ts similarity index 100% rename from addon/helpers/did-insert-helper.ts rename to ember-render-helpers/src/helpers/did-insert-helper.ts diff --git a/addon/helpers/did-update-helper.ts b/ember-render-helpers/src/helpers/did-update-helper.ts similarity index 100% rename from addon/helpers/did-update-helper.ts rename to ember-render-helpers/src/helpers/did-update-helper.ts diff --git a/addon/helpers/will-destroy-helper.ts b/ember-render-helpers/src/helpers/will-destroy-helper.ts similarity index 100% rename from addon/helpers/will-destroy-helper.ts rename to ember-render-helpers/src/helpers/will-destroy-helper.ts diff --git a/addon/index.ts b/ember-render-helpers/src/index.ts similarity index 100% rename from addon/index.ts rename to ember-render-helpers/src/index.ts diff --git a/addon/template-registry.ts b/ember-render-helpers/src/template-registry.ts similarity index 100% rename from addon/template-registry.ts rename to ember-render-helpers/src/template-registry.ts diff --git a/addon/types.ts b/ember-render-helpers/src/types.ts similarity index 100% rename from addon/types.ts rename to ember-render-helpers/src/types.ts diff --git a/ember-render-helpers/tsconfig.json b/ember-render-helpers/tsconfig.json new file mode 100644 index 0000000..5f3c433 --- /dev/null +++ b/ember-render-helpers/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "@tsconfig/ember/tsconfig.json", + "compilerOptions": { + "allowImportingTsExtensions": true, + "allowJs": true, + "declarationDir": "declarations", + "rootDir": "./src" + }, + "include": [ + "src/**/*", + "unpublished-development-types/**/*" + ], + "glint": { + "environment": [ + "ember-loose", + "ember-template-imports" + ] + } +} diff --git a/ember-render-helpers/unpublished-development-types/index.d.ts b/ember-render-helpers/unpublished-development-types/index.d.ts new file mode 100644 index 0000000..adcd102 --- /dev/null +++ b/ember-render-helpers/unpublished-development-types/index.d.ts @@ -0,0 +1,14 @@ +// 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! + +import '@glint/environment-ember-loose'; +// import '@glint/environment-ember-template-imports'; + +declare module '@glint/environment-ember-loose/registry' { + // Remove this once entries have been added! 👇 + // eslint-disable-next-line @typescript-eslint/no-empty-interface + export default interface Registry { + // Add any registry entries from other addons here that your addon itself uses (in non-strict mode templates) + // See https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons + } +} diff --git a/index.js b/index.js deleted file mode 100644 index 0ca063d..0000000 --- a/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = { - name: require('./package').name, -}; diff --git a/package.json b/package.json index ab9bbad..d6364b0 100644 --- a/package.json +++ b/package.json @@ -1,99 +1,21 @@ { - "name": "ember-render-helpers", + "name": "workspace-root", "version": "0.2.0", - "description": "Complimentary render template helpers to the render modifiers", - "keywords": [ - "ember-addon", - "ember-helper", - "ember-template-helper", - "template-helper", - "helper", - "render", - "@ember/render-modifiers", - "did-insert", - "did-update", - "will-destroy" - ], - "repository": "buschtoens/ember-render-helpers", + "private": true, + "repository": "", "license": "MIT", - "author": "Jan Buschtöns (https://jan.buschtoens.me)", - "directories": { - "doc": "doc", - "test": "tests" - }, + "author": "", "scripts": { - "build": "ember build", - "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", - "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", - "lint:hbs": "ember-template-lint .", - "lint:hbs:fix": "ember-template-lint . --fix", - "lint:js": "eslint . --cache", - "lint:js:fix": "eslint . --fix", - "lint:types": "glint", - "prepack": "ember ts:precompile", - "postpack": "ember ts:clean", - "start": "ember serve", - "test": "ember test", - "test:ember-compatibility": "./node_modules/.bin/ember try:one" - }, - "dependencies": { - "ember-cli-babel": "^8.1.0", - "ember-cli-htmlbars": "^6.3.0", - "ember-cli-typescript": "^5.3.0" + "build": "pnpm --filter ember-render-helpers build", + "lint": "pnpm --filter '*' lint", + "lint:fix": "pnpm --filter '*' lint:fix", + "prepare": "pnpm build", + "start": "concurrently 'npm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow", + "start:addon": "pnpm --filter ember-render-helpers start", + "start:test-app": "pnpm --filter test-app start", + "test": "pnpm --filter '*' test" }, "devDependencies": { - "@ember/optional-features": "^2.1.0", - "@ember/test-helpers": "^3.3.0", - "@embroider/test-setup": "^3.0.3", - "@glint/core": "^1.4.0", - "@glint/environment-ember-loose": "^1.4.0", - "@glint/environment-ember-template-imports": "^1.4.0", - "@glint/template": "^1.4.0", - "@tsconfig/ember": "^3.0.6", - "@types/qunit": "^2.19.10", - "@typescript-eslint/eslint-plugin": "^7.5.0", - "@typescript-eslint/parser": "^7.5.0", - "broccoli-asset-rev": "^3.0.0", - "concurrently": "^8.2.2", - "ember-auto-import": "^2.7.2", - "ember-cli": "~5.7.0", - "ember-cli-dependency-checker": "^3.3.2", - "ember-cli-htmlbars": "^6.3.0", - "ember-cli-inject-live-reload": "^2.1.0", - "ember-cli-sri": "^2.1.1", - "ember-cli-terser": "^4.0.2", - "ember-load-initializers": "^2.1.2", - "ember-qunit": "^8.0.2", - "ember-resolver": "^11.0.1", - "ember-source": "~5.7.0", - "ember-source-channel-url": "^3.0.0", - "ember-template-lint": "^6.0.0", - "ember-template-lint-plugin-prettier": "^5.0.0", - "ember-try": "^3.0.0", - "eslint": "^8.57.0", - "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-ember": "^11.12.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-n": "^17.0.0", - "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-qunit": "^8.1.1", - "eslint-plugin-simple-import-sort": "^12.0.0", - "eslint-plugin-typescript-sort-keys": "^3.2.0", - "loader.js": "^4.7.0", - "prettier": "^3.2.5", - "qunit": "^2.20.1", - "qunit-dom": "^3.0.0", - "typescript": "^5.4.4", - "webpack": "^5.91.0" - }, - "engines": { - "node": "18.* || >= 20" - }, - "ember": { - "edition": "octane" - }, - "ember-addon": { - "configPath": "tests/dummy/config" + "concurrently": "^8.2.2" } } diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..4a96c46 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,3 @@ +packages: + - 'ember-render-helpers' + - 'test-app' diff --git a/.ember-cli b/test-app/.ember-cli similarity index 100% rename from .ember-cli rename to test-app/.ember-cli diff --git a/.eslintignore b/test-app/.eslintignore similarity index 100% rename from .eslintignore rename to test-app/.eslintignore diff --git a/test-app/.eslintrc.js b/test-app/.eslintrc.js new file mode 100644 index 0000000..af62575 --- /dev/null +++ b/test-app/.eslintrc.js @@ -0,0 +1,85 @@ +'use strict'; + +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + plugins: [ + 'ember', + '@typescript-eslint', + 'simple-import-sort', + 'typescript-sort-keys', + ], + extends: [ + 'eslint:recommended', + 'plugin:ember/recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', + 'plugin:prettier/recommended', + 'plugin:typescript-sort-keys/recommended', + ], + env: { + browser: true, + }, + rules: { + curly: 'error', + 'simple-import-sort/exports': 'error', + 'simple-import-sort/imports': 'error', + }, + settings: { + 'import/resolver': { + node: { + extensions: ['.gjs', '.gts', '.js', '.ts'], + }, + typescript: true, + }, + }, + overrides: [ + // TypeScript and JavaScript files + { + files: ['**/*.{gjs,gts,js,ts}'], + extends: [ + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + ], + rules: { + 'import/no-duplicates': 'error', + 'import/no-unresolved': [ + 'error', + { ignore: ['^@ember', '^dummy/', '^ember', 'fetch'] }, + ], + }, + }, + // Node files + { + files: [ + './.eslintrc.js', + './.prettierrc.js', + './.stylelintrc.js', + './.template-lintrc.js', + './ember-cli-build.js', + './index.js', + './testem.js', + './blueprints/*/index.js', + './config/**/*.js', + './tests/dummy/config/**/*.js', + ], + env: { + browser: false, + node: true, + }, + extends: ['plugin:n/recommended'], + rules: { + '@typescript-eslint/no-var-requires': 'off', + }, + }, + // Test files + { + files: ['tests/**/*-test.{gjs,gts,js,ts}'], + extends: ['plugin:qunit/recommended'], + }, + ], +}; diff --git a/.npmignore b/test-app/.gitignore similarity index 50% rename from .npmignore rename to test-app/.gitignore index f176ac2..66712ac 100644 --- a/.npmignore +++ b/test-app/.gitignore @@ -1,31 +1,25 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + # compiled output /dist/ /tmp/ +# dependencies +/node_modules/ + # misc -/.bowerrc -/.editorconfig -/.ember-cli /.env* +/.pnp* +/.DS_Store +/.sass-cache /.eslintcache -/.eslintignore -/.eslintrc.js -/.git/ -/.github/ -/.gitignore -/.prettierignore -/.prettierrc.js -/.template-lintrc.js -/.travis.yml -/.watchmanconfig -/bower.json -/CONTRIBUTING.md -/ember-cli-build.js -/testem.js -/tests/ +/.stylelintcache +/connect.lock +/coverage/ +/libpeerconnection.log +/npm-debug.log* +/testem.log /yarn-error.log -/yarn.lock -.gitkeep # ember-try /.node_modules.ember-try/ @@ -35,3 +29,6 @@ /package-lock.json.ember-try /pnpm-lock.yaml.ember-try /yarn.lock.ember-try + +# broccoli-debug +/DEBUG/ diff --git a/.prettierignore b/test-app/.prettierignore similarity index 100% rename from .prettierignore rename to test-app/.prettierignore diff --git a/test-app/.prettierrc.js b/test-app/.prettierrc.js new file mode 100644 index 0000000..7cc706a --- /dev/null +++ b/test-app/.prettierrc.js @@ -0,0 +1,20 @@ +'use strict'; + +module.exports = { + overrides: [ + { + files: '*.hbs', + options: { + printWidth: 64, + singleQuote: false, + }, + }, + { + files: '*.{cjs,cts,gjs,gts,js,mjs,mts,ts}', + options: { + printWidth: 80, + singleQuote: true, + }, + }, + ], +}; diff --git a/test-app/.template-lintrc.js b/test-app/.template-lintrc.js new file mode 100644 index 0000000..cf6448e --- /dev/null +++ b/test-app/.template-lintrc.js @@ -0,0 +1,14 @@ +'use strict'; + +module.exports = { + plugins: ['ember-template-lint-plugin-prettier'], + extends: ['recommended', 'ember-template-lint-plugin-prettier:recommended'], + overrides: [ + { + files: ['addon/**/*.hbs', 'tests/**/*-test.{js,ts}'], + rules: { + prettier: 'off', + }, + }, + ], +}; diff --git a/.watchmanconfig b/test-app/.watchmanconfig similarity index 100% rename from .watchmanconfig rename to test-app/.watchmanconfig diff --git a/tests/dummy/app/app.ts b/test-app/app/app.ts similarity index 100% rename from tests/dummy/app/app.ts rename to test-app/app/app.ts diff --git a/app/.gitkeep b/test-app/app/components/.gitkeep similarity index 100% rename from app/.gitkeep rename to test-app/app/components/.gitkeep diff --git a/tests/dummy/app/config/environment.d.ts b/test-app/app/config/environment.d.ts similarity index 82% rename from tests/dummy/app/config/environment.d.ts rename to test-app/app/config/environment.d.ts index 6cf1e63..d413b5d 100644 --- a/tests/dummy/app/config/environment.d.ts +++ b/test-app/app/config/environment.d.ts @@ -2,7 +2,7 @@ export default config; /** * Type declarations for - * import config from 'dummy/config/environment' + * import config from 'test-app/config/environment' */ declare const config: { APP: Record; diff --git a/tests/dummy/app/index.html b/test-app/app/index.html similarity index 89% rename from tests/dummy/app/index.html rename to test-app/app/index.html index 8a43d2d..5284bcc 100644 --- a/tests/dummy/app/index.html +++ b/test-app/app/index.html @@ -10,7 +10,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} @@ -18,7 +18,7 @@ {{content-for "body"}} - + {{content-for "body-footer"}} diff --git a/tests/dummy/app/router.ts b/test-app/app/router.ts similarity index 100% rename from tests/dummy/app/router.ts rename to test-app/app/router.ts diff --git a/tests/dummy/app/components/.gitkeep b/test-app/app/routes/.gitkeep similarity index 100% rename from tests/dummy/app/components/.gitkeep rename to test-app/app/routes/.gitkeep diff --git a/tests/dummy/app/styles/app.css b/test-app/app/styles/app.css similarity index 100% rename from tests/dummy/app/styles/app.css rename to test-app/app/styles/app.css diff --git a/tests/dummy/app/templates/application.hbs b/test-app/app/templates/application.hbs similarity index 100% rename from tests/dummy/app/templates/application.hbs rename to test-app/app/templates/application.hbs diff --git a/tests/dummy/config/ember-cli-update.json b/test-app/config/ember-cli-update.json similarity index 100% rename from tests/dummy/config/ember-cli-update.json rename to test-app/config/ember-cli-update.json diff --git a/tests/dummy/config/ember-try.js b/test-app/config/ember-try.js similarity index 100% rename from tests/dummy/config/ember-try.js rename to test-app/config/ember-try.js diff --git a/tests/dummy/config/environment.js b/test-app/config/environment.js similarity index 97% rename from tests/dummy/config/environment.js rename to test-app/config/environment.js index 3b32e1f..113d30a 100644 --- a/tests/dummy/config/environment.js +++ b/test-app/config/environment.js @@ -2,7 +2,7 @@ module.exports = function (environment) { const ENV = { - modulePrefix: 'dummy', + modulePrefix: 'test-app', environment, rootURL: '/', locationType: 'history', diff --git a/tests/dummy/config/optional-features.json b/test-app/config/optional-features.json similarity index 100% rename from tests/dummy/config/optional-features.json rename to test-app/config/optional-features.json diff --git a/tests/dummy/config/targets.js b/test-app/config/targets.js similarity index 100% rename from tests/dummy/config/targets.js rename to test-app/config/targets.js diff --git a/test-app/ember-cli-build.js b/test-app/ember-cli-build.js new file mode 100644 index 0000000..7f90320 --- /dev/null +++ b/test-app/ember-cli-build.js @@ -0,0 +1,19 @@ +'use strict'; + +const EmberApp = require('ember-cli/lib/broccoli/ember-app'); + +module.exports = function (defaults) { + const app = new EmberApp(defaults, { + // Add options here + autoImport: { + watchDependencies: ['ember-render-helpers'], + }, + 'ember-cli-babel': { + enableTypeScriptTransform: true, + }, + }); + + const { maybeEmbroider } = require('@embroider/test-setup'); + + return maybeEmbroider(app); +}; diff --git a/test-app/package.json b/test-app/package.json new file mode 100644 index 0000000..1a91782 --- /dev/null +++ b/test-app/package.json @@ -0,0 +1,95 @@ +{ + "name": "test-app", + "version": "0.2.0", + "description": "Complimentary render template helpers to the render modifiers", + "keywords": [ + "ember-helper", + "ember-template-helper", + "template-helper", + "helper", + "render", + "@ember/render-modifiers", + "did-insert", + "did-update", + "will-destroy" + ], + "repository": "buschtoens/ember-render-helpers", + "license": "MIT", + "author": "Jan Buschtöns (https://jan.buschtoens.me)", + "directories": { + "doc": "doc", + "test": "tests" + }, + "scripts": { + "build": "ember build", + "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", + "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", + "lint:hbs": "ember-template-lint .", + "lint:hbs:fix": "ember-template-lint . --fix", + "lint:js": "eslint . --cache", + "lint:js:fix": "eslint . --fix", + "lint:types": "glint", + "prepack": "ember ts:precompile", + "postpack": "ember ts:clean", + "start": "ember serve", + "test": "ember test", + "test:ember-compatibility": "./node_modules/.bin/ember try:one" + }, + "dependencies": {}, + "devDependencies": { + "@ember/optional-features": "^2.1.0", + "@ember/test-helpers": "^3.3.0", + "@embroider/test-setup": "^3.0.3", + "@glint/core": "^1.4.0", + "@glint/environment-ember-loose": "^1.4.0", + "@glint/environment-ember-template-imports": "^1.4.0", + "@glint/template": "^1.4.0", + "@tsconfig/ember": "^3.0.6", + "@types/qunit": "^2.19.10", + "@typescript-eslint/eslint-plugin": "^7.5.0", + "@typescript-eslint/parser": "^7.5.0", + "broccoli-asset-rev": "^3.0.0", + "concurrently": "^8.2.2", + "ember-auto-import": "^2.7.2", + "ember-cli": "~5.7.0", + "ember-cli-babel": "^8.1.0", + "ember-cli-dependency-checker": "^3.3.2", + "ember-cli-htmlbars": "^6.3.0", + "ember-cli-inject-live-reload": "^2.1.0", + "ember-cli-sri": "^2.1.1", + "ember-cli-terser": "^4.0.2", + "ember-cli-typescript": "^5.3.0", + "ember-load-initializers": "^2.1.2", + "ember-qunit": "^8.0.2", + "ember-render-helpers": "0.2.0", + "ember-resolver": "^11.0.1", + "ember-source": "~5.7.0", + "ember-source-channel-url": "^3.0.0", + "ember-template-lint": "^6.0.0", + "ember-template-lint-plugin-prettier": "^5.0.0", + "ember-try": "^3.0.0", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-ember": "^11.12.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-n": "^17.0.0", + "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-qunit": "^8.1.1", + "eslint-plugin-simple-import-sort": "^12.0.0", + "eslint-plugin-typescript-sort-keys": "^3.2.0", + "loader.js": "^4.7.0", + "prettier": "^3.2.5", + "qunit": "^2.20.1", + "qunit-dom": "^3.0.0", + "typescript": "^5.4.4", + "webpack": "^5.91.0" + }, + "engines": { + "node": "18.* || >= 20" + }, + "ember": { + "edition": "octane" + }, + "private": true +} diff --git a/tests/dummy/public/robots.txt b/test-app/public/robots.txt similarity index 100% rename from tests/dummy/public/robots.txt rename to test-app/public/robots.txt diff --git a/testem.js b/test-app/testem.js similarity index 100% rename from testem.js rename to test-app/testem.js diff --git a/tests/dummy/app/routes/.gitkeep b/test-app/tests/helpers/.gitkeep similarity index 100% rename from tests/dummy/app/routes/.gitkeep rename to test-app/tests/helpers/.gitkeep diff --git a/tests/helpers/index.ts b/test-app/tests/helpers/index.ts similarity index 100% rename from tests/helpers/index.ts rename to test-app/tests/helpers/index.ts diff --git a/tests/index.html b/test-app/tests/index.html similarity index 89% rename from tests/index.html rename to test-app/tests/index.html index 3eb848d..fcc42a4 100644 --- a/tests/index.html +++ b/test-app/tests/index.html @@ -11,7 +11,7 @@ {{content-for "test-head"}} - + {{content-for "head-footer"}} @@ -31,7 +31,7 @@ - + {{content-for "body-footer"}} diff --git a/tests/helpers/.gitkeep b/test-app/tests/integration/.gitkeep similarity index 100% rename from tests/helpers/.gitkeep rename to test-app/tests/integration/.gitkeep diff --git a/tests/integration/helpers/did-insert-helper-test.ts b/test-app/tests/integration/helpers/did-insert-helper-test.ts similarity index 98% rename from tests/integration/helpers/did-insert-helper-test.ts rename to test-app/tests/integration/helpers/did-insert-helper-test.ts index 9910977..d55e86b 100644 --- a/tests/integration/helpers/did-insert-helper-test.ts +++ b/test-app/tests/integration/helpers/did-insert-helper-test.ts @@ -5,7 +5,7 @@ import { render, type TestContext as BaseTestContext, } from '@ember/test-helpers'; -import { setupRenderingTest } from 'dummy/tests/helpers'; +import { setupRenderingTest } from 'test-app/tests/helpers'; import { hbs } from 'ember-cli-htmlbars'; import type { CallbackFunction } from 'ember-render-helpers'; import { module, test } from 'qunit'; diff --git a/tests/integration/helpers/did-update-helper-test.ts b/test-app/tests/integration/helpers/did-update-helper-test.ts similarity index 98% rename from tests/integration/helpers/did-update-helper-test.ts rename to test-app/tests/integration/helpers/did-update-helper-test.ts index 042d0f5..9ad48b9 100644 --- a/tests/integration/helpers/did-update-helper-test.ts +++ b/test-app/tests/integration/helpers/did-update-helper-test.ts @@ -5,7 +5,7 @@ import { render, type TestContext as BaseTestContext, } from '@ember/test-helpers'; -import { setupRenderingTest } from 'dummy/tests/helpers'; +import { setupRenderingTest } from 'test-app/tests/helpers'; import { hbs } from 'ember-cli-htmlbars'; import type { CallbackFunction } from 'ember-render-helpers'; import { module, test } from 'qunit'; diff --git a/tests/integration/helpers/will-destroy-helper-test.ts b/test-app/tests/integration/helpers/will-destroy-helper-test.ts similarity index 98% rename from tests/integration/helpers/will-destroy-helper-test.ts rename to test-app/tests/integration/helpers/will-destroy-helper-test.ts index 419f6f7..ae98ca9 100644 --- a/tests/integration/helpers/will-destroy-helper-test.ts +++ b/test-app/tests/integration/helpers/will-destroy-helper-test.ts @@ -6,7 +6,7 @@ import { render, type TestContext as BaseTestContext, } from '@ember/test-helpers'; -import { setupRenderingTest } from 'dummy/tests/helpers'; +import { setupRenderingTest } from 'test-app/tests/helpers'; import { hbs } from 'ember-cli-htmlbars'; import type { CallbackFunction } from 'ember-render-helpers'; import { module, test } from 'qunit'; diff --git a/tests/test-helper.ts b/test-app/tests/test-helper.ts similarity index 75% rename from tests/test-helper.ts rename to test-app/tests/test-helper.ts index 5620531..dc68f81 100644 --- a/tests/test-helper.ts +++ b/test-app/tests/test-helper.ts @@ -1,6 +1,6 @@ import { setApplication } from '@ember/test-helpers'; -import Application from 'dummy/app'; -import config from 'dummy/config/environment'; +import Application from 'test-app/app'; +import config from 'test-app/config/environment'; import { start } from 'ember-qunit'; import * as QUnit from 'qunit'; import { setup } from 'qunit-dom'; diff --git a/tests/integration/.gitkeep b/test-app/tests/unit/.gitkeep similarity index 100% rename from tests/integration/.gitkeep rename to test-app/tests/unit/.gitkeep diff --git a/test-app/tsconfig.json b/test-app/tsconfig.json new file mode 100644 index 0000000..08c16af --- /dev/null +++ b/test-app/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "@tsconfig/ember/tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "test-app/tests/*": [ + "tests/*" + ], + "test-app/*": [ + "app/*" + ], + "*": [ + "types/*" + ] + }, + "skipLibCheck": true + }, + "glint": { + "environment": [ + "ember-loose", + "ember-template-imports" + ] + } +} diff --git a/test-app/types/global.d.ts b/test-app/types/global.d.ts new file mode 100644 index 0000000..45a2e8a --- /dev/null +++ b/test-app/types/global.d.ts @@ -0,0 +1,7 @@ +// Types for compiled templates +declare module 'test-app/templates/*' { + import { TemplateFactory } from 'ember-cli-htmlbars'; + + const tmpl: TemplateFactory; + export default tmpl; +} diff --git a/types/dummy/index.d.ts b/test-app/types/test-app/index.d.ts similarity index 100% rename from types/dummy/index.d.ts rename to test-app/types/test-app/index.d.ts diff --git a/tests/unit/.gitkeep b/tests/unit/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 9b76ab0..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "extends": "@tsconfig/ember/tsconfig.json", - "compilerOptions": { - // Don't check the types of dependencies - "skipLibCheck": true, - - // The combination of `baseUrl` with `paths` allows Ember's classic package - // layout, which is not resolveable with the Node resolution algorithm, to - // work with TypeScript. - "baseUrl": ".", - "paths": { - "dummy/tests/*": [ - "tests/*" - ], - "dummy/*": [ - "tests/dummy/app/*", - "app/*" - ], - "ember-render-helpers": [ - "addon" - ], - "ember-render-helpers/*": [ - "addon/*" - ], - "ember-render-helpers/test-support": [ - "addon-test-support" - ], - "ember-render-helpers/test-support/*": [ - "addon-test-support/*" - ], - "*": [ - "types/*" - ] - } - }, - "include": [ - "app/**/*", - "addon/**/*", - "tests/**/*", - "types/**/*", - "test-support/**/*", - "addon-test-support/**/*" - ], - "glint": { - "environment": [ - "ember-loose", - "ember-template-imports" - ] - } -} diff --git a/types/global.d.ts b/types/global.d.ts deleted file mode 100644 index cd09c29..0000000 --- a/types/global.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Types for compiled templates -declare module 'ember-render-helpers/templates/*' { - import type { TemplateFactory } from 'ember-cli-htmlbars'; - const tmpl: TemplateFactory; - export default tmpl; -} From e9ea560584972f676bcc34743b5ad31c3c606de5 Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Mon, 8 Apr 2024 15:36:16 +0200 Subject: [PATCH 2/4] chore: Manually updated files --- .gitignore | 6 +- LICENSE.md | 2 +- ember-render-helpers/.eslintignore | 3 + ember-render-helpers/.eslintrc.js | 17 +- ember-render-helpers/.gitignore | 16 +- ember-render-helpers/.template-lintrc.js | 8 - ember-render-helpers/LICENSE.md | 9 + ember-render-helpers/README.md | 156 ++++++++++++++++++ ember-render-helpers/package.json | 84 ++++++---- ember-render-helpers/rollup.config.mjs | 2 +- .../src/helpers/did-insert-helper.ts | 3 +- .../src/helpers/did-update-helper.ts | 3 +- .../src/helpers/will-destroy-helper.ts | 3 +- ember-render-helpers/src/index.ts | 8 +- ember-render-helpers/src/template-registry.ts | 6 +- ember-render-helpers/tsconfig.json | 3 +- .../unpublished-development-types/index.d.ts | 6 +- test-app/.template-lintrc.js | 8 +- test-app/package.json | 6 +- .../helpers/did-insert-helper-test.ts | 2 +- .../helpers/did-update-helper-test.ts | 2 +- .../helpers/will-destroy-helper-test.ts | 2 +- test-app/tests/test-helper.ts | 4 +- 23 files changed, 271 insertions(+), 88 deletions(-) create mode 100644 ember-render-helpers/LICENSE.md create mode 100644 ember-render-helpers/README.md diff --git a/.gitignore b/.gitignore index be29758..e291d36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,8 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. - # dependencies node_modules/ # misc +.DS_Store .env* +.eslintcache .pnpm-debug.log -npm-debug.log* -yarn-error.log diff --git a/LICENSE.md b/LICENSE.md index f8d1edb..ff84a5b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 +Copyright (c) 2024 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/ember-render-helpers/.eslintignore b/ember-render-helpers/.eslintignore index b0381f9..3336de0 100644 --- a/ember-render-helpers/.eslintignore +++ b/ember-render-helpers/.eslintignore @@ -7,3 +7,6 @@ # misc /coverage/ +!.* +.*/ + diff --git a/ember-render-helpers/.eslintrc.js b/ember-render-helpers/.eslintrc.js index af62575..1069ceb 100644 --- a/ember-render-helpers/.eslintrc.js +++ b/ember-render-helpers/.eslintrc.js @@ -53,33 +53,22 @@ module.exports = { ], }, }, - // Node files + // Node files (v2 addon) { files: [ './.eslintrc.js', './.prettierrc.js', './.stylelintrc.js', './.template-lintrc.js', - './ember-cli-build.js', - './index.js', - './testem.js', + './addon-main.cjs', './blueprints/*/index.js', - './config/**/*.js', - './tests/dummy/config/**/*.js', + './rollup.config.mjs', ], env: { browser: false, node: true, }, extends: ['plugin:n/recommended'], - rules: { - '@typescript-eslint/no-var-requires': 'off', - }, - }, - // Test files - { - files: ['tests/**/*-test.{gjs,gts,js,ts}'], - extends: ['plugin:qunit/recommended'], }, ], }; diff --git a/ember-render-helpers/.gitignore b/ember-render-helpers/.gitignore index 0f93238..708b76e 100644 --- a/ember-render-helpers/.gitignore +++ b/ember-render-helpers/.gitignore @@ -1,12 +1,12 @@ -# The authoritative copies of these live in the monorepo root (because they're -# more useful on github that way), but the build copies them into here so they -# will also appear in published NPM packages. -/LICENSE.md -/README.md - # compiled output -/declarations -/dist +/declarations/ +/dist/ + +# dependencies +/node_modules/ + +# misc +/.eslintcache # npm/pnpm/yarn pack output *.tgz diff --git a/ember-render-helpers/.template-lintrc.js b/ember-render-helpers/.template-lintrc.js index cf6448e..d05a35d 100644 --- a/ember-render-helpers/.template-lintrc.js +++ b/ember-render-helpers/.template-lintrc.js @@ -3,12 +3,4 @@ module.exports = { plugins: ['ember-template-lint-plugin-prettier'], extends: ['recommended', 'ember-template-lint-plugin-prettier:recommended'], - overrides: [ - { - files: ['addon/**/*.hbs', 'tests/**/*-test.{js,ts}'], - rules: { - prettier: 'off', - }, - }, - ], }; diff --git a/ember-render-helpers/LICENSE.md b/ember-render-helpers/LICENSE.md new file mode 100644 index 0000000..ff84a5b --- /dev/null +++ b/ember-render-helpers/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright (c) 2024 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/ember-render-helpers/README.md b/ember-render-helpers/README.md new file mode 100644 index 0000000..3164f2a --- /dev/null +++ b/ember-render-helpers/README.md @@ -0,0 +1,156 @@ +# ember-render-helpers + +![CI](https://github.com/buschtoens/ember-render-helpers/workflows/CI/badge.svg) +[![npm version](https://badge.fury.io/js/ember-render-helpers.svg)](http://badge.fury.io/js/ember-render-helpers) +[![Download Total](https://img.shields.io/npm/dt/ember-render-helpers.svg)](http://badge.fury.io/js/ember-render-helpers) +[![Ember Observer Score](https://emberobserver.com/badges/ember-render-helpers.svg)](https://emberobserver.com/addons/ember-render-helpers) +[![Ember Versions](https://img.shields.io/badge/Ember.js%20Versions-%5E3.8-brightgreen.svg)](https://travis-ci.org/buschtoens/ember-render-helpers) +[![ember-cli Versions](https://img.shields.io/badge/ember--cli%20Versions-%5E2.13%20%7C%7C%20%5E3.0-brightgreen.svg)](https://travis-ci.org/buschtoens/ember-render-helpers) +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) +[![dependencies](https://img.shields.io/david/buschtoens/ember-render-helpers.svg)](https://david-dm.org/buschtoens/ember-render-helpers) +[![devDependencies](https://img.shields.io/david/dev/buschtoens/ember-render-helpers.svg)](https://david-dm.org/buschtoens/ember-render-helpers) + +Use the `{{did-insert}}`, `{{did-update}}`, `{{will-destroy}}` modifiers from [`@ember/render-modifiers`][render-modifiers] as template helpers. + +The original idea came from [this Pre-RFC][pre-rfc]. + +[render-modifiers]: https://github.com/emberjs/ember-render-modifiers#readme +[pre-rfc]: https://github.com/emberjs/rfcs/issues/484 + +## Installation + +``` +ember install ember-render-helpers +``` + +
+ +Use Glint or <template> tag? ✨ + +- Update your template registry to extend this addon's. Check the [Glint documentation](https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons#using-glint-enabled-addons) for more information. + + ```ts + import '@glint/environment-ember-loose'; + + import type EmberRenderHelpersRegistry from 'ember-render-helpers/template-registry'; + + declare module '@glint/environment-ember-loose/registry' { + export default interface Registry extends EmberRenderHelpersRegistry, /* other addon registries */ { + // local entries + } + } + ``` + +- In a `