@jpmorganchase/mosaic-cli 0.1.0-beta.38 → 0.1.0-beta.39

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/dist/build.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-73UKEGXN.mjs";import"./chunk-AY5WSHSM.mjs";export{a as default};
1
+ import{a}from"./chunk-J73DKLHI.mjs";import"./chunk-AY5WSHSM.mjs";export{a as default};
@@ -0,0 +1,3 @@
1
+ import{a as d,b as w}from"./chunk-AY5WSHSM.mjs";import n from"fs";import e from"path";import k from"deepmerge";import h from"fs-extra";import b from"@jpmorganchase/mosaic-core";async function F(r,y,u){r.plugins=r.plugins.filter(({runTimeOnly:i})=>!i),r.sources=r.sources.map(i=>w(d({},i),{options:w(d({},i.options),{cache:!1})}));let p=u.scope&&u.scope.split(","),l=new b(r),s=e.posix.join(y,u.name??new Date().toISOString());await h.emptyDir(s),await l.start();let f=Array.isArray(p)?l.filesystem.scope(p):l.filesystem,g=0;l.onSourceUpdate(async()=>{try{if(++g===r.sources.length){let i=f.symlinksToJSON(),S=await f.promises.glob("**",{cwd:"/",onlyFiles:!0});for(let t of S){let o=await f.promises.readFile(String(t),{includeConflicts:!0}),c=o[0];if(o.length>1)if(e.posix.extname(String(t))===".json"){console.warn(`'${t}' returned multiple files at the same location. Since the files were JSON dot files, they were merged using \`deepmerge\`.`);let a=o.map(m=>JSON.parse(String(m)));c=Buffer.from(JSON.stringify(k(a[0],a[1])))}else throw new Error(`'${t}' returned multiple files at the same location, this will result in overwritten data in the output. Aborting build.
2
+
3
+ Try using \`--scope\` to just output certain namespaced sources, or adding a \`prefixDir\` to the source options to move the source files into a separate folder.`);await n.promises.mkdir(e.dirname(e.join(s,String(t))),{recursive:!0}),await n.promises.writeFile(e.join(s,String(t)),c)}let x=process.cwd();for(let t in i)if(!t.startsWith("/.tags")){for(let{target:o}of i[t])if(!o.startsWith("/.tags")){await h.ensureDir(e.join(s,e.dirname(t)));try{!!await n.promises.stat(e.join(s,t))&&(console.error(new Error(`Symlink at '${e.join(s,t)}' already exists. Aborting build.`)),process.exit(1))}catch{let c=e.join(s,o),a=e.join(s,t),m=e.basename(a),j=e.relative(e.dirname(a),c);process.chdir(e.dirname(a)),n.existsSync(m)&&n.unlinkSync(m),await n.promises.symlink(j,m)}}}process.chdir(x),console.log(`[Mosaic] filesystem for ${Array.isArray(p)?p.length:r.sources.length} source(s) written to disk at '${s}'`),l.stop()}}catch(i){console.error(i),process.exit(1)}})}export{F as a};
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as e}from"./chunk-73UKEGXN.mjs";import{a as s}from"./chunk-UD5ZA5MY.mjs";import{a as p}from"./chunk-P3RXN7HU.mjs";import{a as n}from"./chunk-VIYGD5XX.mjs";import"./chunk-AY5WSHSM.mjs";import{program as r}from"commander";import i from"path";import{pathToFileURL as a}from"url";r.option("-c, --config <string>","Config path").option("-o, --out <string>","Output directory",".tmp/.mosaic-build").option("-s, --scope <strings>","Command separated namespaces").option("-p, --port <number>","Port to serve on","8080").option("-n, --name <string>","Snapshot name").option("-S, --snapshot <string>","Snapshot path");r.parse();var o=r.opts(),t;if(o.config!==void 0){if(t=await import(a(i.resolve(process.cwd(),o.config)).toString()),!t)throw new Error(`[Mosaic] could not find config file at ${i.resolve(process.cwd(),o.config)}.`)}else throw new Error("[Mosaic] no config file provided");r.args[0]==="build"&&e(t.default,i.resolve(process.cwd(),o.out),o);r.args[0]==="serve"&&s(t.default,o.port,o.scope&&o.scope.split(","));r.args[0]==="upload"&&p(i.resolve(process.cwd(),o.snapshot));r.args[0]==="deploy"&&n(t.default,o);
2
+ import{a as e}from"./chunk-J73DKLHI.mjs";import{a as s}from"./chunk-UD5ZA5MY.mjs";import{a as p}from"./chunk-P3RXN7HU.mjs";import{a as n}from"./chunk-VIYGD5XX.mjs";import"./chunk-AY5WSHSM.mjs";import{program as r}from"commander";import i from"path";import{pathToFileURL as a}from"url";r.option("-c, --config <string>","Config path").option("-o, --out <string>","Output directory",".tmp/.mosaic-build").option("-s, --scope <strings>","Command separated namespaces").option("-p, --port <number>","Port to serve on","8080").option("-n, --name <string>","Snapshot name").option("-S, --snapshot <string>","Snapshot path");r.parse();var o=r.opts(),t;if(o.config!==void 0){if(t=await import(a(i.resolve(process.cwd(),o.config)).toString()),!t)throw new Error(`[Mosaic] could not find config file at ${i.resolve(process.cwd(),o.config)}.`)}else throw new Error("[Mosaic] no config file provided");r.args[0]==="build"&&e(t.default,i.resolve(process.cwd(),o.out),o);r.args[0]==="serve"&&s(t.default,o.port,o.scope&&o.scope.split(","));r.args[0]==="upload"&&p(i.resolve(process.cwd(),o.snapshot));r.args[0]==="deploy"&&n(t.default,o);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpmorganchase/mosaic-cli",
3
- "version": "0.1.0-beta.38",
3
+ "version": "0.1.0-beta.39",
4
4
  "author": "",
5
5
  "description": "Mosaic command line scripts",
6
6
  "license": "Apache-2.0",
@@ -37,16 +37,16 @@
37
37
  "directory": "packages/cli"
38
38
  },
39
39
  "devDependencies": {
40
- "@jpmorganchase/mosaic-types": "^0.1.0-beta.38",
40
+ "@jpmorganchase/mosaic-types": "^0.1.0-beta.39",
41
41
  "esbuild": "0.14.35",
42
42
  "esbuild-node-externals": "^1.0.2",
43
43
  "fast-glob": "^3.2.7"
44
44
  },
45
45
  "dependencies": {
46
- "@jpmorganchase/mosaic-core": "^0.1.0-beta.38",
47
- "@jpmorganchase/mosaic-plugins": "^0.1.0-beta.38",
48
- "@jpmorganchase/mosaic-standard-generator": "^0.1.0-beta.38",
49
- "@jpmorganchase/mosaic-source-local-folder": "^0.1.0-beta.38",
46
+ "@jpmorganchase/mosaic-core": "^0.1.0-beta.39",
47
+ "@jpmorganchase/mosaic-plugins": "^0.1.0-beta.39",
48
+ "@jpmorganchase/mosaic-standard-generator": "^0.1.0-beta.39",
49
+ "@jpmorganchase/mosaic-source-local-folder": "^0.1.0-beta.39",
50
50
  "@aws-sdk/client-s3": "^3.359.0",
51
51
  "commander": "^9.4.1",
52
52
  "cors": "^2.8.5",
@@ -1,3 +0,0 @@
1
- import{a as d,b as w}from"./chunk-AY5WSHSM.mjs";import o from"fs";import t from"path";import y from"fs-extra";import k from"@jpmorganchase/mosaic-core";async function b(r,h,p){r.plugins=r.plugins.filter(({runTimeOnly:i})=>!i),r.sources=r.sources.map(i=>w(d({},i),{options:w(d({},i.options),{cache:!1})}));let c=p.scope&&p.scope.split(","),a=new k(r),e=t.posix.join(h,p.name??new Date().toISOString());await y.emptyDir(e),await a.start();let m=Array.isArray(c)?a.filesystem.scope(c):a.filesystem,g=0;a.onSourceUpdate(async()=>{try{if(++g===r.sources.length){let i=m.symlinksToJSON(),S=await m.promises.glob("**",{cwd:"/",onlyFiles:!0});for(let s of S){let n=await m.promises.readFile(String(s),{includeConflicts:!0}),l=n[0];if(n.length>1)throw new Error(`'${s}' returned multiple files at the same location, this will result in overwritten data in the output. Aborting build.
2
-
3
- Try using \`--scope\` to just output certain namespaced sources, or adding a \`prefixDir\` to the source options to move the source files into a separate folder.`);await o.promises.mkdir(t.dirname(t.join(e,String(s))),{recursive:!0}),await o.promises.writeFile(t.join(e,String(s)),l)}let x=process.cwd();for(let s in i)if(!s.startsWith("/.tags")){for(let{target:n}of i[s])if(!n.startsWith("/.tags")){await y.ensureDir(t.join(e,t.dirname(s)));try{!!await o.promises.stat(t.join(e,s))&&(console.error(new Error(`Symlink at '${t.join(e,s)}' already exists. Aborting build.`)),process.exit(1))}catch{let l=t.join(e,n),u=t.join(e,s),f=t.basename(u),j=t.relative(t.dirname(u),l);process.chdir(t.dirname(u)),o.existsSync(f)&&o.unlinkSync(f),await o.promises.symlink(j,f)}}}process.chdir(x),console.log(`[Mosaic] filesystem for ${Array.isArray(c)?c.length:r.sources.length} source(s) written to disk at '${e}'`),a.stop()}}catch(i){console.error(i),process.exit(1)}})}export{b as a};