as-services/.yarn/plugins/@yarnpkg/plugin-dev-portal.cjs
devthejo d5febb45c8
Some checks failed
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Failing after 1m25s
/ deploy (push) Has been skipped
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Failing after 1m34s
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 2m9s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Failing after 1m42s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Failing after 1m18s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Failing after 1m22s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 2m3s
chore(init): available sources
2025-04-13 10:34:01 +02:00

12 lines
3.8 KiB
JavaScript

/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-dev-portal",
factory: function (require) {
var plugin=(()=>{var B=Object.defineProperty;var U=(n,e,o)=>e in n?B(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o;var s=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+n+'" is not supported')});var a=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var v=(n,e,o)=>(U(n,typeof e!="symbol"?e+"":e,o),o);var $=a((se,P)=>{var g=s("fs");P.exports=function(e){if(g.existsSync(e)){let o=g.lstatSync(e);if(o.isSymbolicLink()){let p=g.realpathSync(e);return g.statSync(p).isDirectory()}return o.isDirectory()}return!1}});var S=a((te,w)=>{w.exports=function(e){process.stdout.write(`[YARN-DEV-PORTAL] ${e}
`)}});var A=a((ce,N)=>{var D=s("path"),O=s("fs"),m=$(),z=S();N.exports=function(e){let o=[];if(!m(e))return o;let p=O.readdirSync(e),y=(r,c)=>{o.push({name:r,path:c}),z(`found package ${r} that will resolve to portal "${c}"`)};for(let r of p){let c=D.join(e,r);if(!r.startsWith("."))if(r.startsWith("@")){let d=O.readdirSync(c);for(let f of d){let i=D.join(c,f);m(i)&&y(`${r}/${f}`,i)}}else m(c)&&y(r,c)}return o}});var E=a((ie,b)=>{var j=s("path"),t=s("fs"),G=s("os"),{execSync:H}=s("child_process"),T=A(),_=process.cwd(),I=".yarn-dev-portal",x=S();b.exports=function(e,{makeLink:o=!0,yarnInstallProcessEnv:p={}}={}){let y=j.join(_,"package.json"),r=JSON.parse(t.readFileSync(y,{encoding:"utf-8"})),c=j.join(G.homedir(),I),d=T(c),f=j.join(_,I);if(d=[...d,...T(f)],e==="dev")for(let i of d)r.resolutions[i.name]=`portal:${i.path}`;else for(let i of Object.keys(r.resolutions))r.resolutions[i].startsWith("portal:")&&delete r.resolutions[i];t.writeFileSync(y,JSON.stringify(r,null,2)),x(`installing ${e}`),H("yarn",{stdio:"inherit",env:{...process.env,INSIDE_YARN_DEV_PORTAL:"true",...p}}),x(`creating ${e} files`),t.copyFileSync("yarn.lock",`yarn.lock.${e}`),t.copyFileSync("package.json",`package.json.${e}`),o&&(x(`linking to ${e} files`),t.existsSync("package.json")&&t.unlinkSync("package.json"),t.symlinkSync(`package.json.${e}`,"package.json"),t.existsSync("yarn.lock")&&t.unlinkSync("yarn.lock"),t.symlinkSync(`yarn.lock.${e}`,"yarn.lock"))}});var L=a((ae,F)=>{F.exports=function(){try{return fs.readlinkSync("yarn.lock").split(".").pop()}catch{return null}}});var q=a((le,J)=>{var R=E(),K=L(),C=S();J.exports=function(e,o={}){if(e||(e=K()||"dev"),!["dev","prod"].includes(e))throw new Error(`Invalid yarn dev-portal env ${e}, allowed values are "dev" or "prod"`);yarnEnvOther=e==="prod"?"dev":"prod",C(`setting env ${e}`),R(yarnEnvOther,{...o,makeLink:!1}),R(e,{...o}),C(`env ${e} ready`)}});var W=a((ye,V)=>{var{BaseCommand:M}=s("@yarnpkg/cli"),{Command:Q,Option:X}=s("clipanion"),Z=q(),h;V.exports=(h=class extends M{args=X.Proxy();async execute(){let[e="dev"]=this.args;Z(e)}},v(h,"paths",[["dev-portal"]]),v(h,"usage",Q.Usage({description:"produce two yarn.lock to seamlessly link to external local libraries you're developing using yarn portal",details:`
upgrade both version, dev and prod, of yarn.lock and package.json, and switch between them
`,examples:[["yarn dev-portal","yarn dev-portal prod","yarn dev-portal dev"]]})),h)});var oe=a((ue,Y)=>{var l=s("fs"),u=s("path"),ee=W(),ne=q(),k=process.cwd();!l.existsSync(u.join(k,"yarn.lock"))&&l.existsSync(u.join(k,"yarn.lock.prod"))&&l.symlinkSync("yarn.lock.prod","yarn.lock");!l.existsSync(u.join(k,"package.json"))&&l.existsSync(u.join(k,"package.json.prod"))&&l.symlinkSync("package.json.prod","package.json");Y.exports={commands:[ee],hooks:{afterAllInstalled:async n=>{process.env.INSIDE_YARN_DEV_PORTAL!=="true"&&(!l.existsSync(u.join(k,"package.json.prod"))||ne(null))}}}});return oe();})();
return plugin;
}
};