Giter Site home page Giter Site logo

Comments (4)

richardlau avatar richardlau commented on June 6, 2024

Yes, unless useGitClone is set:

citgm/README.md

Line 141 in c47ab10

"useGitClone": true Use a shallow git clone instead of downloading the module

from citgm.

simone-sanfratello avatar simone-sanfratello commented on June 6, 2024

Thanks

from citgm.

SimenB avatar SimenB commented on June 6, 2024

head: true also works, I think?

citgm/README.md

Line 128 in c47ab10

"head": true Use the head of the default branch

from citgm.

richardlau avatar richardlau commented on June 6, 2024

head: true also works, I think?

citgm/README.md

Line 128 in c47ab10

"head": true Use the head of the default branch

Possibly. If someone wants to look through the logic, it's in lookup() in lib/lookup.js:

citgm/lib/lookup.js

Lines 86 to 209 in b8193a7

/**
* Certain known modules in npm do not publish their tests,
* causing npm test to fail. In such cases, we need to grab
* the tarball from github. If the package has been published
* from its git repository, npm adds a `gitHead` property to
* the package.json and we can use that to generate the tarball
* URL. Otherwise, we fallback to the git tag. Complicating matters
* is the fact that git tags are not named consistently.
* The lookup mechanism allows us to make a "best guess"
* mapping for known modules. If the -l or --lookup CLI
* argument is known, the npm spec is converted into a
* github tarball url using the information contained in a
* lookup json file. When -l or --lookup is passed without
* a value, the built-in lookup.json file is used. Alternatively,
* the path to a different lookup json file can be specified
**/
export function lookup(context) {
const lookupTable = getLookupTable(context.options);
if (!lookupTable) {
throw new Error('Lookup table could not be loaded');
}
const detail = context.module;
context.emit('data', 'info', 'lookup', detail.name);
const meta = context.meta;
if (meta) {
const rep = lookupTable[detail.name];
context.module.version = meta.version;
if (rep) {
context.emit('data', 'info', 'lookup-found', detail.name);
if (rep.envVar) {
context.module.envVar = rep.envVar;
}
if (rep.stripAnsi) {
context.module.stripAnsi = rep.stripAnsi;
}
if (typeof rep.replace === 'boolean' && !rep.replace) {
rep.npm = true;
}
if (!rep.npm) {
if (!rep.repo && !meta.repository) {
throw new Error('no-repository-field in package.json');
}
if (rep.useGitClone) {
const { url, ref } = makeClone(
getRepo(rep.repo, meta),
rep.head ? null : detail.fetchSpec,
meta['dist-tags'],
rep.prefix
);
context.emit(
'data',
'info',
`${context.module.name} lookup-replace`,
url
);
context.module.useGitClone = true;
context.module.raw = url;
context.module.ref = ref;
} else {
const gitHead = rep.head || rep.ignoreGitHead ? null : meta.gitHead;
const url = makeUrl(
getRepo(rep.repo, meta),
rep.head ? null : detail.fetchSpec,
meta['dist-tags'],
rep.head ? null : rep.prefix,
context.options.sha || rep.sha || gitHead
);
context.emit(
'data',
'info',
`${context.module.name} lookup-replace`,
url
);
context.module.raw = url;
}
}
if (rep.install) {
context.emit(
'data',
'verbose',
`${context.module.name} lookup-install`,
rep.install
);
context.module.install = rep.install;
}
if (rep.scripts) {
context.emit(
'data',
'silly',
`${context.module.name} lookup-scripts`,
rep.scripts
);
context.module.scripts = rep.scripts;
}
if (rep.tags) {
context.module.tags = rep.tags;
}
if (rep.yarn) {
context.module.useYarn = true;
}
if (rep.timeout) {
context.module.timeout = rep.timeout;
}
context.module.flaky = context.options.failFlaky
? false
: defaultMatcher.isMatch(rep.flaky);
context.module.expectFail = context.options.expectFail
? false
: defaultMatcher.isMatch(rep.expectFail);
} else {
context.emit('data', 'info', 'lookup-notfound', detail.name);
if (meta.gitHead) {
const url = makeUrl(
getRepo(null, meta),
null,
null,
null,
context.options.sha || meta.gitHead
);
context.emit('data', 'info', 'lookup-githead', url);
context.module.raw = url;
}
}
}

from citgm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.