Skip to content

Commit

Permalink
feat: migrate build and preview to vite
Browse files Browse the repository at this point in the history
Resolves #3 by migratig both the preview mode and the build to vite.

- Moved rollup configuration to a vite configuration file.
- Added a specific vite config file for the lib build that output both a cjs and an es bundle.
- Disabled default vite esbuild in favor of babel.
- Update all plugins and templates with the new configuration.
  • Loading branch information
jboix committed Apr 30, 2024
1 parent 0372af9 commit 293257f
Show file tree
Hide file tree
Showing 16 changed files with 394 additions and 3,712 deletions.
8 changes: 0 additions & 8 deletions .parcelrc

This file was deleted.

33 changes: 17 additions & 16 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,40 @@ Install the dependencies:
npm install
```

### Adding a new plugin
### Adding a new element

Open your terminal and execute the following command:

```bash
npm run create
```

After running the command, you will be prompted to enter the name of your plugin. A new plugin
directory will be generated in the monorepo with the following structure:
After running the command, you will be prompted to enter the type and name of your element. A new
element directory will be generated in the monorepo with the following structure:

```
/plugins/your-plugin-name
/plugins/your-element-name
|-- src
| `-- your-plugin-name.js # Main JavaScript file for the plugin
| |-- lang # Folder containing localization files (only if selected)
| `-- your-element-name.js # Main JavaScript file for the element
|-- test
| `-- your-plugin-name.test.js # Jest tests for your plugin
|-- .babelrc # Babel configuration specific to this plugin
|-- index.html # Demo page to showcase the plugin
|-- jest.config.js # Jest configuration specific to this plugin
| `-- your-element-name.test.js # A default vitest test for your element
|-- .babelrc # Babel configuration specific to this element
|-- index.html # Demo page to showcase the element
|-- package.json # NPM package file, you might need to install additional dependencies
|-- README.md # Documentation file for the plugin
`-- rollup.config.js # Rollup configuration for building the plugin
|-- README.md # Documentation file for the element
|-- vite.config.lib.js # Vite configuration for building the element as a library
`-- vite.config.js # Vite configuration for building the element demo page
```

After the structure is generated, navigate into the plugin's directory:
After the structure is generated, navigate into the element's directory:

```bash
cd plugins/your-plugin-name
cd plugins/your-element-name
```

The README.md file included in your plugin's directory provides detailed instructions on building
and testing the plugin.
The README.md file included in your element's directory provides detailed instructions on building
and testing the element.

## Contributing

Expand Down Expand Up @@ -110,7 +111,7 @@ Ensure your code builds correctly before submitting a pull request:

```shell
npm run build -ws # Build all the packages in the workspace
npm run build -w @srgssr/your-plugin-name # Build a single page by name
npm run build -w @srgssr/your-element-name # Build a single page by name
```

Refer to our [Contribution Guide](CONTRIBUTING.md) for more detailed information.
Expand Down
Loading

0 comments on commit 293257f

Please sign in to comment.