dceky 1.0.5-beta.ky-declarations.8 → 1.0.5-beta.ky-declarations.10
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/lib/postinstall/helpers/exec.d.ts +8 -0
- package/lib/postinstall/helpers/exec.js +18 -0
- package/lib/postinstall/helpers/exec.js.map +1 -0
- package/lib/postinstall/helpers/getRootPath.d.ts +7 -0
- package/lib/postinstall/helpers/getRootPath.js +17 -0
- package/lib/postinstall/helpers/getRootPath.js.map +1 -0
- package/lib/postinstall/index.d.ts +5 -0
- package/lib/postinstall/index.js +58 -0
- package/lib/postinstall/index.js.map +1 -0
- package/lib/setup/index.js +1 -1
- package/lib/setup/index.js.map +1 -1
- package/package.json +4 -2
- package/postinstall/helpers/exec.ts +17 -0
- package/postinstall/helpers/getRootPath.ts +13 -0
- package/postinstall/index.ts +68 -0
- package/preinstall/helpers/getRootPath.ts +13 -0
- package/preinstall/index.ts +26 -0
- package/setup/index.ts +1 -1
- package/tsconfig.json +7 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute a command
|
|
3
|
+
* @author Gabe Abrams
|
|
4
|
+
* @param command the command to execute
|
|
5
|
+
* @param printToStdOut if true, print to standard out instead of returning
|
|
6
|
+
*/
|
|
7
|
+
declare const exec: (command: string, printToStdOut?: boolean) => string;
|
|
8
|
+
export default exec;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var child_process_1 = require("child_process");
|
|
4
|
+
/**
|
|
5
|
+
* Execute a command
|
|
6
|
+
* @author Gabe Abrams
|
|
7
|
+
* @param command the command to execute
|
|
8
|
+
* @param printToStdOut if true, print to standard out instead of returning
|
|
9
|
+
*/
|
|
10
|
+
var exec = function (command, printToStdOut) {
|
|
11
|
+
if (printToStdOut) {
|
|
12
|
+
(0, child_process_1.execSync)(command, { stdio: 'inherit' });
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
return (0, child_process_1.execSync)(command).toString();
|
|
16
|
+
};
|
|
17
|
+
exports.default = exec;
|
|
18
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../../postinstall/helpers/exec.ts"],"names":[],"mappings":";;AAAA,+CAAyC;AAEzC;;;;;GAKG;AACH,IAAM,IAAI,GAAG,UAAC,OAAe,EAAE,aAAuB;IACpD,IAAI,aAAa,EAAE,CAAC;QAClB,IAAA,wBAAQ,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACxC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,IAAA,wBAAQ,EAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtC,CAAC,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var path_1 = __importDefault(require("path"));
|
|
7
|
+
/**
|
|
8
|
+
* Get the root path of the project
|
|
9
|
+
* @author Yuen Ler Chow
|
|
10
|
+
* @returns the root path of the project
|
|
11
|
+
*/
|
|
12
|
+
var getRootPath = function () {
|
|
13
|
+
var root = path_1.default.join(__dirname, '../../../../');
|
|
14
|
+
return root;
|
|
15
|
+
};
|
|
16
|
+
exports.default = getRootPath;
|
|
17
|
+
//# sourceMappingURL=getRootPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRootPath.js","sourceRoot":"","sources":["../../../postinstall/helpers/getRootPath.ts"],"names":[],"mappings":";;;;;AAAA,8CAAwB;AAExB;;;;GAIG;AACH,IAAM,WAAW,GAAG;IAClB,IAAM,IAAI,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
/**
|
|
4
|
+
* Adds scripts to the top-level project
|
|
5
|
+
* @author Gabe Abrams
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
// Import libs
|
|
12
|
+
var fs_1 = __importDefault(require("fs"));
|
|
13
|
+
var path_1 = __importDefault(require("path"));
|
|
14
|
+
// Import helpers
|
|
15
|
+
var exec_1 = __importDefault(require("./helpers/exec"));
|
|
16
|
+
var getRootPath_1 = __importDefault(require("./helpers/getRootPath"));
|
|
17
|
+
// Get the project directory
|
|
18
|
+
var root = (0, getRootPath_1.default)();
|
|
19
|
+
// Read the root package.json
|
|
20
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
21
|
+
var pkgJson = require(path_1.default.join(root, 'package.json'));
|
|
22
|
+
// Ensure scripts field exists
|
|
23
|
+
if (!pkgJson.scripts) {
|
|
24
|
+
pkgJson.scripts = {};
|
|
25
|
+
}
|
|
26
|
+
// Keep track if something was modified
|
|
27
|
+
var modified = false;
|
|
28
|
+
// Add ky:setup script
|
|
29
|
+
if (!pkgJson.scripts['ky:setup']) {
|
|
30
|
+
pkgJson.scripts['ky:setup'] = 'npm explore dceky -- npm run ky:setup';
|
|
31
|
+
modified = true;
|
|
32
|
+
}
|
|
33
|
+
// Add ky:start script
|
|
34
|
+
if (!pkgJson.scripts['ky:start']) {
|
|
35
|
+
pkgJson.scripts['ky:start'] = 'npm explore dceky -- npm run ky:start';
|
|
36
|
+
modified = true;
|
|
37
|
+
}
|
|
38
|
+
// Add ky:dev script
|
|
39
|
+
if (!pkgJson.scripts['ky:dev']) {
|
|
40
|
+
pkgJson.scripts['ky:dev'] = 'npm explore dceky -- npm run ky:dev';
|
|
41
|
+
modified = true;
|
|
42
|
+
}
|
|
43
|
+
// Write back the modified package.json
|
|
44
|
+
fs_1.default.writeFileSync(path_1.default.join(root, 'package.json'), JSON.stringify(pkgJson, null, 2), 'utf8');
|
|
45
|
+
// Automatically set up
|
|
46
|
+
if (modified) {
|
|
47
|
+
console.log('\nRunning initial ky setup...');
|
|
48
|
+
(0, exec_1.default)("cd ".concat(root, " && npm run ky:setup"), true);
|
|
49
|
+
}
|
|
50
|
+
// Notify user
|
|
51
|
+
if (modified) {
|
|
52
|
+
console.log('\nAdded dceky scripts to package.json');
|
|
53
|
+
console.log('You can now run:');
|
|
54
|
+
console.log(' npm run ky:start # Start ky tests');
|
|
55
|
+
console.log(' npm run ky:setup # Setup or update ky-managed files in this project');
|
|
56
|
+
console.log(' npm run ky:dev # Start ky tests after ensuring set up');
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../postinstall/index.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B;;;GAGG;;;;;AAEH,cAAc;AACd,0CAAoB;AACpB,8CAAwB;AAExB,iBAAiB;AACjB,wDAAkC;AAClC,sEAAgD;AAEhD,4BAA4B;AAC5B,IAAM,IAAI,GAAG,IAAA,qBAAW,GAAE,CAAC;AAE3B,6BAA6B;AAC7B,qEAAqE;AACrE,IAAM,OAAO,GAAG,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;AAEzD,8BAA8B;AAC9B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACrB,OAAO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C,yEAAyE,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;AAC7E,CAAC"}
|
package/lib/setup/index.js
CHANGED
|
@@ -10,11 +10,11 @@ var setupCypressDependencies_1 = __importDefault(require("./setupCypressDependen
|
|
|
10
10
|
var checkRequiredFiles_1 = __importDefault(require("./checkRequiredFiles"));
|
|
11
11
|
var genE2ELaunchFile_1 = __importDefault(require("./genE2ELaunchFile"));
|
|
12
12
|
var genKyCommandDeclarations_1 = __importDefault(require("./genKyCommandDeclarations"));
|
|
13
|
+
(0, setupCypressDependencies_1.default)();
|
|
13
14
|
(0, checkRequiredFiles_1.default)();
|
|
14
15
|
(0, genCommandImportFile_1.default)();
|
|
15
16
|
(0, genDynamicConfigFile_1.default)();
|
|
16
17
|
(0, addToGitIgnore_1.default)();
|
|
17
|
-
(0, setupCypressDependencies_1.default)();
|
|
18
18
|
(0, genE2ELaunchFile_1.default)();
|
|
19
19
|
(0, genKyCommandDeclarations_1.default)();
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
package/lib/setup/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../setup/index.ts"],"names":[],"mappings":";;;;;AAAA,gFAA0D;AAC1D,gFAA0D;AAC1D,oEAA8C;AAC9C,wFAAkE;AAClE,4EAAsD;AACtD,wEAAkD;AAClD,wFAAkE;AAElE,IAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../setup/index.ts"],"names":[],"mappings":";;;;;AAAA,gFAA0D;AAC1D,gFAA0D;AAC1D,oEAA8C;AAC9C,wFAAkE;AAClE,4EAAsD;AACtD,wEAAkD;AAClD,wFAAkE;AAElE,IAAA,kCAAwB,GAAE,CAAC;AAC3B,IAAA,4BAAkB,GAAE,CAAC;AACrB,IAAA,8BAAoB,GAAE,CAAC;AACvB,IAAA,8BAAoB,GAAE,CAAC;AACvB,IAAA,wBAAc,GAAE,CAAC;AACjB,IAAA,0BAAgB,GAAE,CAAC;AACnB,IAAA,kCAAwB,GAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dceky",
|
|
3
|
-
"version": "1.0.5-beta.ky-declarations.
|
|
3
|
+
"version": "1.0.5-beta.ky-declarations.10",
|
|
4
4
|
"description": "Cypress toolkit for Harvard DCE",
|
|
5
5
|
"main": "./lib/src/index.js",
|
|
6
6
|
"types": "./lib/src/index.d.ts",
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
"build": "tsc --project ./tsconfig.json",
|
|
9
9
|
"ky:start": "npx tsx ./start/index.ts",
|
|
10
10
|
"ky:setup": "npx tsx ./setup/index.ts",
|
|
11
|
-
"ky:dev": "npm run ky:setup && npm run ky:start"
|
|
11
|
+
"ky:dev": "npm run ky:setup && npm run ky:start",
|
|
12
|
+
"preinstall": "npx tsx ./preinstall/index.ts",
|
|
13
|
+
"postinstall": "npx tsx ./postinstall/index.ts"
|
|
12
14
|
},
|
|
13
15
|
"repository": {
|
|
14
16
|
"type": "git",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Execute a command
|
|
5
|
+
* @author Gabe Abrams
|
|
6
|
+
* @param command the command to execute
|
|
7
|
+
* @param printToStdOut if true, print to standard out instead of returning
|
|
8
|
+
*/
|
|
9
|
+
const exec = (command: string, printToStdOut?: boolean): string => {
|
|
10
|
+
if (printToStdOut) {
|
|
11
|
+
execSync(command, { stdio: 'inherit' });
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
return execSync(command).toString();
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default exec;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the root path of the project
|
|
5
|
+
* @author Yuen Ler Chow
|
|
6
|
+
* @returns the root path of the project
|
|
7
|
+
*/
|
|
8
|
+
const getRootPath = () => {
|
|
9
|
+
const root = path.join(__dirname, '../../../../');
|
|
10
|
+
return root;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default getRootPath;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/**
|
|
3
|
+
* Adds scripts to the top-level project
|
|
4
|
+
* @author Gabe Abrams
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Import libs
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
|
|
11
|
+
// Import helpers
|
|
12
|
+
import exec from './helpers/exec';
|
|
13
|
+
import getRootPath from './helpers/getRootPath';
|
|
14
|
+
|
|
15
|
+
// Get the project directory
|
|
16
|
+
const root = getRootPath();
|
|
17
|
+
|
|
18
|
+
// Read the root package.json
|
|
19
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
20
|
+
const pkgJson = require(path.join(root, 'package.json'));
|
|
21
|
+
|
|
22
|
+
// Ensure scripts field exists
|
|
23
|
+
if (!pkgJson.scripts) {
|
|
24
|
+
pkgJson.scripts = {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Keep track if something was modified
|
|
28
|
+
let modified = false;
|
|
29
|
+
|
|
30
|
+
// Add ky:setup script
|
|
31
|
+
if (!pkgJson.scripts['ky:setup']) {
|
|
32
|
+
pkgJson.scripts['ky:setup'] = 'npm explore dceky -- npm run ky:setup';
|
|
33
|
+
modified = true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Add ky:start script
|
|
37
|
+
if (!pkgJson.scripts['ky:start']) {
|
|
38
|
+
pkgJson.scripts['ky:start'] = 'npm explore dceky -- npm run ky:start';
|
|
39
|
+
modified = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Add ky:dev script
|
|
43
|
+
if (!pkgJson.scripts['ky:dev']) {
|
|
44
|
+
pkgJson.scripts['ky:dev'] = 'npm explore dceky -- npm run ky:dev';
|
|
45
|
+
modified = true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Write back the modified package.json
|
|
49
|
+
fs.writeFileSync(
|
|
50
|
+
path.join(root, 'package.json'),
|
|
51
|
+
JSON.stringify(pkgJson, null, 2),
|
|
52
|
+
'utf8',
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// Automatically set up
|
|
56
|
+
if (modified) {
|
|
57
|
+
console.log('\nRunning initial ky setup...');
|
|
58
|
+
exec(`cd ${root} && npm run ky:setup`, true);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Notify user
|
|
62
|
+
if (modified) {
|
|
63
|
+
console.log('\nAdded dceky scripts to package.json');
|
|
64
|
+
console.log('You can now run:');
|
|
65
|
+
console.log(' npm run ky:start # Start ky tests');
|
|
66
|
+
console.log(' npm run ky:setup # Setup or update ky-managed files in this project');
|
|
67
|
+
console.log(' npm run ky:dev # Start ky tests after ensuring set up');
|
|
68
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the root path of the project
|
|
5
|
+
* @author Yuen Ler Chow
|
|
6
|
+
* @returns the root path of the project
|
|
7
|
+
*/
|
|
8
|
+
const getRootPath = () => {
|
|
9
|
+
const root = path.join(__dirname, '../../../../');
|
|
10
|
+
return root;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default getRootPath;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/**
|
|
3
|
+
* Make sure cypress folder is created
|
|
4
|
+
* @author Gabe Abrams
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Import libs
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
|
|
11
|
+
// Import helpers
|
|
12
|
+
import getRootPath from './helpers/getRootPath';
|
|
13
|
+
|
|
14
|
+
// Get the project directory
|
|
15
|
+
const root = getRootPath();
|
|
16
|
+
|
|
17
|
+
// Check for cypress folder
|
|
18
|
+
const cypressDir = path.join(root, 'cypress');
|
|
19
|
+
const cypressExists = fs.existsSync(cypressDir);
|
|
20
|
+
if (!cypressExists) {
|
|
21
|
+
console.log('Install cypress before installing dceky:');
|
|
22
|
+
console.log('1. Run "npm i cypress --save-dev"');
|
|
23
|
+
console.log('2. Run "npx cypress open" and follow configuration instructions');
|
|
24
|
+
console.log('3. Run "npm i dceky --save-dev');
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
package/setup/index.ts
CHANGED
|
@@ -6,10 +6,10 @@ import checkRequiredFiles from './checkRequiredFiles';
|
|
|
6
6
|
import genE2ELaunchFile from './genE2ELaunchFile';
|
|
7
7
|
import genKyCommandDeclarations from './genKyCommandDeclarations';
|
|
8
8
|
|
|
9
|
+
setupCypressDependencies();
|
|
9
10
|
checkRequiredFiles();
|
|
10
11
|
genCommandImportFile();
|
|
11
12
|
genDynamicConfigFile();
|
|
12
13
|
addToGitIgnore();
|
|
13
|
-
setupCypressDependencies();
|
|
14
14
|
genE2ELaunchFile();
|
|
15
15
|
genKyCommandDeclarations();
|
package/tsconfig.json
CHANGED
|
@@ -11,7 +11,13 @@
|
|
|
11
11
|
"lib": ["es5", "es2015.promise", "es2017.object", "dom"],
|
|
12
12
|
"outDir": "./lib"
|
|
13
13
|
},
|
|
14
|
-
"include": [
|
|
14
|
+
"include": [
|
|
15
|
+
"./src",
|
|
16
|
+
"setup",
|
|
17
|
+
"start",
|
|
18
|
+
"preinstall",
|
|
19
|
+
"postinstall"
|
|
20
|
+
],
|
|
15
21
|
"ts-node": {
|
|
16
22
|
"files": true
|
|
17
23
|
}
|