Skip to content

Commit

Permalink
Add missing addon blueprint config, fix vscode settings & package lint (
Browse files Browse the repository at this point in the history
#892)

* Add ember-cli-update config

* Update addon blueprint

* Remove netlify

* Fix pnpm-lock

* Add missing packages

* Fix pnpm scripts

* Add missing package in test-app & fix types registry

* Fix lint error

* Fix vscode setting
  • Loading branch information
mkszepp authored May 8, 2024
1 parent e079de2 commit 44c0c0d
Show file tree
Hide file tree
Showing 19 changed files with 320 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ 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:
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ yarn-error.log
/package-lock.json.ember-try
/yarn.lock.ember-try
/pnpm-lock.ember-try.yaml

# Local Netlify folder
.netlify
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-basic-dropdown`
- `npm install`
- `pnpm install`

## Linting

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

## Building the addon

- `cd ember-basic-dropdown`
- `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/).
21 changes: 21 additions & 0 deletions config/ember-cli-update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"schemaVersion": "1.0.0",
"projectName": "ember-basic-dropdown",
"packages": [
{
"name": "@embroider/addon-blueprint",
"version": "2.16.0",
"blueprints": [
{
"name": "@embroider/addon-blueprint",
"isBaseBlueprint": true,
"options": [
"--pnpm",
"--no-welcome",
"--typescript"
]
}
]
}
]
}
8 changes: 4 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
},
"scripts": {
"build": "ember build --environment=production",
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
"lint:css": "stylelint \"**/*.css\" --allow-empty-input",
"lint:css:fix": "concurrently \"npm:lint:css -- --fix\"",
"lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
"lint:css:fix": "concurrently \"pnpm:lint:css -- --fix\"",
"lint:fix": "concurrently \"pnpm: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",
"start": "ember serve",
"test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
"test": "concurrently \"pnpm:lint\" \"pnpm:test:*\" --names \"lint,test:\"",
"test:ember": "ember test",
"test:ember-try": "ember try:one",
"test:ember-compatibility": "ember try:each"
Expand Down
2 changes: 1 addition & 1 deletion docs/types/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@glint/environment-ember-loose';
import EmberBasicDropdownRegistry from 'ember-basic-dropdown/template-registry';
import type EmberBasicDropdownRegistry from 'ember-basic-dropdown/template-registry';

export interface GetCodeSnippetHelperRegistry {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
9 changes: 8 additions & 1 deletion ember-basic-dropdown/.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 @@ -28,6 +28,13 @@ module.exports = {
// Add any custom rules here
},
},
// require relative imports use full extensions
{
files: ['src/**/*.{js,ts,gjs,gts}'],
rules: {
'import/extensions': ['error', 'always', { ignorePackages: true }],
},
},
// node files
{
files: [
Expand Down
14 changes: 7 additions & 7 deletions ember-basic-dropdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,21 @@
"vendor"
],
"scripts": {
"build": "concurrently 'npm:build:*'",
"build": "concurrently 'pnpm: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": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'",
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"lint:types": "glint",
"prepack": "pnpm build",
"start": "concurrently 'npm:start:*'",
"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 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 @@ -121,6 +120,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-basic-dropdown/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 BasicDropdownComponent from './components/basic-dropdown';
import type BasicDropdownWormholeComponent from './components/basic-dropdown-wormhole';
import type DropdownTriggerModifier from './modifiers/basic-dropdown-trigger';
Expand Down
44 changes: 39 additions & 5 deletions ember-basic-dropdown/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"compilerOptions": {
"allowJs": true,
"moduleResolution": "node",
"declarationDir": "declarations",
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"noImplicitThis": true,
Expand All @@ -22,10 +22,44 @@
"noUnusedParameters": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
/**
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,
"noEmit": true,
"allowImportingTsExtensions": true,
"experimentalDecorators": true,
"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#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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// 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! 👇
Expand Down
8 changes: 0 additions & 8 deletions netlify.toml

This file was deleted.

12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,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-basic-dropdown 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-basic-dropdown",
Expand Down Expand Up @@ -50,4 +54,4 @@
"npm": false
},
"version": "8.1.0"
}
}
Loading

0 comments on commit 44c0c0d

Please sign in to comment.