@nx/storybook
Version:
33 lines (32 loc) • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTestUILibNoNgDevkit = createTestUILibNoNgDevkit;
exports.deleteNewConfigurationAndCreateNew = deleteNewConfigurationAndCreateNew;
const js_1 = require("@nx/js");
async function createTestUILibNoNgDevkit(appTree, libName) {
await (0, js_1.libraryGenerator)(appTree, {
linter: 'eslint',
skipFormat: true,
skipTsConfig: false,
unitTestRunner: 'none',
directory: libName,
});
return appTree;
}
function deleteNewConfigurationAndCreateNew(appTree, projectStorybookRoot) {
// Remove new Storybook configuration
appTree.delete(`.storybook/main.js`);
appTree.delete(`.storybook/tsconfig.json`);
appTree.delete(`${projectStorybookRoot}/main.js`);
appTree.delete(`${projectStorybookRoot}/preview.js`);
appTree.delete(`${projectStorybookRoot}/tsconfig.json`);
// Create old Storybook configuration
appTree.write(`.storybook/addons.js`, 'console.log("hello")');
appTree.write(`.storybook/webpack.config.js`, 'console.log("hello")');
appTree.write(`.storybook/tsconfig.json`, '{"test": "hello"}');
appTree.write(`${projectStorybookRoot}/config.js`, 'console.log("hello")');
appTree.write(`${projectStorybookRoot}/addons.js`, 'console.log("hello")');
appTree.write(`${projectStorybookRoot}/webpack.config.js`, 'console.log("hello")');
appTree.write(`${projectStorybookRoot}/tsconfig.json`, '{"test": "hello"}');
return appTree;
}