@arc-js/initiator 0.0.84 → 0.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.min.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -194739,7 +194739,7 @@ class ConfigGenerator {
|
|
|
194739
194739
|
const relative = path.relative(outputDir, targetPath);
|
|
194740
194740
|
let importPath = relative.replace(/\\/g, '/');
|
|
194741
194741
|
if (!importPath.startsWith('.') && !importPath.startsWith('/')) {
|
|
194742
|
-
importPath = '
|
|
194742
|
+
importPath = './' + importPath;
|
|
194743
194743
|
}
|
|
194744
194744
|
return importPath;
|
|
194745
194745
|
}
|
package/index.min.js
CHANGED
|
@@ -376,7 +376,7 @@ ${e}
|
|
|
376
376
|
}
|
|
377
377
|
};
|
|
378
378
|
|
|
379
|
-
export default translations;`}generateTypeDefinitions(){if(0===this.keys.length)return"string";let r={};return this.keys.forEach(e=>{var t=e.module||"core";r[t]||(r[t]=[]),r[t].push(e.key)}),Object.entries(r).map(([e,t])=>{t=t.filter((e,t,r)=>r.indexOf(e)===t).map(e=>`"${e}"`).join(" | ");return"core"===e?t:e+":"+t}).join(" | ")}}function TranslationInitiator(){return __awaiter(this,arguments,void 0,function*(e=__dirname$3){new TranslationGenerator({},e).generate().then(()=>{}).catch(e=>{})})}let __filename$2=url.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&"SCRIPT"===_documentCurrentScript.tagName.toUpperCase()&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href),__dirname$2=path.dirname(__filename$2);class ConfigGenerator{constructor(e={},t=__dirname$2){this.modules=new Set,this.config={srcDir:e.srcDir||pajoExports.Pajo.join(t,"src")||"",outputFile:e.outputFile||pajoExports.Pajo.join(t,"src\\auto-config.ts")||"",modulesDir:e.modulesDir||pajoExports.Pajo.join(t,"src\\modules")||"",rootConfigPath:e.rootConfigPath||pajoExports.Pajo.join(t,"src\\config.json")||"",projectRoot:e.projectRoot||t||""}}generate(){return __awaiter(this,void 0,void 0,function*(){yield this.discoverModules(),yield this.generateAutoConfigFile()})}discoverModules(){return __awaiter(this,void 0,void 0,function*(){try{var e;if(fs.existsSync(this.config.modulesDir))for(e of fs.readdirSync(this.config.modulesDir,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)){var t=path.join(this.config.modulesDir,e,"config.json");fs.existsSync(t)&&this.modules.add(e)}}catch(e){}})}generateAutoConfigFile(){return __awaiter(this,void 0,void 0,function*(){var e=path.dirname(this.config.outputFile),e=(fs.existsSync(e)||fs.mkdirSync(e,{recursive:!0}),this.generateFileContent());fs.writeFileSync(this.config.outputFile,e,"utf-8")})}getRelativeImportPath(e){var t=path.dirname(this.config.outputFile);let r=path.relative(t,e).replace(/\\/g,"/");return r=r.startsWith(".")||r.startsWith("/")?r:"
|
|
379
|
+
export default translations;`}generateTypeDefinitions(){if(0===this.keys.length)return"string";let r={};return this.keys.forEach(e=>{var t=e.module||"core";r[t]||(r[t]=[]),r[t].push(e.key)}),Object.entries(r).map(([e,t])=>{t=t.filter((e,t,r)=>r.indexOf(e)===t).map(e=>`"${e}"`).join(" | ");return"core"===e?t:e+":"+t}).join(" | ")}}function TranslationInitiator(){return __awaiter(this,arguments,void 0,function*(e=__dirname$3){new TranslationGenerator({},e).generate().then(()=>{}).catch(e=>{})})}let __filename$2=url.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&"SCRIPT"===_documentCurrentScript.tagName.toUpperCase()&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href),__dirname$2=path.dirname(__filename$2);class ConfigGenerator{constructor(e={},t=__dirname$2){this.modules=new Set,this.config={srcDir:e.srcDir||pajoExports.Pajo.join(t,"src")||"",outputFile:e.outputFile||pajoExports.Pajo.join(t,"src\\auto-config.ts")||"",modulesDir:e.modulesDir||pajoExports.Pajo.join(t,"src\\modules")||"",rootConfigPath:e.rootConfigPath||pajoExports.Pajo.join(t,"src\\config.json")||"",projectRoot:e.projectRoot||t||""}}generate(){return __awaiter(this,void 0,void 0,function*(){yield this.discoverModules(),yield this.generateAutoConfigFile()})}discoverModules(){return __awaiter(this,void 0,void 0,function*(){try{var e;if(fs.existsSync(this.config.modulesDir))for(e of fs.readdirSync(this.config.modulesDir,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)){var t=path.join(this.config.modulesDir,e,"config.json");fs.existsSync(t)&&this.modules.add(e)}}catch(e){}})}generateAutoConfigFile(){return __awaiter(this,void 0,void 0,function*(){var e=path.dirname(this.config.outputFile),e=(fs.existsSync(e)||fs.mkdirSync(e,{recursive:!0}),this.generateFileContent());fs.writeFileSync(this.config.outputFile,e,"utf-8")})}getRelativeImportPath(e){var t=path.dirname(this.config.outputFile);let r=path.relative(t,e).replace(/\\/g,"/");return r=r.startsWith(".")||r.startsWith("/")?r:"./"+r}generateFileContent(){let{rootConfigPath:e,modulesDir:r}=this.config;var t=Array.from(this.modules).sort(),n=fs.existsSync(e),i=n?this.getRelativeImportPath(e):null,n=n&&i?` 'app': (() => import('${i}').then(module => module.default || module))`:" 'app': (() => Promise.resolve({}))",i=t.map(e=>{var t=path.join(r,e,"config.json");return fs.existsSync(t)?` '${e}': (() => import('${this.getRelativeImportPath(t)}').then(module => module.default || module))`:` '${e}': (() => Promise.resolve({}))`}).join(",\n");return`export const configs = {
|
|
380
380
|
'base': {
|
|
381
381
|
${n}
|
|
382
382
|
},
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.85",
|
|
7
7
|
"description": "INITIATOR est un plugin d'initialisation intelligent pour les applications React avec TypeScript/Javascript. Il génère automatiquement les fichiers de configuration, de routage et d'internationalisation basés sur la structure de votre projet.",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"keywords": [],
|