How to use serve - 7 common examples

To help you get started, we’ve selected a few serve examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nstudio / xplat / packages / electron / src / schematics / application / index.spec.ts View on Github external
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
    const packageData: any = jsonParse(checkFile);
    expect(packageData.scripts['postinstall']).toBeDefined();
    expect(packageData.scripts['postinstall.electron']).toBeDefined();
    expect(packageData.scripts['postinstall.web']).toBeDefined();
    expect(packageData.scripts['build.electron.foo']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.local']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.linux']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.windows']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.mac']).toBeDefined();
    expect(packageData.scripts['prepare.electron.foo']).toBeDefined();
    expect(packageData.scripts['serve.electron.foo.target']).toBeDefined();
    expect(packageData.scripts['serve.electron.foo']).toBeDefined();
    expect(packageData.scripts['start.electron.foo']).toBeDefined();

    // should *NOT* generate angular specific files
    expect(
      tree.exists('/apps/web-viewer/src/app/app.electron.module.ts')
    ).toBeFalsy();
    expect(tree.exists('/apps/web-viewer/src/main.electron.ts')).toBeFalsy();

    // should create correct files
    expect(tree.exists('/apps/web-viewer/src/main.ts')).toBeFalsy();

    // make sure start script is correct
    checkPath = '/package.json';
    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
    expect(
github nstudio / xplat / packages / electron-angular / src / schematics / application / index.spec.ts View on Github external
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
    const packageData: any = jsonParse(checkFile);
    expect(packageData.scripts['postinstall']).toBeDefined();
    expect(packageData.scripts['postinstall.electron']).toBeDefined();
    expect(packageData.scripts['postinstall.web']).toBeDefined();
    expect(packageData.scripts['build.electron.foo']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.local']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.linux']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.windows']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.mac']).toBeDefined();
    expect(packageData.scripts['prepare.electron.foo']).toBeDefined();
    expect(packageData.scripts['serve.electron.foo.target']).toBeDefined();
    expect(packageData.scripts['serve.electron.foo']).toBeDefined();
    expect(packageData.scripts['start.electron.foo']).toBeDefined();

    // check target web app for supporting files
    checkPath = '/apps/web-viewer/src/app/app.electron.module.ts';
    expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
    expect(checkFile.indexOf(`TtElectronCoreModule`)).toBeGreaterThanOrEqual(0);
    expect(checkFile.indexOf(`AppElectronModule`)).toBeGreaterThanOrEqual(0);

    checkPath = '/apps/web-viewer/src/main.electron.ts';
    expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
github nstudio / xplat / packages / electron / src / schematics / application / index.spec.ts View on Github external
checkPath = '/package.json';
    expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
    const packageData: any = jsonParse(checkFile);
    expect(packageData.scripts['postinstall']).toBeDefined();
    expect(packageData.scripts['postinstall.electron']).toBeDefined();
    expect(packageData.scripts['postinstall.web']).toBeDefined();
    expect(packageData.scripts['build.electron.foo']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.local']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.linux']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.windows']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.mac']).toBeDefined();
    expect(packageData.scripts['prepare.electron.foo']).toBeDefined();
    expect(packageData.scripts['serve.electron.foo.target']).toBeDefined();
    expect(packageData.scripts['serve.electron.foo']).toBeDefined();
    expect(packageData.scripts['start.electron.foo']).toBeDefined();

    // should *NOT* generate angular specific files
    expect(
      tree.exists('/apps/web-viewer/src/app/app.electron.module.ts')
    ).toBeFalsy();
    expect(tree.exists('/apps/web-viewer/src/main.electron.ts')).toBeFalsy();

    // should create correct files
    expect(tree.exists('/apps/web-viewer/src/main.ts')).toBeFalsy();

    // make sure start script is correct
    checkPath = '/package.json';
    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
github nstudio / xplat / packages / electron-angular / src / schematics / application / index.spec.ts View on Github external
checkPath = '/package.json';
    expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
    const packageData: any = jsonParse(checkFile);
    expect(packageData.scripts['postinstall']).toBeDefined();
    expect(packageData.scripts['postinstall.electron']).toBeDefined();
    expect(packageData.scripts['postinstall.web']).toBeDefined();
    expect(packageData.scripts['build.electron.foo']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.local']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.linux']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.windows']).toBeDefined();
    expect(packageData.scripts['build.electron.foo.mac']).toBeDefined();
    expect(packageData.scripts['prepare.electron.foo']).toBeDefined();
    expect(packageData.scripts['serve.electron.foo.target']).toBeDefined();
    expect(packageData.scripts['serve.electron.foo']).toBeDefined();
    expect(packageData.scripts['start.electron.foo']).toBeDefined();

    // check target web app for supporting files
    checkPath = '/apps/web-viewer/src/app/app.electron.module.ts';
    expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);
    // console.log(checkFile);
    expect(checkFile.indexOf(`TtElectronCoreModule`)).toBeGreaterThanOrEqual(0);
    expect(checkFile.indexOf(`AppElectronModule`)).toBeGreaterThanOrEqual(0);

    checkPath = '/apps/web-viewer/src/main.electron.ts';
    expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);
github intuit / Ignite / src / watch.js View on Github external
function startServer(dist, port) {
  server = serve(dist, {
    silent: true,
    port,
    ignore: ['node_modules']
  });
}
github phenomic / phenomic / packages / core / src / index.js View on Github external
async preview(inputConfig?: PhenomicInputConfig) {
    try {
      const config = await normalizeConfiguration(inputConfig);
      await build(config);
      log(
        `⚡️ Serving on http://localhost:${config.port}` +
          config.baseUrl.pathname,
      );
      serve(config.outdir, {
        port: config.port,
      });
    } catch (e) {
      handleError(e);
    }
  },
};
github nstudio / xplat / src / app.nest / index_spec.ts View on Github external
expect(checkFile.indexOf(`"name": "foo"`)).toBeGreaterThanOrEqual(0);

    expect(
      files.indexOf("/tools/electron/postinstall.js")
    ).toBeGreaterThanOrEqual(0);
    expect(files.indexOf("/tools/web/postinstall.js")).toBeGreaterThanOrEqual(
      0
    );

    checkPath = "/package.json";
    expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);

    checkFile = getFileContent(tree, checkPath);

    const packageData: any = jsonParse(checkFile);
    expect(packageData.scripts["serve.nest.foo"]).toBeDefined();
    expect(packageData.scripts["start.nest.foo"]).toBeDefined();
  });

serve

Static file serving and directory listing

MIT
Latest version published 3 months ago

Package Health Score

88 / 100
Full package analysis