Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing addon blueprint config & update blueprint #1806

Merged
merged 5 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ on:
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ yarn-error.log
/package-lock.json.ember-try
/yarn.lock.ember-try
/pnpm-lock.ember-try.yaml

15 changes: 12 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"eslint.validate": [
"glimmer-ts",
"glimmer-js"
"eslint.probe": [
"javascript",
"typescript",
"html",
"markdown",
"glimmer-js",
"glimmer-ts"
],
"eslint.validate": [
"javascript",
"glimmer-ts",
"glimmer-js"
]
}
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@

- `git clone <repository-url>`
- `cd ember-power-select`
- `npm install`
- `pnpm install`

## Linting

- `npm run lint`
- `npm run lint:fix`
- `pnpm lint`
- `pnpm lint:fix`

## Building the addon

- `cd ember-power-select`
- `npm build`
- `pnpm build`

## Running tests

- `cd test-app`
- `npm run test` – Runs the test suite on the current Ember version
- `npm run test:watch` – Runs the test suite in "watch mode"
- `pnpm test` – Runs the test suite on the current Ember version
- `pnpm test:watch` – Runs the test suite in "watch mode"

## Running the test application

- `cd test-app`
- `npm run start`
- `pnpm start`
- Visit the test application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
20 changes: 20 additions & 0 deletions config/ember-cli-update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"schemaVersion": "1.0.0",
"projectName": "ember-power-select",
"packages": [
{
"name": "@embroider/addon-blueprint",
"version": "2.16.0",
"blueprints": [
{
"name": "@embroider/addon-blueprint",
"isBaseBlueprint": true,
"options": [
"--pnpm",
"--typescript"
]
}
]
}
]
}
9 changes: 8 additions & 1 deletion ember-power-select/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 'latest',
},
plugins: ['ember'],
plugins: ['ember', 'import'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
Expand All @@ -29,6 +29,13 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 0,
},
},
// require relative imports use full extensions
{
files: ['src/**/*.{js,ts,gjs,gts}'],
rules: {
'import/extensions': ['error', 'always', { ignorePackages: true }],
},
},
// node files
{
files: [
Expand Down
13 changes: 10 additions & 3 deletions ember-power-select/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# 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.
/README.md
/LICENSE.md

# compiled output
/dist
/declarations
/vendor
dist/
declarations/
vendor/

# npm/pnpm/yarn pack output
*.tgz

# deps & caches
node_modules/
.eslintcache
.prettiercache
6 changes: 3 additions & 3 deletions ember-power-select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"lint:types": "glint",
"prepack": "pnpm run build",
"prepack": "concurrently 'pnpm:build:*'",
"start": "concurrently 'pnpm: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'",
"prepare": "pnpm run build"
"test": "echo 'A v2 addon does not have tests, run tests in test-app'"
},
"dependencies": {
"@embroider/addon-shim": "^1.8.7",
Expand Down Expand Up @@ -127,6 +126,7 @@
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-ember": "^12.0.2",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"node-sass": "^9.0.0",
Expand Down
4 changes: 4 additions & 0 deletions ember-power-select/src/template-registry.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Easily allow apps, which are not yet using strict mode templates, to consume your Glint types, by importing this file.
// Add all your components, helpers and modifiers to the template registry here, so apps don't have to do this.
// See https://typed-ember.gitbook.io/glint/environments/ember/authoring-addons

import type PowerSelectComponent from './components/power-select';
import type PowerSelectMultipleComponent from './components/power-select-multiple';

Expand Down
38 changes: 38 additions & 0 deletions ember-power-select/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,44 @@
"compilerOptions": {
"allowJs": true,
"declarationDir": "declarations",
/**
https://www.typescriptlang.org/tsconfig#noEmit

We want to emit declarations, so this option must be set to `false`.
@tsconfig/ember sets this to `true`, which is incompatible with our need to set `emitDeclarationOnly`.
@tsconfig/ember is more optimized for apps, which wouldn't emit anything, only type check.
*/
"noEmit": false,
/**
https://www.typescriptlang.org/tsconfig#emitDeclarationOnly
We want to only emit declarations as we use Rollup to emit JavaScript.
*/
"emitDeclarationOnly": true,

/**
https://www.typescriptlang.org/tsconfig#noEmitOnError
Do not block emit on TS errors.
*/
"noEmitOnError": false,

/**
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#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
}
}
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@
"build:docs": "pnpm run --filter docs build",
"lint": "pnpm run --filter '*' lint",
"lint:fix": "pnpm run --filter '*' lint:fix",
"start": "concurrently 'npm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow",
"prepare": "pnpm run build",
"start": "concurrently 'pnpm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow",
"start:addon": "pnpm run --filter ember-power-select start --no-watch.clearScreen",
"start:docs": "pnpm run --filter docs start --preserveWatchOutput",
"start:test-app": "pnpm run --filter test-app start"
"start:test-app": "pnpm run --filter test-app start",
"test:ember": "pnpm --filter '*' test:ember"
},
"devDependencies": {
"@glint/core": "^1.2.1",
"@release-it-plugins/lerna-changelog": "^6.1.0",
"@release-it-plugins/workspaces": "^4.2.0",
"concurrently": "^8.2.2",
"prettier": "^3.2.5",
"prettier-plugin-ember-template-tag": "^2.0.2",
"release-it": "^17.2.1"
"release-it": "^17.2.1",
"typescript": "^5.4.5"
},
"workspaces": [
"ember-power-select",
Expand Down Expand Up @@ -56,4 +60,4 @@
"npm": false
},
"version": "8.2.0"
}
}
Loading