fix: correct all the references to @create-index
This commit is contained in:
@@ -83,7 +83,7 @@ create-index --help
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
--update, -u Recursively iterates target directories looking for "index.js"
|
--update, -u Recursively iterates target directories looking for "index.js"
|
||||||
files that start with "'create index';\n" (create-index index
|
files that start with "// @create-index\n" (create-index index
|
||||||
file). Updates found index files. Does not create new index
|
file). Updates found index files. Does not create new index
|
||||||
files. [boolean] [default: false]
|
files. [boolean] [default: false]
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ drwxr-xr-x 2 gajus staff 68B 6 Jan 15:29 foo
|
|||||||
Given the above directory contents, `./index.js` will be:
|
Given the above directory contents, `./index.js` will be:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
'create index';
|
// @create-index
|
||||||
|
|
||||||
import bar from './bar';
|
import bar from './bar';
|
||||||
import foo from './foo.js';
|
import foo from './foo.js';
|
||||||
@@ -187,6 +187,6 @@ When file has the same name as a sibling directory, file `import` takes preceden
|
|||||||
|
|
||||||
Directories that do not have `./index.js` in themselves will be excluded.
|
Directories that do not have `./index.js` in themselves will be excluded.
|
||||||
|
|
||||||
When run again, `create-index` will update existing `./index.js` if it starts with `'create index';\n\n`.
|
When run again, `create-index` will update existing `./index.js` if it starts with `// @create-index\n\n`.
|
||||||
|
|
||||||
If `create-index` is executed against a directory that contains `./index.js`, which does not start with `'create index';\n\n`, an error will be thrown.
|
If `create-index` is executed against a directory that contains `./index.js`, which does not start with `// @create-index\n\n`, an error will be thrown.
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import {
|
|||||||
const argv = yargs
|
const argv = yargs
|
||||||
.demand(1)
|
.demand(1)
|
||||||
.options({
|
.options({
|
||||||
'update': {
|
update: {
|
||||||
alias: 'u',
|
alias: 'u',
|
||||||
default: false,
|
default: false,
|
||||||
description: 'Recursively iterates target directories looking for "index.js" files that start with "\'create index\';\\n" (create-index index file). Updates found index files. Does not create new index files.',
|
description: 'Recursively iterates target directories looking for "index.js" files that start with "// @create-index\\n" (create-index index file). Updates found index files. Does not create new index files.',
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
'create index';
|
// @create-index
|
||||||
|
|
||||||
export createIndexCode from './createIndexCode.js';
|
export createIndexCode from './createIndexCode.js';
|
||||||
export findIndexFiles from './findIndexFiles.js';
|
export findIndexFiles from './findIndexFiles.js';
|
||||||
@@ -8,4 +8,3 @@ export sortByDepth from './sortByDepth.js';
|
|||||||
export validateTargetDirectory from './validateTargetDirectory.js';
|
export validateTargetDirectory from './validateTargetDirectory.js';
|
||||||
export writeIndex from './writeIndex.js';
|
export writeIndex from './writeIndex.js';
|
||||||
export writeIndexCli from './writeIndexCli.js';
|
export writeIndexCli from './writeIndexCli.js';
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ describe('createIndexCode()', () => {
|
|||||||
const indexCode = createIndexCode([]);
|
const indexCode = createIndexCode([]);
|
||||||
|
|
||||||
expect(indexCode).to.equal(codeExample(`
|
expect(indexCode).to.equal(codeExample(`
|
||||||
'create index';
|
// @create-index
|
||||||
`));
|
`));
|
||||||
});
|
});
|
||||||
it('describes a single child', () => {
|
it('describes a single child', () => {
|
||||||
const indexCode = createIndexCode(['foo']);
|
const indexCode = createIndexCode(['foo']);
|
||||||
|
|
||||||
expect(indexCode).to.equal(codeExample(`
|
expect(indexCode).to.equal(codeExample(`
|
||||||
'create index';
|
// @create-index
|
||||||
|
|
||||||
export foo from './foo';
|
export foo from './foo';
|
||||||
`));
|
`));
|
||||||
@@ -27,7 +27,7 @@ export foo from './foo';
|
|||||||
const indexCode = createIndexCode(['bar', 'foo']);
|
const indexCode = createIndexCode(['bar', 'foo']);
|
||||||
|
|
||||||
expect(indexCode).to.equal(codeExample(`
|
expect(indexCode).to.equal(codeExample(`
|
||||||
'create index';
|
// @create-index
|
||||||
|
|
||||||
export bar from './bar';
|
export bar from './bar';
|
||||||
export foo from './foo';
|
export foo from './foo';
|
||||||
@@ -38,7 +38,7 @@ export foo from './foo';
|
|||||||
const indexCode = createIndexCode(['foo.js']);
|
const indexCode = createIndexCode(['foo.js']);
|
||||||
|
|
||||||
expect(indexCode).to.equal(codeExample(`
|
expect(indexCode).to.equal(codeExample(`
|
||||||
'create index';
|
// @create-index
|
||||||
|
|
||||||
export foo from './foo.js';
|
export foo from './foo.js';
|
||||||
`));
|
`));
|
||||||
@@ -49,7 +49,7 @@ export foo from './foo.js';
|
|||||||
const indexCode = createIndexCode(['foo', 'bar']);
|
const indexCode = createIndexCode(['foo', 'bar']);
|
||||||
|
|
||||||
expect(indexCode).to.equal(codeExample(`
|
expect(indexCode).to.equal(codeExample(`
|
||||||
'create index';
|
// @create-index
|
||||||
|
|
||||||
export bar from './bar';
|
export bar from './bar';
|
||||||
export foo from './foo';
|
export foo from './foo';
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
'create index';
|
// @create-index
|
||||||
|
|
||||||
export bar from './bar';
|
export bar from './bar';
|
||||||
export foo from './foo.js';
|
export foo from './foo.js';
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ describe('writeIndex()', () => {
|
|||||||
const indexCode = fs.readFileSync(indexFilePath, 'utf8');
|
const indexCode = fs.readFileSync(indexFilePath, 'utf8');
|
||||||
|
|
||||||
expect(indexCode).to.equal(codeExample(`
|
expect(indexCode).to.equal(codeExample(`
|
||||||
'create index';
|
// @create-index
|
||||||
|
|
||||||
export bar from './bar';
|
export bar from './bar';
|
||||||
export foo from './foo.js';
|
export foo from './foo.js';
|
||||||
|
|||||||
Reference in New Issue
Block a user