├── .editorconfig ├── .ember-cli ├── .eslintignore ├── .eslintrc.js ├── .github ├── dependabot.yml └── workflows │ ├── auto-merge.yml │ ├── ci.yml │ ├── codeql-analysis.yml │ ├── create_release.yaml │ ├── release.yaml │ ├── tag_version.yaml │ └── update-transitive-dependenies.yaml ├── .gitignore ├── .npmignore ├── .nvmrc ├── .prettierignore ├── .prettierrc.js ├── .stylelintignore ├── .stylelintrc.js ├── .template-lintrc.js ├── .watchmanconfig ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── addon └── .gitkeep ├── app └── .gitkeep ├── ember-cli-build.js ├── index.js ├── lib └── generate-icons.js ├── package.json ├── pnpm-lock.yaml ├── testem.js ├── tests ├── acceptance │ └── load-shapes-test.js ├── dummy │ ├── app │ │ ├── app.js │ │ ├── components │ │ │ └── .gitkeep │ │ ├── controllers │ │ │ └── .gitkeep │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── index.html │ │ ├── models │ │ │ └── .gitkeep │ │ ├── router.js │ │ ├── routes │ │ │ └── .gitkeep │ │ ├── styles │ │ │ └── app.css │ │ └── templates │ │ │ └── application.hbs │ ├── config │ │ ├── ember-cli-update.json │ │ ├── ember-try.js │ │ ├── environment.js │ │ ├── optional-features.json │ │ └── targets.js │ └── public │ │ ├── circle.svg │ │ ├── crossdomain.xml │ │ ├── robots.txt │ │ └── square.svg ├── helpers │ └── index.js ├── index.html ├── integration │ └── .gitkeep ├── test-helper.js └── unit │ └── .gitkeep └── tsconfig.declarations.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | end_of_line = lf 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | indent_style = space 13 | indent_size = 2 14 | 15 | [*.hbs] 16 | insert_final_newline = false 17 | 18 | [*.{diff,md}] 19 | trim_trailing_whitespace = false 20 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript 4 | rather than JavaScript by default, when a TypeScript version of a given blueprint is available. 5 | */ 6 | "isTypeScriptProject": false 7 | } 8 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # unconventional js 2 | /blueprints/*/files/ 3 | 4 | # compiled output 5 | /dist/ 6 | 7 | # misc 8 | /coverage/ 9 | !.* 10 | .*/ 11 | 12 | # ember-try 13 | /.node_modules.ember-try/ 14 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | root: true, 5 | parser: '@babel/eslint-parser', 6 | parserOptions: { 7 | ecmaVersion: 'latest', 8 | sourceType: 'module', 9 | requireConfigFile: false, 10 | babelOptions: { 11 | plugins: [ 12 | ['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }], 13 | ], 14 | }, 15 | }, 16 | plugins: ['ember'], 17 | extends: [ 18 | 'eslint:recommended', 19 | 'plugin:ember/recommended', 20 | 'plugin:prettier/recommended', 21 | ], 22 | env: { 23 | browser: true, 24 | }, 25 | rules: {}, 26 | overrides: [ 27 | // node files 28 | { 29 | files: [ 30 | './.eslintrc.js', 31 | './.prettierrc.js', 32 | './.stylelintrc.js', 33 | './.template-lintrc.js', 34 | './ember-cli-build.js', 35 | './index.js', 36 | './testem.js', 37 | './blueprints/*/index.js', 38 | './config/**/*.js', 39 | './tests/dummy/config/**/*.js', 40 | ], 41 | parserOptions: { 42 | sourceType: 'script', 43 | }, 44 | env: { 45 | browser: false, 46 | node: true, 47 | }, 48 | extends: ['plugin:n/recommended'], 49 | }, 50 | { 51 | // test files 52 | files: ['tests/**/*-test.{js,ts}'], 53 | extends: ['plugin:qunit/recommended'], 54 | }, 55 | ], 56 | }; 57 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | open-pull-requests-limit: 10 8 | versioning-strategy: increase-if-necessary 9 | ignore: 10 | - dependency-name: "@babel/eslint-parser" 11 | - dependency-name: "@babel/plugin-proposal-decorators" 12 | - dependency-name: "@ember/optional-features" 13 | - dependency-name: "@ember/string" 14 | - dependency-name: "@ember/test-helpers" 15 | - dependency-name: "@embroider/test-setup" 16 | - dependency-name: "@glimmer/component" 17 | - dependency-name: "@glimmer/tracking" 18 | - dependency-name: broccoli-asset-rev 19 | - dependency-name: concurrently 20 | - dependency-name: ember-auto-import 21 | - dependency-name: ember-cli 22 | - dependency-name: ember-cli-babel 23 | - dependency-name: ember-cli-dependency-checker 24 | - dependency-name: ember-cli-htmlbars 25 | - dependency-name: ember-cli-inject-live-reload 26 | - dependency-name: ember-cli-sri 27 | - dependency-name: ember-cli-terser 28 | - dependency-name: ember-load-initializers 29 | - dependency-name: ember-page-title 30 | - dependency-name: ember-qunit 31 | - dependency-name: ember-resolver 32 | - dependency-name: ember-source 33 | - dependency-name: ember-source-channel-url 34 | - dependency-name: ember-template-lint 35 | - dependency-name: ember-try 36 | - dependency-name: eslint 37 | - dependency-name: eslint-config-prettier 38 | - dependency-name: eslint-plugin-ember 39 | - dependency-name: eslint-plugin-n 40 | - dependency-name: eslint-plugin-prettier 41 | - dependency-name: eslint-plugin-qunit 42 | - dependency-name: loader.js 43 | - dependency-name: prettier 44 | - dependency-name: qunit 45 | - dependency-name: qunit-dom 46 | - dependency-name: stylelint 47 | - dependency-name: stylelint-config-standard 48 | - dependency-name: stylelint-prettier 49 | - dependency-name: webpack 50 | - package-ecosystem: github-actions 51 | directory: "/" 52 | schedule: 53 | interval: weekly 54 | -------------------------------------------------------------------------------- /.github/workflows/auto-merge.yml: -------------------------------------------------------------------------------- 1 | name: Dependabot auto-merge 2 | on: pull_request_target 3 | permissions: 4 | pull-requests: write 5 | contents: write 6 | jobs: 7 | dependabot: 8 | runs-on: ubuntu-latest 9 | if: ${{ github.actor == 'dependabot[bot]' }} 10 | steps: 11 | - uses: actions/checkout@v4 12 | - name: Enable auto-merge for Dependabot PRs 13 | run: gh pr merge --merge --auto ${{ github.event.number }} 14 | env: 15 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | pull_request: {} 9 | 10 | concurrency: 11 | group: ci-${{ github.head_ref || github.ref }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | test: 16 | name: "Tests" 17 | runs-on: ubuntu-latest 18 | timeout-minutes: 10 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | - uses: pnpm/action-setup@v4 23 | - uses: actions/setup-node@v4 24 | with: 25 | node-version: 18 26 | cache: pnpm 27 | - run: pnpm install 28 | - name: Lint 29 | run: pnpm run lint 30 | - name: Run Tests 31 | run: pnpm run test:ember 32 | - name: percy 33 | run: pnpm run test:percy 34 | env: 35 | PERCY_TOKEN: ${{secrets.PERCY_TOKEN}} 36 | 37 | floating: 38 | name: "Floating Dependencies" 39 | runs-on: ubuntu-latest 40 | timeout-minutes: 10 41 | 42 | steps: 43 | - uses: actions/checkout@v4 44 | - uses: pnpm/action-setup@v4 45 | - uses: actions/setup-node@v4 46 | with: 47 | node-version: 18 48 | cache: pnpm 49 | - run: pnpm install --no-lockfile 50 | - name: Run Tests 51 | run: pnpm run test:ember 52 | 53 | try-scenarios: 54 | name: ${{ matrix.try-scenario }} 55 | runs-on: ubuntu-latest 56 | needs: "test" 57 | timeout-minutes: 10 58 | 59 | strategy: 60 | fail-fast: false 61 | matrix: 62 | try-scenario: 63 | - ember-lts-4.8 64 | - ember-lts-4.12 65 | - ember-release 66 | - ember-beta 67 | - ember-canary 68 | - embroider-safe 69 | - embroider-optimized 70 | 71 | steps: 72 | - uses: actions/checkout@v4 73 | - uses: pnpm/action-setup@v4 74 | - uses: actions/setup-node@v4 75 | with: 76 | node-version: 18 77 | cache: pnpm 78 | - run: pnpm install 79 | - name: Run Tests 80 | run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }} 81 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '43 6 * * 5' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v4 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v3 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v3 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v3 72 | -------------------------------------------------------------------------------- /.github/workflows/create_release.yaml: -------------------------------------------------------------------------------- 1 | name: Release Notes 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | notes: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | with: 14 | fetch-depth: 0 15 | - name: Get Previous Tag 16 | run: | 17 | PREVIOUS_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)) 18 | echo ${PREVIOUS_TAG} 19 | echo "previous_tag=${PREVIOUS_TAG}" >> $GITHUB_ENV 20 | - name: Get New Tag 21 | run: | 22 | NEW_TAG=${GITHUB_REF#refs/tags/} 23 | echo ${NEW_TAG} 24 | echo "new_tag=${NEW_TAG}" >> $GITHUB_ENV 25 | - uses: actions/setup-node@v4 26 | - name: Generate Release Notes 27 | id: notes 28 | run: | 29 | NOTES=$(npx generate-github-release-notes jrjohnson ember-cli-image-transformer ${{ env.previous_tag }} ${{env.new_tag}}) 30 | echo ${NOTES} 31 | # remove line breaks from notes so they can be passed around 32 | NOTES="${NOTES//$'\n'/'%0A'}" 33 | echo "release_notes=${NOTES}" >> $GITHUB_ENV 34 | - uses: ncipollo/release-action@v1 35 | with: 36 | body: ${{env.release_notes}} 37 | token: ${{ secrets.MY_TOKEN }} 38 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Publish NPM Package 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | publish-npm: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4 12 | - uses: pnpm/action-setup@v4 13 | - uses: actions/setup-node@v4 14 | with: 15 | node-version: 18 16 | cache: pnpm 17 | registry-url: https://registry.npmjs.org/ 18 | - run: pnpm install --ignore-scripts 19 | - name: publish 20 | run: pnpm publish 21 | env: 22 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 23 | -------------------------------------------------------------------------------- /.github/workflows/tag_version.yaml: -------------------------------------------------------------------------------- 1 | name: Tag Version 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | releaseType: 7 | description: 'Semver Release Type (major,minor,patch)' 8 | required: true 9 | 10 | jobs: 11 | tag: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | with: 16 | token: ${{ secrets.MY_TOKEN }} 17 | - name: Validate releaseType 18 | run: npx in-string-list ${{ github.event.inputs.releaseType }} major,minor,patch 19 | - name: Setup Git 20 | run: | 21 | git config --global user.name "Jonathan Johnson" 22 | git config --global user.email "jon.johnson@ucsf.edu" 23 | - uses: pnpm/action-setup@v4 24 | - name: Increment Version 25 | run: pnpm version ${{ github.event.inputs.releaseType }} 26 | - name: Push Changes 27 | run: git push --follow-tags 28 | -------------------------------------------------------------------------------- /.github/workflows/update-transitive-dependenies.yaml: -------------------------------------------------------------------------------- 1 | name: Update Transitive Dependencies 2 | 3 | on: 4 | schedule: 5 | - cron: '15 11 * * 0' # weekly, on Sunday morning (UTC) 6 | workflow_dispatch: 7 | 8 | jobs: 9 | update: 10 | name: Update and Create PR 11 | runs-on: macos-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: pnpm/action-setup@v4 16 | - uses: actions/setup-node@v4 17 | with: 18 | node-version: 18 19 | cache: pnpm 20 | - name: remove and re-create lock file 21 | run: | 22 | rm pnpm-lock.yaml 23 | pnpm install 24 | - name: Create Pull Request 25 | id: cpr 26 | uses: peter-evans/create-pull-request@v7 27 | with: 28 | token: ${{ secrets.MY_TOKEN }} 29 | commit-message: Update Transitive Dependencies 30 | title: Update Transitive Dependencies 31 | body: | 32 | - Dependency updates 33 | 34 | Auto-generated by [create-pull-request][1] 35 | 36 | [1]: https://github.com/peter-evans/create-pull-request 37 | branch: auto-update-dependencies 38 | labels: dependencies 39 | - name: Enable Pull Request Automerge 40 | if: steps.cpr.outputs.pull-request-operation == 'created' 41 | uses: peter-evans/enable-pull-request-automerge@v3 42 | with: 43 | token: ${{ secrets.GITHUB_TOKEN }} 44 | pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} 45 | merge-method: merge 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist/ 3 | /declarations/ 4 | 5 | # dependencies 6 | /node_modules/ 7 | 8 | # misc 9 | /.env* 10 | /.pnp* 11 | /.eslintcache 12 | /coverage/ 13 | /npm-debug.log* 14 | /testem.log 15 | /yarn-error.log 16 | 17 | # ember-try 18 | /.node_modules.ember-try/ 19 | /npm-shrinkwrap.json.ember-try 20 | /package.json.ember-try 21 | /package-lock.json.ember-try 22 | /yarn.lock.ember-try 23 | 24 | # broccoli-debug 25 | /DEBUG/ 26 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist/ 3 | /tmp/ 4 | 5 | # misc 6 | /.editorconfig 7 | /.ember-cli 8 | /.env* 9 | /.eslintcache 10 | /.eslintignore 11 | /.eslintrc.js 12 | /.git/ 13 | /.github/ 14 | /.gitignore 15 | /.prettierignore 16 | /.prettierrc.js 17 | /.stylelintignore 18 | /.stylelintrc.js 19 | /.template-lintrc.js 20 | /.travis.yml 21 | /.watchmanconfig 22 | /CONTRIBUTING.md 23 | /ember-cli-build.js 24 | /testem.js 25 | /tests/ 26 | /yarn-error.log 27 | /yarn.lock 28 | .gitkeep 29 | 30 | # ember-try 31 | /.node_modules.ember-try/ 32 | /npm-shrinkwrap.json.ember-try 33 | /package.json.ember-try 34 | /package-lock.json.ember-try 35 | /yarn.lock.ember-try 36 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 18 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # unconventional js 2 | /blueprints/*/files/ 3 | 4 | # compiled output 5 | /dist/ 6 | 7 | # misc 8 | /coverage/ 9 | !.* 10 | .*/ 11 | 12 | # ember-try 13 | /.node_modules.ember-try/ 14 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | overrides: [ 5 | { 6 | files: '*.{js,ts}', 7 | options: { 8 | singleQuote: true, 9 | }, 10 | }, 11 | ], 12 | }; 13 | -------------------------------------------------------------------------------- /.stylelintignore: -------------------------------------------------------------------------------- 1 | # unconventional files 2 | /blueprints/*/files/ 3 | 4 | # compiled output 5 | /dist/ 6 | 7 | # addons 8 | /.node_modules.ember-try/ 9 | -------------------------------------------------------------------------------- /.stylelintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'], 5 | }; 6 | -------------------------------------------------------------------------------- /.template-lintrc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | extends: 'recommended', 5 | }; 6 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["dist"] 3 | } 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How To Contribute 2 | 3 | ## Installation 4 | 5 | * `git clone ` 6 | * `cd my-addon` 7 | * `npm install` 8 | 9 | ## Linting 10 | 11 | * `npm run lint` 12 | * `npm run lint:fix` 13 | 14 | ## Running tests 15 | 16 | * `ember test` – Runs the test suite on the current Ember version 17 | * `ember test --server` – Runs the test suite in "watch mode" 18 | * `ember try:each` – Runs the test suite against multiple Ember versions 19 | 20 | ## Running the dummy application 21 | 22 | * `ember serve` 23 | * Visit the dummy application at [http://localhost:4200](http://localhost:4200). 24 | 25 | For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/). 26 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ember-cli-image-transformer 2 | 3 | [![Build Status](https://travis-ci.org/jrjohnson/ember-cli-image-transformer.svg?branch=master)](https://travis-ci.org/jrjohnson/ember-cli-image-transformer) 4 | [![Ember Observer Score](https://emberobserver.com/badges/ember-cli-image-transformer.svg)](https://emberobserver.com/addons/ember-cli-image-transformer) 5 | 6 | ## Transform Images for your Ember Application from One Source Image 7 | 8 | I hate having to create a bunch of identical images for use as icons and favicon images for my application, so I created this addon to take a single source image and transform it into many images of differing sizes, types, and backgrounds. 9 | 10 | It is built using EmberJS and takes advantage of the awesome [Sharp](https://github.com/lovell/sharp) library to do the heavy lifting. 11 | 12 | 13 | ## Compatibility 14 | 15 | * Ember.js v4.8 or above 16 | * Ember CLI v4.8 or above 17 | * Node.js v18 or above 18 | 19 | 20 | ## Installation 21 | 22 | ```bash 23 | ember install ember-cli-image-transformer 24 | ``` 25 | 26 | 27 | ## Usage 28 | 29 | Create an `ember-cli-image-transformer` section in your `ember-cli-build.js` file with 30 | an `images` array. Each element in the array represents a different set of images to 31 | be generated. 32 | 33 | ```js 34 | module.exports = function(defaults) { 35 | var app = new EmberApp(defaults, { 36 | 'ember-cli-image-transformer': { 37 | images: [ 38 | { 39 | inputFilename: 'public/square.svg', 40 | outputFileName: 'icon-square', 41 | convertTo: 'png', 42 | sizes: [16, 32, 45, 900], 43 | }, 44 | { 45 | inputFilename: 'public/circle.svg', 46 | outputFileName: 'transparent-circle', 47 | convertTo: 'png', 48 | background: {r: 255, g: 255, b: 255, alpha: 0}, 49 | sizes: [100], 50 | } 51 | ] 52 | } 53 | }); 54 | ``` 55 | 56 | All generated images will be placed into the `public/assets` path of your application. 57 | 58 | 59 | ### Usage in a template 60 | 61 | ```handlebars 62 | 63 | 64 | ``` 65 | 66 | ### Image Options 67 | 68 | | Key | Required | Default Value | Example | Description | 69 | |-----|----------|---------------|---------|-------------| 70 | |`inputFileName`| :heavy_check_mark: | none | `public/circle.svg` | Where (relative to the application root) to find the input image | 71 | |`outputFileName`| :heavy_check_mark: | none | `transparent-circle` | This is combined with the `convertTo` and `size` to create the output file eg `transparent-circle92.png` | 72 | |`convertTo`| :heavy_check_mark: | none | `png` | The output file type | 73 | |`sizes`| :heavy_check_mark: | none | `[92, 150]` | An array of image sizes to produce | 74 | |`destination`| | `assets/icons` | `images/wherever/you/want` | The destination directory for the output images relative to `/public` | 75 | |`background`| | none | `{r: 255, g: 255, b: 255, alpha: 0}` | Add a background color to the image. | 76 | 77 | ## Contributing 78 | 79 | See the [Contributing](CONTRIBUTING.md) guide for details. 80 | 81 | 82 | ## License 83 | 84 | This project is licensed under the [MIT License](LICENSE.md). 85 | -------------------------------------------------------------------------------- /addon/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/addon/.gitkeep -------------------------------------------------------------------------------- /app/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/app/.gitkeep -------------------------------------------------------------------------------- /ember-cli-build.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 4 | 5 | module.exports = function (defaults) { 6 | const app = new EmberAddon(defaults, { 7 | 'ember-cli-image-transformer': { 8 | images: [ 9 | { 10 | inputFilename: 'tests/dummy/public/square.svg', 11 | outputFileName: 'icon-square', 12 | convertTo: 'png', 13 | sizes: [16, 32, 45, 900], 14 | }, 15 | { 16 | inputFilename: 'tests/dummy/public/circle.svg', 17 | outputFileName: 'transparent-circle', 18 | convertTo: 'png', 19 | background: { r: 255, g: 255, b: 255, alpha: 0 }, 20 | sizes: [100], 21 | }, 22 | { 23 | inputFilename: 'tests/dummy/public/circle.svg', 24 | outputFileName: 'circle-with-green-background', 25 | convertTo: 'jpg', 26 | background: { r: 0, g: 255, b: 0, alpha: 0 }, 27 | sizes: [100], 28 | }, 29 | { 30 | inputFilename: 'tests/dummy/public/square.svg', 31 | outputFileName: 'bigsquare', 32 | convertTo: 'png', 33 | destination: 'big/images', 34 | sizes: [200], 35 | }, 36 | ], 37 | }, 38 | }); 39 | 40 | /* 41 | This build file specifies the options for the dummy test app of this 42 | addon, located in `/tests/dummy` 43 | This build file does *not* influence how the addon or the app using it 44 | behave. You most likely want to be modifying `./index.js` or app's build file 45 | */ 46 | 47 | const { maybeEmbroider } = require('@embroider/test-setup'); 48 | return maybeEmbroider(app, { 49 | skipBabel: [ 50 | { 51 | package: 'qunit', 52 | }, 53 | ], 54 | }); 55 | }; 56 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | const GenerateIcons = require('./lib/generate-icons'); 5 | const Funnel = require('broccoli-funnel'); 6 | const MergeTrees = require('broccoli-merge-trees'); 7 | const assert = require('assert'); 8 | 9 | module.exports = { 10 | name: require('./package').name, 11 | imageTransformerConfig: null, 12 | app: null, 13 | included(app) { 14 | this._super.included.apply(this, arguments); 15 | 16 | if (typeof app.import !== 'function' && app.app) { 17 | app = app.app; 18 | } 19 | this.app = app; 20 | 21 | var addonOptions = 22 | (this.parent && this.parent.options) || 23 | (this.app && this.app.options) || 24 | {}; 25 | this.imageTransformerConfig = addonOptions[this.name] || { 26 | images: [], 27 | }; 28 | }, 29 | treeForPublic(publicTree) { 30 | let trees = this.imageTransformerConfig.images.map((obj) => { 31 | this.checkProperty('inputFilename', obj); 32 | this.checkProperty('outputFileName', obj); 33 | this.checkProperty('convertTo', obj); 34 | this.checkProperty('sizes', obj); 35 | const inputPath = path.join(this.app.project.root, obj.inputFilename); 36 | 37 | const pathData = path.parse(inputPath); 38 | const imageNode = new Funnel(pathData.dir, { 39 | include: [pathData.base], 40 | }); 41 | let options = { 42 | sizes: obj.sizes, 43 | inputFilename: pathData.base, 44 | outputFileName: obj.outputFileName, 45 | project: this.app.project, 46 | convertTo: obj.convertTo, 47 | }; 48 | if ('background' in obj) { 49 | options.background = obj.background; 50 | } 51 | const icons = new GenerateIcons(imageNode, options); 52 | 53 | const destDir = 'destination' in obj ? obj.destination : 'assets/icons'; 54 | return new Funnel(icons, { destDir }); 55 | }); 56 | 57 | if (publicTree) { 58 | trees.push(publicTree); 59 | } 60 | 61 | return new MergeTrees(trees); 62 | }, 63 | checkProperty(property, obj) { 64 | assert.ok( 65 | property in obj, 66 | `\n${this.name} error: ${property} missing from image definition\n`, 67 | ); 68 | }, 69 | }; 70 | -------------------------------------------------------------------------------- /lib/generate-icons.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 'use strict'; 3 | 4 | const CachingWriter = require('broccoli-caching-writer'); 5 | const path = require('path'); 6 | const sharp = require('sharp'); 7 | 8 | class GenerateIcons extends CachingWriter { 9 | constructor(inputNode, options) { 10 | super([inputNode], { 11 | annotation: 'ember-cli-image-transformer-build', 12 | }); 13 | 14 | sharp.cache(false); 15 | this.options = options; 16 | } 17 | 18 | build() { 19 | const options = this.options; 20 | const promises = []; 21 | options.sizes.forEach((size) => { 22 | promises.push(this.writeIcon(size)); 23 | }); 24 | 25 | return Promise.all(promises); 26 | } 27 | writeIcon(size) { 28 | const fileName = `${this.options.outputFileName}${size}.${this.options.convertTo}`; 29 | const outputPath = path.join(this.outputPath, fileName); 30 | const originalSvg = path.join( 31 | this.inputPaths[0], 32 | this.options.inputFilename, 33 | ); 34 | const image = this.getSharp(originalSvg); 35 | image.resize(size); 36 | if (this.options.background) { 37 | image.flatten({ background: this.options.background }); 38 | } 39 | 40 | return image.toFormat(this.options.convertTo).toFile(outputPath); 41 | } 42 | /** 43 | * There is an issue in the way sharp processes SVGs on OSX 44 | * This is a workaround based on https://github.com/lovell/sharp/issues/1593#issuecomment-491171982 45 | */ 46 | getSharp(path) { 47 | sharp( 48 | Buffer.from( 49 | ``, 50 | 'utf-8', 51 | ), 52 | ) 53 | .metadata() 54 | .catch(() => { 55 | //do nothing 56 | }); 57 | 58 | return sharp(path); 59 | } 60 | } 61 | 62 | module.exports = GenerateIcons; 63 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-cli-image-transformer", 3 | "version": "7.0.0", 4 | "description": "Transform Images for your Ember Application", 5 | "keywords": [ 6 | "ember-addon", 7 | "image", 8 | "icon", 9 | "sharp" 10 | ], 11 | "repository": "https://github.com/jrjohnson/ember-cli-image-transformer", 12 | "license": "MIT", 13 | "author": "Jonathan Johnson (jon.johnson@ucsf.edu)", 14 | "directories": { 15 | "doc": "doc", 16 | "test": "tests" 17 | }, 18 | "scripts": { 19 | "build": "ember build --environment=production", 20 | "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", 21 | "lint:css": "stylelint \"**/*.css\"", 22 | "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"", 23 | "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", 24 | "lint:hbs": "ember-template-lint .", 25 | "lint:hbs:fix": "ember-template-lint . --fix", 26 | "lint:js": "eslint . --cache", 27 | "lint:js:fix": "eslint . --fix", 28 | "start": "ember serve", 29 | "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"", 30 | "test:ember": "ember test", 31 | "test:ember-compatibility": "ember try:each", 32 | "test:percy": "percy exec -- ember test", 33 | "preinstall": "npx only-allow pnpm" 34 | }, 35 | "dependencies": { 36 | "@babel/core": "^7.23.2", 37 | "broccoli-caching-writer": "^3.0.3", 38 | "broccoli-funnel": "^3.0.2", 39 | "broccoli-merge-trees": "^4.1.0", 40 | "ember-cli-babel": "^8.2.0", 41 | "ember-cli-htmlbars": "^6.3.0", 42 | "rsvp": "^4.7.0", 43 | "sharp": "^0.33.0" 44 | }, 45 | "devDependencies": { 46 | "@babel/eslint-parser": "^7.22.15", 47 | "@babel/plugin-proposal-decorators": "^7.23.2", 48 | "@ember/optional-features": "^2.0.0", 49 | "@ember/test-helpers": "^3.2.0", 50 | "@embroider/test-setup": "^3.0.2", 51 | "@glimmer/component": "^1.1.2", 52 | "@glimmer/tracking": "^1.1.2", 53 | "@percy/cli": "^1.0.0-beta.70", 54 | "@percy/ember": "^4.2.0", 55 | "broccoli-asset-rev": "^3.0.0", 56 | "concurrently": "^8.2.2", 57 | "ember-auto-import": "^2.6.3", 58 | "ember-cli": "~5.4.1", 59 | "ember-cli-clean-css": "^3.0.0", 60 | "ember-cli-dependency-checker": "^3.3.2", 61 | "ember-cli-inject-live-reload": "^2.1.0", 62 | "ember-cli-sri": "^2.1.1", 63 | "ember-cli-terser": "^4.0.2", 64 | "ember-load-initializers": "^2.1.2", 65 | "ember-page-title": "^8.0.0", 66 | "ember-qunit": "^8.0.1", 67 | "ember-resolver": "^11.0.1", 68 | "ember-source": "~5.4.0", 69 | "ember-source-channel-url": "^3.0.0", 70 | "ember-template-lint": "^5.11.2", 71 | "ember-try": "^3.0.0", 72 | "eslint": "^8.52.0", 73 | "eslint-config-prettier": "^9.0.0", 74 | "eslint-plugin-ember": "^11.11.1", 75 | "eslint-plugin-n": "^16.2.0", 76 | "eslint-plugin-prettier": "^5.0.1", 77 | "eslint-plugin-qunit": "^8.0.1", 78 | "loader.js": "^4.7.0", 79 | "prettier": "^3.0.3", 80 | "qunit": "^2.20.0", 81 | "qunit-dom": "^2.0.0", 82 | "stylelint": "^15.11.0", 83 | "stylelint-config-standard": "^34.0.0", 84 | "stylelint-prettier": "^4.0.2", 85 | "webpack": "^5.89.0" 86 | }, 87 | "peerDependencies": { 88 | "ember-source": ">= 4.0.0" 89 | }, 90 | "engines": { 91 | "node": ">= 18", 92 | "yarn": "use pnpm", 93 | "npm": "use pnpm" 94 | }, 95 | "ember": { 96 | "edition": "octane" 97 | }, 98 | "ember-addon": { 99 | "configPath": "tests/dummy/config" 100 | }, 101 | "packageManager": "pnpm@8.6.12", 102 | "files": [ 103 | "index.js", 104 | "ember-cli-build.js", 105 | "addon/", 106 | "app/", 107 | "blueprints/", 108 | "config/", 109 | "lib/", 110 | "vendor/" 111 | ] 112 | } 113 | -------------------------------------------------------------------------------- /testem.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | test_page: 'tests/index.html?hidepassed', 5 | disable_watching: true, 6 | launch_in_ci: ['Chrome'], 7 | launch_in_dev: ['Chrome'], 8 | browser_start_timeout: 120, 9 | browser_args: { 10 | Chrome: { 11 | ci: [ 12 | // --no-sandbox is needed when running Chrome inside a container 13 | process.env.CI ? '--no-sandbox' : null, 14 | '--headless', 15 | '--disable-dev-shm-usage', 16 | '--disable-software-rasterizer', 17 | '--mute-audio', 18 | '--remote-debugging-port=0', 19 | '--window-size=1440,900', 20 | ].filter(Boolean), 21 | }, 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /tests/acceptance/load-shapes-test.js: -------------------------------------------------------------------------------- 1 | import { currentURL, visit, findAll } from '@ember/test-helpers'; 2 | import { module, test } from 'qunit'; 3 | import { setupApplicationTest } from 'ember-qunit'; 4 | import percySnapshot from '@percy/ember'; 5 | 6 | module('Acceptance | Load Shapes', function (hooks) { 7 | setupApplicationTest(hooks); 8 | 9 | function testLoad(assert, selector) { 10 | const done = assert.async(1); 11 | assert.equal(currentURL(), '/'); 12 | const images = findAll(selector); 13 | assert.equal(images.length, 1); 14 | const img = images[0]; 15 | 16 | const reloadedImage = new Image(); 17 | reloadedImage.addEventListener('error', () => { 18 | const filename = img.src.replace(/^.*[\\/]/, ''); 19 | assert.ok(false, `${filename} image didn't load`); 20 | reloadedImage.remove(); 21 | done(); 22 | }); 23 | reloadedImage.addEventListener('load', () => { 24 | assert.ok(true); 25 | done(); 26 | }); 27 | reloadedImage.src = img.src; 28 | } 29 | 30 | test('percy visual test', async function (assert) { 31 | await visit('/'); 32 | assert.dom('img').exists({ count: 9 }); 33 | await percySnapshot('Shapes Loaded'); 34 | }); 35 | 36 | test('circle with green background', async function (assert) { 37 | assert.timeout(1000); 38 | await visit('/'); 39 | 40 | testLoad(assert, '.circle-with-green-background img'); 41 | }); 42 | 43 | test('sized squares', async function (assert) { 44 | assert.timeout(1000); 45 | await visit('/'); 46 | 47 | testLoad(assert, '.squares img:nth-of-type(1)'); 48 | testLoad(assert, '.squares img:nth-of-type(2)'); 49 | testLoad(assert, '.squares img:nth-of-type(3)'); 50 | testLoad(assert, '.squares img:nth-of-type(4)'); 51 | }); 52 | 53 | test('transparent circle', async function (assert) { 54 | assert.timeout(1000); 55 | await visit('/'); 56 | 57 | testLoad(assert, '.transparent-circle img'); 58 | }); 59 | 60 | test('different destination square', async function (assert) { 61 | assert.timeout(1000); 62 | await visit('/'); 63 | 64 | testLoad(assert, '.square-in-a-different-destination img'); 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Application from '@ember/application'; 2 | import Resolver from 'ember-resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from 'dummy/config/environment'; 5 | 6 | export default class App extends Application { 7 | modulePrefix = config.modulePrefix; 8 | podModulePrefix = config.podModulePrefix; 9 | Resolver = Resolver; 10 | } 11 | 12 | loadInitializers(App, config.modulePrefix); 13 | -------------------------------------------------------------------------------- /tests/dummy/app/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/tests/dummy/app/components/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/tests/dummy/app/controllers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/helpers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/tests/dummy/app/helpers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dummy 6 | 7 | 8 | 9 | {{content-for "head"}} 10 | 11 | 12 | 13 | 14 | {{content-for "head-footer"}} 15 | 16 | 17 | {{content-for "body"}} 18 | 19 | 20 | 21 | 22 | {{content-for "body-footer"}} 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/tests/dummy/app/models/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/router.js: -------------------------------------------------------------------------------- 1 | import EmberRouter from '@ember/routing/router'; 2 | import config from 'dummy/config/environment'; 3 | 4 | export default class Router extends EmberRouter { 5 | location = config.locationType; 6 | rootURL = config.rootURL; 7 | } 8 | 9 | Router.map(function () {}); 10 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/tests/dummy/app/routes/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.css: -------------------------------------------------------------------------------- 1 | /* Ember supports plain CSS out of the box. More info: https://cli.emberjs.com/release/advanced-use/stylesheets/ */ 2 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 | {{page-title "Generated Images Samples"}} 2 | 3 |

Generated Images

4 | 5 |

Original Shapes

6 | square 7 | circle 8 | 9 | 10 |

Transparent Circle

11 |
12 | transparent-circle 13 |
14 | 15 |

Circle With Green Background

16 |
17 | circle-with-green-background 21 |
22 | 23 | 24 |

Sized Squares

25 |
26 | square-16 27 | square-32 28 | square-45 29 | square-900 30 |
31 | 32 |

Square in a different destination

33 |
34 | large-test-square 35 |
36 | -------------------------------------------------------------------------------- /tests/dummy/config/ember-cli-update.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": "1.0.0", 3 | "packages": [ 4 | { 5 | "name": "ember-cli", 6 | "version": "5.4.1", 7 | "blueprints": [ 8 | { 9 | "name": "addon", 10 | "outputRepo": "https://github.com/ember-cli/ember-addon-output", 11 | "codemodsSource": "ember-addon-codemods-manifest@1", 12 | "isBaseBlueprint": true, 13 | "options": [ 14 | "--no-welcome" 15 | ] 16 | } 17 | ] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /tests/dummy/config/ember-try.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const getChannelURL = require('ember-source-channel-url'); 4 | const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup'); 5 | 6 | module.exports = async function () { 7 | return { 8 | usePnpm: true, 9 | scenarios: [ 10 | { 11 | name: 'ember-lts-4.8', 12 | npm: { 13 | devDependencies: { 14 | 'ember-source': '~4.8.0', 15 | }, 16 | }, 17 | }, 18 | { 19 | name: 'ember-lts-4.12', 20 | npm: { 21 | devDependencies: { 22 | 'ember-source': '~4.12.0', 23 | }, 24 | }, 25 | }, 26 | { 27 | name: 'ember-release', 28 | npm: { 29 | devDependencies: { 30 | 'ember-source': await getChannelURL('release'), 31 | }, 32 | }, 33 | }, 34 | { 35 | name: 'ember-beta', 36 | npm: { 37 | devDependencies: { 38 | 'ember-source': await getChannelURL('beta'), 39 | }, 40 | }, 41 | }, 42 | { 43 | name: 'ember-canary', 44 | npm: { 45 | devDependencies: { 46 | 'ember-source': await getChannelURL('canary'), 47 | }, 48 | }, 49 | }, 50 | embroiderSafe(), 51 | embroiderOptimized(), 52 | ], 53 | }; 54 | }; 55 | -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (environment) { 4 | const ENV = { 5 | modulePrefix: 'dummy', 6 | environment, 7 | rootURL: '/', 8 | locationType: 'history', 9 | EmberENV: { 10 | EXTEND_PROTOTYPES: false, 11 | FEATURES: { 12 | // Here you can enable experimental features on an ember canary build 13 | // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true 14 | }, 15 | }, 16 | 17 | APP: { 18 | // Here you can pass flags/options to your application instance 19 | // when it is created 20 | }, 21 | }; 22 | 23 | if (environment === 'development') { 24 | // ENV.APP.LOG_RESOLVER = true; 25 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 26 | // ENV.APP.LOG_TRANSITIONS = true; 27 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 28 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 29 | } 30 | 31 | if (environment === 'test') { 32 | // Testem prefers this... 33 | ENV.locationType = 'none'; 34 | 35 | // keep test console output quieter 36 | ENV.APP.LOG_ACTIVE_GENERATION = false; 37 | ENV.APP.LOG_VIEW_LOOKUPS = false; 38 | 39 | ENV.APP.rootElement = '#ember-testing'; 40 | ENV.APP.autoboot = false; 41 | } 42 | 43 | if (environment === 'production') { 44 | // here you can enable a production-specific feature 45 | } 46 | 47 | return ENV; 48 | }; 49 | -------------------------------------------------------------------------------- /tests/dummy/config/optional-features.json: -------------------------------------------------------------------------------- 1 | { 2 | "application-template-wrapper": false, 3 | "default-async-observers": true, 4 | "jquery-integration": false, 5 | "template-only-glimmer-components": true 6 | } 7 | -------------------------------------------------------------------------------- /tests/dummy/config/targets.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const browsers = [ 4 | 'last 1 Chrome versions', 5 | 'last 1 Firefox versions', 6 | 'last 1 Safari versions', 7 | ]; 8 | 9 | module.exports = { 10 | browsers, 11 | }; 12 | -------------------------------------------------------------------------------- /tests/dummy/public/circle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/dummy/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /tests/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /tests/dummy/public/square.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/helpers/index.js: -------------------------------------------------------------------------------- 1 | import { 2 | setupApplicationTest as upstreamSetupApplicationTest, 3 | setupRenderingTest as upstreamSetupRenderingTest, 4 | setupTest as upstreamSetupTest, 5 | } from 'ember-qunit'; 6 | 7 | // This file exists to provide wrappers around ember-qunit's 8 | // test setup functions. This way, you can easily extend the setup that is 9 | // needed per test type. 10 | 11 | function setupApplicationTest(hooks, options) { 12 | upstreamSetupApplicationTest(hooks, options); 13 | 14 | // Additional setup for application tests can be done here. 15 | // 16 | // For example, if you need an authenticated session for each 17 | // application test, you could do: 18 | // 19 | // hooks.beforeEach(async function () { 20 | // await authenticateSession(); // ember-simple-auth 21 | // }); 22 | // 23 | // This is also a good place to call test setup functions coming 24 | // from other addons: 25 | // 26 | // setupIntl(hooks); // ember-intl 27 | // setupMirage(hooks); // ember-cli-mirage 28 | } 29 | 30 | function setupRenderingTest(hooks, options) { 31 | upstreamSetupRenderingTest(hooks, options); 32 | 33 | // Additional setup for rendering tests can be done here. 34 | } 35 | 36 | function setupTest(hooks, options) { 37 | upstreamSetupTest(hooks, options); 38 | 39 | // Additional setup for unit tests can be done here. 40 | } 41 | 42 | export { setupApplicationTest, setupRenderingTest, setupTest }; 43 | -------------------------------------------------------------------------------- /tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dummy Tests 6 | 7 | 8 | 9 | {{content-for "head"}} 10 | {{content-for "test-head"}} 11 | 12 | 13 | 14 | 15 | 16 | {{content-for "head-footer"}} 17 | {{content-for "test-head-footer"}} 18 | 19 | 20 | {{content-for "body"}} 21 | {{content-for "test-body"}} 22 | 23 |
24 |
25 |
26 |
27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | {{content-for "body-footer"}} 37 | {{content-for "test-body-footer"}} 38 | 39 | 40 | -------------------------------------------------------------------------------- /tests/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/tests/integration/.gitkeep -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import Application from 'dummy/app'; 2 | import config from 'dummy/config/environment'; 3 | import * as QUnit from 'qunit'; 4 | import { setApplication } from '@ember/test-helpers'; 5 | import { setup } from 'qunit-dom'; 6 | import { start } from 'ember-qunit'; 7 | 8 | setApplication(Application.create(config.APP)); 9 | 10 | setup(QUnit.assert); 11 | 12 | start(); 13 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jrjohnson/ember-cli-image-transformer/449befca98de526481c24fe2efaad75295af822f/tests/unit/.gitkeep -------------------------------------------------------------------------------- /tsconfig.declarations.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "declarationDir": "declarations", 5 | "emitDeclarationOnly": true, 6 | "noEmit": false, 7 | "rootDir": "." 8 | }, 9 | "include": ["addon", "addon-test-support"] 10 | } 11 | --------------------------------------------------------------------------------