Skip to content

Commit

Permalink
Merge pull request #1 from SilverMira/dev
Browse files Browse the repository at this point in the history
2.0.0 Refactor, builds now according to angular.json, production file replacements, typecheck worker
  • Loading branch information
SilverMira authored Jan 3, 2021
2 parents ba52c79 + ba39ced commit bb00bad
Show file tree
Hide file tree
Showing 10 changed files with 662 additions and 721 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This is a highly experimental snowpack plugin. Has only been tested to work on brand new Angular 11 project generated through `ng new <project_name>`. Working setup could be seen [here](https://github.com/phantasmalmira/AngularSnowpackDemo).

## Style Preprocessors

This plugin does not support style preprocessing yet, implementing a working style preprocessing plugin is simple enough, but it would mean that the plugin has to preprocess the styles as well, an ideal solution is to use other snowpack plugins to feed their output into this plugin, which for the time being I haven't found the solution for yet. Please do contribute by opening a pull request if you have an idea.

## Usage

```bash
Expand All @@ -12,7 +16,6 @@ npm i --save-dev angular-snowpack-plugin
// snowpack.config.js

{
"installs": ["@angular/common"],
"plugins": [
[
"angular-snowpack-plugin",
Expand All @@ -26,12 +29,13 @@ npm i --save-dev angular-snowpack-plugin

## Plugin Options

| Name | Type | Description | Default |
| ------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `src` | `string` | Relative path to the source directory of your angular project. | `src` |
| `logLevel` | `'normal' \| 'debug'` | Logging verbosity of the plugin. | `normal` |
| `tsConfig` | `string` | Relative path to the build options tsconfig of your Angular project, check in `angular.json`. | `tsconfig.app.json` |
| `ngccTargets` | `string[]` | `ngcc` targets that the plugin will attempt to run `ngcc` with on each startup, values here will be extending the default value. | `['@angular/platform-browser']` |
| Name | Type | Description | Default |
| ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| `src` | `string` | Relative path to the source directory of your angular project. | `src` |
| `angularJson` | `string` | Relative path to `angular.json` of your Angular project. | `angular.json` |
| `angularProject` | `string` | Target project of the build as according to `angular.json` | default project defined in `angular.json` |
| `ngccTargets` | `string[]` | `ngcc` targets that the plugin will attempt to run `ngcc` with on each startup, values here will be extending the default value. | `['@angular/core', '@angular/common', '@angular/platform-browser-dynamic']` |
| `errorToBrowser` | `boolean` | Determines whether a type-check error will be pushed to the browser as a build error, note that this only applies to dev mode, build and first compilation will push error to browser regardless, `false` will mimic the behavior of `ng serve` | `true` |

## Important Notes

Expand Down
11 changes: 3 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-snowpack-plugin",
"version": "1.0.1",
"version": "2.0.0",
"description": "Snowpack Plugin for angular projects",
"main": "dist/index.js",
"repository": {
Expand All @@ -15,21 +15,16 @@
"author": "PhantasmalMira",
"license": "ISC",
"dependencies": {
"execa": "^5.0.0",
"less": "^4.0.0",
"sass": "^1.32.0",
"stylus": "^0.54.8"
"execa": "^5.0.0"
},
"devDependencies": {
"@angular/compiler": "^11.0.5",
"@angular/compiler-cli": "^11.0.5",
"@types/less": "^3.0.2",
"@types/sass": "^1.16.0",
"@types/stylus": "^0.48.33",
"snowpack": "^2.18.5",
"typescript": "4.0"
},
"peerDependencies": {
"@angular/compiler": "*",
"@angular/compiler-cli": "*",
"snowpack": "^2.18.5",
"typescript": "4.0"
Expand Down
Loading

0 comments on commit bb00bad

Please sign in to comment.