@quenty/nevermore-cli 4.12.4 → 4.13.0-canary.637.d86930c.0
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.
- package/CHANGELOG.md +11 -0
- package/dist/args/global-args.js +1 -2
- package/dist/commands/download-roblox-types.d.ts +1 -1
- package/dist/commands/download-roblox-types.d.ts.map +1 -1
- package/dist/commands/download-roblox-types.js +43 -88
- package/dist/commands/download-roblox-types.js.map +1 -1
- package/dist/commands/init-game-command.d.ts +1 -1
- package/dist/commands/init-game-command.d.ts.map +1 -1
- package/dist/commands/init-game-command.js +69 -113
- package/dist/commands/init-game-command.js.map +1 -1
- package/dist/commands/init-package-command.d.ts +1 -1
- package/dist/commands/init-package-command.d.ts.map +1 -1
- package/dist/commands/init-package-command.js +31 -75
- package/dist/commands/init-package-command.js.map +1 -1
- package/dist/commands/init-plugin-command.d.ts +1 -1
- package/dist/commands/init-plugin-command.d.ts.map +1 -1
- package/dist/commands/init-plugin-command.js +28 -70
- package/dist/commands/init-plugin-command.js.map +1 -1
- package/dist/commands/install-package-command.d.ts +2 -2
- package/dist/commands/install-package-command.d.ts.map +1 -1
- package/dist/commands/install-package-command.js +42 -62
- package/dist/commands/install-package-command.js.map +1 -1
- package/dist/commands/pack-command.d.ts +1 -1
- package/dist/commands/pack-command.d.ts.map +1 -1
- package/dist/commands/pack-command.js +19 -59
- package/dist/commands/pack-command.js.map +1 -1
- package/dist/commands/test-project-command.d.ts +1 -1
- package/dist/commands/test-project-command.d.ts.map +1 -1
- package/dist/commands/test-project-command.js +89 -124
- package/dist/commands/test-project-command.js.map +1 -1
- package/dist/nevermore.js +29 -25
- package/dist/nevermore.js.map +1 -1
- package/dist/utils/nevermore-cli-utils.d.ts +3 -3
- package/dist/utils/nevermore-cli-utils.d.ts.map +1 -1
- package/dist/utils/nevermore-cli-utils.js +19 -61
- package/dist/utils/nevermore-cli-utils.js.map +1 -1
- package/package.json +13 -12
- package/src/commands/download-roblox-types.ts +1 -1
- package/src/commands/init-game-command.ts +2 -3
- package/src/commands/init-package-command.ts +2 -2
- package/src/commands/init-plugin-command.ts +3 -3
- package/src/commands/install-package-command.ts +31 -27
- package/src/commands/pack-command.ts +2 -2
- package/src/commands/test-project-command.ts +2 -2
- package/src/nevermore.ts +20 -7
- package/src/utils/nevermore-cli-utils.ts +3 -3
- package/tsconfig.json +5 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
* Install Nevermore packages from npm
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { Argv, CommandModule } from
|
|
6
|
-
import { OutputHelper } from
|
|
7
|
-
import { NevermoreGlobalArgs } from
|
|
8
|
-
import {
|
|
9
|
-
runCommandAsync,
|
|
10
|
-
} from "../utils/nevermore-cli-utils";
|
|
5
|
+
import { Argv, CommandModule } from 'yargs';
|
|
6
|
+
import { OutputHelper } from '@quenty/cli-output-helpers';
|
|
7
|
+
import { NevermoreGlobalArgs } from '../args/global-args.js';
|
|
8
|
+
import { runCommandAsync } from '../utils/nevermore-cli-utils.js';
|
|
11
9
|
|
|
12
10
|
export interface InstallPackageArgs extends NevermoreGlobalArgs {
|
|
13
11
|
packages: string[];
|
|
@@ -16,27 +14,29 @@ export interface InstallPackageArgs extends NevermoreGlobalArgs {
|
|
|
16
14
|
/**
|
|
17
15
|
* Install a Nevermore package from npm
|
|
18
16
|
*/
|
|
19
|
-
export class InstallPackageCommand<T>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
public
|
|
17
|
+
export class InstallPackageCommand<T>
|
|
18
|
+
implements CommandModule<T, InstallPackageArgs>
|
|
19
|
+
{
|
|
20
|
+
public command = 'install [packages..]';
|
|
21
|
+
public aliases = ['i'];
|
|
22
|
+
public describe = 'Install Nevermore packages from npm';
|
|
23
23
|
|
|
24
24
|
private static _validatePackageName(name: string): void {
|
|
25
25
|
if (!name) {
|
|
26
|
-
throw new Error(
|
|
26
|
+
throw new Error('Package name is required!');
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
private static async _getPackages(): Promise<string[]> {
|
|
31
31
|
try {
|
|
32
32
|
const response = await fetch(
|
|
33
|
-
|
|
33
|
+
'https://registry.npmjs.org/-/v1/search?text=@quenty/&size=1000'
|
|
34
34
|
);
|
|
35
35
|
const data = await response.json();
|
|
36
36
|
return data.objects
|
|
37
37
|
.map((obj: any) => obj.package.name)
|
|
38
|
-
.filter((name: string) => name.startsWith(
|
|
39
|
-
.map((name: string) => name.replace(
|
|
38
|
+
.filter((name: string) => name.startsWith('@quenty/'))
|
|
39
|
+
.map((name: string) => name.replace('@quenty/', ''))
|
|
40
40
|
.sort();
|
|
41
41
|
} catch {
|
|
42
42
|
return [];
|
|
@@ -44,14 +44,14 @@ export class InstallPackageCommand<T> implements CommandModule<T, InstallPackage
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
public builder(args: Argv<T>) {
|
|
47
|
-
args.positional(
|
|
48
|
-
type:
|
|
47
|
+
args.positional('packages', {
|
|
48
|
+
type: 'string',
|
|
49
49
|
array: true,
|
|
50
|
-
describe:
|
|
50
|
+
describe: 'Name of the package(s) to install',
|
|
51
51
|
completion: async (current: string) => {
|
|
52
52
|
const packages = await InstallPackageCommand._getPackages();
|
|
53
|
-
return packages.filter(name => !current || name.startsWith(current));
|
|
54
|
-
}
|
|
53
|
+
return packages.filter((name) => !current || name.startsWith(current));
|
|
54
|
+
},
|
|
55
55
|
});
|
|
56
56
|
return args as Argv<InstallPackageArgs>;
|
|
57
57
|
}
|
|
@@ -60,26 +60,30 @@ export class InstallPackageCommand<T> implements CommandModule<T, InstallPackage
|
|
|
60
60
|
const srcRoot = process.cwd();
|
|
61
61
|
|
|
62
62
|
if (!args.packages?.length) {
|
|
63
|
-
throw new Error(
|
|
63
|
+
throw new Error('No packages specified!');
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
args.packages.forEach(packageName =>
|
|
66
|
+
args.packages.forEach((packageName) =>
|
|
67
|
+
InstallPackageCommand._validatePackageName(packageName)
|
|
68
|
+
);
|
|
67
69
|
|
|
68
70
|
const availablePackages = await InstallPackageCommand._getPackages();
|
|
69
71
|
const invalidPackages = args.packages.filter(
|
|
70
|
-
packageName => !availablePackages.includes(packageName)
|
|
72
|
+
(packageName) => !availablePackages.includes(packageName)
|
|
71
73
|
);
|
|
72
74
|
|
|
73
75
|
if (invalidPackages.length > 0) {
|
|
74
|
-
throw new Error(`Invalid packages: ${invalidPackages.join(
|
|
76
|
+
throw new Error(`Invalid packages: ${invalidPackages.join(', ')}`);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
const prefixedPackages = args.packages.map(
|
|
79
|
+
const prefixedPackages = args.packages.map(
|
|
80
|
+
(packageName) => `@quenty/${packageName}`
|
|
81
|
+
);
|
|
78
82
|
|
|
79
|
-
OutputHelper.info(`Installing packages: ${args.packages.join(
|
|
83
|
+
OutputHelper.info(`Installing packages: ${args.packages.join(', ')}`);
|
|
80
84
|
|
|
81
|
-
await runCommandAsync(args,
|
|
85
|
+
await runCommandAsync(args, 'npm', ['install', ...prefixedPackages], {
|
|
82
86
|
cwd: srcRoot,
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
|
-
}
|
|
89
|
+
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
import { Argv, CommandModule } from 'yargs';
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
import { TemplateHelper } from '@quenty/nevermore-template-helpers';
|
|
8
|
-
import { NevermoreGlobalArgs } from '../args/global-args';
|
|
8
|
+
import { NevermoreGlobalArgs } from '../args/global-args.js';
|
|
9
9
|
import {
|
|
10
10
|
getTemplatePathByName,
|
|
11
11
|
runCommandAsync,
|
|
12
|
-
} from '../utils/nevermore-cli-utils';
|
|
12
|
+
} from '../utils/nevermore-cli-utils.js';
|
|
13
13
|
|
|
14
14
|
export interface PackArgs extends NevermoreGlobalArgs {
|
|
15
15
|
packageDirectory: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Argv, CommandModule } from 'yargs';
|
|
2
2
|
import { OutputHelper } from '@quenty/cli-output-helpers';
|
|
3
|
-
import { NevermoreGlobalArgs } from '../args/global-args';
|
|
4
|
-
import { runCommandAsync } from '../utils/nevermore-cli-utils';
|
|
3
|
+
import { NevermoreGlobalArgs } from '../args/global-args.js';
|
|
4
|
+
import { runCommandAsync } from '../utils/nevermore-cli-utils.js';
|
|
5
5
|
import * as fs from 'fs/promises';
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
|
package/src/nevermore.ts
CHANGED
|
@@ -6,15 +6,28 @@
|
|
|
6
6
|
|
|
7
7
|
import yargs from 'yargs';
|
|
8
8
|
import { hideBin } from 'yargs/helpers';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
import { dirname, join } from 'path';
|
|
9
11
|
import { OutputHelper } from '@quenty/cli-output-helpers';
|
|
12
|
+
import { checkForUpdatesAsync } from '@quenty/nevermore-cli-helpers';
|
|
10
13
|
|
|
11
|
-
import { InitGameCommand } from './commands/init-game-command';
|
|
12
|
-
import { InitPackageCommand } from './commands/init-package-command';
|
|
13
|
-
import { InitPluginCommand } from './commands/init-plugin-command';
|
|
14
|
-
import { PackCommand } from './commands/pack-command';
|
|
15
|
-
import { InstallPackageCommand } from './commands/install-package-command';
|
|
16
|
-
import { TestProjectCommand } from './commands/test-project-command';
|
|
17
|
-
import { DownloadRobloxTypes } from './commands/download-roblox-types';
|
|
14
|
+
import { InitGameCommand } from './commands/init-game-command.js';
|
|
15
|
+
import { InitPackageCommand } from './commands/init-package-command.js';
|
|
16
|
+
import { InitPluginCommand } from './commands/init-plugin-command.js';
|
|
17
|
+
import { PackCommand } from './commands/pack-command.js';
|
|
18
|
+
import { InstallPackageCommand } from './commands/install-package-command.js';
|
|
19
|
+
import { TestProjectCommand } from './commands/test-project-command.js';
|
|
20
|
+
import { DownloadRobloxTypes } from './commands/download-roblox-types.js';
|
|
21
|
+
|
|
22
|
+
await checkForUpdatesAsync({
|
|
23
|
+
humanReadableName: 'Nevermore CLI',
|
|
24
|
+
packageName: '@quenty/nevermore-cli',
|
|
25
|
+
registryUrl: 'https://registry.npmjs.org/',
|
|
26
|
+
packageJsonPath: join(
|
|
27
|
+
dirname(fileURLToPath(import.meta.url)),
|
|
28
|
+
'../package.json'
|
|
29
|
+
),
|
|
30
|
+
});
|
|
18
31
|
|
|
19
32
|
yargs(hideBin(process.argv))
|
|
20
33
|
.scriptName('nevermore')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import { OutputHelper } from '@quenty/cli-output-helpers';
|
|
3
|
-
import { NevermoreGlobalArgs } from '../args/global-args';
|
|
4
|
-
import execa from 'execa';
|
|
3
|
+
import { NevermoreGlobalArgs } from '../args/global-args.js';
|
|
4
|
+
import { execa, Options } from 'execa';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Gets a temlate path by name
|
|
@@ -16,7 +16,7 @@ export async function runCommandAsync(
|
|
|
16
16
|
initGameArgs: NevermoreGlobalArgs,
|
|
17
17
|
command: string,
|
|
18
18
|
args: string[],
|
|
19
|
-
options?:
|
|
19
|
+
options?: Options
|
|
20
20
|
): Promise<any> {
|
|
21
21
|
if (initGameArgs.dryrun) {
|
|
22
22
|
OutputHelper.info(
|
package/tsconfig.json
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "./dist",
|
|
5
5
|
"rootDir": "./src",
|
|
6
|
-
"declarationDir": "./dist"
|
|
6
|
+
"declarationDir": "./dist",
|
|
7
|
+
"composite": true,
|
|
8
|
+
"declaration": true
|
|
7
9
|
},
|
|
8
10
|
"references": [
|
|
9
11
|
{ "path": "../cli-output-helpers" },
|
|
10
|
-
{ "path": "../nevermore-template-helpers" }
|
|
12
|
+
{ "path": "../nevermore-template-helpers" },
|
|
13
|
+
{ "path": "../nevermore-cli-helpers" }
|
|
11
14
|
],
|
|
12
15
|
"include": ["src/**/*"]
|
|
13
16
|
}
|