@fnet/cli 0.111.1 → 0.112.0
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/fbin/index.js +2 -0
- package/dist/fnet/{index.DBSKvJyG.js → index.B3bzhxbL.js} +1 -1
- package/dist/fnet/index.js +1 -1
- package/dist/fnode/index.B_EoIJV1.js +1 -0
- package/dist/fnode/{index.CLlKzCGk.js → index.CLPC6OJN.js} +1 -1
- package/dist/fnode/index.D5QuQuJX.js +1 -0
- package/dist/fnode/index.axpuK8O5.js +1 -0
- package/dist/fnode/index.js +1 -1
- package/dist/fnode/index.teSOwugt.js +1 -0
- package/dist/fnode/index.uvOH1EJS.js +1 -0
- package/package.json +5 -4
- package/{README.md → readme.md} +115 -9
- package/template/fnet/node/package.json.njk +4 -3
- package/template/fnode/bun/build.js.njk +1 -1
- package/template/fnode/bun/package.json.njk +3 -1
- package/template/fnode/node/package.json.njk +4 -3
- package/template/fnode/project/fnode.yaml.njk +1 -1
- package/dist/fnode/index.53yND1Av.js +0 -1
- package/dist/fnode/index.B1zLg4Y2.js +0 -1
- package/dist/fnode/index.B2LXSSn7.js +0 -1
- package/dist/fnode/index.BBrItYB9.js +0 -1
- package/dist/fnode/index.BSQp_bJN.js +0 -1
- package/dist/fnode/index.Bqzc7Bx8.js +0 -1
- package/dist/fnode/index.BwhWziH6.js +0 -1
- package/dist/fnode/index.Chvv_TJm.js +0 -1
- package/dist/fnode/index.D4KQB1ot.js +0 -1
- package/dist/fnode/index.DItyYiZ_.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"node:fs";import i from"node:path";import e from"nunjucks";import a from"@flownet/lib-parse-imports-js";import s from"@flownet/lib-parse-node-url";import{B as o}from"./index.Bqzc7Bx8.js";import{i as n,a as r,c as p,b as c}from"./index.D4KQB1ot.js";import{p as l,c as m,a as h,b as d,d as f,e as w,f as g,i as y,r as x}from"./index.CLlKzCGk.js";import{c as b,a as u}from"./index.BwhWziH6.js";import"node:crypto";import"yaml";import"chalk";import"@flownet/lib-atom-api-js";import"@fnet/config";import"@fnet/list-files";import"lodash.merge";import"@fnet/npm-list-versions";import"@fnet/shelljs";import"@flownet/lib-render-templates-dir";import"@fnet/npm-pick-versions";import"object-hash";import"ajv/dist/2020.js";import"ajv/dist/standalone/index.js";import"ajv-formats";import"./index.js";import"node:url";import"node:child_process";import"node:os";import"yargs";import"@fnet/prompt";import"@fnet/yaml";import"@fnet/shell-flow";import"node:util";import"tree-kill";import"redis";import"@flownet/lib-is-redis-online";class j extends o{async initRuntime(){await n(this.apiContext),await r(this.apiContext),await this.initLibraryDir(),await this.initNunjucks(),await this.initLibs()}async initLibs(){this.setProgress({message:"Initializing external libs."});const t=[{name:this.atom.doc.name,type:"atom",parent_id:this.atom.parent_id}];this.libs=t,await this.initAtomLibsAndDeps({libs:t,packageDependencies:this.apiContext.packageDependencies})}async initAtomLibsAndDeps({libs:t,packageDependencies:i}){const e=t.filter((t=>"atom"===t.type));for(let t=0;t<e.length;t++){const a=e[t],s=await this.findAtomLibrary({url:a.name});a.atom=s;const o=s.doc.dependencies?.filter((t=>void 0===t.repo||"npm"===t.repo));o?.forEach((t=>{const e=i.find((i=>i.package===t.package));e?"string"==typeof t.path?(e.path||[]).some((i=>i===t.path))||(e.path=e.path||[],e.path.push(t.path)):Array.isArray(t.path)&&t.path.forEach((t=>{(e.path||[]).some((i=>i===t))||(e.path=e.path||[],e.path.push(t))})):i.push(t)}))}i.sort(((t,i)=>t.package?.localeCompare(i.package)))}async findAtomLibrary({url:t}){const e=s({url:t});if(!e)throw new Error(`Invalid package name: ${t}`);if(e.protocol||(e.protocol=this.context.protocol),"ac:"===e.protocol){const i=e.pathname.split("/");if(1===i.length)return await this.apiContext.Atom.first({where:{name:t,parent_id:this.atomConfig.env.ATOM_LIBRARIES_ID,type:"workflow.lib"}});if(2===i.length){const t=await this.apiContext.Atom.first({where:{name:i[0],parent_id:this.atomConfig.env.ATOM_LIBRARIES_ID,type:"folder"}});return await this.apiContext.Atom.first({where:{name:i[1],parent_id:t.id,type:"workflow.lib"}})}}else if("local:"===e.protocol){const t=this.atom;t.protocol="local:",t.doc.dependencies=t.doc.dependencies||[],t.name=t.doc.name;const e=i.resolve(this.context.projectSrcDir,"index.js"),s=await a({file:e,recursive:!0}),o=t.doc.dependencies,n=s.all;for await(const t of n){if("npm"!==t.type)continue;if(o.find((i=>i.package===t.package)))continue;const i=await l({name:t.package,projectDir:this.context.projectDir,setProgress:this.apiContext.setProgress});o.push({package:t.package,subpath:t.subpath,version:i.minorRange,type:"npm"})}return t}}async createAtomLibFiles({libs:e}){await this.setProgress({message:"Creating external lib files."}),this.atom.typesDir="./types";const a=e.filter((t=>"atom"===t.type));for(let e=0;e<a.length;e++){const s=a[e].atom,o=this.context.projectDir;if("local:"===s.protocol){const e=i.resolve(this.context.projectSrcDir,`${s.fileName||s.name}.js`),a=i.relative(i.join(this.context.projectDir,"src","default"),e);if(!t.existsSync(e)){t.mkdirSync(i.dirname(e),{recursive:!0});let a="export default async (args)=>{\n";a+="}",t.writeFileSync(e,a,"utf8")}s.relativePath=a.split(i.sep).join("/"),this.atom.typesDir=`./types/${i.basename(o)}/src`}else{const e=i.join(o,"src","libs",`${s.id}.js`),a=s.doc.contents?.find((t=>"esm"===t.format))||s.doc;t.writeFileSync(e,a.content,"utf8")}}}async createEngine(){await this.setProgress({message:"Creating engine file."});const a={libs:this.libs.filter((t=>"atom"===t.type)),libraryAtom:this.atom,atom:this.atom},s=this.context.templateDir,o=e.compile(t.readFileSync(i.resolve(s,i.join("src","default","engine.js.njk")),"utf8"),this.apiContext.njEnv).render(a),n=this.context.projectDir,r=i.resolve(n,i.join("src","default","index.js"));t.writeFileSync(r,o,"utf8")}async build(){try{this.fileMode&&(await this.createAtomLibFiles({libs:this.libs}),await this.createEngine(),await this.createProjectYaml(),await b(this.apiContext),await m(this.apiContext),await u(this.apiContext),await h(this.apiContext),await d(this.apiContext),await f(this.apiContext),await p(this.apiContext),await w(this.apiContext),await g(this.apiContext),await c(this.apiContext),this.buildMode&&(await y(this.apiContext),await x(this.apiContext),this.deployMode&&await this.deploy())),await this._cache_set(this.buildKey,{status:"COMPLETED"})}catch(t){throw await this._cache_set(this.buildKey,{status:"FAILED",message:t.message||t}),console.log(t),t}}}export{j as default};
|