feat(extend-lion-docs): support usage without a scope folder
This commit is contained in:
parent
17c471ed4b
commit
9a6ef73fd5
6 changed files with 97 additions and 2 deletions
|
|
@ -123,11 +123,11 @@ export async function generateExtendDocsConfig({
|
|||
await init;
|
||||
const options = { classPrefix, classBareImport, tagPrefix, tagBareImport };
|
||||
|
||||
const folderToCheck = path.join(_nodeModulesDir, npmScope);
|
||||
const folderToCheck = npmScope ? path.join(_nodeModulesDir, npmScope) : _nodeModulesDir;
|
||||
const packages = fs
|
||||
.readdirSync(folderToCheck)
|
||||
.filter(dir => fs.statSync(path.join(folderToCheck, dir)).isDirectory())
|
||||
.map(dir => `${npmScope}/${dir}`);
|
||||
.map(dir => (npmScope ? `${npmScope}/${dir}` : dir));
|
||||
|
||||
const changes = [];
|
||||
for (const pkgName of packages) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export { LionAccordion } from './src/LionAccordion.js';
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import { LionAccordion } from './src/LionAccordion.js';
|
||||
|
||||
customElements.define('lion-accordion', LionAccordion);
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"name": "@lion/accordion",
|
||||
"version": "0.5.0",
|
||||
"description": "Vertically stacked list of invokers that can be clicked to reveal or hide content associated with them.",
|
||||
"license": "MIT",
|
||||
"author": "ing-bank",
|
||||
"homepage": "https://github.com/ing-bank/lion/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ing-bank/lion.git",
|
||||
"directory": "packages/accordion"
|
||||
},
|
||||
"main": "index.js",
|
||||
"module": "index.js",
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"*.js",
|
||||
"custom-elements.json",
|
||||
"docs",
|
||||
"src",
|
||||
"test",
|
||||
"test-helpers",
|
||||
"translations",
|
||||
"types"
|
||||
],
|
||||
"scripts": {
|
||||
"custom-elements-manifest": "custom-elements-manifest analyze --litelement --exclude \"docs/**/*\" \"test-helpers/**/*\"",
|
||||
"debug": "cd ../../ && npm run debug -- --group accordion",
|
||||
"debug:firefox": "cd ../../ && npm run debug:firefox -- --group accordion",
|
||||
"debug:webkit": "cd ../../ && npm run debug:webkit -- --group accordion",
|
||||
"publish-docs": "node ../../packages-node/publish-docs/src/cli.js --github-url https://github.com/ing-bank/lion/ --git-root-dir ../../",
|
||||
"prepublishOnly": "npm run publish-docs && npm run custom-elements-manifest",
|
||||
"test": "cd ../../ && npm run test:browser -- --group accordion"
|
||||
},
|
||||
"sideEffects": [
|
||||
"lion-accordion.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@lion/core": "0.17.0"
|
||||
},
|
||||
"keywords": [
|
||||
"accordion",
|
||||
"lion",
|
||||
"web-components"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"customElementsManifest": "custom-elements.json",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./define": "./lion-accordion.js",
|
||||
"./docs/": "./docs/"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
export class LionAccordion extends HTMLElement {}
|
||||
|
|
@ -74,6 +74,41 @@ describe('generateExtendDocsConfig', () => {
|
|||
]);
|
||||
});
|
||||
|
||||
it('works if there is no npm scope sub folder', async () => {
|
||||
const result = await execute('fixtures/no-node-modules-scope-folder', {
|
||||
npmScope: '',
|
||||
});
|
||||
|
||||
expect(result).to.deep.equal([
|
||||
{
|
||||
name: 'accordion - LionAccordion',
|
||||
variable: {
|
||||
from: 'LionAccordion',
|
||||
to: 'IngAccordion',
|
||||
paths: [
|
||||
{
|
||||
from: '@lion/accordion',
|
||||
to: 'ing-web/accordion',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'accordion/define',
|
||||
tag: {
|
||||
from: 'lion-accordion',
|
||||
to: 'ing-accordion',
|
||||
paths: [
|
||||
{
|
||||
from: '@lion/accordion/define',
|
||||
to: '#accordion/define',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('can customize the target', async () => {
|
||||
const result = await execute('fixtures/accordion', {
|
||||
classPrefix: 'Wolf',
|
||||
|
|
|
|||
Loading…
Reference in a new issue