How to use the npm-packlist.sync function in npm-packlist

To help you get started, we’ve selected a few npm-packlist 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 github / vscode-codeql / tools / build-tasks / src / deploy.ts View on Github external
async function collectPackages(context: RushContext, name: string, version: string,
  pkgs: PackageMap): Promise {

  let pkg = pkgs.getPackageInfo(name, version);
  if (!pkg) {
    const info = await context.getPackageInfo(name, version);

    let files: string[];
    if (info.isLocal) {
      // For local packages, use `packlist` to get the list of files that npm would have packed
      // into the tarball.
      files = packlist.sync({ path: info.path });
    }
    else {
      // For non-local packages, just copy everything.
      files = await glob('**/*', {
        nodir: true,
        cwd: info.path
      });
    }

    pkg = {
      name: name,
      version: version,
      sourcePath: info.path,
      files: files,
      dependencies: []
    };
github eslint / eslint / lib / config-tester / config-tester.js View on Github external
it("should contain all files that your config referred.", () => {
                        const validFiles = new Set(
                            packlist.sync({ path: projectRoot })
                                .map(relPath => path.relative(projectRoot, path.resolve(projectRoot, relPath)))
                        );
                        const invalidFiles = getDependedFiles()
                            .map(filePath => path.relative(projectRoot, filePath))
                            .filter(filePath => !filePath.startsWith(`node_modules${path.sep}`) && !validFiles.has(filePath))
                            .sort();

                        assert.deepStrictEqual(
                            invalidFiles,
                            [],
                            `${invalidFiles.length} file(s) were not contained in your package. Check your 'package.json' and '.npmignore'.`
                        );
                    });
github netlify / zip-it-and-ship-it / src / finders.js View on Github external
modulePaths.forEach(modulePath => {
    const packageJson = pkgs[modulePath]
    let moduleFilePaths

    moduleFilePaths = packList.sync({ path: modulePath })

    moduleFilePaths.forEach(moduleFilePath => {
      if (includeModuleFile(packageJson, moduleFilePath)) {
        filePaths.add(path.join(modulePath, moduleFilePath))
      }
    })
  })
github fimbullinter / wotan / scripts / api-guard.ts View on Github external
function checkPackage(packageDir: string, baselineDir: string, callback: (content: string, filename: string) => void) {
    const list = packlist.sync({path: packageDir});
    callback(list.join('\n'), path.join(baselineDir, 'packlist.txt'));

    for (const file of list)
        if (file.endsWith('.d.ts'))
            callback(stripPrivateMembers(fs.readFileSync(path.join(packageDir, file), 'utf8')), path.join(baselineDir, file));
}
github DavidWells / serverless-manifest-plugin / src / getDeps.js View on Github external
modulePaths.forEach(modulePath => {
    const packageJson = pkgs[modulePath];
    let moduleFilePaths;

    moduleFilePaths = packList.sync({ path: modulePath });

    moduleFilePaths.forEach(moduleFilePath => {
      if (includeModuleFile(packageJson, moduleFilePath)) {
        filePaths.add(path.join(modulePath, moduleFilePath));
      }
    });
  });
github netlify / netlify-dev-plugin / src / utils / finders.js View on Github external
modulePaths.forEach(modulePath => {
    const packageJson = pkgs[modulePath];
    let moduleFilePaths;

    moduleFilePaths = packList.sync({ path: modulePath });

    moduleFilePaths.forEach(moduleFilePath => {
      if (includeModuleFile(packageJson, moduleFilePath)) {
        filePaths.add(path.join(modulePath, moduleFilePath));
      }
    });
  });
github netlify / cli / src / utils / finders.js View on Github external
modulePaths.forEach(modulePath => {
    const packageJson = pkgs[modulePath]
    let moduleFilePaths

    moduleFilePaths = packList.sync({ path: modulePath })

    moduleFilePaths.forEach(moduleFilePath => {
      if (includeModuleFile(packageJson, moduleFilePath)) {
        filePaths.add(path.join(modulePath, moduleFilePath))
      }
    })
  })

npm-packlist

Get a list of the files to add from a folder into an npm package

ISC
Latest version published 3 months ago

Package Health Score

91 / 100
Full package analysis

Popular npm-packlist functions

Similar packages