Skip to content

Commit 4f3d06b

Browse files
committed
v1.0.0
1 parent 5fbc263 commit 4f3d06b

File tree

5 files changed

+57
-61
lines changed

5 files changed

+57
-61
lines changed

action/index.js

Lines changed: 52 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,36 +2330,34 @@ exports.runCommand = command_1.createCommand((api) => {
23302330
demandOption: true,
23312331
});
23322332
},
2333-
handler(args) {
2333+
async handler(args) {
23342334
var _a;
2335-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
2336-
const commandName = args.command;
2337-
const command = (_a = config === null || config === void 0 ? void 0 : config.commands) === null || _a === void 0 ? void 0 : _a[commandName];
2338-
if (!command) {
2339-
// Better error - example config
2340-
throw new Error(`Command ${commandName} not found. Define it in bob.config.js`);
2341-
}
2342-
const { affected, packages } = getAffectedPackages({
2343-
config,
2344-
filterCommand: commandName,
2345-
});
2346-
if (!affected.length) {
2347-
reporter.success("Nothing is affected");
2348-
return;
2349-
}
2350-
reporter.info([
2351-
`Affected packages: `,
2352-
affected.map((name) => ` - ${name}`).join("\n"),
2353-
"\n\n",
2354-
].join("\n"));
2355-
const input = {
2356-
names: affected,
2357-
paths: affected.map((name) => packages[name].location),
2358-
};
2359-
const [bin, rest] = yield command.run(input);
2360-
yield util_1.promisify(cross_spawn_1.default)(bin, rest, {
2361-
stdio: "inherit",
2362-
});
2335+
const commandName = args.command;
2336+
const command = (_a = config === null || config === void 0 ? void 0 : config.commands) === null || _a === void 0 ? void 0 : _a[commandName];
2337+
if (!command) {
2338+
// Better error - example config
2339+
throw new Error(`Command ${commandName} not found. Define it in bob.config.js`);
2340+
}
2341+
const { affected, packages } = getAffectedPackages({
2342+
config,
2343+
filterCommand: commandName,
2344+
});
2345+
if (!affected.length) {
2346+
reporter.success("Nothing is affected");
2347+
return;
2348+
}
2349+
reporter.info([
2350+
`Affected packages: `,
2351+
affected.map((name) => ` - ${name}`).join("\n"),
2352+
"\n\n",
2353+
].join("\n"));
2354+
const input = {
2355+
names: affected,
2356+
paths: affected.map((name) => packages[name].location),
2357+
};
2358+
const [bin, rest] = await command.run(input);
2359+
await util_1.promisify(cross_spawn_1.default)(bin, rest, {
2360+
stdio: "inherit",
23632361
});
23642362
},
23652363
};
@@ -2781,35 +2779,33 @@ const tslib_1 = __webpack_require__(422);
27812779
const core = tslib_1.__importStar(__webpack_require__(470));
27822780
const path_1 = __webpack_require__(622);
27832781
const run_1 = __webpack_require__(776);
2784-
function run() {
2785-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
2786-
try {
2787-
core.info("Running Bob...");
2788-
core.info("Looking for bob.config.js");
2789-
const config = require(path_1.resolve(process.env.GITHUB_WORKSPACE, "bob.config.js"));
2790-
const filterCommand = core.getInput("command");
2791-
if (filterCommand) {
2792-
core.info(`Scoping to one command: ${filterCommand}`);
2793-
}
2794-
core.info("Checking affected packages");
2795-
const { affected } = run_1.getAffectedPackages({
2796-
config,
2797-
filterCommand,
2798-
});
2799-
affected.forEach((name) => {
2800-
core.info(`- ${name}`);
2801-
});
2802-
if (affected.length === 0) {
2803-
core.info("No affected packages");
2804-
}
2805-
core.setOutput("dirty", affected.length > 0 ? "true" : "false");
2782+
async function run() {
2783+
try {
2784+
core.info("Running Bob...");
2785+
core.info("Looking for bob.config.js");
2786+
const config = require(path_1.resolve(process.env.GITHUB_WORKSPACE, "bob.config.js"));
2787+
const filterCommand = core.getInput("command");
2788+
if (filterCommand) {
2789+
core.info(`Scoping to one command: ${filterCommand}`);
28062790
}
2807-
catch (error) {
2808-
console.error(error);
2809-
core.setFailed(error.message);
2810-
core.setOutput("dirty", "true");
2791+
core.info("Checking affected packages");
2792+
const { affected } = run_1.getAffectedPackages({
2793+
config,
2794+
filterCommand,
2795+
});
2796+
affected.forEach((name) => {
2797+
core.info(`- ${name}`);
2798+
});
2799+
if (affected.length === 0) {
2800+
core.info("No affected packages");
28112801
}
2812-
});
2802+
core.setOutput("dirty", affected.length > 0 ? "true" : "false");
2803+
}
2804+
catch (error) {
2805+
console.error(error);
2806+
core.setFailed(error.message);
2807+
core.setOutput("dirty", "true");
2808+
}
28132809
}
28142810
run();
28152811

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bob-the-bundler",
3-
"version": "1.0.0-rc.14",
3+
"version": "1.0.0",
44
"description": "Bob The Bundler!",
55
"author": {
66
"email": "[email protected]",

src/commands/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ function rewritePackageJson(pkg: Record<string, any>) {
316316
];
317317

318318
fields.forEach((field) => {
319-
if (pkg[field]) {
319+
if (typeof pkg[field] !== 'undefined') {
320320
newPkg[field] = pkg[field];
321321
}
322322
});

src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ export async function useConfig(
4242
: cosmi.search());
4343

4444
if (!config) {
45-
throw new Error("Config not found");
45+
throw new Error("Config not found.");
4646
}
4747

4848
if (config.isEmpty) {
49-
throw new Error("Config is empty");
49+
throw new Error("Config is empty.");
5050
}
5151

5252
return config.config;

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"module": "commonjs",
44
"strictNullChecks": true,
5-
"target": "es2015",
5+
"target": "es2018",
66
"lib": ["esnext"],
77
"outDir": "dist",
88
"declaration": true,

0 commit comments

Comments
 (0)