Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/** -diff linguist-generated=true
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /
schedule:
interval: daily
42 changes: 42 additions & 0 deletions .github/workflows/check-dist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Check dist/

on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
merge_group:

jobs:
check-dist:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: 'package-lock.json'

- name: Install dependencies
run: npm ci

- name: Rebuild the dist/ directory
run: |
npm run build

- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
32 changes: 32 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish package to GitHub Packages

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Setup Node.js and set registry to GitHub Packages
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Publish package to GitHub Packages
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
node_modules
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.github
.gitattributes
.nvmrc
.prettierignore
.prettierrc.json
tsconfig.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/iron
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
}
84 changes: 83 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,83 @@
# stencil-styleguide-output-target
# @netlogix/stencil-styleguide-output-target

A stencil output target which also builds Pattern Lab and processes scss

## Usage

To use this output target, add it to your `stencil.config.ts`:

```typescript
import { Config } from '@stencil/core';
import { sass } from '@stencil/sass';
import { patternLabOutputTarget } from "@netlogix/stencil-styleguide-output-target";
import postcss from "rollup-plugin-postcss";

export const config: Config = {
namespace: 'stencil',
srcDir: 'source/script',
watchIgnoredRegex: /dependencyGraph.json/, // important for watching for changes in patternlab
outputTargets: [
// ... other output targets
patternLabOutputTarget({
rollupOptions:
{
input: 'source/css/style.scss',
plugins: [
postcss({
modules: true,
extract: true,
}),
],
},
}),
// ...
],
devServer: {
openBrowser: false,
reloadStrategy: "pageReload", // important for hot reload to work with patternlab
root: 'public',
},
plugins: [
sass(),
],
// ...
};
```
## Configuration
The PatternlabOutput function takes an optional configuration object with the following properties:

`rollupOptions`:

An object with rollup options to be merged with the default options.

Default:
```
rollupOptions: {
input: 'source/scss/style.scss',
plugins: [
postcss({
modules: true,
extract: true
})
]
},
```
#
`rollupOutputOptions`:

An object with rollup output options to be merged with the default options.

Default:
```
rollupOutputOptions: {
name: 'style',
dir: './public/css',
format: 'es'
},
```
#
`sourceDir`: the directory which will be watched. Default: `source/**/*`


## License
This package is licensed under the MIT license.
139 changes: 139 additions & 0 deletions dist/output-target.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading