Skip to content

Commit

Permalink
fix: ts friendly dev tasks exports
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Oct 15, 2020
1 parent 926f722 commit a5c7d0d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
11 changes: 0 additions & 11 deletions packages/xarc-app-dev/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/xarc-app-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@xarc/app-dev",
"version": "8.1.18",
"description": "Electrode X application development support",
"main": "index.js",
"main": "lib/index.js",
"homepage": "http://www.electrode.io",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/xarc-app-dev/src/config/env-babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = function getEnvBabel() {
const { options } = userConfig;

const babelConfigSpec = {
enableTypeScript: { env: "ENABLE_BABEL_TYPESCRIPT", default: options.typescript || false },
enableTypeScript: { env: "ENABLE_BABEL_TYPESCRIPT", default: options.typescript || true },
enableDynamicImport: { env: "ENABLE_DYNAMIC_IMPORT", default: false },
enableFlow: { env: "ENABLE_BABEL_FLOW", default: true },
// require the @flow directive in source to enable FlowJS type stripping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ function setWebpackDev() {
process.env.WEBPACK_DEV = "true";
}

export { XarcOptions } from "../config/opt2/xarc-options";

/**
* Load xarc development tasks that can be invoked using @xarc/run
*
* @param xclap @xarc/run task runner
* @param xrun - `@xarc/run` (or xclap) task runner. pass `null` and an
* internal version will be used.
* @param xarcOptions user provided options to configure features etc
* @returns void
*/
module.exports = function loadArchetype(xclap, xarcOptions: XarcOptions = {}) {
export function loadXarcDevTasks(xrun, xarcOptions: XarcOptions = {}) {
// lazy require modules that have effects so as to permit customization
// from userspace, i.e. `userOptions`
const archetype = getArchetype(xarcOptions);
Expand Down Expand Up @@ -1231,11 +1234,11 @@ You only need to run this if you are doing something not through the xarc tasks.
// require.resolve(`${archetype.devArchetypeName}/package.json`);
// }

xclap = xclap || requireAt(process.cwd())("xclap") || require("xclap");
xrun = xrun || requireAt(process.cwd())("xclap") || require("xclap");
process.env._ELECTRODE_DEV_ = "1";
if (!process.env.hasOwnProperty("FORCE_COLOR")) {
process.env.FORCE_COLOR = "1"; // force color for chalk
}
xclap.load("electrode", makeTasks(xclap), -10);
xrun.load("electrode", makeTasks(xrun), -10);
generateBrowsersListRc();
};
}
26 changes: 26 additions & 0 deletions packages/xarc-app-dev/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { loadXarcDevTasks } from "./dev-tasks";

Object.defineProperties(loadXarcDevTasks, {
require: {
value: require,
enumerable: false
},
hapiPlugin: {
value: require("./webpack-dev-hapi"),
enumerable: false
},
fastifyPlugin: {
value: require("./webpack-dev-fastify"),
enumerable: false
},
expressMiddleware: {
value: require("./webpack-dev-express"),
enumerable: false
},
koaMiddleware: {
value: require("./webpack-dev-koa"),
enumerable: false
}
});

export = loadXarcDevTasks;

0 comments on commit a5c7d0d

Please sign in to comment.