@ryziz/cli 0.0.45 → 0.0.47

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/build.js +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryziz/cli",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ryziz": "./index.js",
package/src/build.js CHANGED
@@ -56,13 +56,14 @@ export default (isDev) => task('Building', {
56
56
  external: ['firebase-admin', 'firebase-functions', 'express'],
57
57
  plugins: [
58
58
  { name: 'log', setup: (b) => b.onEnd(() => { c.onFunctionsBuilt?.(); }) },
59
- { name: 'var', setup: (b) => { b.onResolve({ filter: /^virtual:api-routes$/ }, (a) => ({ path: a.path, namespace: 'var' })); b.onLoad({ filter: /.*/, namespace: 'var' }, () => { const routes = scanApiRoutes(); const imports = routes.map((r, i) => `import handler${i} from './src/${r.file}';`).join('\n'); const entries = routes.map((r, i) => `{path:'${r.path}',handler:handler${i},functionName:'${r.functionName}'}`).join(','); return { contents: `${imports}\nexport default [${entries}];`, loader: 'js', resolveDir: c.root, watchDirs: [c.src] }; }); } },
59
+ { name: 'var', setup: (b) => { b.onResolve({ filter: /^virtual:api-routes$/ }, (a) => ({ path: a.path, namespace: 'var' })); b.onLoad({ filter: /.*/, namespace: 'var' }, () => { const routes = scanApiRoutes(); const requires = routes.map((r, i) => `const handler${i} = require('./src/${r.file}');`).join('\n'); const entries = routes.map((r, i) => `{path:'${r.path}',handler:handler${i}.default || handler${i},functionName:'${r.functionName}'}`).join(','); return { contents: `${requires}\nmodule.exports = [${entries}];`, loader: 'js', resolveDir: c.root, watchDirs: [c.src] }; }); } },
60
60
  { name: 'fb', setup: (b) => b.onEnd(() => { const routes = scanApiRoutes(); const cfg = JSON.parse(readFileSync(join(c.functionsPkg, 'firebase.json'))); writeFileSync(join(c.dist, 'firebase.json'), JSON.stringify({ ...cfg, hosting: { ...cfg.hosting, rewrites: [...routes.map((r) => ({ source: r.path, function: r.functionName })), { source: '**', destination: '/index.html' }] } }, null, 2)); }) },
61
61
  ],
62
62
  });
63
63
 
64
64
  await c.functionsBuilder.rebuild();
65
65
  cpSync(join(c.functionsPkg, 'package.json'), join(c.dist, 'functions', 'package.json'));
66
+ cpSync(join(c.functionsPkg, 'firestore.rules'), join(c.dist, 'firestore.rules'));
66
67
  if (!isDev) await c.functionsBuilder.dispose();
67
68
  },
68
69
  'Watching': async (c) => {