-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cc8e79c
Showing
28 changed files
with
12,112 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# unconventional js | ||
/blueprints/*/files/ | ||
|
||
# compiled output | ||
/dist/ | ||
/declarations/ | ||
|
||
# misc | ||
/coverage/ |
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,46 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
root: true, | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
babelOptions: { | ||
root: __dirname, | ||
}, | ||
}, | ||
plugins: ['ember', 'prettier'], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:ember/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
env: { | ||
browser: true, | ||
}, | ||
rules: {}, | ||
overrides: [ | ||
{ | ||
files: ['**/*.ts'], | ||
}, | ||
// node files | ||
{ | ||
files: [ | ||
'./.eslintrc.cjs', | ||
'./.prettierrc.cjs', | ||
'./.template-lintrc.cjs', | ||
'./addon-main.cjs', | ||
], | ||
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,39 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: "https://registry.npmjs.org" | ||
env: | ||
NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: latest | ||
- run: pnpm i | ||
- run: pnpm run build || echo "ignore failures for now" | ||
- run: pnpm run test | ||
- run: pnpm view "ember-vite-hmr@$(cat package.json | jq -r '.version')" || npm publish | ||
if: github.ref == 'refs/heads/main' | ||
|
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,27 @@ | ||
* | ||
!tests | ||
!tests/**/* | ||
!declarations | ||
!declarations/**/* | ||
!lib | ||
!lib/**/* | ||
!src | ||
!src/**/* | ||
!types | ||
!types/**/* | ||
!.eslintignore | ||
!.eslintrc.cjs | ||
!.gitignore | ||
!.prettierignore | ||
!.prettierrc.cjs | ||
!.template-lintrc.cjs | ||
!addon-main.cjs | ||
!babel.config.json | ||
!CONTRIBUTING.md | ||
!package.json | ||
!pnpm-lock.yaml | ||
!README.md | ||
!rollup.config.mjs | ||
!tsconfig.json | ||
!tsconfig.lib.json | ||
!webpack.js |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,9 @@ | ||
# unconventional js | ||
/blueprints/*/files/ | ||
|
||
# compiled output | ||
/dist/ | ||
/declarations/ | ||
|
||
# misc | ||
/coverage/ |
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,6 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
plugins: ['prettier-plugin-ember-template-tag'], | ||
singleQuote: 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,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: '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,25 @@ | ||
# How To Contribute | ||
|
||
## Linting | ||
|
||
- `pnpm lint` | ||
- `pnpm lint:fix` | ||
|
||
## Building the addon | ||
|
||
- `cd ember-webpack-hot-reload` | ||
- `pnpm build` | ||
|
||
## Running tests | ||
|
||
- `cd test-app` | ||
- `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` | ||
- `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/). |
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,38 @@ | ||
ember-vite-hmr | ||
|
||
Ember Vite Hmr plugin. | ||
|
||
this can hot reload | ||
|
||
- helpers | ||
- modifiers | ||
- components + templates, fcct components and its deps | ||
- routes/controllers/route-templates (although it refreshes the whole route and thus looses all state) | ||
|
||
it cannot hot reload local properties that turn out to be helpers/modifiers/components. | ||
|
||
## Installation | ||
|
||
``` | ||
ember install ember-vite-hmr | ||
``` | ||
|
||
## Usage | ||
|
||
update your `vite.config.mjs` with | ||
|
||
```js | ||
import { hmr } from 'ember-vite-hmr'; | ||
...hmr | ||
plugins: [ | ||
...hmr(resolver()) | ||
] | ||
``` | ||
|
||
## Contributing | ||
|
||
See the [Contributing](CONTRIBUTING.md) guide for details. | ||
|
||
## 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,44 @@ | ||
'use strict'; | ||
|
||
const { addonV1Shim } = require('@embroider/addon-shim'); | ||
const path = require('path'); | ||
module.exports = addonV1Shim(__dirname); | ||
const included = module.exports.included; | ||
|
||
Object.assign(module.exports, { | ||
_getBabelOptions() { | ||
const parentOptions = this.parent && this.parent.options; | ||
const appOptions = this.app && this.app.options; | ||
const addonOptions = parentOptions || appOptions || {}; | ||
|
||
addonOptions.babel = addonOptions.babel || {}; | ||
addonOptions.babel.plugins = addonOptions.babel.plugins || []; | ||
return addonOptions.babel; | ||
}, | ||
included(...args) { | ||
this._getBabelOptions().plugins.push([require.resolve('./dist/lib/babel-plugin.js'), { v: 4, appName: this.app.name }]); | ||
this._super.included; // need to access this somehow? otherwise it fails later on... | ||
|
||
let astPlugin = this._buildPlugin(); | ||
astPlugin.parallelBabel = { | ||
requireFile: __filename, | ||
buildUsing: '_buildPlugin', | ||
params: {} | ||
}; | ||
const compatAppBuilder = require.resolve('@embroider/compat/src/compat-app-builder', { paths: [process.cwd()] }); | ||
const CompatAppBuilder = require(compatAppBuilder).CompatAppBuilder; | ||
const etcOptions = CompatAppBuilder.prototype.etcOptions; | ||
CompatAppBuilder.prototype.etcOptions = function (...args) { | ||
const opts = etcOptions.call(this, ...args); | ||
opts.transforms.push(astPlugin); | ||
return opts; | ||
} | ||
included.call(this, ...args); | ||
}, | ||
|
||
_buildPlugin() { | ||
const hotAstProcessor = require('./dist/lib/babel-plugin').hotAstProcessor; | ||
return hotAstProcessor.transform.bind(hotAstProcessor); | ||
}, | ||
}) | ||
|
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,19 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"@babel/plugin-transform-typescript", | ||
{ "allExtensions": true, "allowDeclareFields": true } | ||
], | ||
"@embroider/addon-dev/template-colocation-plugin", | ||
"@babel/plugin-transform-class-static-block", | ||
[ | ||
"babel-plugin-ember-template-compilation", | ||
{ | ||
"targetFormat": "hbs", | ||
"transforms": [] | ||
} | ||
], | ||
["@babel/plugin-proposal-decorators", { "version": "legacy" }], | ||
"@babel/plugin-proposal-class-properties" | ||
] | ||
} |
Oops, something went wrong.