forked from olcxjas-softworks/LarpixClient
Add capacitorjs runtime
This commit is contained in:
parent
d0ece489ee
commit
f90c0e6c40
8362 changed files with 1502407 additions and 1 deletions
77
node_modules/get-pkg-repo/src/cli.js
generated
vendored
Executable file
77
node_modules/get-pkg-repo/src/cli.js
generated
vendored
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require(`fs`);
|
||||
const getPkgRepo = require(`../`);
|
||||
const through = require(`through2`);
|
||||
const util = require(`util`);
|
||||
|
||||
const yargs = require('yargs/yargs')(process.argv.slice(2))
|
||||
.usage(
|
||||
'\nPractice writing repository URL or validate the repository in a package.json file. If used without specifying a package.json file path, you will enter an interactive shell. Otherwise, the repository info in package.json is printed.'
|
||||
)
|
||||
.scriptName('get-pkg-repo')
|
||||
.command('$0')
|
||||
.command('<path> [<path> ...]')
|
||||
.example('get-pkg-repo')
|
||||
.example('get-pkg-repo package.json')
|
||||
.example('cat package.json | get-pkg-repo')
|
||||
.help().argv;
|
||||
|
||||
const input = yargs._;
|
||||
|
||||
if (process.stdin.isTTY) {
|
||||
if (input.length > 0) {
|
||||
input.forEach(path => {
|
||||
let repo;
|
||||
fs.readFile(path, 'utf8', (err, data) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
repo = getPkgRepo(JSON.parse(data));
|
||||
console.log(repo);
|
||||
} catch (e) {
|
||||
console.error(`${path}: ${e.toString()}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
process.stdin
|
||||
.pipe(
|
||||
through.obj((chunk, enc, cb) => {
|
||||
let repo;
|
||||
const pkgData = {
|
||||
repository: chunk.toString(),
|
||||
};
|
||||
|
||||
try {
|
||||
repo = getPkgRepo(pkgData);
|
||||
cb(null, util.format(repo) + '\n');
|
||||
} catch (e) {
|
||||
console.error(e.toString());
|
||||
cb();
|
||||
}
|
||||
})
|
||||
)
|
||||
.pipe(process.stdout);
|
||||
}
|
||||
} else {
|
||||
process.stdin
|
||||
.pipe(
|
||||
through.obj((chunk, enc, cb) => {
|
||||
let repo;
|
||||
try {
|
||||
repo = getPkgRepo(JSON.parse(chunk.toString()));
|
||||
} catch (e) {
|
||||
console.error(e.toString());
|
||||
process.exit(1);
|
||||
}
|
||||
cb(null, util.format(repo) + '\n');
|
||||
})
|
||||
)
|
||||
.pipe(process.stdout);
|
||||
}
|
||||
16
node_modules/get-pkg-repo/src/index.js
generated
vendored
Normal file
16
node_modules/get-pkg-repo/src/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
const hostedGitInfo = require(`hosted-git-info`);
|
||||
const parseRepositoryURL = require(`@hutson/parse-repository-url`);
|
||||
|
||||
module.exports = packageData => {
|
||||
if (!packageData ||
|
||||
!packageData.repository ||
|
||||
(typeof packageData.repository !== 'string' && !packageData.repository.url)) {
|
||||
throw new Error(`No valid "repository" data found in package metadata. Please see https://docs.npmjs.com/files/package.json#repository for proper syntax.`);
|
||||
}
|
||||
|
||||
const repositoryURL = typeof packageData.repository === 'string' ? packageData.repository : packageData.repository.url;
|
||||
|
||||
return hostedGitInfo.fromUrl(repositoryURL) || parseRepositoryURL(repositoryURL);
|
||||
};
|
||||
179
node_modules/get-pkg-repo/src/index.spec.js
generated
vendored
Normal file
179
node_modules/get-pkg-repo/src/index.spec.js
generated
vendored
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
'use strict';
|
||||
|
||||
const {expect} = require(`chai`);
|
||||
const {describe, it} = require(`mocha`);
|
||||
const getPkgRepo = require(`../`);
|
||||
|
||||
describe(`get-pkg-repo`, () => {
|
||||
it(`should error if cannot get repository`, () => {
|
||||
expect(() => getPkgRepo()).to.throw(
|
||||
Error,
|
||||
`No valid "repository" data found in package metadata. Please see https://docs.npmjs.com/files/package.json#repository for proper syntax.`);
|
||||
expect(() => getPkgRepo({})).to.throw(
|
||||
Error,
|
||||
`No valid "repository" data found in package metadata. Please see https://docs.npmjs.com/files/package.json#repository for proper syntax.`);
|
||||
expect(() => getPkgRepo({repository: {type: `git`}})).to.throw(
|
||||
Error,
|
||||
`No valid "repository" data found in package metadata. Please see https://docs.npmjs.com/files/package.json#repository for proper syntax.`);
|
||||
});
|
||||
|
||||
it(`should parse github http when it's just a string`, () => {
|
||||
const repository = getPkgRepo({repository: `http://github.com/a/b`});
|
||||
expect(repository).to.contain({
|
||||
domain: `github.com`,
|
||||
type: `github`,
|
||||
user: `a`,
|
||||
project: `b`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse github http`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `http://github.com/a/b`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `github.com`,
|
||||
type: `github`,
|
||||
user: `a`,
|
||||
project: `b`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse github https`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `https://github.com/a/b`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `github.com`,
|
||||
type: `github`,
|
||||
user: `a`,
|
||||
project: `b`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse gitlab https`, () => {
|
||||
const repository = getPkgRepo({repository: `https://gitlab.com/hyper-expanse/semantic-release-gitlab-releaser.git`});
|
||||
expect(repository).to.contain({
|
||||
domain: `gitlab.com`,
|
||||
type: `gitlab`,
|
||||
user: `hyper-expanse`,
|
||||
project: `semantic-release-gitlab-releaser`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse github ssh`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `git@github.com:joyent/node.git`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `github.com`,
|
||||
type: `github`,
|
||||
user: `joyent`,
|
||||
project: `node`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse private gitlab ssh`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `git@gitlab.team.com:username/test.git`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `gitlab.team.com`,
|
||||
type: `gitlab`,
|
||||
user: `username`,
|
||||
project: `test`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse github short`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `a/b`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `github.com`,
|
||||
type: `github`,
|
||||
user: `a`,
|
||||
project: `b`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse bitbucket`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `https://bitbucket.org/a/b.git`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `bitbucket.org`,
|
||||
type: `bitbucket`,
|
||||
user: `a`,
|
||||
project: `b`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse svn`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `svn://a/b`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `a`,
|
||||
project: null,
|
||||
type: null,
|
||||
user: null,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse https`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `https://a/b`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `a`,
|
||||
project: null,
|
||||
type: null,
|
||||
user: null,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse a url with an @`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `a@b.com`}});
|
||||
expect(repository).to.contain({
|
||||
domain: null,
|
||||
project: null,
|
||||
type: null,
|
||||
user: null,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should fix bad protocol`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `badprotocol://a/b`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `a`,
|
||||
project: null,
|
||||
type: null,
|
||||
user: null,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse github enterprise http url`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `http://github.mycompany.dev/user/myRepo`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `github.mycompany.dev`,
|
||||
user: `user`,
|
||||
project: `myRepo`,
|
||||
type: `github`,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse unknown git URL`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `git@git.ourdomain.co:group1/group2/group3/project.git`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `git.ourdomain.co`,
|
||||
user: `group1/group2/group3`,
|
||||
project: `project`,
|
||||
type: null,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse simple unknown host`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `https://unknown-host/`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `unknown-host`,
|
||||
project: null,
|
||||
type: null,
|
||||
user: null,
|
||||
});
|
||||
});
|
||||
|
||||
it(`should parse weird unknown host`, () => {
|
||||
const repository = getPkgRepo({repository: {url: `https://unknown-host/.git`}});
|
||||
expect(repository).to.contain({
|
||||
domain: `unknown-host`,
|
||||
project: null,
|
||||
type: null,
|
||||
user: null,
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue