Skip to content

Commit

Permalink
Merge branch 'add-storybook-ng18' of https://github.com/DSI-HUG/ngx-c…
Browse files Browse the repository at this point in the history
…omponents into add-storybook-ng18
  • Loading branch information
rfrt committed Sep 6, 2024
2 parents 86469ca + e2502bb commit ecdc49c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 24 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci_story-book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy story-book

on:
workflow_dispatch:
push:
branches:
- main
tags-ignore:
- '**'
paths:
- '.github/workflows/ci_story-book.yml'
- 'projects/story-book/**'

env:
HUSKY: 0

concurrency:
group: deploy-story-book-group-${{ github.ref }}
cancel-in-progress: true

jobs:
ci_story-book:
runs-on: ubuntu-latest
steps:
- name: Setup
uses: dsi-hug/actions/setup@v2

- name: Build story-book
working-directory: projects/story-book
run: npm run build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.DSI_HUG_BOT_GITHUB_TOKEN }}
publish_dir: ./dist/story-book
user_name: dsi-hug-bot
user_email: 'dsi-hug-bot@users.noreply.github.com'
7 changes: 7 additions & 0 deletions projects/story-book/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ const config: StorybookConfig = {
staticDirs: [
'./public'
],
webpackFinal: webpackConfig => {
webpackConfig.performance = (typeof webpackConfig.performance === 'object') ? webpackConfig.performance : {};
webpackConfig.performance.hints = false;
webpackConfig.performance.maxEntrypointSize = 512000;
webpackConfig.performance.maxAssetSize = 512000;
return webpackConfig;
},
core: {
disableTelemetry: true
}
Expand Down
Binary file added projects/story-book/public/favicon.ico
Binary file not shown.
27 changes: 3 additions & 24 deletions scripts/new-package/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
const { schematic, spawn, replaceInFile, workspace, modifyJsonFile, library, createOrUpdateFile } = require('@hug/ngx-schematics-utilities');
const {
schematic, spawn, replaceInFile, workspace, modifyJsonFile, library, createOrUpdateFile, runAtEnd
} = require('@hug/ngx-schematics-utilities');
const { noop } = require('@angular-devkit/schematics');

// ----
// This was introduced in @hug/ngx-schematics-utilities@9.2.0 but manually backported here as 7.x is used
// TODO: remove this once @hug/ngx-schematics-utilities >= 9.2.x is installed
//
const scheduledTasks = {};
const runAtEnd = cb =>
(tree, context) => {
const name = `__task_${Object.keys(scheduledTasks).length}__`;

// Register the task
if (!scheduledTasks[name]) {
context.engine._host.registerTaskExecutor({
name, create: async () => new Promise(resolve => resolve(() => Promise.resolve(cb(tree, context))))
});
} else {
throw new Error(`Task with name '${name}' already registered.`);
}

// Schedule the task
scheduledTasks[name] = context.addTask({ toConfiguration: () => ({ name }) }, Object.values(scheduledTasks));
};
// ----

exports.default = options =>
schematic('new-package', [
spawn('ng', ['g', 'library', options.libName]),
Expand Down

0 comments on commit ecdc49c

Please sign in to comment.