From b942524ca1c75325c22ed8db3db14cdb29d4bc95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 26 Feb 2021 15:06:03 +0100 Subject: [PATCH] Fix main in package.json --- README.md | 4 +++- package.json | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e1638ed..2cfde6c 100644 --- a/README.md +++ b/README.md @@ -70,13 +70,15 @@ component('example', ExampleComponent); Which will make it accessible using `Alpine.component('example')('foo', 'bar)`. -**Note: It's better to avoid using `Alpine.component('example', ExampleComponent)`** even if it might work in some cases. The reason for this is that `window.Alpine` might not yet be accessible when you're registering components, and if it is, it's possible that it's already evaluated some of the `x-data` attributes. +**Note: It's better to avoid using `Alpine.component('example', ExampleComponent)`** even if it might work in some cases. The reason for this is that `window.Alpine` might not yet be accessible when you're registering components, and if it is, it's possible that it's already evaluated some of the `x-data` attributes. `component()` is guaranteed to work. And of course, you can alias the import if you wish to use a different name. To register multiple components, you can use the `registerComponents()` helper. This can pair well with scripts that crawl your e.g. `alpine/` directory to register all components using their file names. ```ts +// alpine/index.js + import { registerComponents } from '@leanadmin/alpine-typescript'; const files = require.context('./', true, /.*.ts/) diff --git a/package.json b/package.json index 8fe67c7..342b621 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@leanadmin/alpine-typescript", "version": "0.1.0", "description": "TypeScript support for Alpine.js", - "main": "src/index.js", + "main": "src/index.ts", "repository": { "type": "git", "url": "git+https://github.com/LeanAdmin/alpine-typescript.git" @@ -10,10 +10,6 @@ "files": [ "src/index.ts" ], - "scripts": { - "build": "npx mix --production", - "prepublishOnly": "npm run-script build" - }, "keywords": [ "alpine", "alpine.js",