dit
This commit is contained in:
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* eslint-disable filenames/match-regex */
|
||||
"use strict";
|
||||
|
||||
var _yargs = _interopRequireDefault(require("yargs"));
|
||||
|
||||
var _utilities = require("../utilities");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const argv = _yargs.default.demand(1).options({
|
||||
recursive: {
|
||||
alias: 'r',
|
||||
default: false,
|
||||
description: 'Create/update index files recursively. Halts on any unsafe "index.js" files.',
|
||||
type: 'boolean'
|
||||
}
|
||||
}).options({
|
||||
ignoreUnsafe: {
|
||||
alias: 'i',
|
||||
default: false,
|
||||
description: 'Ignores unsafe "index.js" files instead of halting.',
|
||||
type: 'boolean'
|
||||
}
|
||||
}).options({
|
||||
ignoreDirectories: {
|
||||
alias: 'd',
|
||||
default: false,
|
||||
description: 'Ignores importing directories into the index file, even if they have a safe "index.js".',
|
||||
type: 'boolean'
|
||||
}
|
||||
}).options({
|
||||
update: {
|
||||
alias: 'u',
|
||||
default: false,
|
||||
description: 'Updates only previously created index files (recursively).',
|
||||
type: 'boolean'
|
||||
}
|
||||
}).options({
|
||||
banner: {
|
||||
description: 'Add a custom banner at the top of the index file',
|
||||
type: 'string'
|
||||
}
|
||||
}).options({
|
||||
extensions: {
|
||||
alias: 'x',
|
||||
default: ['js'],
|
||||
description: 'Allows some extensions to be parsed as valid source. First extension will always be preferred to homonyms with another allowed extension.',
|
||||
type: 'array'
|
||||
}
|
||||
}).options({
|
||||
outputFile: {
|
||||
alias: 'o',
|
||||
default: 'index.js',
|
||||
description: 'Output file',
|
||||
type: 'string'
|
||||
}
|
||||
}).example('create-index ./src ./src/utilities', 'Creates or updates an existing create-index index file in the target (./src, ./src/utilities) directories.').example('create-index --update ./src ./tests', 'Finds all create-index index files in the target directories and descending directories. Updates found index files.').example('create-index ./src --extensions js jsx', 'Creates or updates an existing create-index index file in the target (./src) directory for both .js and .jsx extensions.').argv;
|
||||
|
||||
(0, _utilities.writeIndexCli)(argv._, {
|
||||
banner: argv.banner,
|
||||
extensions: argv.extensions,
|
||||
ignoreDirectories: argv.ignoreDirectories,
|
||||
ignoreUnsafe: argv.ignoreUnsafe,
|
||||
outputFile: argv.outputFile,
|
||||
recursive: argv.recursive,
|
||||
updateIndex: argv.update
|
||||
});
|
||||
//# sourceMappingURL=create-index.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/bin/create-index.js"],"names":["argv","yargs","demand","options","recursive","alias","default","description","type","ignoreUnsafe","ignoreDirectories","update","banner","extensions","outputFile","example","_","updateIndex"],"mappings":"AAAA;;AAEA;;;AAEA;;AACA;;;;AAIA,MAAMA,IAAI,GAAGC,eACVC,MADU,CACH,CADG,EAEVC,OAFU,CAEF;AACPC,EAAAA,SAAS,EAAE;AACTC,IAAAA,KAAK,EAAE,GADE;AAETC,IAAAA,OAAO,EAAE,KAFA;AAGTC,IAAAA,WAAW,EAAE,8EAHJ;AAITC,IAAAA,IAAI,EAAE;AAJG;AADJ,CAFE,EAUVL,OAVU,CAUF;AACPM,EAAAA,YAAY,EAAE;AACZJ,IAAAA,KAAK,EAAE,GADK;AAEZC,IAAAA,OAAO,EAAE,KAFG;AAGZC,IAAAA,WAAW,EAAE,qDAHD;AAIZC,IAAAA,IAAI,EAAE;AAJM;AADP,CAVE,EAkBVL,OAlBU,CAkBF;AACPO,EAAAA,iBAAiB,EAAE;AACjBL,IAAAA,KAAK,EAAE,GADU;AAEjBC,IAAAA,OAAO,EAAE,KAFQ;AAGjBC,IAAAA,WAAW,EAAE,yFAHI;AAIjBC,IAAAA,IAAI,EAAE;AAJW;AADZ,CAlBE,EA0BVL,OA1BU,CA0BF;AACPQ,EAAAA,MAAM,EAAE;AACNN,IAAAA,KAAK,EAAE,GADD;AAENC,IAAAA,OAAO,EAAE,KAFH;AAGNC,IAAAA,WAAW,EAAE,4DAHP;AAINC,IAAAA,IAAI,EAAE;AAJA;AADD,CA1BE,EAkCVL,OAlCU,CAkCF;AACPS,EAAAA,MAAM,EAAE;AACNL,IAAAA,WAAW,EAAE,kDADP;AAENC,IAAAA,IAAI,EAAE;AAFA;AADD,CAlCE,EAwCVL,OAxCU,CAwCF;AACPU,EAAAA,UAAU,EAAE;AACVR,IAAAA,KAAK,EAAE,GADG;AAEVC,IAAAA,OAAO,EAAE,CAAC,IAAD,CAFC;AAGVC,IAAAA,WAAW,EAAE,2IAHH;AAIVC,IAAAA,IAAI,EAAE;AAJI;AADL,CAxCE,EAgDVL,OAhDU,CAgDF;AACPW,EAAAA,UAAU,EAAE;AACVT,IAAAA,KAAK,EAAE,GADG;AAEVC,IAAAA,OAAO,EAAE,UAFC;AAGVC,IAAAA,WAAW,EAAE,aAHH;AAIVC,IAAAA,IAAI,EAAE;AAJI;AADL,CAhDE,EAwDVO,OAxDU,CAyDT,oCAzDS,EA0DT,4GA1DS,EA4DVA,OA5DU,CA6DT,qCA7DS,EA8DT,qHA9DS,EAgEVA,OAhEU,CAiET,wCAjES,EAkET,0HAlES,EAoEVf,IApEH;;AAsEA,8BAAcA,IAAI,CAACgB,CAAnB,EAAsB;AACpBJ,EAAAA,MAAM,EAAEZ,IAAI,CAACY,MADO;AAEpBC,EAAAA,UAAU,EAAEb,IAAI,CAACa,UAFG;AAGpBH,EAAAA,iBAAiB,EAAEV,IAAI,CAACU,iBAHJ;AAIpBD,EAAAA,YAAY,EAAET,IAAI,CAACS,YAJC;AAKpBK,EAAAA,UAAU,EAAEd,IAAI,CAACc,UALG;AAMpBV,EAAAA,SAAS,EAAEJ,IAAI,CAACI,SANI;AAOpBa,EAAAA,WAAW,EAAEjB,IAAI,CAACW;AAPE,CAAtB","sourcesContent":["#!/usr/bin/env node\n\n/* eslint-disable filenames/match-regex */\n\nimport yargs from 'yargs';\nimport {\n writeIndexCli,\n} from '../utilities';\n\nconst argv = yargs\n .demand(1)\n .options({\n recursive: {\n alias: 'r',\n default: false,\n description: 'Create/update index files recursively. Halts on any unsafe \"index.js\" files.',\n type: 'boolean',\n },\n })\n .options({\n ignoreUnsafe: {\n alias: 'i',\n default: false,\n description: 'Ignores unsafe \"index.js\" files instead of halting.',\n type: 'boolean',\n },\n })\n .options({\n ignoreDirectories: {\n alias: 'd',\n default: false,\n description: 'Ignores importing directories into the index file, even if they have a safe \"index.js\".',\n type: 'boolean',\n },\n })\n .options({\n update: {\n alias: 'u',\n default: false,\n description: 'Updates only previously created index files (recursively).',\n type: 'boolean',\n },\n })\n .options({\n banner: {\n description: 'Add a custom banner at the top of the index file',\n type: 'string',\n },\n })\n .options({\n extensions: {\n alias: 'x',\n default: ['js'],\n description: 'Allows some extensions to be parsed as valid source. First extension will always be preferred to homonyms with another allowed extension.',\n type: 'array',\n },\n })\n .options({\n outputFile: {\n alias: 'o',\n default: 'index.js',\n description: 'Output file',\n type: 'string',\n },\n })\n .example(\n 'create-index ./src ./src/utilities',\n 'Creates or updates an existing create-index index file in the target (./src, ./src/utilities) directories.',\n )\n .example(\n 'create-index --update ./src ./tests',\n 'Finds all create-index index files in the target directories and descending directories. Updates found index files.',\n )\n .example(\n 'create-index ./src --extensions js jsx',\n 'Creates or updates an existing create-index index file in the target (./src) directory for both .js and .jsx extensions.',\n )\n .argv;\n\nwriteIndexCli(argv._, {\n banner: argv.banner,\n extensions: argv.extensions,\n ignoreDirectories: argv.ignoreDirectories,\n ignoreUnsafe: argv.ignoreUnsafe,\n outputFile: argv.outputFile,\n recursive: argv.recursive,\n updateIndex: argv.update,\n});\n"],"file":"create-index.js"}
|
||||
Reference in New Issue
Block a user