diff --git a/.travis.yml b/.travis.yml index 0070dc1a04..281b47f8c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -117,7 +117,7 @@ jobs: script: # Build Demo shell & Storybook for production docker" - NODE_OPTIONS=--max_old_space_size=8192 nx build demoshell --configuration production - - NODE_OPTIONS=--max_old_space_size=8192 nx run process-services-cloud:build-storybook --configuration ci + - NODE_OPTIONS=--max_old_space_size=8192 nx run stories:build-storybook --configuration ci - ./scripts/travis/release/release-docker.sh workspaces: create: diff --git a/angular.json b/angular.json index d2186e95b6..717ed2eb85 100644 --- a/angular.json +++ b/angular.json @@ -737,6 +737,46 @@ } } } + }, + "stories": { + "root": "lib/stories", + "sourceRoot": "lib/stories", + "projectType": "library", + "architect": { + "storybook": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "lib/stories/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "build-storybook": { + "builder": "@nrwl/storybook:build", + "outputs": [ + "{options.outputPath}" + ], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/stories", + "config": { + "configFolder": "lib/stories/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } } }, "defaultProject": "demoshell", diff --git a/lib/core/viewer/components/viewer.component.spec.ts b/lib/core/viewer/components/viewer.component.spec.ts index 85a793876b..64b94c6787 100644 --- a/lib/core/viewer/components/viewer.component.spec.ts +++ b/lib/core/viewer/components/viewer.component.spec.ts @@ -546,8 +546,7 @@ describe('ViewerComponent', () => { spyOn(component['nodesApi'], 'getNode').and.returnValues( Promise.resolve(new NodeEntry({ entry: { name: 'file1', content: {} } })) ); - spyOn(component['contentApi'], 'getContentUrl').and.returnValues('http://iam-fake.url'); - spyOn(component, 'getViewerTypeByExtension').and.returnValue('pdf'); + spyOn(component, 'getViewerTypeByExtension').and.returnValue('jpg'); component.urlFile = null; component.displayName = null; diff --git a/lib/stories/.storybook/main.js b/lib/stories/.storybook/main.js new file mode 100644 index 0000000000..6a2e274975 --- /dev/null +++ b/lib/stories/.storybook/main.js @@ -0,0 +1,28 @@ +const rootMain = require('../../../.storybook/main'); + + +module.exports = { + ...rootMain, + + core: { ...rootMain.core, builder: 'webpack4' }, + + stories: [ + ...rootMain.stories, + '../../core/**/*.stories.@(js|jsx|ts|tsx)', + '../../content-services/**/*.stories.@(js|jsx|ts|tsx)', + '../../process-services-cloud/**/*.stories.@(js|jsx|ts|tsx)' + ], + addons: [...rootMain.addons ], + webpackFinal: async (config, { configType }) => { + // apply any global webpack configs that might have been specified in .storybook/main.js + if (rootMain.webpackFinal) { + config = await rootMain.webpackFinal(config, { configType }); + } + + + + // add your own webpack tweaks if needed + + return config; + }, +}; diff --git a/lib/stories/.storybook/preview.js b/lib/stories/.storybook/preview.js new file mode 100644 index 0000000000..117506016e --- /dev/null +++ b/lib/stories/.storybook/preview.js @@ -0,0 +1,3 @@ +export const parameters = { + docs: { inlineStories: true } +} diff --git a/lib/stories/.storybook/tsconfig.json b/lib/stories/.storybook/tsconfig.json new file mode 100644 index 0000000000..74829392d7 --- /dev/null +++ b/lib/stories/.storybook/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "emitDecoratorMetadata": true + + }, + + "exclude": ["../**/*.spec.ts" ], + "include": ["../src/**/*", "*.js"] +} diff --git a/lib/stories/src/index.ts b/lib/stories/src/index.ts new file mode 100644 index 0000000000..2225e53f52 --- /dev/null +++ b/lib/stories/src/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved. + * + * License rights for this program may be obtained from Alfresco Software, Ltd. + * pursuant to a written agreement and any use of this program without such an + * agreement is prohibited. + */ + diff --git a/lib/stories/tsconfig.json b/lib/stories/tsconfig.json new file mode 100644 index 0000000000..f14da61cdf --- /dev/null +++ b/lib/stories/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/lib/stories/tsconfig.lib.json b/lib/stories/tsconfig.lib.json new file mode 100644 index 0000000000..9effed8cf1 --- /dev/null +++ b/lib/stories/tsconfig.lib.json @@ -0,0 +1,19 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "target": "es2015", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [], + "lib": ["dom", "es2018"] + }, + "angularCompilerOptions": { + "skipTemplateCodegen": true, + "strictMetadataEmit": true, + "enableResourceInlining": true + }, + "exclude": [], + "include": ["**/*.ts"] +} diff --git a/nx.json b/nx.json index e3730e864f..15e747957c 100644 --- a/nx.json +++ b/nx.json @@ -49,6 +49,9 @@ }, "cli": { "tags": ["scope:cli", "type:lib"] + }, + "stories": { + "tags": ["scope:stories", "type:lib"] } } } diff --git a/scripts/travis/release/release-docker.sh b/scripts/travis/release/release-docker.sh index e300ff1aba..de4bfad864 100755 --- a/scripts/travis/release/release-docker.sh +++ b/scripts/travis/release/release-docker.sh @@ -40,7 +40,7 @@ then echo "ℹ️ storybook-shell: Running the docker with tag" $TAGS - DOCKER_PROJECT_ARGS="PROJECT_NAME=storybook/process-services-cloud" + DOCKER_PROJECT_ARGS="PROJECT_NAME=storybook/stories" # Publish Image to docker ./node_modules/@alfresco/adf-cli/bin/adf-cli docker --loginCheck --loginUsername "$DOCKER_REPOSITORY_USER" --loginPassword "$DOCKER_REPOSITORY_PASSWORD" --loginRepo "$DOCKER_REPOSITORY_DOMAIN" --dockerRepo "$DOCKER_REPOSITORY_STORYBOOK" --buildArgs "$DOCKER_PROJECT_ARGS" --dockerTags "$TAGS" --pathProject "$(pwd)"