-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #577 from simonihmig/core-package
Extract shared utils and types into core package
- Loading branch information
Showing
30 changed files
with
314 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
"license": "MIT", | ||
"author": "Simon Ihmig <[email protected]>", | ||
"scripts": { | ||
"build": "pnpm --filter ember-responsive-image run build && pnpm --filter @ember-responsive-image/webpack run build && pnpm --filter @ember-responsive-image/blurhash run build && pnpm --filter @ember-responsive-image/cloudinary run build && pnpm --filter @ember-responsive-image/imgix run build", | ||
"build": "pnpm --filter @ember-responsive-image/core run build && pnpm --filter ember-responsive-image run build && pnpm --filter @ember-responsive-image/webpack run build && pnpm --filter @ember-responsive-image/blurhash run build && pnpm --filter @ember-responsive-image/cloudinary run build && pnpm --filter @ember-responsive-image/imgix run build", | ||
"lint": "pnpm run -r lint", | ||
"lint:fix": "pnpm run -r lint:fix", | ||
"prepare": "pnpm build", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# compiled output | ||
/dist/ | ||
/declarations/ | ||
/tmp/ | ||
|
||
# dependencies | ||
/node_modules/ | ||
|
||
# misc | ||
/coverage/ | ||
!.* | ||
.*/ | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
babelOptions: { | ||
root: __dirname, | ||
}, | ||
}, | ||
extends: ['eslint:recommended', 'plugin:prettier/recommended'], | ||
env: { | ||
browser: true, | ||
}, | ||
rules: {}, | ||
overrides: [ | ||
// ts files | ||
{ | ||
files: ['**/*.ts'], | ||
extends: [ | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
], | ||
rules: { | ||
// Add any custom rules here | ||
}, | ||
}, | ||
// node files | ||
{ | ||
files: ['./.eslintrc.js', './.prettierrc.js'], | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
env: { | ||
browser: false, | ||
node: true, | ||
}, | ||
plugins: ['n'], | ||
extends: ['plugin:n/recommended'], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 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 | ||
|
||
# compiled output | ||
/dist | ||
/declarations | ||
|
||
# npm/pnpm/yarn pack output | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# @ember-responsive-image/core | ||
|
||
Internal package | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT License](../../LICENSE.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-transform-typescript", | ||
{ | ||
"allExtensions": true, | ||
"onlyRemoveTypeImports": true, | ||
"allowDeclareFields": true | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "@ember-responsive-image/core", | ||
"version": "1.0.0-beta.0", | ||
"description": "Internal core functions and config for ember-responsive-image", | ||
"repository": "https://github.com/simonihmig/ember-responsive-image", | ||
"license": "MIT", | ||
"author": "Simon Ihmig <[email protected]>", | ||
"files": [ | ||
"declarations", | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "concurrently 'npm:build:*'", | ||
"build:js": "rollup --config", | ||
"build:types": "tsc --emitDeclarationOnly", | ||
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'", | ||
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'", | ||
"lint:js": "eslint . --cache", | ||
"lint:js:fix": "eslint . --fix", | ||
"lint:types": "tsc --noEmit", | ||
"start": "concurrently 'npm:start:*'", | ||
"start:js": "rollup --config --watch --no-watch.clearScreen", | ||
"start:types": "tsc --emitDeclarationOnly --watch", | ||
"test": "echo 'No tests available'", | ||
"prepack": "rollup --config" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.24.4", | ||
"@babel/plugin-transform-typescript": "7.24.4", | ||
"@babel/runtime": "7.24.4", | ||
"@tsconfig/ember": "3.0.6", | ||
"@typescript-eslint/eslint-plugin": "7.7.1", | ||
"@typescript-eslint/parser": "7.7.1", | ||
"@rollup/plugin-babel": "6.0.4", | ||
"concurrently": "8.2.2", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-plugin-n": "17.3.1", | ||
"eslint-plugin-prettier": "5.1.3", | ||
"prettier": "3.2.5", | ||
"rollup": "4.16.4", | ||
"rollup-plugin-copy": "3.5.0", | ||
"typescript": "5.4.5" | ||
}, | ||
"publishConfig": { | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./declarations/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"declarations/index" | ||
] | ||
} | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { babel } from '@rollup/plugin-babel'; | ||
import copy from 'rollup-plugin-copy'; | ||
|
||
export default { | ||
input: 'src/index.ts', | ||
output: { | ||
dir: './dist', | ||
}, | ||
|
||
plugins: [ | ||
babel({ | ||
extensions: ['.js', '.ts'], | ||
}), | ||
|
||
// Copy Readme and License into published package | ||
copy({ | ||
targets: [ | ||
// { src: '../../README.md', dest: '.' }, | ||
{ src: '../../LICENSE.md', dest: '.' }, | ||
], | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export type * from './types.ts'; | ||
export { findMatchingImage } from './match.ts'; |
2 changes: 1 addition & 1 deletion
2
...ember-responsive-image/src/utils/match.ts → packages/core/src/match.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"extends": "@tsconfig/ember/tsconfig.json", | ||
"include": ["src/**/*", "unpublished-development-types/**/*"], | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"noEmit": false, | ||
"declarationDir": "declarations", | ||
|
||
/** | ||
https://www.typescriptlang.org/tsconfig#rootDir | ||
"Default: The longest common path of all non-declaration input files." | ||
Because we want our declarations' structure to match our rollup output, | ||
we need this "rootDir" to match the "srcDir" in the rollup.config.mjs. | ||
This way, we can have simpler `package.json#exports` that matches | ||
imports to files on disk | ||
*/ | ||
"rootDir": "./src", | ||
|
||
/** | ||
https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax | ||
We don't want to include types dependencies in our compiled output, so tell TypeScript | ||
to enforce using `import type` instead of `import` for Types. | ||
*/ | ||
"verbatimModuleSyntax": true, | ||
|
||
/** | ||
https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions | ||
We want our tooling to know how to resolve our custom files so the appropriate plugins | ||
can do the proper transformations on those files. | ||
*/ | ||
"allowImportingTsExtensions": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export { default as ResponsiveImage } from './components/responsive-image.ts'; | ||
export { default as ResponsiveImageService } from './services/responsive-image.ts'; | ||
export { default as resolve } from './helpers/responsive-image-resolve.ts'; | ||
export * from './types.ts'; | ||
export { findMatchingImage } from './utils/match.ts'; | ||
export type { ImageData } from '@ember-responsive-image/core'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.