@arc-js/initiator 0.0.5 → 0.0.6
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 -2
- package/index.min.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -194687,7 +194687,7 @@ class ConfigGenerator {
|
|
|
194687
194687
|
srcDir: config.srcDir || pajoExports.Pajo.join(dirname, 'src') || '',
|
|
194688
194688
|
outputFile: config.outputFile || pajoExports.Pajo.join(dirname, 'src\\auto-config.ts') || '',
|
|
194689
194689
|
modulesDir: config.modulesDir || pajoExports.Pajo.join(dirname, 'src\\modules') || '',
|
|
194690
|
-
rootConfigPath: config.rootConfigPath || pajoExports.Pajo.join(dirname, 'config.json') || '',
|
|
194690
|
+
rootConfigPath: config.rootConfigPath || pajoExports.Pajo.join(dirname, 'src\\config.json') || '',
|
|
194691
194691
|
projectRoot: config.projectRoot || dirname || ''
|
|
194692
194692
|
};
|
|
194693
194693
|
console.log(`--> ConfigGenerator config:: `, this.config);
|
|
@@ -194741,7 +194741,6 @@ class ConfigGenerator {
|
|
|
194741
194741
|
if (!importPath.startsWith('.') && !importPath.startsWith('/')) {
|
|
194742
194742
|
importPath = './' + importPath;
|
|
194743
194743
|
}
|
|
194744
|
-
importPath = importPath.replace(/\.json$/, '');
|
|
194745
194744
|
return importPath;
|
|
194746
194745
|
}
|
|
194747
194746
|
generateFileContent() {
|
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$2){new TranslationGenerator({},e).generate().then(()=>{}).catch(e=>{})})}let __filename$1=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$1=path.dirname(__filename$1);class ConfigGenerator{constructor(e={},t=__dirname$1){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,"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=
|
|
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$2){new TranslationGenerator({},e).generate().then(()=>{}).catch(e=>{})})}let __filename$1=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$1=path.dirname(__filename$1);class ConfigGenerator{constructor(e={},t=__dirname$1){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.6",
|
|
7
7
|
"description": "INITIATOR est un système de gestion de configuration modulaire pour les applications React avec TypeScript/JavaScript. Il fournit une gestion centralisée des configurations, un chargement dynamique des modules, et une intégration transparente avec les variables d'environnement.",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"keywords": [],
|